From owner-svn-src-head@freebsd.org Sun Oct 22 03:52:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB6F3E46F01; Sun, 22 Oct 2017 03:52: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 mx1.freebsd.org (Postfix) with ESMTPS id A44267784F; Sun, 22 Oct 2017 03:52: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 v9M3qHdn028176; Sun, 22 Oct 2017 03:52:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M3qHvX028175; Sun, 22 Oct 2017 03:52:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710220352.v9M3qHvX028175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 03:52:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324844 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 324844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 03:52:19 -0000 Author: imp Date: Sun Oct 22 03:52:17 2017 New Revision: 324844 URL: https://svnweb.freebsd.org/changeset/base/324844 Log: When building standalone, don't define errno. Let the definition from stand.h override. This is similar to what we do in the kernel. Sponsored by: Netflix Modified: head/sys/sys/errno.h Modified: head/sys/sys/errno.h ============================================================================== --- head/sys/sys/errno.h Sun Oct 22 03:52:12 2017 (r324843) +++ head/sys/sys/errno.h Sun Oct 22 03:52:17 2017 (r324844) @@ -38,7 +38,7 @@ #ifndef _SYS_ERRNO_H_ #define _SYS_ERRNO_H_ -#ifndef _KERNEL +#if !defined(_KERNEL) && !defined(_STAND) #include __BEGIN_DECLS int * __error(void); From owner-svn-src-head@freebsd.org Sun Oct 22 03:52:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AAD0E46EF7; Sun, 22 Oct 2017 03:52:14 +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 mx1.freebsd.org (Postfix) with ESMTPS id 434D7777E1; Sun, 22 Oct 2017 03:52: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 v9M3qDuB028122; Sun, 22 Oct 2017 03:52:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M3qDko028117; Sun, 22 Oct 2017 03:52:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710220352.v9M3qDko028117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 03:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324843 - in head/sys/boot: . i386/gptboot i386/gptzfsboot i386/libi386 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot: . i386/gptboot i386/gptzfsboot i386/libi386 X-SVN-Commit-Revision: 324843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 03:52:14 -0000 Author: imp Date: Sun Oct 22 03:52:12 2017 New Revision: 324843 URL: https://svnweb.freebsd.org/changeset/base/324843 Log: Stopgap fix to the mistmatch between LOADER_GELI_SUPPORT and LOADER_NO_GELI_SUPPORT. To disable geli support in the loader, define LOADER_GELI_SUPPORT=no. Proper warnings for for old build options to follow. Sponsored by: Netflix Modified: head/sys/boot/Makefile.amd64 head/sys/boot/Makefile.i386 head/sys/boot/i386/gptboot/Makefile head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/libi386/Makefile Modified: head/sys/boot/Makefile.amd64 ============================================================================== --- head/sys/boot/Makefile.amd64 Sun Oct 22 03:52:08 2017 (r324842) +++ head/sys/boot/Makefile.amd64 Sun Oct 22 03:52:12 2017 (r324843) @@ -5,7 +5,7 @@ SUBDIR+= libsa32 SUBDIR+= zfs SUBDIR+= userboot -.if !defined(LOADER_NO_GELI_SUPPORT) +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" SUBDIR+= geli .endif Modified: head/sys/boot/Makefile.i386 ============================================================================== --- head/sys/boot/Makefile.i386 Sun Oct 22 03:52:08 2017 (r324842) +++ head/sys/boot/Makefile.i386 Sun Oct 22 03:52:12 2017 (r324843) @@ -4,6 +4,6 @@ SUBDIR+= efi SUBDIR+= libsa32 SUBDIR+= zfs -.if !defined(LOADER_NO_GELI_SUPPORT) +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" SUBDIR+= geli .endif Modified: head/sys/boot/i386/gptboot/Makefile ============================================================================== --- head/sys/boot/i386/gptboot/Makefile Sun Oct 22 03:52:08 2017 (r324842) +++ head/sys/boot/i386/gptboot/Makefile Sun Oct 22 03:52:12 2017 (r324843) @@ -41,7 +41,7 @@ CFLAGS+=-DBOOTPROG=\"gptboot\" \ CFLAGS.gcc+= --param max-inline-insns-single=100 -.if !defined(LOADER_NO_GELI_SUPPORT) +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${.CURDIR}/../../geli CFLAGS+= -I${.CURDIR}/../../.. Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Sun Oct 22 03:52:08 2017 (r324842) +++ head/sys/boot/i386/gptzfsboot/Makefile Sun Oct 22 03:52:12 2017 (r324843) @@ -48,7 +48,7 @@ CFLAGS+= -Wno-tentative-definition-incomplete-type # Do not unroll skein loops, reduce code size CFLAGS+= -DSKEIN_LOOP=111 -.if !defined(LOADER_NO_GELI_SUPPORT) +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${.CURDIR}/../../geli LIBGELIBOOT= ${.OBJDIR}/../../geli/libgeliboot.a Modified: head/sys/boot/i386/libi386/Makefile ============================================================================== --- head/sys/boot/i386/libi386/Makefile Sun Oct 22 03:52:08 2017 (r324842) +++ head/sys/boot/i386/libi386/Makefile Sun Oct 22 03:52:12 2017 (r324843) @@ -25,7 +25,7 @@ CFLAGS+= -DCOMSPEED=${BOOT_COMCONSOLE_SPEED} CFLAGS+= -DDISK_DEBUG .endif -.if !defined(LOADER_NO_GELI_SUPPORT) +.if ${LOADER_GELI_SUPPORT:Uyes} == "yes" # Decrypt encrypted drives CFLAGS+= -DLOADER_GELI_SUPPORT CFLAGS+= -I${.CURDIR}/../../geli From owner-svn-src-head@freebsd.org Sun Oct 22 03:52:04 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 977DDE46ED1; Sun, 22 Oct 2017 03:52: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 mx1.freebsd.org (Postfix) with ESMTPS id 659BE7776A; Sun, 22 Oct 2017 03:52: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 v9M3q3r8028013; Sun, 22 Oct 2017 03:52:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M3q3l9028012; Sun, 22 Oct 2017 03:52:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710220352.v9M3q3l9028012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 03:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324841 - head/sys/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot X-SVN-Commit-Revision: 324841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 03:52:04 -0000 Author: imp Date: Sun Oct 22 03:52:03 2017 New Revision: 324841 URL: https://svnweb.freebsd.org/changeset/base/324841 Log: Use BOOTDIR more consistently in defs.mk rather than repeat sys/boot. Sponsored By: Netflix Modified: head/sys/boot/defs.mk Modified: head/sys/boot/defs.mk ============================================================================== --- head/sys/boot/defs.mk Sun Oct 22 00:10:18 2017 (r324840) +++ head/sys/boot/defs.mk Sun Oct 22 03:52:03 2017 (r324841) @@ -6,9 +6,9 @@ __BOOT_DEFS_MK__=${MFILE} BOOTDIR= ${SRCTOP}/sys/boot -FICLDIR= ${SRCTOP}/sys/boot/ficl +FICLDIR= ${BOOTDIR}/ficl LDR_MI= ${BOOTDIR}/common -SASRC= ${SRCTOP}/sys/boot/libsa +SASRC= ${BOOTDIR}/libsa SYSDIR= ${SRCTOP}/sys # NB: The makefiles depend on these being empty when we don't build forth. From owner-svn-src-head@freebsd.org Sun Oct 22 03:52:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E718E46EEB; Sun, 22 Oct 2017 03:52:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3BEA87777D; Sun, 22 Oct 2017 03:52: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 v9M3q8Ub028067; Sun, 22 Oct 2017 03:52:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M3q8VX028066; Sun, 22 Oct 2017 03:52:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710220352.v9M3q8VX028066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 03:52:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324842 - head/sys/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot X-SVN-Commit-Revision: 324842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 03:52:09 -0000 Author: imp Date: Sun Oct 22 03:52:08 2017 New Revision: 324842 URL: https://svnweb.freebsd.org/changeset/base/324842 Log: Introduce BOOTOBJ: The top level object directory for the boot tree and use it in preference to spelling out the path. Sponsored by: Netflix Modified: head/sys/boot/defs.mk Modified: head/sys/boot/defs.mk ============================================================================== --- head/sys/boot/defs.mk Sun Oct 22 03:52:03 2017 (r324841) +++ head/sys/boot/defs.mk Sun Oct 22 03:52:08 2017 (r324842) @@ -11,13 +11,15 @@ LDR_MI= ${BOOTDIR}/common SASRC= ${BOOTDIR}/libsa SYSDIR= ${SRCTOP}/sys +BOOTOBJ= ${OBJTOP}/sys/boot + # NB: The makefiles depend on these being empty when we don't build forth. .if ${MK_FORTH} != "no" -LIBFICL= ${OBJTOP}/sys/boot/ficl/libficl.a -LIBFICL32= ${OBJTOP}/sys/boot/ficl32/libficl.a +LIBFICL= ${BOOTOBJ}/ficl/libficl.a +LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a .endif -LIBSA= ${OBJTOP}/sys/boot/libsa/libsa.a -LIBSA32= ${OBJTOP}/sys/boot/libsa32/libsa32.a +LIBSA= ${BOOTOBJ}/libsa/libsa.a +LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a # Standard options: From owner-svn-src-head@freebsd.org Sun Oct 22 03:52:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20475E46F45; Sun, 22 Oct 2017 03:52:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id D7E5877932; Sun, 22 Oct 2017 03:52:27 +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 v9M3qRbc028284; Sun, 22 Oct 2017 03:52:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M3qRTR028283; Sun, 22 Oct 2017 03:52:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710220352.v9M3qRTR028283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 03:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324846 - head X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 324846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 03:52:28 -0000 Author: imp Date: Sun Oct 22 03:52:26 2017 New Revision: 324846 URL: https://svnweb.freebsd.org/changeset/base/324846 Log: Add note to updating about shifting LOADER_*SUPPORT options. Sponsored by: Netflix Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Oct 22 03:52:22 2017 (r324845) +++ head/UPDATING Sun Oct 22 03:52:26 2017 (r324846) @@ -51,6 +51,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20171021: + As part of the boot loader infrastructure cleanup, LOADER_*_SUPPORT + options are changing from controlling the build if defined / undefined + to controlling the build with explicit 'yes' or 'no' values. They will + shift to WITH/WITHOUT options to match other options in the system. + 20171010: libstand has turned into a private library for sys/boot use only. It is no longer supported as a public interface outside of sys/boot. From owner-svn-src-head@freebsd.org Sun Oct 22 03:52:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11B5CE46F25; Sun, 22 Oct 2017 03:52:24 +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 mx1.freebsd.org (Postfix) with ESMTPS id BDEFD778CF; Sun, 22 Oct 2017 03:52:23 +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 v9M3qM4U028232; Sun, 22 Oct 2017 03:52:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M3qMwc028227; Sun, 22 Oct 2017 03:52:22 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710220352.v9M3qMwc028227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 03:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324845 - in head/sys/boot/i386: gptboot gptzfsboot libi386 loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot/i386: gptboot gptzfsboot libi386 loader X-SVN-Commit-Revision: 324845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 03:52:24 -0000 Author: imp Date: Sun Oct 22 03:52:22 2017 New Revision: 324845 URL: https://svnweb.freebsd.org/changeset/base/324845 Log: Use BOOTOBJ and BOOTDIR to find geli includes and libraries. Sponsored by: Netflix Modified: head/sys/boot/i386/gptboot/Makefile head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/libi386/Makefile head/sys/boot/i386/loader/Makefile Modified: head/sys/boot/i386/gptboot/Makefile ============================================================================== --- head/sys/boot/i386/gptboot/Makefile Sun Oct 22 03:52:17 2017 (r324844) +++ head/sys/boot/i386/gptboot/Makefile Sun Oct 22 03:52:22 2017 (r324845) @@ -43,9 +43,9 @@ CFLAGS.gcc+= --param max-inline-insns-single=100 .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${.CURDIR}/../../geli +CFLAGS+= -I${BOOTDIR}/geli CFLAGS+= -I${.CURDIR}/../../.. -LIBGELIBOOT= ${.OBJDIR}/../../geli/libgeliboot.a +LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a .PATH: ${.CURDIR}/../../../opencrypto OPENCRYPTO_XTS= xform_aes_xts.o .endif Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Sun Oct 22 03:52:17 2017 (r324844) +++ head/sys/boot/i386/gptzfsboot/Makefile Sun Oct 22 03:52:22 2017 (r324845) @@ -50,8 +50,8 @@ CFLAGS+= -DSKEIN_LOOP=111 .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${.CURDIR}/../../geli -LIBGELIBOOT= ${.OBJDIR}/../../geli/libgeliboot.a +CFLAGS+= -I${BOOTDIR}/geli +LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a .PATH: ${.CURDIR}/../../../opencrypto OPENCRYPTO_XTS= xform_aes_xts.o .endif Modified: head/sys/boot/i386/libi386/Makefile ============================================================================== --- head/sys/boot/i386/libi386/Makefile Sun Oct 22 03:52:17 2017 (r324844) +++ head/sys/boot/i386/libi386/Makefile Sun Oct 22 03:52:22 2017 (r324845) @@ -28,7 +28,7 @@ CFLAGS+= -DDISK_DEBUG .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" # Decrypt encrypted drives CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${.CURDIR}/../../geli +CFLAGS+= -I${BOOTDIR}/geli .endif .if !defined(BOOT_HIDE_SERIAL_NUMBERS) Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Sun Oct 22 03:52:17 2017 (r324844) +++ head/sys/boot/i386/loader/Makefile Sun Oct 22 03:52:22 2017 (r324845) @@ -42,8 +42,8 @@ HAVE_ISABUS= yes .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${.CURDIR}/../../geli -LIBGELIBOOT= ${.OBJDIR}/../../geli/libgeliboot.a +CFLAGS+= -I${BOOTDIR}/geli +LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a .PATH: ${.CURDIR}/../../../opencrypto SRCS+= xform_aes_xts.c CFLAGS+= -I${.CURDIR}/../../.. -D_STAND From owner-svn-src-head@freebsd.org Sun Oct 22 07:25:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3FA4E4B50A; Sun, 22 Oct 2017 07:25:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id B688F80829; Sun, 22 Oct 2017 07:25:29 +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 v9M7PSoH014720; Sun, 22 Oct 2017 07:25:28 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M7PS5w014719; Sun, 22 Oct 2017 07:25:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710220725.v9M7PS5w014719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 07:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324850 - head/sys/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot X-SVN-Commit-Revision: 324850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 07:25:30 -0000 Author: imp Date: Sun Oct 22 07:25:28 2017 New Revision: 324850 URL: https://svnweb.freebsd.org/changeset/base/324850 Log: Define LIBSA32 to LIBSA on i386 to fix build. Sponsored by: Netflix Modified: head/sys/boot/defs.mk Modified: head/sys/boot/defs.mk ============================================================================== --- head/sys/boot/defs.mk Sun Oct 22 07:20:11 2017 (r324849) +++ head/sys/boot/defs.mk Sun Oct 22 07:25:28 2017 (r324850) @@ -19,7 +19,11 @@ LIBFICL= ${BOOTOBJ}/ficl/libficl.a LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a .endif LIBSA= ${BOOTOBJ}/libsa/libsa.a +.if ${MACHINE} == "i386" +LIBSA32= ${LIBSA} +.else LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a +.endif # Standard options: From owner-svn-src-head@freebsd.org Sun Oct 22 07:36:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D162E4B7C2; Sun, 22 Oct 2017 07:36:30 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB28D80CE8; Sun, 22 Oct 2017 07:36:29 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9M7aTZs018919; Sun, 22 Oct 2017 07:36:29 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M7aTqw018918; Sun, 22 Oct 2017 07:36:29 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201710220736.v9M7aTqw018918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 22 Oct 2017 07:36:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324851 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 324851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 07:36:30 -0000 Author: ngie Date: Sun Oct 22 07:36:28 2017 New Revision: 324851 URL: https://svnweb.freebsd.org/changeset/base/324851 Log: Regenerate src.conf(5) after r324340 (armv7 addition) Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Sun Oct 22 07:25:28 2017 (r324850) +++ head/share/man/man5/src.conf.5 Sun Oct 22 07:36:28 2017 (r324851) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd October 06, 2017 +.Dd October 10, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -162,7 +162,7 @@ Set to build and install binutils (as, ld, objcopy, an of the normal system build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BINUTILS_BOOTSTRAP Set to not build binutils (as, ld, objcopy and objdump) as part of the bootstrap process. @@ -178,7 +178,7 @@ Set build binutils (as, ld, objcopy and objdump) as part of the bootstrap process. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BLACKLIST Set this if you do not want to build .Xr blacklistd 8 @@ -220,11 +220,6 @@ Set to not build the BSD licensed version of cpio base .Xr libarchive 3 . .It Va WITH_BSD_GREP Install BSD-licensed grep as '[ef]grep' instead of GNU grep. -.It Va WITHOUT_BSD_GREP_FASTMATCH -Set this option to exclude the fastmatch implementation from -.Xr bsdgrep 1 , -instead using only -.Xr regex 3 . .It Va WITHOUT_BSNMP Set to not build or install .Xr bsnmpd 1 @@ -325,7 +320,7 @@ When set, it enforces these options: Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_BOOTSTRAP Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -338,7 +333,7 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mi Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_CLANG_EXTRAS Set to build additional clang and llvm tools, such as bugpoint. .It Va WITHOUT_CLANG_FULL @@ -352,7 +347,7 @@ Set to build the ARCMigrate, Rewriter and StaticAnalyz Clang C/C++ compiler. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_IS_CC Set to install the GCC compiler as .Pa /usr/bin/cc , @@ -370,7 +365,7 @@ and .Pa /usr/bin/cpp . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_CPP Set to not build .Xr cpp 1 . @@ -437,7 +432,7 @@ Set to not build .Xr cxgbetool 8 .Pp This is a default setting on -arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and riscv/riscv64sf. +arm/arm, arm/armeb, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_CXGBETOOL Set to build .Xr cxgbetool 8 @@ -479,7 +474,7 @@ Set to build and related libraries. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_DEBUG_FILES Set to avoid building or installing standalone debug files for each executable binary and shared library. @@ -624,7 +619,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP Set to not build ELF Tool Chain tools (addr2line, nm, size, strings and strip) @@ -680,7 +675,7 @@ Set to not build games. Set to not build and install gcc and g++ as part of the normal build process. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_GCC Set to build and install gcc and g++. .Pp @@ -693,7 +688,7 @@ unless an alternative compiler is provided via XCC. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_GCC_BOOTSTRAP Set to build gcc and g++ as part of the bootstrap process. .Pp @@ -714,7 +709,7 @@ Set to build .Xr gdb 1 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_GDB_LIBEXEC Set to install .Xr gdb 1 @@ -722,7 +717,7 @@ into .Pa /usr/bin . .Pp This is a default setting on -arm/arm, arm/armeb, arm/armv6 and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv7 and sparc64/sparc64. .It Va WITH_GDB_LIBEXEC Set to install .Xr gdb 1 @@ -741,7 +736,7 @@ Do not build the GNU C++ stack (g++, libstdc++). This is the default on platforms where clang is the system compiler. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_GNUCXX Build the GNU C++ stack (g++, libstdc++). This is the default on platforms where gcc is the system compiler. @@ -769,7 +764,7 @@ Set to build the BSD licensed version of the device tr than the GPLed one from elinux.org. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITH_GPL_DTC Set to build the GPL'd version of the device tree compiler from elinux.org, instead of the BSD licensed one. @@ -962,12 +957,12 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mi Set to build LLVM's lld linker. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLDB Set to not build the LLDB debugger. .Pp This is a default setting on -arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLDB Set to build the LLDB debugger. .Pp @@ -980,7 +975,7 @@ To be able to build the system, either Binutils or LLD enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build. .Pp @@ -990,7 +985,7 @@ arm64/aarch64. Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_LLD_IS_LD Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp @@ -1000,7 +995,7 @@ arm64/aarch64. Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp This is a default setting on -arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LLVM_LIBUNWIND Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp @@ -1269,7 +1264,7 @@ Set to build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_QUOTAS Set to not build .Xr quota 1 @@ -1353,7 +1348,7 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mi Set to build world with propolice stack smashing protection. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64. .It Va WITH_STAGING Enable staging of files to a stage tree. This can be best thought of as auto-install to From owner-svn-src-head@freebsd.org Sun Oct 22 08:11:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFE14E4C623; Sun, 22 Oct 2017 08:11:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF19B820F5; Sun, 22 Oct 2017 08:11:46 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9M8Bjt9033553; Sun, 22 Oct 2017 08:11:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9M8Bjw5033551; Sun, 22 Oct 2017 08:11:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201710220811.v9M8Bjw5033551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 22 Oct 2017 08:11:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324853 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 324853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 08:11:47 -0000 Author: kib Date: Sun Oct 22 08:11:45 2017 New Revision: 324853 URL: https://svnweb.freebsd.org/changeset/base/324853 Log: Remove the support for mknod(S_IFMT), which created dummy vnodes with VBAD type. FFS ffs_write() VOP catches such vnodes and panics, other VOPs do not check for the type and their behaviour is really undefined. The comment claims that this support was done for 'badsect' to flag bad sectors, we do not have such facility in kernel anyway. Reported by: Dmitry Vyukov Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_syscalls.c head/sys/sys/priv.h Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sun Oct 22 07:58:28 2017 (r324852) +++ head/sys/kern/vfs_syscalls.c Sun Oct 22 08:11:45 2017 (r324853) @@ -1248,9 +1248,6 @@ kern_mknodat(struct thread *td, int fd, char *path, en if (error == 0 && dev == VNOVAL) error = EINVAL; break; - case S_IFMT: - error = priv_check(td, PRIV_VFS_MKNOD_BAD); - break; case S_IFWHT: error = priv_check(td, PRIV_VFS_MKNOD_WHT); break; @@ -1288,9 +1285,6 @@ restart: whiteout = 0; switch (mode & S_IFMT) { - case S_IFMT: /* used by badsect to flag bad sectors */ - vattr.va_type = VBAD; - break; case S_IFCHR: vattr.va_type = VCHR; break; Modified: head/sys/sys/priv.h ============================================================================== --- head/sys/sys/priv.h Sun Oct 22 07:58:28 2017 (r324852) +++ head/sys/sys/priv.h Sun Oct 22 08:11:45 2017 (r324853) @@ -266,7 +266,7 @@ #define PRIV_VFS_GETFH 327 /* Can retrieve file handles. */ #define PRIV_VFS_GETQUOTA 328 /* getquota(). */ #define PRIV_VFS_LINK 329 /* bsd.hardlink_check_uid */ -#define PRIV_VFS_MKNOD_BAD 330 /* Can mknod() to mark bad inodes. */ +#define PRIV_VFS_MKNOD_BAD 330 /* Was: mknod() can mark bad inodes. */ #define PRIV_VFS_MKNOD_DEV 331 /* Can mknod() to create dev nodes. */ #define PRIV_VFS_MKNOD_WHT 332 /* Can mknod() to create whiteout. */ #define PRIV_VFS_MOUNT 333 /* Can mount(). */ From owner-svn-src-head@freebsd.org Sun Oct 22 10:32:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A639AE4F387; Sun, 22 Oct 2017 10:32:41 +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 mx1.freebsd.org (Postfix) with ESMTPS id 81BBD162C; Sun, 22 Oct 2017 10:32:41 +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 v9MAWeOo094426; Sun, 22 Oct 2017 10:32:40 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MAWehd094425; Sun, 22 Oct 2017 10:32:40 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710221032.v9MAWehd094425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 22 Oct 2017 10:32:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324856 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 324856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 10:32:41 -0000 Author: trasz Date: Sun Oct 22 10:32:40 2017 New Revision: 324856 URL: https://svnweb.freebsd.org/changeset/base/324856 Log: Don't call realpath(3) from libmap rtld code. This gets rid of a few calls to fstatat(2) at binary startup; the difference looks like this: --- przed 2017-10-14 13:55:49.983528000 +0100 +++ po 2017-10-14 14:10:39.134343000 +0100 @@ -1,15 +1,10 @@ mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34366173184 (0x800623000) issetugid() = 0 (0x0) -fstatat(AT_FDCWD,"/etc",{ mode=drwxr-xr-x ,inode=1364352,size=2560,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0) -fstatat(AT_FDCWD,"/etc/libmap.conf",{ mode=-rw-r--r-- ,inode=1373288,size=102,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0) openat(AT_FDCWD,"/etc/libmap.conf",O_RDONLY|O_CLOEXEC,00) = 3 (0x3) fstat(3,{ mode=-rw-r--r-- ,inode=1373288,size=102,blksize=32768 }) = 0 (0x0) mmap(0x0,102,PROT_READ,MAP_PRIVATE,3,0x0) = 34366205952 (0x80062b000) close(3) = 0 (0x0) -fstatat(AT_FDCWD,"/usr",{ mode=drwxr-xr-x ,inode=561792,size=512,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0) -fstatat(AT_FDCWD,"/usr/local",{ mode=drwxr-xr-x ,inode=561800,size=512,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0) -fstatat(AT_FDCWD,"/usr/local/etc",{ mode=drwxr-xr-x ,inode=653279,size=1536,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0) -fstatat(AT_FDCWD,"/usr/local/etc/libmap.d",0x7fffffffcf50,AT_SYMLINK_NOFOLLOW) ERR#2 'No such file or directory' +open("/usr/local/etc/libmap.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,0165) ERR#2 'No such file or directory' munmap(0x80062b000,102) = 0 (0x0) openat(AT_FDCWD,"/var/run/ld-elf.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3) read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\M-2\0\0"...,128) = 128 (0x80) Reviewed by: kib MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12741 Modified: head/libexec/rtld-elf/libmap.c Modified: head/libexec/rtld-elf/libmap.c ============================================================================== --- head/libexec/rtld-elf/libmap.c Sun Oct 22 08:47:13 2017 (r324855) +++ head/libexec/rtld-elf/libmap.c Sun Oct 22 10:32:40 2017 (r324856) @@ -36,6 +36,8 @@ struct lmp { static TAILQ_HEAD(lmc_list, lmc) lmc_head = TAILQ_HEAD_INITIALIZER(lmc_head); struct lmc { char *path; + dev_t dev; + ino_t ino; TAILQ_ENTRY(lmc) next; }; @@ -99,45 +101,45 @@ lmc_parse_file(char *path) struct lmc *p; struct stat st; int fd; - char *rpath; char *lm_map; - rpath = realpath(path, NULL); - if (rpath == NULL) - return; - TAILQ_FOREACH(p, &lmc_head, next) { - if (strcmp(p->path, rpath) == 0) { - free(rpath); + if (strcmp(p->path, path) == 0) return; - } } - fd = open(rpath, O_RDONLY | O_CLOEXEC); + fd = open(path, O_RDONLY | O_CLOEXEC); if (fd == -1) { - dbg("lm_parse_file: open(\"%s\") failed, %s", rpath, + dbg("lm_parse_file: open(\"%s\") failed, %s", path, rtld_strerror(errno)); - free(rpath); return; } if (fstat(fd, &st) == -1) { close(fd); - dbg("lm_parse_file: fstat(\"%s\") failed, %s", rpath, + dbg("lm_parse_file: fstat(\"%s\") failed, %s", path, rtld_strerror(errno)); - free(rpath); return; } + + TAILQ_FOREACH(p, &lmc_head, next) { + if (p->dev == st.st_dev && p->ino == st.st_ino) { + close(fd); + return; + } + } + lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (lm_map == (const char *)MAP_FAILED) { close(fd); - dbg("lm_parse_file: mmap(\"%s\") failed, %s", rpath, + dbg("lm_parse_file: mmap(\"%s\") failed, %s", path, rtld_strerror(errno)); - free(rpath); return; } close(fd); p = xmalloc(sizeof(struct lmc)); - p->path = rpath; + p->path = xstrdup(path); + p->dev = st.st_dev; + p->ino = st.st_ino; TAILQ_INSERT_HEAD(&lmc_head, p, next); lmc_parse(lm_map, st.st_size); munmap(lm_map, st.st_size); @@ -151,26 +153,19 @@ lmc_parse_dir(char *idir) struct lmc *p; char conffile[MAXPATHLEN]; char *ext; - char *rpath; - rpath = realpath(idir, NULL); - if (rpath == NULL) - return; - TAILQ_FOREACH(p, &lmc_head, next) { - if (strcmp(p->path, rpath) == 0) { - free(rpath); + if (strcmp(p->path, idir) == 0) return; - } } d = opendir(idir); - if (d == NULL) { - free(rpath); + if (d == NULL) return; - } p = xmalloc(sizeof(struct lmc)); - p->path = rpath; + p->path = xstrdup(idir); + p->dev = NODEV; + p->ino = 0; TAILQ_INSERT_HEAD(&lmc_head, p, next); while ((dp = readdir(d)) != NULL) { From owner-svn-src-head@freebsd.org Sun Oct 22 10:35:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59A45E4F40B; Sun, 22 Oct 2017 10:35:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id 29A7E17B6; Sun, 22 Oct 2017 10:35:31 +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 v9MAZU0m094590; Sun, 22 Oct 2017 10:35:30 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MAZUki094587; Sun, 22 Oct 2017 10:35:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710221035.v9MAZUki094587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 22 Oct 2017 10:35:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324857 - in head: lib/libc/gen sys/vm X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: lib/libc/gen sys/vm X-SVN-Commit-Revision: 324857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 10:35:31 -0000 Author: trasz Date: Sun Oct 22 10:35:29 2017 New Revision: 324857 URL: https://svnweb.freebsd.org/changeset/base/324857 Log: Add OID for the vm.overcommit sysctl. This makes it possible to remove one call to sysctl(2) from jemalloc startup code. (That also requires changes to jemalloc, but I plan to push those to upstream first.) Reviewed by: kib MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12745 Modified: head/lib/libc/gen/sysctl.3 head/sys/vm/swap_pager.c head/sys/vm/vm_param.h Modified: head/lib/libc/gen/sysctl.3 ============================================================================== --- head/lib/libc/gen/sysctl.3 Sun Oct 22 10:32:40 2017 (r324856) +++ head/lib/libc/gen/sysctl.3 Sun Oct 22 10:35:29 2017 (r324857) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd September 10, 2015 +.Dd October 22, 2017 .Dt SYSCTL 3 .Os .Sh NAME @@ -741,6 +741,7 @@ privilege may change the value. .It Dv VM_V_FREE_TARGET Ta integer Ta yes .It Dv VM_V_INACTIVE_TARGET Ta integer Ta yes .It Dv VM_V_PAGEOUT_FREE_MIN Ta integer Ta yes +.It Dv VM_OVERCOMMIT Ta integer Ta yes .El .Bl -tag -width 6n .It Li VM_LOADAVG @@ -773,6 +774,9 @@ process address space when needed. .It Li VM_V_PAGEOUT_FREE_MIN If the amount of free and cache memory falls below this value, the pageout daemon will enter "memory conserving mode" to avoid deadlock. +.It Li VM_OVERCOMMIT +Overcommit behaviour, as described in +.Xr tuning 7 . .El .Sh RETURN VALUES .Rv -std Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Oct 22 10:32:40 2017 (r324856) +++ head/sys/vm/swap_pager.c Sun Oct 22 10:35:29 2017 (r324857) @@ -157,7 +157,7 @@ static vm_ooffset_t swap_reserved; SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, "Amount of swap storage needed to back all allocated anonymous memory."); static int overcommit = 0; -SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, +SYSCTL_INT(_vm, VM_OVERCOMMIT, overcommit, CTLFLAG_RW, &overcommit, 0, "Configure virtual memory overcommit behavior. See tuning(7) " "for details."); static unsigned long swzone; Modified: head/sys/vm/vm_param.h ============================================================================== --- head/sys/vm/vm_param.h Sun Oct 22 10:32:40 2017 (r324856) +++ head/sys/vm/vm_param.h Sun Oct 22 10:35:29 2017 (r324857) @@ -84,7 +84,8 @@ #define VM_V_PAGEOUT_FREE_MIN 9 /* vm_cnt.v_pageout_free_min */ #define VM_OBSOLETE_10 10 /* pageout algorithm */ #define VM_SWAPPING_ENABLED 11 /* swapping enabled */ -#define VM_MAXID 12 /* number of valid vm ids */ +#define VM_OVERCOMMIT 12 /* vm.overcommit */ +#define VM_MAXID 13 /* number of valid vm ids */ /* * Structure for swap device statistics From owner-svn-src-head@freebsd.org Sun Oct 22 11:15:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CACBEE4FF7D; Sun, 22 Oct 2017 11:15:59 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A3462C49; Sun, 22 Oct 2017 11:15:59 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9MBFwED011940; Sun, 22 Oct 2017 11:15:58 GMT (envelope-from bms@FreeBSD.org) Received: (from bms@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MBFwP9011938; Sun, 22 Oct 2017 11:15:58 GMT (envelope-from bms@FreeBSD.org) Message-Id: <201710221115.v9MBFwP9011938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bms set sender to bms@FreeBSD.org using -f From: Bruce M Simpson Date: Sun, 22 Oct 2017 11:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324858 - in head/sys/dev/usb: . misc X-SVN-Group: head X-SVN-Commit-Author: bms X-SVN-Commit-Paths: in head/sys/dev/usb: . misc X-SVN-Commit-Revision: 324858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 11:15:59 -0000 Author: bms Date: Sun Oct 22 11:15:58 2017 New Revision: 324858 URL: https://svnweb.freebsd.org/changeset/base/324858 Log: Add Prolific PL27A1 USB 3.0 Host-Host device to udbp(4). Tested with a Plugable cable in VirtualBox against Linux 4.11. MFC after: 2 weeks Modified: head/sys/dev/usb/misc/udbp.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/misc/udbp.c ============================================================================== --- head/sys/dev/usb/misc/udbp.c Sun Oct 22 10:35:29 2017 (r324857) +++ head/sys/dev/usb/misc/udbp.c Sun Oct 22 11:15:58 2017 (r324858) @@ -264,6 +264,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: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Oct 22 10:35:29 2017 (r324857) +++ head/sys/dev/usb/usbdevs Sun Oct 22 11:15:58 2017 (r324858) @@ -3679,6 +3679,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-head@freebsd.org Sun Oct 22 11:40:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C417E507A0; Sun, 22 Oct 2017 11:40:56 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DF903997; Sun, 22 Oct 2017 11:40:56 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9MBetYL020761; Sun, 22 Oct 2017 11:40:55 GMT (envelope-from bms@FreeBSD.org) Received: (from bms@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MBet9s020760; Sun, 22 Oct 2017 11:40:55 GMT (envelope-from bms@FreeBSD.org) Message-Id: <201710221140.v9MBet9s020760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bms set sender to bms@FreeBSD.org using -f From: Bruce M Simpson Date: Sun, 22 Oct 2017 11:40:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324860 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: bms X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 324860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 11:40:56 -0000 Author: bms Date: Sun Oct 22 11:40:55 2017 New Revision: 324860 URL: https://svnweb.freebsd.org/changeset/base/324860 Log: 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. MFC after: 3 weeks Modified: head/share/man/man4/udbp.4 Modified: head/share/man/man4/udbp.4 ============================================================================== --- head/share/man/man4/udbp.4 Sun Oct 22 11:21:31 2017 (r324859) +++ head/share/man/man4/udbp.4 Sun Oct 22 11:40:55 2017 (r324860) @@ -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-head@freebsd.org Sun Oct 22 12:10:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05360E513A5; Sun, 22 Oct 2017 12:10:02 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) 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 C3B6A638CF; Sun, 22 Oct 2017 12:10:01 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x22b.google.com with SMTP id j3so9776375pga.1; Sun, 22 Oct 2017 05:10:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=u1Y1l9Xi/gK4f5ZwIZJsk1YOVfKm0Rl1+wjH9z502GA=; b=A2AxzVOVbiWu8Px9TocEmQJqH03+2gVtfJHtS6XHIS2aCMshavSbb3EJ7b6KcgWhN4 ZgDgRiL9O81Rl3PXYZRPkhm3O8LGkrmFw1OP3MYUJtrcmWOay/omXThwJrb65e64yBQN vcq7K5iTNDt4l9tUByWNej9dSzKVWbsUqrKe1Kdfy9I03/qOASefLuwOJlHLLGuMp+87 64M6uHZ4sefBikM2a6nXFzX2W2vV7Yfiiahra+h58NEJMgI+MpBq5D/YuqG+mmHQGDCe jZiwm8BorQfJnTpf2gVEy1/VNHkRujTCWQT2uGW8A384JJiaBbWSIxBGCmzo34ko9JOP aSag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=u1Y1l9Xi/gK4f5ZwIZJsk1YOVfKm0Rl1+wjH9z502GA=; b=HGiYZHj36eofJOrIX5W3h4FzjGjPCcDuOGBp+QBwBZZlQSRuh3Rb7fIdoBNFF6nTny aeES1PgElN4Q8sBQ31i0T5SZKnTEWg0tHN5yio0TYI12GvCbGFruDcsQ5ypeXFhb2iqH 5bkvQHhbSUpLNkj1heFJbIuXdjU49o/nUYzerzQ7IYC719Iptmm/BmWAfvqS1Q0u6cwi aoraz7zri1pdGj+Grsz5jEMGg/sCeYJnC0ZZwSmHNKXVnvnDoUHo7/iR3O+I9gfwCcNj /KHvdq1dReLflEZ1MLZDtBIgigtySJtVhQr4kHwSLIEaRGB/N2sURi5B9UAQ8EDaUg1h f5TA== X-Gm-Message-State: AMCzsaURQhvOg+vTa4o88scBnlHWcg3wJtGRQZtH9OXMcw69hVT4qBOt zcm7Ib8GwUDxNfmzTdyBL1Ilvfm1 X-Google-Smtp-Source: ABhQp+Q2IlirHxJZVPEttQ7xJCu2CYIxY49KWSiexMsmloNBeLnXG5i1WMdPZVNOMfo5AjqK4QM+Tg== X-Received: by 10.159.216.141 with SMTP id s13mr8075557plp.377.1508674201007; Sun, 22 Oct 2017 05:10:01 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id q69sm9907258pfg.127.2017.10.22.05.09.59 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Oct 2017 05:10:00 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_AA8DD736-7FEF-4F86-A69F-8207A705B2D8"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r324789 - in head/sys: kern sys From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201710200402.v9K42rFP029260@repo.freebsd.org> Date: Sun, 22 Oct 2017 05:09:58 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201710200402.v9K42rFP029260@repo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 12:10:02 -0000 --Apple-Mail=_AA8DD736-7FEF-4F86-A69F-8207A705B2D8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 19, 2017, at 21:02, Mateusz Guzik wrote: >=20 > Author: mjg > Date: Fri Oct 20 04:02:53 2017 > New Revision: 324789 > URL: https://svnweb.freebsd.org/changeset/base/324789 >=20 > Log: > Mark kdb_active as __read_frequently and switch to bool to eat less = space. >=20 > Modified: > head/sys/kern/subr_kdb.c > head/sys/sys/kdb.h >=20 > Modified: head/sys/kern/subr_kdb.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/subr_kdb.c Fri Oct 20 03:38:58 2017 = (r324788) > +++ head/sys/kern/subr_kdb.c Fri Oct 20 04:02:53 2017 = (r324789) > @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); > #include > #endif >=20 > -int kdb_active =3D 0; > +bool __read_frequently kdb_active =3D 0; > static void *kdb_jmpbufp =3D NULL; > struct kdb_dbbe *kdb_dbbe =3D NULL; > static struct pcb kdb_pcb; >=20 > Modified: head/sys/sys/kdb.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/sys/kdb.h Fri Oct 20 03:38:58 2017 = (r324788) > +++ head/sys/sys/kdb.h Fri Oct 20 04:02:53 2017 = (r324789) > @@ -59,7 +59,7 @@ struct kdb_dbbe { > }; \ > DATA_SET(kdb_dbbe_set, name##_dbbe) >=20 > -extern int kdb_active; /* Non-zero while in = debugger. */ > +extern bool kdb_active; /* Non-zero while in = debugger. */ > extern int debugger_on_panic; /* enter the debugger on panic. = */ > extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or = NULL. */ > extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ This broke `kdb_active` use in `kdb_trap`. It=E2=80=99s noticed = by gcc on riscv64: = https://ci.freebsd.org/job/FreeBSD-head-riscv64-build/4356/console . Please fix or revert. Thanks, -Ngie --Apple-Mail=_AA8DD736-7FEF-4F86-A69F-8207A705B2D8 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE5bk3FaGcY5rvqmb79YOpJmkwhhUFAlnsipYACgkQ9YOpJmkw hhVczA/+I2F111hzAKbMczgzWnSejlmjugNFQb/Ot//CKXgO2qdzNIm3KfQnIU8l WhAZsQQGlUCKSBVkV5uBOBg2i5RrbB23ibnJ0a//CoAXa25V25Bj6juv3hreBoIE IneoXIhHLL7NRnqIEcZg01MynYbvlLm2iuUecj/tMBTLNMO2O4ELPNg0SlOhayLg 1Up3GJQuxpHuKAkLF85NQG99x4pnlDVbgMIikS9flRxtaRWIqIDlyPpFNqqriAdi rXrAu1GvpdGKQtSsJRWlkC3ML1+Ai6lNkkUf3DHrAtlmAwOO0ZwxrK5zqbtUXrZY hHPW42OFCwzMeyNw9V/j9XnLP7s2DckDb6PfrFgc0FmKe8ib0ydp0iw2ta0LVlfo Vrco8mgvLWrKPvJNqDcFhspv41mxftNXzBKUqmG5Hg+kBZXGttzlg7N6s66dABta adWbZAtLEb82zzs860dpmyshZGT3txPj/ewgWcB3qaU4bi/JENEqfM+MW7PI9ace J1dT9JlNsgAdWKlLcRyX8KSOrG4wFpsYxhXGe0/E/iKr5+fZjorKVaEhCsYLbxC3 tpguGl1+g1qtuQuavczibpzOXxaBVaVXC8+RQwBDn+QJDTO8R6EVCi04ZbKgDH5C FJpBDWci++ytilszqx73GhlwWM9pUF1rs1Jt3J7rGbtWk0wHSsY= =WM5Z -----END PGP SIGNATURE----- --Apple-Mail=_AA8DD736-7FEF-4F86-A69F-8207A705B2D8-- From owner-svn-src-head@freebsd.org Sun Oct 22 12:12:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00759E51585; Sun, 22 Oct 2017 12:12:54 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C379463C7B; Sun, 22 Oct 2017 12:12:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9MCCrJ8036996; Sun, 22 Oct 2017 12:12:53 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MCCrRo036995; Sun, 22 Oct 2017 12:12:53 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201710221212.v9MCCrRo036995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 22 Oct 2017 12:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324862 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 12:12:54 -0000 Author: ngie Date: Sun Oct 22 12:12:52 2017 New Revision: 324862 URL: https://svnweb.freebsd.org/changeset/base/324862 Log: Clean up trailing whitespace in kdb_thr_ctx(..) MFC after: 1 week Modified: head/sys/kern/subr_kdb.c Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Sun Oct 22 11:45:51 2017 (r324861) +++ head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) @@ -513,12 +513,12 @@ kdb_reenter(void) struct pcb * kdb_thr_ctx(struct thread *thr) -{ +{ #if defined(SMP) && defined(KDB_STOPPEDPCB) struct pcpu *pc; #endif - - if (thr == curthread) + + if (thr == curthread) return (&kdb_pcb); #if defined(SMP) && defined(KDB_STOPPEDPCB) From owner-svn-src-head@freebsd.org Sun Oct 22 13:42:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36C06E52EA3; Sun, 22 Oct 2017 13:42:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05CAF6651D; Sun, 22 Oct 2017 13:42:57 +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 v9MDgvwm074684; Sun, 22 Oct 2017 13:42:57 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MDguCC074682; Sun, 22 Oct 2017 13:42:56 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201710221342.v9MDguCC074682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 22 Oct 2017 13:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324863 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 324863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 13:42:58 -0000 Author: mjg Date: Sun Oct 22 13:42:56 2017 New Revision: 324863 URL: https://svnweb.freebsd.org/changeset/base/324863 Log: Change kdb_active type to u_char. Fixes warnings from gcc and keeps the small size. Perhaps nesting should be moved to another variablle. Reported by: ngie Modified: head/sys/kern/subr_kdb.c head/sys/sys/kdb.h Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #endif -bool __read_frequently kdb_active = 0; +u_char __read_frequently kdb_active = 0; static void *kdb_jmpbufp = NULL; struct kdb_dbbe *kdb_dbbe = NULL; static struct pcb kdb_pcb; Modified: head/sys/sys/kdb.h ============================================================================== --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) @@ -59,7 +59,7 @@ struct kdb_dbbe { }; \ DATA_SET(kdb_dbbe_set, name##_dbbe) -extern bool kdb_active; /* Non-zero while in debugger. */ +extern u_char kdb_active; /* Non-zero while in debugger. */ extern int debugger_on_panic; /* enter the debugger on panic. */ extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ From owner-svn-src-head@freebsd.org Sun Oct 22 14:25:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C65F2E537BD; Sun, 22 Oct 2017 14:25:32 +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 8F953675A3; Sun, 22 Oct 2017 14:25:32 +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 52DE8260117; Sun, 22 Oct 2017 16:25:30 +0200 (CEST) Subject: Re: svn commit: r324863 - in head/sys: kern sys To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710221342.v9MDguCC074682@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <467e3d9b-ae78-9689-6a5f-4b78301553eb@selasky.org> Date: Sun, 22 Oct 2017 16:22:48 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <201710221342.v9MDguCC074682@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 14:25:32 -0000 On 10/22/17 15:42, Mateusz Guzik wrote: > Author: mjg > Date: Sun Oct 22 13:42:56 2017 > New Revision: 324863 > URL: https://svnweb.freebsd.org/changeset/base/324863 > > Log: > Change kdb_active type to u_char. > > Fixes warnings from gcc and keeps the small size. Perhaps nesting should be moved > to another variablle. > > Reported by: ngie > > Modified: > head/sys/kern/subr_kdb.c > head/sys/sys/kdb.h > > Modified: head/sys/kern/subr_kdb.c > ============================================================================== > --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) > +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) > @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); > #include > #endif > > -bool __read_frequently kdb_active = 0; > +u_char __read_frequently kdb_active = 0; > static void *kdb_jmpbufp = NULL; > struct kdb_dbbe *kdb_dbbe = NULL; > static struct pcb kdb_pcb; > > Modified: head/sys/sys/kdb.h > ============================================================================== > --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) > +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) > @@ -59,7 +59,7 @@ struct kdb_dbbe { > }; \ > DATA_SET(kdb_dbbe_set, name##_dbbe) > > -extern bool kdb_active; /* Non-zero while in debugger. */ > +extern u_char kdb_active; /* Non-zero while in debugger. */ > extern int debugger_on_panic; /* enter the debugger on panic. */ > extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ > extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ > > Hi, Sorry for nitpicking. I believe this variable is better suited as "int"? Or am I wrong? What does the resulting assembly code look like? --HPS From owner-svn-src-head@freebsd.org Sun Oct 22 14:27:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93237E53840; Sun, 22 Oct 2017 14:27:27 +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 088D8676F0; Sun, 22 Oct 2017 14:27:27 +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 12D31260117; Sun, 22 Oct 2017 16:27:19 +0200 (CEST) Subject: Re: svn commit: r324863 - in head/sys: kern sys To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710221342.v9MDguCC074682@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> Date: Sun, 22 Oct 2017 16:24:41 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <201710221342.v9MDguCC074682@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 14:27:27 -0000 On 10/22/17 15:42, Mateusz Guzik wrote: > Author: mjg > Date: Sun Oct 22 13:42:56 2017 > New Revision: 324863 > URL: https://svnweb.freebsd.org/changeset/base/324863 > > Log: > Change kdb_active type to u_char. > > Fixes warnings from gcc and keeps the small size. Perhaps nesting should be moved > to another variablle. > > Reported by: ngie > > Modified: > head/sys/kern/subr_kdb.c > head/sys/sys/kdb.h > > Modified: head/sys/kern/subr_kdb.c > ============================================================================== > --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) > +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) > @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); > #include > #endif > > -bool __read_frequently kdb_active = 0; > +u_char __read_frequently kdb_active = 0; > static void *kdb_jmpbufp = NULL; > struct kdb_dbbe *kdb_dbbe = NULL; > static struct pcb kdb_pcb; > > Modified: head/sys/sys/kdb.h > ============================================================================== > --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) > +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) > @@ -59,7 +59,7 @@ struct kdb_dbbe { > }; \ > DATA_SET(kdb_dbbe_set, name##_dbbe) > > -extern bool kdb_active; /* Non-zero while in debugger. */ > +extern u_char kdb_active; /* Non-zero while in debugger. */ > extern int debugger_on_panic; /* enter the debugger on panic. */ > extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ > extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ > > Should we add __aligned(8) to this definition? ./systm.h:#define __read_frequently __section(".data.read_frequently") It will prevent commonly read variables from residing in two different cache-lines on x86 and amd64 at least??? --HPS From owner-svn-src-head@freebsd.org Sun Oct 22 14:50:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51073E541CA; Sun, 22 Oct 2017 14:50:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qk0-x22c.google.com (mail-qk0-x22c.google.com [IPv6:2607:f8b0:400d:c09::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 0606F6862E; Sun, 22 Oct 2017 14:50:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qk0-x22c.google.com with SMTP id y23so19226760qkb.10; Sun, 22 Oct 2017 07:50: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=yjqikO2xZnf8ucMbhiNDosvmpF8CpZ99dwiR19s71+8=; b=fJlIxkkIB29dyh48qBX/GpQzgf24a4qEBMhxglGj/cvdTQzeTvt/ybhwSJHW3ygsme PIrGs096WyvJGrsGMRlIuQg4fYD8vaEqzP4trPkf/ISEeLNor5WE5kiGCMgPefAC69+w 05V3AQKlxd9IzJecdkbq46L1TV5urWNvPJte9++352iujpF0BmARRypOsfaqm0w3UvKS UsCl15KpDsBlvJe1M6690fcrM5e04jUfkJLE2H9/y0FE9mVifiXmbJgc/BQIhB10OLXb 0zfSM72ekmLfXQdsSq4SBy31+oo/DXCQmwTLbgeKZhMJQGUEMDG3kp+KBeZBye+MsLpA m0+g== 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=yjqikO2xZnf8ucMbhiNDosvmpF8CpZ99dwiR19s71+8=; b=n6po2wb9ZsCI40vIGQibPie3JY4rDHue+ntlNAivhgi93HP6h+p2hbTJT/7tlWdfPy M+SIHM0gfHMj+eneGyKnqFFN61mjTBz2s9+fypXe5VkhLxs6sf5y5coBqDt5xKF+i+5q 6jV0hwRu5oAC8IQztyFjKLTM0l1GbjISGVQgLmdNxHNgGYMjFOxFsm1sqJyEOTLBUpmO rqcrdOH1+8SVHLZgeBFFMKP8WVH6LiFyoLffdaj+Pg8zVQTMGfn1vOboaSm6L2rfdan+ iTjQ364KxzonlF+o9C/5H8v4ZW5O4NPD74OSXGBr44fC7mTyC8WTMZajk2U93g6S2xnb S36A== X-Gm-Message-State: AMCzsaVa1y3rdpLyyZx1kzXqFSuzZzj+J8guU9fcmdf56wFD5gIYlHL5 Z7XrE2OcoFPs7duTYI4hXVtrgddfy5bEAC4HtUDZJA== X-Google-Smtp-Source: ABhQp+Q4yvp5zrKdXKPSwljyBVlH/qbWoZ5/15imbeCS79JsmsuoQOx8YSENhdGB1o4Wc3fKbRgRVzFlj345+ocTi5g= X-Received: by 10.55.15.139 with SMTP id 11mr14836137qkp.141.1508683841985; Sun, 22 Oct 2017 07:50:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.51.167 with HTTP; Sun, 22 Oct 2017 07:50:41 -0700 (PDT) In-Reply-To: <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> References: <201710221342.v9MDguCC074682@repo.freebsd.org> <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> From: Mateusz Guzik Date: Sun, 22 Oct 2017 16:50:41 +0200 Message-ID: Subject: Re: svn commit: r324863 - in head/sys: kern sys To: Hans Petter Selasky Cc: Mateusz Guzik , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 14:50:43 -0000 On Sun, Oct 22, 2017 at 04:24:41PM +0200, Hans Petter Selasky wrote: > On 10/22/17 15:42, Mateusz Guzik wrote: > > Author: mjg > > Date: Sun Oct 22 13:42:56 2017 > > New Revision: 324863 > > URL: https://svnweb.freebsd.org/changeset/base/324863 > > > > Log: > > Change kdb_active type to u_char. > > Fixes warnings from gcc and keeps the small size. Perhaps nesting should be moved > > to another variablle. > > Reported by: ngie > > > > Modified: > > head/sys/kern/subr_kdb.c > > head/sys/sys/kdb.h > > > > Modified: head/sys/kern/subr_kdb.c > > ============================================================================== > > --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) > > +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) > > @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #endif > > -bool __read_frequently kdb_active = 0; > > +u_char __read_frequently kdb_active = 0; > > static void *kdb_jmpbufp = NULL; > > struct kdb_dbbe *kdb_dbbe = NULL; > > static struct pcb kdb_pcb; > > > > Modified: head/sys/sys/kdb.h > > ============================================================================== > > --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) > > +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) > > @@ -59,7 +59,7 @@ struct kdb_dbbe { > > }; \ > > DATA_SET(kdb_dbbe_set, name##_dbbe) > > -extern bool kdb_active; /* Non-zero while in debugger. */ > > +extern u_char kdb_active; /* Non-zero while in debugger. */ > > extern int debugger_on_panic; /* enter the debugger on panic. */ > > extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ > > extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ > > > > > > Should we add __aligned(8) to this definition? > > ./systm.h:#define __read_frequently __section(".data.read_frequently") > > It will prevent commonly read variables from residing in two different > cache-lines on x86 and amd64 at least??? > I don't follow. This would *increase* alignemnt requirement and in particular prevent bool variables from being put in consecutive bytes. To answer the question from your other e-mail, the bigger the type the worse it is as it takes more space. The idea is to change all frequently read and effectively bool variables from int to bool so that more of them fit in one cacheline. Right now there is nothing to nicely sort them to get rid of holes, but I'm tinkering with automagic size addition to section name. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sun Oct 22 15:32:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F44EE54DCB; Sun, 22 Oct 2017 15:32:57 +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 25D7C6A110; Sun, 22 Oct 2017 15:32:56 +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 v9MFWtOf039163; Sun, 22 Oct 2017 08:32: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 v9MFWt6B039162; Sun, 22 Oct 2017 08:32:55 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201710221532.v9MFWt6B039162@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r324841 - head/sys/boot In-Reply-To: <201710220352.v9M3q3l9028012@repo.freebsd.org> To: Warner Losh Date: Sun, 22 Oct 2017 08:32:55 -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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 15:32:57 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: imp > Date: Sun Oct 22 03:52:03 2017 > New Revision: 324841 > URL: https://svnweb.freebsd.org/changeset/base/324841 > > Log: > Use BOOTDIR more consistently in defs.mk rather than repeat sys/boot. > > Sponsored By: Netflix Shouldn't these be BOOTSRC so BOOTDIR can be /boot as BINDIR is /bin? > Modified: > head/sys/boot/defs.mk > > Modified: head/sys/boot/defs.mk > ============================================================================== > --- head/sys/boot/defs.mk Sun Oct 22 00:10:18 2017 (r324840) > +++ head/sys/boot/defs.mk Sun Oct 22 03:52:03 2017 (r324841) > @@ -6,9 +6,9 @@ > __BOOT_DEFS_MK__=${MFILE} > > BOOTDIR= ${SRCTOP}/sys/boot > -FICLDIR= ${SRCTOP}/sys/boot/ficl > +FICLDIR= ${BOOTDIR}/ficl > LDR_MI= ${BOOTDIR}/common > -SASRC= ${SRCTOP}/sys/boot/libsa > +SASRC= ${BOOTDIR}/libsa > SYSDIR= ${SRCTOP}/sys > > # NB: The makefiles depend on these being empty when we don't build forth. > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Oct 22 15:36:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F97EE54EA0 for ; Sun, 22 Oct 2017 15:36:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (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 510856A389 for ; Sun, 22 Oct 2017 15:36:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x22d.google.com with SMTP id l196so3349928itl.4 for ; Sun, 22 Oct 2017 08:36:06 -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=xdcUXHOOfNxHEH584lObXAm3jshiDiIYZsPrudDxAtQ=; b=Xc8lKcx6Ot9Hm5uA9lduQChQsJdGxeAm65OLE4DD8+cmFLqyWLh9Y2QyJ5cCQBNZg4 UmaESZ2CoA4VUDQGHCtlrX8U6UzNVt71CHn3pOhnM6zB53q574QITE49mut6u4mwJK8P wiv0A1KhjpylAHeL1CIR13NB9bAZo+QZBvfHQouimaj8Hky86mXXGAQA19AtSm8vy0d1 RA2ZO8m7/Xib8GAk7YBwpRz0SU0EkG593GxD8Ba9ECZJFl7QW8bpCTmVbnvjvrkBFv3B dNoPFCGjvAChid/xasVYTEVjCcFAi0piLvSGgkBXyMmXH6YQUoVTxfhSMBvUkmqQ8w98 r4sw== 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=xdcUXHOOfNxHEH584lObXAm3jshiDiIYZsPrudDxAtQ=; b=SpBt+ht/9FIlhg5DoXvTulbqwUcjmLVfe/bU0i4hziHeswitZ+sKXhtB4eO8eKiIV8 QvMgNWho2ZICDkIDAqNO/SSfw7F6USc/XetKPahtnUSEmK72n8/x8HbNwNEx8kDygQ38 pn+TKxXFBSvIVdFSL5cCJl1MmuvkPG69WGV12CUuIzXwYiP+temfwubjSD8PGm/RRBOL ig+mESOUoFVtK1U4PEq2Fgn0s4X+PW5dpAZp6IFy0T85Y3eFRf3EHTD3Rd9oNlEr6D4u bHsEiARutxQnZNHxCCwtjlLMXPxRphgaiPLwBmE8QJmuz+1pVikYczURDk3Y8IpJfpUG MD/w== X-Gm-Message-State: AMCzsaVutFyAH9hlf353rqprgUnlRRUsKBY3BLldiVmoQPYoYif37OgH +pwht1EYiz9DEBLk7YAD+qFFIEpCNly5RO3aOOFdIg== X-Google-Smtp-Source: ABhQp+QMRZHR+u6KV5cFl8QKuCpDHtcWN/18MoM243t+IqCtxjGvSq5zcMOYHqKW0/gH0Uu6PUH2i2TVy9t4MkGmRlM= X-Received: by 10.36.69.100 with SMTP id y97mr6049262ita.50.1508686565504; Sun, 22 Oct 2017 08:36:05 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Sun, 22 Oct 2017 08:36:04 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:df5:793f:4458:5cf6] In-Reply-To: <201710221532.v9MFWt6B039162@pdx.rh.CN85.dnsmgr.net> References: <201710220352.v9M3q3l9028012@repo.freebsd.org> <201710221532.v9MFWt6B039162@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Sun, 22 Oct 2017 09:36:04 -0600 X-Google-Sender-Auth: i_8Nsi4zbOiMnA4aZOnjzgBHKfs Message-ID: Subject: Re: svn commit: r324841 - head/sys/boot 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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 15:36:06 -0000 On Sun, Oct 22, 2017 at 9:32 AM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: imp > > Date: Sun Oct 22 03:52:03 2017 > > New Revision: 324841 > > URL: https://svnweb.freebsd.org/changeset/base/324841 > > > > Log: > > Use BOOTDIR more consistently in defs.mk rather than repeat sys/boot. > > > > Sponsored By: Netflix > > Shouldn't these be BOOTSRC so BOOTDIR can be /boot as BINDIR is /bin? There's currently no BOOTDIR, so there's no conflict. However, as a design point, that may be desirable. Warner > > Modified: > > head/sys/boot/defs.mk > > > > Modified: head/sys/boot/defs.mk > > ============================================================ > ================== > > --- head/sys/boot/defs.mk Sun Oct 22 00:10:18 2017 (r324840) > > +++ head/sys/boot/defs.mk Sun Oct 22 03:52:03 2017 (r324841) > > @@ -6,9 +6,9 @@ > > __BOOT_DEFS_MK__=${MFILE} > > > > BOOTDIR= ${SRCTOP}/sys/boot > > -FICLDIR= ${SRCTOP}/sys/boot/ficl > > +FICLDIR= ${BOOTDIR}/ficl > > LDR_MI= ${BOOTDIR}/common > > -SASRC= ${SRCTOP}/sys/boot/libsa > > +SASRC= ${BOOTDIR}/libsa > > SYSDIR= ${SRCTOP}/sys > > > > # NB: The makefiles depend on these being empty when we don't build > forth. > > > > > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Sun Oct 22 16:53:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53B4FE56862; Sun, 22 Oct 2017 16:53:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f44.google.com (mail-it0-f44.google.com [209.85.214.44]) (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 1CCD86D48F; Sun, 22 Oct 2017 16:53:48 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f44.google.com with SMTP id f187so3470763itb.1; Sun, 22 Oct 2017 09:53: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:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=B6fnTyUSHTo8byF9Lb9wxdu9R65BeaWEvGC8Vnd9360=; b=UHEFq9AITL3D3jNaNGFP28Iii9DcNhHdp35jSFTbeS5IipGZs4GaSNMDOeOTSRMoJK d8NH6hzbokWMnnLftUwQYoon5PXvaIsFf0+q0z37GZ6nePeNCHUILbVD0B65GuaXVTZX XbD9rt6NLt2ryLBj1PG4xLzyvoDmSQFy0WKh9N0hNC8Zs1HVaCrYt55pfEbQ2yIy5mmq p0mB/ei2krjmE8nrLAhFg756sQ1q3udqUXGDZ4gBv5R2JZAzoMyDUtqkQaEsa9ftMWt3 /F+SRb5RCZ2tatpZ1/h1EwUpgP6+QgOMcAw4krF1TP6jpO7XYeB/2ymSZ26YTwWZ7MD/ tYHg== X-Gm-Message-State: AMCzsaVntLGzbcsVYY8XpMBfXuFE9Z5V4YUogxGnnsoZrRzhBQxbe4VX aKs8/39lSGqleKOPecatQvw5nFUv X-Received: by 10.36.71.74 with SMTP id t71mr6385475itb.53.1508691227656; Sun, 22 Oct 2017 09:53:47 -0700 (PDT) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com. [209.85.214.49]) by smtp.gmail.com with ESMTPSA id n132sm1543403itn.25.2017.10.22.09.53.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Oct 2017 09:53:47 -0700 (PDT) Received: by mail-it0-f49.google.com with SMTP id r127so3454483itb.5; Sun, 22 Oct 2017 09:53:46 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RT/IxQdgRYAGmFKE4dq/NoQusnynoe6+tGoPucIY1rcw893S1YmMGFWUI98zMKHjnArgRIc3ej/e/L/TrGLbU= X-Received: by 10.36.224.78 with SMTP id c75mr5745268ith.71.1508691226628; Sun, 22 Oct 2017 09:53:46 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.164.130 with HTTP; Sun, 22 Oct 2017 09:53:46 -0700 (PDT) In-Reply-To: <201710220811.v9M8Bjw5033551@repo.freebsd.org> References: <201710220811.v9M8Bjw5033551@repo.freebsd.org> From: Conrad Meyer Date: Sun, 22 Oct 2017 09:53:46 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r324853 - in head/sys: kern sys 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 16:53:49 -0000 Thanks! For other users that managed to create such files: fsck will clean them up. Best, Conrad On Sun, Oct 22, 2017 at 1:11 AM, Konstantin Belousov wrote: > Author: kib > Date: Sun Oct 22 08:11:45 2017 > New Revision: 324853 > URL: https://svnweb.freebsd.org/changeset/base/324853 > > Log: > Remove the support for mknod(S_IFMT), which created dummy vnodes with > VBAD type. > > FFS ffs_write() VOP catches such vnodes and panics, other VOPs do not > check for the type and their behaviour is really undefined. The > comment claims that this support was done for 'badsect' to flag bad > sectors, we do not have such facility in kernel anyway. > > Reported by: Dmitry Vyukov > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > > Modified: > head/sys/kern/vfs_syscalls.c > head/sys/sys/priv.h > > Modified: head/sys/kern/vfs_syscalls.c > ============================================================================== > --- head/sys/kern/vfs_syscalls.c Sun Oct 22 07:58:28 2017 (r324852) > +++ head/sys/kern/vfs_syscalls.c Sun Oct 22 08:11:45 2017 (r324853) > @@ -1248,9 +1248,6 @@ kern_mknodat(struct thread *td, int fd, char *path, en > if (error == 0 && dev == VNOVAL) > error = EINVAL; > break; > - case S_IFMT: > - error = priv_check(td, PRIV_VFS_MKNOD_BAD); > - break; > case S_IFWHT: > error = priv_check(td, PRIV_VFS_MKNOD_WHT); > break; > @@ -1288,9 +1285,6 @@ restart: > whiteout = 0; > > switch (mode & S_IFMT) { > - case S_IFMT: /* used by badsect to flag bad sectors */ > - vattr.va_type = VBAD; > - break; > case S_IFCHR: > vattr.va_type = VCHR; > break; > > Modified: head/sys/sys/priv.h > ============================================================================== > --- head/sys/sys/priv.h Sun Oct 22 07:58:28 2017 (r324852) > +++ head/sys/sys/priv.h Sun Oct 22 08:11:45 2017 (r324853) > @@ -266,7 +266,7 @@ > #define PRIV_VFS_GETFH 327 /* Can retrieve file handles. */ > #define PRIV_VFS_GETQUOTA 328 /* getquota(). */ > #define PRIV_VFS_LINK 329 /* bsd.hardlink_check_uid */ > -#define PRIV_VFS_MKNOD_BAD 330 /* Can mknod() to mark bad inodes. */ > +#define PRIV_VFS_MKNOD_BAD 330 /* Was: mknod() can mark bad inodes. */ > #define PRIV_VFS_MKNOD_DEV 331 /* Can mknod() to create dev nodes. */ > #define PRIV_VFS_MKNOD_WHT 332 /* Can mknod() to create whiteout. */ > #define PRIV_VFS_MOUNT 333 /* Can mount(). */ > From owner-svn-src-head@freebsd.org Sun Oct 22 17:01:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06D67E56D99; Sun, 22 Oct 2017 17:01:59 +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 88D676DAAB; Sun, 22 Oct 2017 17:01:58 +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 6EC4D260117; Sun, 22 Oct 2017 19:01:56 +0200 (CEST) Subject: Re: svn commit: r324863 - in head/sys: kern sys To: Mateusz Guzik Cc: Mateusz Guzik , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201710221342.v9MDguCC074682@repo.freebsd.org> <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> From: Hans Petter Selasky Message-ID: Date: Sun, 22 Oct 2017 18:59:19 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 17:01:59 -0000 On 10/22/17 16:50, Mateusz Guzik wrote: > On Sun, Oct 22, 2017 at 04:24:41PM +0200, Hans Petter Selasky wrote: >> On 10/22/17 15:42, Mateusz Guzik wrote: >>> Author: mjg >>> Date: Sun Oct 22 13:42:56 2017 >>> New Revision: 324863 >>> URL: https://svnweb.freebsd.org/changeset/base/324863 >>> >>> Log: >>> Change kdb_active type to u_char. >>> Fixes warnings from gcc and keeps the small size. Perhaps nesting > should be moved >>> to another variablle. >>> Reported by: ngie >>> >>> Modified: >>> head/sys/kern/subr_kdb.c >>> head/sys/sys/kdb.h >>> >>> Modified: head/sys/kern/subr_kdb.c >>> > ============================================================================== >>> --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) >>> +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) >>> @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); >>> #include >>> #endif >>> -bool __read_frequently kdb_active = 0; >>> +u_char __read_frequently kdb_active = 0; >>> static void *kdb_jmpbufp = NULL; >>> struct kdb_dbbe *kdb_dbbe = NULL; >>> static struct pcb kdb_pcb; >>> >>> Modified: head/sys/sys/kdb.h >>> > ============================================================================== >>> --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) >>> +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) >>> @@ -59,7 +59,7 @@ struct kdb_dbbe { >>> }; \ >>> DATA_SET(kdb_dbbe_set, name##_dbbe) >>> -extern bool kdb_active; /* Non-zero while in debugger. */ >>> +extern u_char kdb_active; /* Non-zero while in debugger. */ >>> extern int debugger_on_panic; /* enter the debugger on panic. > */ >>> extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or > NULL. */ >>> extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ >>> >>> >> >> Should we add __aligned(8) to this definition? >> >> ./systm.h:#define __read_frequently > __section(".data.read_frequently") >> >> It will prevent commonly read variables from residing in two different >> cache-lines on x86 and amd64 at least??? >> > > I don't follow. This would *increase* alignemnt requirement and in > particular prevent bool variables from being put in consecutive bytes. > > To answer the question from your other e-mail, the bigger the type the > worse it is as it takes more space. The idea is to change all frequently > read and effectively bool variables from int to bool so that more of > them fit in one cacheline. > > Right now there is nothing to nicely sort them to get rid of holes, but > I'm tinkering with automagic size addition to section name. > Hi, The point is that for x86 there is no alignment so the variables get packed back to back, and then you sometimes get not so smart layouts, like that an integer crosses a cache line. Regarding automation: Maybe the idea behind sysinit can be used: sys/boot/usb/tools/sysinit.c --HPS From owner-svn-src-head@freebsd.org Sun Oct 22 17:37:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A69FE2B97C; Sun, 22 Oct 2017 17:37:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com [IPv6:2607:f8b0:400d:c0d::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 3175C6E8C5; Sun, 22 Oct 2017 17:37:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x233.google.com with SMTP id k31so23690489qta.6; Sun, 22 Oct 2017 10:37:49 -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=SYe0WYsdU5xCNts6V6zu0Kv9uYtoWGSVtr4vJo4P95w=; b=QsCct3+wPDUDgh6bEZDoetHXTAcmGwHQdQSEGjQOY0ByIBZ4lJRoMH+0Y2Mvhz1+1S ICwvKqNG3jjmerC2w8Vu7sfqzJb+WjheFyFfWLeFwIB8IWYxU6kP8PZ6nGVgJzPBgA+2 dp2N5k1gGF1E6vLdxJTVs+87N6KVlYZCz1eL0YNgx48E6hrqlmblCkpGZojYoupK+LsY PteecO4ugSZyh1ehI32dG1diaL+vtkvIwm0/TPoYXxhN89pWQRMbDSK1Bbqobgn5zAH2 ggngxPhPCMF2QxJVgSDTSYjCXLW+rGcL9hiJOPjgNDEfhxSVVHbGYteReosyIX3aA+TX qTwQ== 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=SYe0WYsdU5xCNts6V6zu0Kv9uYtoWGSVtr4vJo4P95w=; b=GjNjMG9fgtyjLXjNUhXNZ3pD7Ygmyfs69O1OgIPfaTcF82F6djaynAeUkTvmPHYDrC PQohNbB7mjdj3ZdGx/Q5Y0CleWh2NyvuR0gcowzdSOefe+GVBdr1jwQF3OfWJWwHumA5 hKm8XKB/P9VvGcEyspuLBTGDRP65LcYMVyY9KCq1ca7vWA9z2rhllGs8rIdExgLRHo9O 0acPD4u8oZrjj0Bqg0TXnLuUjduzfhR7MH4rJwWNH91n23RoPa2mEw1pPj1geiQi8kxU /ij3XXr7iGQfCiSUtmerrifcoDdkqxbCP1YTafBVx6UbMjPk+ToHldVJvLWoA/CRVXyD VkCA== X-Gm-Message-State: AMCzsaUaiH+4zxeLRVpwDCH2LkYDvuBTU9wMC6YF4qfzCcIJI7lGxNA5 +n6ml2dqRZVGHPoMG+5bblDWKv7/KGgqO3zadtE= X-Google-Smtp-Source: ABhQp+R4d5rsNG8s6Gg2LcwmU8pU+a/LB7ttkPIOt5dxDePrbcpl1j7rAlRylw2dvhjAd/GdvskV+6nsvpWSDrSBS8I= X-Received: by 10.200.8.239 with SMTP id y44mr16701399qth.341.1508693867335; Sun, 22 Oct 2017 10:37:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.51.167 with HTTP; Sun, 22 Oct 2017 10:37:46 -0700 (PDT) In-Reply-To: References: <201710221342.v9MDguCC074682@repo.freebsd.org> <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> From: Mateusz Guzik Date: Sun, 22 Oct 2017 19:37:46 +0200 Message-ID: Subject: Re: svn commit: r324863 - in head/sys: kern sys To: Hans Petter Selasky Cc: Mateusz Guzik , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 17:37:49 -0000 On Sun, Oct 22, 2017 at 6:59 PM, Hans Petter Selasky wrote: > On 10/22/17 16:50, Mateusz Guzik wrote: > >> On Sun, Oct 22, 2017 at 04:24:41PM +0200, Hans Petter Selasky wrote: >> >>> On 10/22/17 15:42, Mateusz Guzik wrote: >>> >>>> Author: mjg >>>> Date: Sun Oct 22 13:42:56 2017 >>>> New Revision: 324863 >>>> URL: https://svnweb.freebsd.org/changeset/base/324863 >>>> >>>> Log: >>>> Change kdb_active type to u_char. >>>> Fixes warnings from gcc and keeps the small size. Perhaps nesting >>>> >>> should be moved >> >>> to another variablle. >>>> Reported by: ngie >>>> >>>> Modified: >>>> head/sys/kern/subr_kdb.c >>>> head/sys/sys/kdb.h >>>> >>>> Modified: head/sys/kern/subr_kdb.c >>>> >>>> ============================================================ >> ================== >> >>> --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) >>>> +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) >>>> @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); >>>> #include >>>> #endif >>>> -bool __read_frequently kdb_active = 0; >>>> +u_char __read_frequently kdb_active = 0; >>>> static void *kdb_jmpbufp = NULL; >>>> struct kdb_dbbe *kdb_dbbe = NULL; >>>> static struct pcb kdb_pcb; >>>> >>>> Modified: head/sys/sys/kdb.h >>>> >>>> ============================================================ >> ================== >> >>> --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) >>>> +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) >>>> @@ -59,7 +59,7 @@ struct kdb_dbbe { >>>> }; \ >>>> DATA_SET(kdb_dbbe_set, name##_dbbe) >>>> -extern bool kdb_active; /* Non-zero while in debugger. */ >>>> +extern u_char kdb_active; /* Non-zero while in debugger. */ >>>> extern int debugger_on_panic; /* enter the debugger on panic. >>>> >>> */ >> >>> extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or >>>> >>> NULL. */ >> >>> extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ >>>> >>>> >>>> >>> Should we add __aligned(8) to this definition? >>> >>> ./systm.h:#define __read_frequently >>> >> __section(".data.read_frequently") >> >>> >>> It will prevent commonly read variables from residing in two different >>> cache-lines on x86 and amd64 at least??? >>> >>> >> I don't follow. This would *increase* alignemnt requirement and in >> particular prevent bool variables from being put in consecutive bytes. >> >> To answer the question from your other e-mail, the bigger the type the >> worse it is as it takes more space. The idea is to change all frequently >> read and effectively bool variables from int to bool so that more of >> them fit in one cacheline. >> >> Right now there is nothing to nicely sort them to get rid of holes, but >> I'm tinkering with automagic size addition to section name. >> >> > Hi, > > The point is that for x86 there is no alignment so the variables get > packed back to back, and then you sometimes get not so smart layouts, like > that an integer crosses a cache line. > > They are aligned to their size and this creates holes, like here: ffffffff8112873c D kdb_active ---------------- ffffffff81128740 D audit_enabled Regarding automation: Maybe the idea behind sysinit can be used: > sys/boot/usb/tools/sysinit.c > I don't know how this can be plugged here. Would this require defining variables elsewhere? Preferably they would be sorted by the linker. -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sun Oct 22 17:43:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3572E2BCF4; Sun, 22 Oct 2017 17:43:26 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from mail.strugglingcoder.info (strugglingcoder.info [104.236.146.68]) by mx1.freebsd.org (Postfix) with ESMTP id 48F216ED0E; Sun, 22 Oct 2017 17:43:26 +0000 (UTC) (envelope-from hiren@strugglingcoder.info) Received: from localhost (unknown [10.1.1.3]) (Authenticated sender: hiren@strugglingcoder.info) by mail.strugglingcoder.info (Postfix) with ESMTPA id 8299D172E6; Sun, 22 Oct 2017 10:43:23 -0700 (PDT) Date: Sun, 22 Oct 2017 10:43:23 -0700 From: hiren panchasara To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324836 - in head/sys: kern sys Message-ID: <20171022174323.GM47441@strugglingcoder.info> References: <201710212240.v9LMe9iK096074@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dzI2QqkSBOAresgT" Content-Disposition: inline In-Reply-To: <201710212240.v9LMe9iK096074@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 17:43:26 -0000 --dzI2QqkSBOAresgT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 10/21/17 at 10:40P, Mateusz Guzik wrote: > Author: mjg > Date: Sat Oct 21 22:40:09 2017 > New Revision: 324836 > URL: https://svnweb.freebsd.org/changeset/base/324836 >=20 > Log: > mtx: implement thread lock fastpath Hi, Can you please elaborate this commit-log message a little more? what is the fastpath here and what scenarios would benefit from this change? This would help novice like myself. :-) Cheers, Hiren --dzI2QqkSBOAresgT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQF8BAABCgBmBQJZ7Ni4XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNEUyMEZBMUQ4Nzg4RjNGMTdFNjZGMDI4 QjkyNTBFMTU2M0VERkU1AAoJEIuSUOFWPt/l12EH/AvuRjV+lh+QySYiQFmY2Of7 JqFe34fz/IfDU+2y/dipJaKcu5+RWOXe7YIYnugYhNDFn3IPGkgl8YzKTi+ewhI4 3R9ZX1QrNlPNlnw2cgD86vCfiofJevTtiBai1WfBXVH0iQD/WMFmKi33ZDxYilsr iO4Uyy5JCGhpsfJJ38i0Tdtd1Bstv62NMA5B5VcjIghQN8TwiuXfVYzx3oZ4+Hu/ YVxaomqfzFRyOPJGw6IqRN+FoM+qW0TVA99oxGAxQ70TfkIrvoCxPidiAecIwcl9 yyGfmnKYnYdQvtZZcYTG6BDvVM0zALo4uQua5Ay2W3xRL4dMSpwD33pl44ZYyH4= =1GUk -----END PGP SIGNATURE----- --dzI2QqkSBOAresgT-- From owner-svn-src-head@freebsd.org Sun Oct 22 18:19:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBCD0E2FAC2; Sun, 22 Oct 2017 18:19:47 +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 8B6016FD91; Sun, 22 Oct 2017 18:19:47 +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 DC714260117; Sun, 22 Oct 2017 20:19:45 +0200 (CEST) Subject: Re: svn commit: r324863 - in head/sys: kern sys To: Mateusz Guzik Cc: Mateusz Guzik , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" References: <201710221342.v9MDguCC074682@repo.freebsd.org> <316ecd86-a508-fb36-e33c-ba32f5cb8073@selasky.org> From: Hans Petter Selasky Message-ID: <7f65c32c-4f7d-9424-f106-8b699d19f684@selasky.org> Date: Sun, 22 Oct 2017 20:17:08 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 18:19:48 -0000 On 10/22/17 19:37, Mateusz Guzik wrote: > On Sun, Oct 22, 2017 at 6:59 PM, Hans Petter Selasky > wrote: > >> On 10/22/17 16:50, Mateusz Guzik wrote: >> >>> On Sun, Oct 22, 2017 at 04:24:41PM +0200, Hans Petter Selasky wrote: >>> >>>> On 10/22/17 15:42, Mateusz Guzik wrote: >>>> >>>>> Author: mjg >>>>> Date: Sun Oct 22 13:42:56 2017 >>>>> New Revision: 324863 >>>>> URL: https://svnweb.freebsd.org/changeset/base/324863 >>>>> >>>>> Log: >>>>> Change kdb_active type to u_char. >>>>> Fixes warnings from gcc and keeps the small size. Perhaps nesting >>>>> >>>> should be moved >>> >>>> to another variablle. >>>>> Reported by: ngie >>>>> >>>>> Modified: >>>>> head/sys/kern/subr_kdb.c >>>>> head/sys/sys/kdb.h >>>>> >>>>> Modified: head/sys/kern/subr_kdb.c >>>>> >>>>> ============================================================ >>> ================== >>> >>>> --- head/sys/kern/subr_kdb.c Sun Oct 22 12:12:52 2017 (r324862) >>>>> +++ head/sys/kern/subr_kdb.c Sun Oct 22 13:42:56 2017 (r324863) >>>>> @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); >>>>> #include >>>>> #endif >>>>> -bool __read_frequently kdb_active = 0; >>>>> +u_char __read_frequently kdb_active = 0; >>>>> static void *kdb_jmpbufp = NULL; >>>>> struct kdb_dbbe *kdb_dbbe = NULL; >>>>> static struct pcb kdb_pcb; >>>>> >>>>> Modified: head/sys/sys/kdb.h >>>>> >>>>> ============================================================ >>> ================== >>> >>>> --- head/sys/sys/kdb.h Sun Oct 22 12:12:52 2017 (r324862) >>>>> +++ head/sys/sys/kdb.h Sun Oct 22 13:42:56 2017 (r324863) >>>>> @@ -59,7 +59,7 @@ struct kdb_dbbe { >>>>> }; \ >>>>> DATA_SET(kdb_dbbe_set, name##_dbbe) >>>>> -extern bool kdb_active; /* Non-zero while in debugger. */ >>>>> +extern u_char kdb_active; /* Non-zero while in debugger. */ >>>>> extern int debugger_on_panic; /* enter the debugger on panic. >>>>> >>>> */ >>> >>>> extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or >>>>> >>>> NULL. */ >>> >>>> extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ >>>>> >>>>> >>>>> >>>> Should we add __aligned(8) to this definition? >>>> >>>> ./systm.h:#define __read_frequently >>>> >>> __section(".data.read_frequently") >>> >>>> >>>> It will prevent commonly read variables from residing in two different >>>> cache-lines on x86 and amd64 at least??? >>>> >>>> >>> I don't follow. This would *increase* alignemnt requirement and in >>> particular prevent bool variables from being put in consecutive bytes. >>> >>> To answer the question from your other e-mail, the bigger the type the >>> worse it is as it takes more space. The idea is to change all frequently >>> read and effectively bool variables from int to bool so that more of >>> them fit in one cacheline. >>> >>> Right now there is nothing to nicely sort them to get rid of holes, but >>> I'm tinkering with automagic size addition to section name. >>> >>> >> Hi, >> >> The point is that for x86 there is no alignment so the variables get >> packed back to back, and then you sometimes get not so smart layouts, like >> that an integer crosses a cache line. >> >> > They are aligned to their size and this creates holes, like here: > > ffffffff8112873c D kdb_active > ---------------- > ffffffff81128740 D audit_enabled > > Regarding automation: Maybe the idea behind sysinit can be used: >> sys/boot/usb/tools/sysinit.c >> > > I don't know how this can be plugged here. Would this require defining > variables elsewhere? > > Preferably they would be sorted by the linker. > Hi, If the linker supports this, that's the best. Else you'll need a custom tool. sysinit.c might give you some ideas how to implement it in a cross-OS way. --HPS From owner-svn-src-head@freebsd.org Sun Oct 22 18:32:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14CC6E30029; Sun, 22 Oct 2017 18:32: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 mx1.freebsd.org (Postfix) with ESMTPS id C0623704BB; Sun, 22 Oct 2017 18:32:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9MIWTiG097150; Sun, 22 Oct 2017 18:32:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MIWTin097149; Sun, 22 Oct 2017 18:32:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710221832.v9MIWTin097149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 22 Oct 2017 18:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324864 - head/cddl/contrib/opensolaris/lib/libctf/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libctf/common X-SVN-Commit-Revision: 324864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 18:32:30 -0000 Author: markj Date: Sun Oct 22 18:32:28 2017 New Revision: 324864 URL: https://svnweb.freebsd.org/changeset/base/324864 Log: MFV r323105 (partial): 8300 fix man page issues found by mandoc 1.14.1 illumos/illumos-gate@72d3dbb9ab4481606cb93caca98ba3b3a8eb6ce2 https://github.com/illumos/illumos-gate/commit/72d3dbb9ab4481606cb93caca98ba3b3a8eb6ce2 https://www.illumos.org/issues/8300 Prior to integrating the mdocml update to 1.14.1, fix issues found by new version, especially the "new sentence, new line" style rule. FreeBSD note: this revision merges only the changes to the CTF manual page. The changes to the ZFS pages cannot be applied directly. Reviewed by: Robert Mustacchi Reviewed by: Toomas Soome Approved by: Gordon Ross Author: Yuri Pankov Discussed with: avg MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Directory Properties: head/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 ============================================================================== --- head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Sun Oct 22 13:42:56 2017 (r324863) +++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Sun Oct 22 18:32:28 2017 (r324864) @@ -39,7 +39,8 @@ data contained in each file has information about the sizes of C types, including intrinsic types, enumerations, structures, typedefs, and unions, that are used by the corresponding .Sy ELF -object. The +object. +The .Nm data may also include information about the types of global objects and the return type and arguments of functions in the symbol table. @@ -53,11 +54,11 @@ file itself, it may also be referred to as a .Lp On illumos systems, .Nm -data is consumed by multiple programs. It can be used by the modular -debugger, +data is consumed by multiple programs. +It can be used by the modular debugger, .Xr mdb 1 , as well as by -.Xr dtrace 1M . +.Xr dtrace 1 . Programmatic access to .Nm data can be obtained through @@ -65,8 +66,8 @@ data can be obtained through .Lp The .Nm -file format is broken down into seven different sections. The first -section is the +file format is broken down into seven different sections. +The first section is the .Sy preamble and .Sy header , @@ -74,18 +75,22 @@ which describes the version of the .Nm file, links it has to other .Nm -files, and the sizes of the other sections. The next section is the +files, and the sizes of the other sections. +The next section is the .Sy label section, which provides a way of identifying similar groups of .Nm -data across multiple files. This is followed by the +data across multiple files. +This is followed by the .Sy object information section, which describes the type of global -symbols. The subsequent section is the +symbols. +The subsequent section is the .Sy function information section, which describes the return -types and arguments of functions. The next section is the +types and arguments of functions. +The next section is the .Sy type information section, which describes the format and layout of the C types themselves, and finally the last @@ -106,29 +111,33 @@ A file may contain all of the type information that it requires, or it may optionally refer to another .Nm -file which holds the remaining types. When a +file which holds the remaining types. +When a .Nm file refers to another file, it is called the .Sy child and the file it refers to is called the .Sy parent . -A given file may only refer to one parent. This process is called +A given file may only refer to one parent. +This process is called .Em uniquification because it ensures each child only has type information that is -unique to it. A common example of this is that most kernel modules in -illumos are uniquified against the kernel module +unique to it. +A common example of this is that most kernel modules in illumos are uniquified +against the kernel module .Sy genunix and the type information that comes from the .Sy IP -module. This means that a module only has types that are unique to -itself and the most common types in the kernel are not duplicated. +module. +This means that a module only has types that are unique to itself and the most +common types in the kernel are not duplicated. .Sh FILE FORMAT This documents version .Em two of the .Nm -file format. All applications and tools currently produce and operate on -this version. +file format. +All applications and tools currently produce and operate on this version. .Lp The file format can be summarized with the following image, the following sections will cover this in more detail. @@ -235,26 +244,31 @@ This .Sy preamble defines the version of the .Nm -file which defines the format of the rest of the header. While the -header may change in subsequent versions, the preamble will not change +file which defines the format of the rest of the header. +While the header may change in subsequent versions, the preamble will not change across versions, though the interpretation of its flags may change from -version to version. The +version to version. +The .Em ctp_magic member defines the magic number for the .Nm -file format. This must always be +file format. +This must always be .Li 0xcff1 . If another value is encountered, then the file should not be treated as a .Nm -file. The +file. +The .Em ctp_version member defines the version of the .Nm -file. The current version is +file. +The current version is .Li 2 . -It is possible to encounter an unsupported version. In that case, -software should not try to parse the format, as it may have changed. +It is possible to encounter an unsupported version. +In that case, software should not try to parse the format, as it may have +changed. Finally, the .Em ctp_flags member describes aspects of the file which modify its interpretation. @@ -273,9 +287,10 @@ has been compressed through the .Sy zlib library and its .Sy deflate -algorithm. If this flag is not present, then the body has not been -compressed and no special action is needed to interpret it. All offsets -into the data as described by +algorithm. +If this flag is not present, then the body has not been compressed and no +special action is needed to interpret it. +All offsets into the data as described by .Sy header , always refer to the .Sy uncompressed @@ -289,8 +304,8 @@ denotes whether whether or not this .Nm file is the child of another .Nm -file and also indicates the size of the remaining sections. The -structure for the +file and also indicates the size of the remaining sections. +The structure for the .Sy header , logically contains a copy of the .Sy preamble @@ -315,37 +330,40 @@ the next two members .Em cth_parlablel and .Em cth_parname , -are used to identify the parent. The value of both members are offsets -into the +are used to identify the parent. +The value of both members are offsets into the .Sy string -section which point to the start of a null-terminated string. For more -information on the encoding of strings, see the subsection on +section which point to the start of a null-terminated string. +For more information on the encoding of strings, see the subsection on .Sx String Identifiers . If the value of either is zero, then there is no entry for that -member. If the member +member. +If the member .Em cth_parlabel is set, then the .Em ctf_parname member must be set, otherwise it will not be possible to find the -parent. If +parent. +If .Em ctf_parname is set, it is not necessary to define .Em cth_parlabel , -as the parent may not have a label. For more information on labels -and their interpretation, see +as the parent may not have a label. +For more information on labels and their interpretation, see .Sx The Label Section . .Lp The remaining members (excepting .Em cth_strlen ) -describe the beginning of the corresponding sections. These offsets are -relative to the end of the +describe the beginning of the corresponding sections. +These offsets are relative to the end of the .Sy header . Therefore, something with an offset of 0 is at an offset of thirty-six bytes relative to the start of the .Nm -file. The difference between members -indicates the size of the section itself. Different offsets have -different alignment requirements. The start of the +file. +The difference between members indicates the size of the section itself. +Different offsets have different alignment requirements. +The start of the .Em cth_objotoff and .Em cth_funcoff @@ -353,13 +371,14 @@ must be two byte aligned, while the sections .Em cth_lbloff and .Em cth_typeoff -must be four-byte aligned. The section +must be four-byte aligned. +The section .Em cth_stroff -has no alignment requirements. To calculate the size of a given section, -excepting the +has no alignment requirements. +To calculate the size of a given section, excepting the .Sy string -section, one should subtract the offset of the section from the following one. For -example, the size of the +section, one should subtract the offset of the section from the following one. +For example, the size of the .Sy types section can be calculated by subtracting .Em cth_stroff @@ -368,8 +387,8 @@ from .Lp Finally, the member .Em cth_strlen -describes the length of the string section itself. From it, you can also -calculate the size of the entire +describes the length of the string section itself. +From it, you can also calculate the size of the entire .Nm file by adding together the size of the .Sy ctf_header_t , @@ -380,9 +399,11 @@ and the size of the string section in .Ss Type Identifiers Through the .Nm ctf -data, types are referred to by identifiers. A given +data, types are referred to by identifiers. +A given .Nm -file supports up to 32767 (0x7fff) types. The first valid type identifier is 0x1. +file supports up to 32767 (0x7fff) types. +The first valid type identifier is 0x1. When a given .Nm file is a child, indicated by a non-zero entry for the @@ -403,18 +424,20 @@ Other consumers of information may use larger or opaque identifiers. .Ss String Identifiers String identifiers are always encoded as four byte unsigned integers -which are an offset into a string table. The +which are an offset into a string table. +The .Nm format supports two different string tables which have an identifier of -zero or one. This identifier is stored in the high-order bit of the -unsigned four byte offset. Therefore, the maximum supported offset into -one of these tables is 0x7ffffffff. +zero or one. +This identifier is stored in the high-order bit of the unsigned four byte +offset. +Therefore, the maximum supported offset into one of these tables is 0x7ffffffff. .Lp Table identifier zero, always refers to the .Sy string -section in the CTF file itself. String table identifier one refers to an -external string table which is the ELF string table for the ELF symbol -table associated with the +section in the CTF file itself. +String table identifier one refers to an external string table which is the ELF +string table for the ELF symbol table associated with the .Nm container. .Ss Type Encoding @@ -434,8 +457,8 @@ The length of the variable data .Lp The 16 bits that make up the encoding are broken down such that you have five bits for the kind, one bit for indicating whether or not it is a -root type, and 10 bits for the variable length. This is laid out as -follows: +root type, and 10 bits for the variable length. +This is laid out as follows: .Bd -literal -offset indent +--------------------+ | kind | root | vlen | @@ -443,12 +466,13 @@ follows: 15 11 10 9 0 .Ed .Lp -The current version of the file format defines 14 different kinds. The -interpretation of these different kinds will be discussed in the section +The current version of the file format defines 14 different kinds. +The interpretation of these different kinds will be discussed in the section .Sx The Type Section . If a kind is encountered that is not listed below, then it is not a valid .Nm -file. The kinds are defined as follows: +file. +The kinds are defined as follows: .Bd -literal -offset indent #define CTF_K_UNKNOWN 0 #define CTF_K_INTEGER 1 @@ -467,14 +491,16 @@ file. The kinds are defined as follows: .Ed .Lp Programs directly reference many types; however, other types are referenced -indirectly because they are part of some other structure. These types that are -referenced directly and used are called +indirectly because they are part of some other structure. +These types that are referenced directly and used are called .Sy root -types. Other types may be used indirectly, for example, a program may reference -a structure directly, but not one of its members which has a type. That type is -not considered a +types. +Other types may be used indirectly, for example, a program may reference +a structure directly, but not one of its members which has a type. +That type is not considered a .Sy root -type. If a type is a +type. +If a type is a .Sy root type, then it will have bit 10 set. .Lp @@ -499,16 +525,17 @@ When consuming .Nm data, it is often useful to know whether two different .Nm -containers come from the same source base and version. For example, when -building illumos, there are many kernel modules that are built against a -single collection of source code. A label is encoded into the +containers come from the same source base and version. +For example, when building illumos, there are many kernel modules that are built +against a single collection of source code. +A label is encoded into the .Nm -files that corresponds with the particular build. This ensures that if -files on the system were to become mixed up from multiple releases, that -they are not used together by tools, particularly when a child needs to -refer to a type in the parent. Because they are linked used the type -identifiers, if the wrong parent is used then the wrong type will be -encountered. +files that corresponds with the particular build. +This ensures that if files on the system were to become mixed up from multiple +releases, that they are not used together by tools, particularly when a child +needs to refer to a type in the parent. +Because they are linked used the type identifiers, if the wrong parent is used +then the wrong type will be encountered. .Lp Each label is encoded in the file format using the following eight byte structure: @@ -530,21 +557,22 @@ section. The type identifier encoded in the member .Em ctl_typeidx refers to the last type identifier that a label refers to in the current -file. Labels only refer to types in the current file, if the +file. +Labels only refer to types in the current file, if the .Nm file is a child, then it will have the same label as its parent; however, its label will only refer to its types, not its parents. .Lp It is also possible, though rather uncommon, for a .Nm -file to have multiple labels. Labels are placed one after another, every -eight bytes. When multiple labels are present, types may only belong to -a single label. +file to have multiple labels. +Labels are placed one after another, every eight bytes. +When multiple labels are present, types may only belong to a single label. .Ss The Object Section The object section provides a mapping from ELF symbols of type .Sy STT_OBJECT -in the symbol table to a type identifier. Every entry in this section is -a +in the symbol table to a type identifier. +Every entry in this section is a .Sy uint16_t which contains a type identifier as described in the section .Sx Type Identifiers . @@ -555,9 +583,10 @@ To walk the object section, you need to have a corresp .Sy symbol table in the ELF object that contains the .Nm -data. Not every object is included in this section. Specifically, when -walking the symbol table. An entry is skipped if it matches any of the -following conditions: +data. +Not every object is included in this section. +Specifically, when walking the symbol table. +An entry is skipped if it matches any of the following conditions: .Lp .Bl -bullet -offset indent -compact .It @@ -628,40 +657,45 @@ walk_symbols(uint16_t *objtoff, Elf_Data *symdata, Elf The function section of the .Nm file encodes the types of both the function's arguments and the function's -return type. Similar to +return type. +Similar to .Sx The Object Section , the function section encodes information for all symbols of type .Sy STT_FUNCTION , -excepting those that fit specific criteria. Unlike with objects, because -functions have a variable number of arguments, they start with a type encoding -as defined in +excepting those that fit specific criteria. +Unlike with objects, because functions have a variable number of arguments, they +start with a type encoding as defined in .Sx Type Encoding , which is the size of a .Sy uint16_t . For functions which have no type information available, they are encoded as .Li CTF_TYPE_INFO(CTF_K_UNKNOWN, 0, 0) . -Functions with arguments are encoded differently. Here, the variable length is -turned into the number of arguments in the function. If a function is a +Functions with arguments are encoded differently. +Here, the variable length is turned into the number of arguments in the +function. +If a function is a .Sy varargs -type function, then the number of arguments is increased by one. Functions with -type information are encoded as: +type function, then the number of arguments is increased by one. +Functions with type information are encoded as: .Li CTF_TYPE_INFO(CTF_K_FUNCTION, 0, nargs) . .Lp For functions that have no type information, nothing else is encoded, and the -next function is encoded. For functions with type information, the next +next function is encoded. +For functions with type information, the next .Sy uint16_t -is encoded with the type identifier of the return type of the function. It is -followed by each of the type identifiers of the arguments, if any exist, in the -order that they appear in the function. Therefore, argument 0 is the first type -identifier and so on. When a function has a final varargs argument, that is -encoded with the type identifier of zero. +is encoded with the type identifier of the return type of the function. +It is followed by each of the type identifiers of the arguments, if any exist, +in the order that they appear in the function. +Therefore, argument 0 is the first type identifier and so on. +When a function has a final varargs argument, that is encoded with the type +identifier of zero. .Lp Like .Sx The Object Section , -the function section is encoded in the order of the symbol table. It has -similar, but slightly different considerations from objects. While iterating the -symbol table, if any of the following conditions are true, then the entry is -skipped and no corresponding entry is written: +the function section is encoded in the order of the symbol table. +It has similar, but slightly different considerations from objects. +While iterating the symbol table, if any of the following conditions are true, +then the entry is skipped and no corresponding entry is written: .Lp .Bl -bullet -offset indent -compact .It @@ -683,10 +717,11 @@ ELF. .Ss The Type Section The type section is the heart of the .Nm -data. It encodes all of the information about the types themselves. The base of -the type information comes in two forms, a short form and a long form, each of -which may be followed by a variable number of arguments. The following -definitions describe the short and long forms: +data. +It encodes all of the information about the types themselves. +The base of the type information comes in two forms, a short form and a long +form, each of which may be followed by a variable number of arguments. +The following definitions describe the short and long forms: .Bd -literal #define CTF_MAX_SIZE 0xfffe /* max size of a type in bytes */ #define CTF_LSIZE_SENT 0xffff /* sentinel for ctt_size */ @@ -720,14 +755,17 @@ Type sizes are stored in .Sy bytes . The basic small form uses a .Sy ushort_t -to store the number of bytes. If the number of bytes in a structure would exceed -0xfffe, then the alternate form, the +to store the number of bytes. +If the number of bytes in a structure would exceed 0xfffe, then the alternate +form, the .Sy ctf_type_t , -is used instead. To indicate that the larger form is being used, the member +is used instead. +To indicate that the larger form is being used, the member .Em ctt_size is set to value of .Sy CTF_LSIZE_SENT -(0xffff). In general, when going through the type section, consumers use the +(0xffff). +In general, when going through the type section, consumers use the .Sy ctf_type_t structure, but pay attention to the value of the member .Em ctt_size @@ -739,17 +777,21 @@ Not all kinds of types use .Sy ctt_size . Those which do not, will always use the .Sy ctf_stype_t -structure. The individual sections for each kind have more information. +structure. +The individual sections for each kind have more information. .Lp -Types are written out in order. Therefore the first entry encountered has a type -id of 0x1, or 0x8000 if a child. The member +Types are written out in order. +Therefore the first entry encountered has a type id of 0x1, or 0x8000 if a +child. +The member .Em ctt_name is encoded as described in the section .Sx String Identifiers . -The string that it points to is the name of the type. If the identifier points -to an empty string (one that consists solely of a null terminator) then the type -does not have a name, this is common with anonymous structures and unions that -only have a typedef to name them, as well as, pointers and qualifiers. +The string that it points to is the name of the type. +If the identifier points to an empty string (one that consists solely of a null +terminator) then the type does not have a name, this is common with anonymous +structures and unions that only have a typedef to name them, as well as, +pointers and qualifiers. .Lp The next member, the .Em ctt_info , @@ -757,18 +799,21 @@ is encoded as described in the section .Sx Type Encoding . The types kind tells us how to interpret the remaining data in the .Sy ctf_type_t -and any variable length data that may exist. The rest of this section will be -broken down into the interpretation of the various kinds. +and any variable length data that may exist. +The rest of this section will be broken down into the interpretation of the +various kinds. .Ss Encoding of Integers Integers, which are of type .Sy CTF_K_INTEGER , -have no variable length arguments. Instead, they are followed by a four byte +have no variable length arguments. +Instead, they are followed by a four byte .Sy uint_t -which describes their encoding. All integers must be encoded with a variable -length of zero. The +which describes their encoding. +All integers must be encoded with a variable length of zero. +The .Em ctt_size -member describes the length of the integer in bytes. In general, integer sizes -will be rounded up to the closest power of two. +member describes the length of the integer in bytes. +In general, integer sizes will be rounded up to the closest power of two. .Lp The integer encoding contains three different pieces of information: .Bl -bullet -offset indent -compact @@ -804,33 +849,37 @@ The following flags are defined for the encoding at th .Lp By default, an integer is considered to be unsigned, unless it has the .Sy CTF_INT_SIGNED -flag set. If the flag +flag set. +If the flag .Sy CTF_INT_CHAR is set, that indicates that the integer is of a type that stores character data, for example the intrinsic C type .Sy char would have the .Sy CTF_INT_CHAR -flag set. If the flag +flag set. +If the flag .Sy CTF_INT_BOOL -is set, that indicates that the integer represents a boolean type. For example, -the intrinsic C type +is set, that indicates that the integer represents a boolean type. +For example, the intrinsic C type .Sy _Bool would have the .Sy CTF_INT_BOOL -flag set. Finally, the flag +flag set. +Finally, the flag .Sy CTF_INT_VARARGS indicates that the integer is used as part of a variable number of arguments. This encoding is rather uncommon. .Ss Encoding of Floats Floats, which are of type .Sy CTF_K_FLOAT , -are similar to their integer counterparts. They have no variable length -arguments and are followed by a four byte encoding which describes the kind of -float that exists. The +are similar to their integer counterparts. +They have no variable length arguments and are followed by a four byte encoding +which describes the kind of float that exists. +The .Em ctt_size -member is the size, in bytes, of the float. The float encoding has three -different pieces of information inside of it: +member is the size, in bytes, of the float. +The float encoding has three different pieces of information inside of it: .Lp .Bl -bullet -offset indent -compact .It @@ -856,10 +905,11 @@ This encoding can be expressed through the following m .Ed .Lp Where as the encoding for integers was a series of flags, the encoding for -floats maps to a specific kind of float. It is not a flag-based value. The kinds of floats -correspond to both their size, and the encoding. This covers all of the basic C -intrinsic floating point types. The following are the different kinds of floats -represented in the encoding: +floats maps to a specific kind of float. +It is not a flag-based value. +The kinds of floats correspond to both their size, and the encoding. +This covers all of the basic C intrinsic floating point types. +The following are the different kinds of floats represented in the encoding: .Bd -literal -offset indent #define CTF_FP_SINGLE 1 /* IEEE 32-bit float encoding */ #define CTF_FP_DOUBLE 2 /* IEEE 64-bit float encoding */ @@ -877,12 +927,14 @@ represented in the encoding: .Ss Encoding of Arrays Arrays, which are of type .Sy CTF_K_ARRAY , -have no variable length arguments. They are followed by a structure which -describes the number of elements in the array, the type identifier of the -elements in the array, and the type identifier of the index of the array. With -arrays, the +have no variable length arguments. +They are followed by a structure which describes the number of elements in the +array, the type identifier of the elements in the array, and the type identifier +of the index of the array. +With arrays, the .Em ctt_size -member is set to zero. The structure that follows an array is defined as: +member is set to zero. +The structure that follows an array is defined as: .Bd -literal typedef struct ctf_array { ushort_t cta_contents; /* reference to type of array contents */ @@ -901,14 +953,15 @@ are type identifiers which are encoded as per the sect .Sx Type Identifiers . The member .Em cta_nelems -is a simple four byte unsigned count of the number of elements. This count may -be zero when encountering C99's flexible array members. +is a simple four byte unsigned count of the number of elements. +This count may be zero when encountering C99's flexible array members. .Ss Encoding of Functions Function types, which are of type .Sy CTF_K_FUNCTION , -use the variable length list to be the number of arguments in the function. When -the function has a final member which is a varargs, then the argument count is -incremented by one to account for the variable argument. Here, the +use the variable length list to be the number of arguments in the function. +When the function has a final member which is a varargs, then the argument count +is incremented by one to account for the variable argument. +Here, the .Em ctt_type member is encoded with the type identifier of the return type of the function. Note that the @@ -916,31 +969,36 @@ Note that the member is not used here. .Lp The variable argument list contains the type identifiers for the arguments of -the function, if any. Each one is represented by a +the function, if any. +Each one is represented by a .Sy uint16_t and encoded according to the .Sx Type Identifiers -section. If the function's last argument is of type varargs, then it is also -written out, but the type identifier is zero. This is included in the count of -the function's arguments. +section. +If the function's last argument is of type varargs, then it is also written out, +but the type identifier is zero. +This is included in the count of the function's arguments. .Ss Encoding of Structures and Unions Structures and Unions, which are encoded with .Sy CTF_K_STRUCT and .Sy CTF_K_UNION -respectively, are very similar constructs in C. The main difference -between them is the fact that every member of a structure follows one another, -where as in a union, all members share the same memory. They are also very -similar in terms of their encoding in +respectively, are very similar constructs in C. +The main difference between them is the fact that every member of a structure +follows one another, where as in a union, all members share the same memory. +They are also very similar in terms of their encoding in .Nm . The variable length argument for structures and unions represents the number of -members that they have. The value of the member +members that they have. +The value of the member .Em ctt_size -is the size of the structure and union. There are two different structures which -are used to encode members in the variable list. When the size of a structure or -union is greater than or equal to the large member threshold, 8192, then a -different structure is used to encode the member, all members are encoded using -the same structure. The structure for members is as follows: +is the size of the structure and union. +There are two different structures which are used to encode members in the +variable list. +When the size of a structure or union is greater than or equal to the large +member threshold, 8192, then a different structure is used to encode the member, +all members are encoded using the same structure. +The structure for members is as follows: .Bd -literal typedef struct ctf_member { uint_t ctm_name; /* reference to name in string table */ @@ -961,44 +1019,52 @@ Both the .Em ctm_name and .Em ctlm_name -refer to the name of the member. The name is encoded as an offset into the -string table as described by the section +refer to the name of the member. +The name is encoded as an offset into the string table as described by the +section .Sx String Identifiers . The members .Sy ctm_type and .Sy ctlm_type -both refer to the type of the member. They are encoded as per the section +both refer to the type of the member. +They are encoded as per the section .Sx Type Identifiers . .Lp The last piece of information that is present is the offset which describes the -offset in memory that the member begins at. For unions, this value will always -be zero because the start of unions in memory is always zero. For structures, -this is the offset in +offset in memory that the member begins at. +For unions, this value will always be zero because the start of unions in memory +is always zero. +For structures, this is the offset in .Sy bits -that the member begins at. Note that a compiler may lay out a type with padding. +that the member begins at. +Note that a compiler may lay out a type with padding. This means that the difference in offset between two consecutive members may be -larger than the size of the member. When the size of the overall structure is -strictly less than 8192 bytes, the normal structure, +larger than the size of the member. +When the size of the overall structure is strictly less than 8192 bytes, the +normal structure, .Sy ctf_member_t , is used and the offset in bits is stored in the member .Em ctm_offset . However, when the size of the structure is greater than or equal to 8192 bytes, -then the number of bits is split into two 32-bit quantities. One member, +then the number of bits is split into two 32-bit quantities. +One member, .Em ctlm_offsethi , represents the upper 32 bits of the offset, while the other member, .Em ctlm_offsetlo , -represents the lower 32 bits of the offset. These can be joined together to get -a 64-bit sized offset in bits by shifting the member +represents the lower 32 bits of the offset. +These can be joined together to get a 64-bit sized offset in bits by shifting +the member .Em ctlm_offsethi to the left by thirty two and then doing a binary or of .Em ctlm_offsetlo . .Ss Encoding of Enumerations Enumerations, noted by the type .Sy CTF_K_ENUM , -are similar to structures. Enumerations use the variable list to note the number -of values that the enumeration contains, which we'll term enumerators. In C, an -enumeration is always equivalent to the intrinsic type +are similar to structures. +Enumerations use the variable list to note the number of values that the +enumeration contains, which we'll term enumerators. +In C, an enumeration is always equivalent to the intrinsic type .Sy int , thus the value of the member .Em ctt_size @@ -1032,25 +1098,27 @@ Forward references, types of kind .Sy CTF_K_FORWARD , in a .Nm -file refer to types which may not have a definition at all, only a name. If -the +file refer to types which may not have a definition at all, only a name. +If the .Nm file is a child, then it may be that the forward is resolved to an actual type in the parent, otherwise the definition may be in another .Nm -container or may not be known at all. The only member of the +container or may not be known at all. +The only member of the .Sy ctf_type_t that matters for a forward declaration is the .Em ctt_name which points to the name of the forward reference in the string table as -described earlier. There is no other information recorded for forward -references. +described earlier. +There is no other information recorded for forward references. .Ss Encoding of Pointers, Typedefs, Volatile, Const, and Restrict Pointers, typedefs, volatile, const, and restrict are all similar in .Nm . -They all refer to another type. In the case of typedefs, they provide an -alternate name, while volatile, const, and restrict change how the type is -interpreted in the C programming language. This covers the +They all refer to another type. +In the case of typedefs, they provide an alternate name, while volatile, const, +and restrict change how the type is interpreted in the C programming language. +This covers the .Nm kinds .Sy CTF_K_POINTER , @@ -1066,43 +1134,49 @@ to refer to the base type that they modify. .Ss Encoding of Unknown Types Types with the kind .Sy CTF_K_UNKNOWN -are used to indicate gaps in the type identifier space. These entries consume an -identifier, but do not define anything. Nothing should refer to these gap -identifiers. +are used to indicate gaps in the type identifier space. +These entries consume an identifier, but do not define anything. +Nothing should refer to these gap identifiers. .Ss Dependencies Between Types -C types can be imagined as a directed, cyclic, graph. Structures and unions may -refer to each other in a way that creates a cyclic dependency. In cases such as -these, the entire type section must be read in and processed. Consumers must -not assume that every type can be laid out in dependency order; they -cannot. +C types can be imagined as a directed, cyclic, graph. +Structures and unions may refer to each other in a way that creates a cyclic +dependency. +In cases such as these, the entire type section must be read in and processed. +Consumers must not assume that every type can be laid out in dependency order; +they cannot. .Ss The String Section The last section of the .Nm file is the .Sy string -section. This section encodes all of the strings that appear throughout -the other sections. It is laid out as a series of characters followed by -a null terminator. Generally, all names are written out in ASCII, as -most C compilers do not allow and characters to appear in identifiers -outside of a subset of ASCII. However, any extended characters sets -should be written out as a series of UTF-8 bytes. +section. +This section encodes all of the strings that appear throughout the other +sections. +It is laid out as a series of characters followed by a null terminator. +Generally, all names are written out in ASCII, as most C compilers do not allow +and characters to appear in identifiers outside of a subset of ASCII. +However, any extended characters sets should be written out as a series of UTF-8 +bytes. .Lp The first entry in the section, at offset zero, is a single null -terminator to reference the empty string. Following that, each C string -should be written out, including the null terminator. Offsets that refer -to something in this section should refer to the first byte which begins -a string. Beyond the first byte in the section being the null -terminator, the order of strings is unimportant. -.Ss Data Encoding and ELF Considerations +terminator to reference the empty string. +Following that, each C string should be written out, including the null +terminator. +Offsets that refer to something in this section should refer to the first byte +which begins a string. +Beyond the first byte in the section being the null terminator, the order of +strings is unimportant. +.Sh Data Encoding and ELF Considerations .Nm data is generally included in ELF objects which specify information to -identify the architecture and endianness of the file. A +identify the architecture and endianness of the file. +A .Nm -container inside such an object must match the endianness of the ELF -object. Aside from the question of the endian encoding of data, there -should be no other differences between architectures. While many of the -types in this document refer to non-fixed size C integral types, they -are equivalent in the models +container inside such an object must match the endianness of the ELF object. +Aside from the question of the endian encoding of data, there should be no other +differences between architectures. +While many of the types in this document refer to non-fixed size C integral +types, they are equivalent in the models .Sy ILP32 and .Sy LP64 . @@ -1118,15 +1192,16 @@ When placing a container inside of an ELF object, there are certain conventions that are expected for the purposes of tooling being able to find the .Nm -data. In particular, a given ELF object should only contain a single +data. +In particular, a given ELF object should only contain a single .Nm -section. Multiple containers should be merged together into a single -one. +section. +Multiple containers should be merged together into a single one. .Lp The .Nm -file should be included in its own ELF section. The section's name -must be +file should be included in its own ELF section. +The section's name must be .Ql .SUNW_ctf . The type of the section must be .Sy SHT_PROGBITS . From owner-svn-src-head@freebsd.org Sun Oct 22 19:17:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 845B7E312FB; Sun, 22 Oct 2017 19:17: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 mx1.freebsd.org (Postfix) with ESMTPS id 5E93571AE8; Sun, 22 Oct 2017 19:17: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 v9MJHPL7014214; Sun, 22 Oct 2017 19:17:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MJHP1P014213; Sun, 22 Oct 2017 19:17:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710221917.v9MJHP1P014213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 22 Oct 2017 19:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324865 - head/cddl/contrib/opensolaris/lib/libctf/common X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libctf/common X-SVN-Commit-Revision: 324865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 19:17:26 -0000 Author: markj Date: Sun Oct 22 19:17:25 2017 New Revision: 324865 URL: https://svnweb.freebsd.org/changeset/base/324865 Log: Address some miscellaneous issues in the CTF man page. - Fix a number of typos. - Replace some illumos-specific references. - Note that a type definition of kind CTF_K_FUNCTION may be followed by a null type identifier in order to provide 4-byte alignment for the next type definition. MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 ============================================================================== --- head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Sun Oct 22 18:32:28 2017 (r324864) +++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf.5 Sun Oct 22 19:17:25 2017 (r324865) @@ -52,17 +52,15 @@ file itself, it may also be referred to as a .Nm .Sy container . .Lp -On illumos systems, +On +.Fx +systems, .Nm -data is consumed by multiple programs. -It can be used by the modular debugger, -.Xr mdb 1 , -as well as by +data is consumed by .Xr dtrace 1 . Programmatic access to .Nm -data can be obtained through -.Xr libctf 3LIB . +data can be obtained through libctf. .Lp The .Nm @@ -73,7 +71,7 @@ and .Sy header , which describes the version of the .Nm -file, links it has to other +file, the links it has to other .Nm files, and the sizes of the other sections. The next section is the @@ -84,7 +82,7 @@ which provides a way of identifying similar groups of data across multiple files. This is followed by the .Sy object -information section, which describes the type of global +information section, which describes the types of global symbols. The subsequent section is the .Sy function @@ -137,7 +135,9 @@ This documents version of the .Nm file format. -All applications and tools currently produce and operate on this version. +All applications and tools on +.Fx +currently produce and operate on this version. .Lp The file format can be summarized with the following image, the following sections will cover this in more detail. @@ -300,13 +300,13 @@ In version two of the .Nm file format, the .Sy header -denotes whether whether or not this +denotes whether or not this .Nm file is the child of another .Nm file and also indicates the size of the remaining sections. The structure for the -.Sy header , +.Sy header logically contains a copy of the .Sy preamble and the two have a combined size of 36 bytes. @@ -534,7 +534,7 @@ files that corresponds with the particular build. This ensures that if files on the system were to become mixed up from multiple releases, that they are not used together by tools, particularly when a child needs to refer to a type in the parent. -Because they are linked used the type identifiers, if the wrong parent is used +Because they are linked using the type identifiers, if the wrong parent is used then the wrong type will be encountered. .Lp Each label is encoded in the file format using the following eight byte @@ -561,7 +561,7 @@ file. Labels only refer to types in the current file, if the .Nm file is a child, then it will have the same label as its parent; -however, its label will only refer to its types, not its parents. +however, its label will only refer to its types, not its parent's. .Lp It is also possible, though rather uncommon, for a .Nm @@ -585,8 +585,8 @@ in the ELF object that contains the .Nm data. Not every object is included in this section. -Specifically, when walking the symbol table. -An entry is skipped if it matches any of the following conditions: +Specifically, when walking the symbol table, an entry is skipped if it matches +any of the following conditions: .Lp .Bl -bullet -offset indent -compact .It @@ -657,7 +657,7 @@ walk_symbols(uint16_t *objtoff, Elf_Data *symdata, Elf The function section of the .Nm file encodes the types of both the function's arguments and the function's -return type. +return value. Similar to .Sx The Object Section , the function section encodes information for all symbols of type @@ -790,14 +790,14 @@ is encoded as described in the section The string that it points to is the name of the type. If the identifier points to an empty string (one that consists solely of a null terminator) then the type does not have a name, this is common with anonymous -structures and unions that only have a typedef to name them, as well as, +structures and unions that only have a typedef to name them, as well as pointers and qualifiers. .Lp The next member, the .Em ctt_info , is encoded as described in the section .Sx Type Encoding . -The types kind tells us how to interpret the remaining data in the +The type's kind tells us how to interpret the remaining data in the .Sy ctf_type_t and any variable length data that may exist. The rest of this section will be broken down into the interpretation of the @@ -904,7 +904,7 @@ This encoding can be expressed through the following m (((encoding) << 24) | ((offset) << 16) | (bits)) .Ed .Lp -Where as the encoding for integers was a series of flags, the encoding for +Where as the encoding for integers is a series of flags, the encoding for floats maps to a specific kind of float. It is not a flag-based value. The kinds of floats correspond to both their size, and the encoding. @@ -978,14 +978,18 @@ section. If the function's last argument is of type varargs, then it is also written out, but the type identifier is zero. This is included in the count of the function's arguments. +An extra type identifier may follow the argument and return type identifiers +in order to maintain four-byte alignment for the following type definition. +Such a type identifier is not included in the argument count and has a value +of zero. .Ss Encoding of Structures and Unions Structures and Unions, which are encoded with .Sy CTF_K_STRUCT and .Sy CTF_K_UNION respectively, are very similar constructs in C. -The main difference between them is the fact that every member of a structure -follows one another, where as in a union, all members share the same memory. +The main difference between them is the fact that members of a structure +follow one another, where as in a union, all members share the same memory. They are also very similar in terms of their encoding in .Nm . The variable length argument for structures and unions represents the number of @@ -1032,12 +1036,12 @@ They are encoded as per the section .Sx Type Identifiers . .Lp The last piece of information that is present is the offset which describes the -offset in memory that the member begins at. -For unions, this value will always be zero because the start of unions in memory -is always zero. +offset in memory at which the member begins. +For unions, this value will always be zero because each member of a union has +an offset of zero. For structures, this is the offset in .Sy bits -that the member begins at. +at which the member begins. Note that a compiler may lay out a type with padding. This means that the difference in offset between two consecutive members may be larger than the size of the member. @@ -1069,12 +1073,16 @@ In C, an enumeration is always equivalent to the intri thus the value of the member .Em ctt_size is always the size of an integer which is determined based on the current model. -For illumos systems, this will always be 4, as an integer is always defined to +For +.Fx +systems, this will always be 4, as an integer is always defined to be 4 bytes large in both .Sy ILP32 and .Sy LP64 , regardless of the architecture. +For further details, see +.Xr arch 7 . .Lp The enumerators encoded in an enumeration have the following structure in the variable list: @@ -1154,7 +1162,7 @@ This section encodes all of the strings that appear th sections. It is laid out as a series of characters followed by a null terminator. Generally, all names are written out in ASCII, as most C compilers do not allow -and characters to appear in identifiers outside of a subset of ASCII. +any characters to appear in identifiers outside of a subset of ASCII. However, any extended characters sets should be written out as a series of UTF-8 bytes. .Lp @@ -1166,7 +1174,7 @@ Offsets that refer to something in this section should which begins a string. Beyond the first byte in the section being the null terminator, the order of strings is unimportant. -.Sh Data Encoding and ELF Considerations +.Ss Data Encoding and ELF Considerations .Nm data is generally included in ELF objects which specify information to identify the architecture and endianness of the file. @@ -1212,4 +1220,5 @@ alignment must be 4. .Xr elf 3 , .Xr gelf 3 , .Xr a.out 5 , -.Xr elf 5 +.Xr elf 5 , +.Xr arch 7 From owner-svn-src-head@freebsd.org Sun Oct 22 20:01:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D4A4E338A3; Sun, 22 Oct 2017 20:01:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF6E472DBB; Sun, 22 Oct 2017 20:01:08 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9MK18Pj034158; Sun, 22 Oct 2017 20:01:08 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MK18am034157; Sun, 22 Oct 2017 20:01:08 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201710222001.v9MK18am034157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 22 Oct 2017 20:01:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324866 - head/include X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/include X-SVN-Commit-Revision: 324866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 20:01:09 -0000 Author: jilles Date: Sun Oct 22 20:01:07 2017 New Revision: 324866 URL: https://svnweb.freebsd.org/changeset/base/324866 Log: libc: Do not refer to _DefaultRuneLocale in ctype inlines Referring to _DefaultRuneLocale causes this >4KB structure to be copied to all executables that use inlines (except PIE executables). This only affects the case where thread local storage is available. _CurrentRuneLocale cannot be NULL, so the check can be removed entirely. _DefaultRuneLocale needs to remain available for now since libc++ uses it. The __isctype inline in include/_ctype.h also refers to _DefaultRuneLocale and remains available because it may still be used by third party software. Reviewed by: bdrewery, theraven Differential Revision: https://reviews.freebsd.org/D10363 Modified: head/include/runetype.h Modified: head/include/runetype.h ============================================================================== --- head/include/runetype.h Sun Oct 22 19:17:25 2017 (r324865) +++ head/include/runetype.h Sun Oct 22 20:01:07 2017 (r324866) @@ -95,9 +95,7 @@ static __inline const _RuneLocale *__getCurrentRuneLoc if (_ThreadRuneLocale) return _ThreadRuneLocale; - if (_CurrentRuneLocale) - return _CurrentRuneLocale; - return &_DefaultRuneLocale; + return _CurrentRuneLocale; } #endif /* __NO_TLS || __RUNETYPE_INTERNAL */ #define _CurrentRuneLocale (__getCurrentRuneLocale()) From owner-svn-src-head@freebsd.org Sun Oct 22 20:14:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60E66E33DA4; Sun, 22 Oct 2017 20:14:49 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2973573471; Sun, 22 Oct 2017 20:14:49 +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 v9MKEmcJ039124; Sun, 22 Oct 2017 20:14:48 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MKEmom039123; Sun, 22 Oct 2017 20:14:48 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201710222014.v9MKEmom039123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 22 Oct 2017 20:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324867 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 324867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 20:14:49 -0000 Author: mjg Date: Sun Oct 22 20:14:48 2017 New Revision: 324867 URL: https://svnweb.freebsd.org/changeset/base/324867 Log: sdt: whack unused SDT_PROBE_ENABLED Modified: head/sys/sys/sdt.h Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Sun Oct 22 20:01:07 2017 (r324866) +++ head/sys/sys/sdt.h Sun Oct 22 20:14:48 2017 (r324867) @@ -86,7 +86,6 @@ #define SDT_PROVIDER_DECLARE(prov) #define SDT_PROBE_DEFINE(prov, mod, func, name) #define SDT_PROBE_DECLARE(prov, mod, func, name) -#define SDT_PROBE_ENABLED(prov, mod, func, name) 0 #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) @@ -160,9 +159,6 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); #define SDT_PROBE_DECLARE(prov, mod, func, name) \ extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] - -#define SDT_PROBE_ENABLED(prov, mod, func, name) \ - __predict_false((sdt_##prov##_##mod##_##func##_##name->id)) #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \ if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ From owner-svn-src-head@freebsd.org Sun Oct 22 20:22:12 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEE21E33FC8; Sun, 22 Oct 2017 20:22:12 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7844173809; Sun, 22 Oct 2017 20:22:12 +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 v9MKMBsb043021; Sun, 22 Oct 2017 20:22:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MKMBkb043020; Sun, 22 Oct 2017 20:22:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710222022.v9MKMBkb043020@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 22 Oct 2017 20:22:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324868 - head/sys/fs/pseudofs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/fs/pseudofs X-SVN-Commit-Revision: 324868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 20:22:12 -0000 Author: markj Date: Sun Oct 22 20:22:11 2017 New Revision: 324868 URL: https://svnweb.freebsd.org/changeset/base/324868 Log: Delete declarations of struct pfs_bitmap, removed in r143841. MFC after: 1 week Modified: head/sys/fs/pseudofs/pseudofs.h Modified: head/sys/fs/pseudofs/pseudofs.h ============================================================================== --- head/sys/fs/pseudofs/pseudofs.h Sun Oct 22 20:14:48 2017 (r324867) +++ head/sys/fs/pseudofs/pseudofs.h Sun Oct 22 20:22:11 2017 (r324868) @@ -81,7 +81,6 @@ typedef enum { */ struct pfs_info; struct pfs_node; -struct pfs_bitmap; /* * Init / uninit callback @@ -120,8 +119,6 @@ struct vattr; #define PFS_ATTR_PROTO(name) \ int name(PFS_ATTR_ARGS); typedef int (*pfs_attr_t)(PFS_ATTR_ARGS); - -struct pfs_bitmap; /* opaque */ /* * Visibility callback From owner-svn-src-head@freebsd.org Sun Oct 22 20:22:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 50241E34018; Sun, 22 Oct 2017 20:22:25 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BA8F73919; Sun, 22 Oct 2017 20:22:25 +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 v9MKMO3W043076; Sun, 22 Oct 2017 20:22:24 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MKMOjX043073; Sun, 22 Oct 2017 20:22:24 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201710222022.v9MKMOjX043073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 22 Oct 2017 20:22:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324869 - in head/sys: cddl/dev/sdt kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: cddl/dev/sdt kern sys X-SVN-Commit-Revision: 324869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 20:22:25 -0000 Author: mjg Date: Sun Oct 22 20:22:23 2017 New Revision: 324869 URL: https://svnweb.freebsd.org/changeset/base/324869 Log: sdt: make all sdt probe sites test one variable This saves on cache misses at the expense of a slight grow of .text. Note this is a bandaid for lack of hotpatching. Discussed with: markj Modified: head/sys/cddl/dev/sdt/sdt.c head/sys/kern/kern_sdt.c head/sys/sys/sdt.h Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Sun Oct 22 20:22:11 2017 (r324868) +++ head/sys/cddl/dev/sdt/sdt.c Sun Oct 22 20:22:23 2017 (r324869) @@ -76,6 +76,8 @@ static void sdt_kld_unload_try(void *, struct linker_f static MALLOC_DEFINE(M_SDT, "SDT", "DTrace SDT providers"); +static int sdt_probes_enabled_count; + static dtrace_pattr_t sdt_attr = { { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, @@ -208,6 +210,9 @@ sdt_enable(void *arg __unused, dtrace_id_t id, void *p probe->sdtp_lf->nenabled++; if (strcmp(probe->prov->name, "lockstat") == 0) lockstat_enabled++; + sdt_probes_enabled_count++; + if (sdt_probes_enabled_count == 1) + sdt_probes_enabled = true; } static void @@ -217,6 +222,9 @@ sdt_disable(void *arg __unused, dtrace_id_t id, void * KASSERT(probe->sdtp_lf->nenabled > 0, ("no probes enabled")); + sdt_probes_enabled_count--; + if (sdt_probes_enabled_count == 0) + sdt_probes_enabled = false; if (strcmp(probe->prov->name, "lockstat") == 0) lockstat_enabled--; probe->id = 0; Modified: head/sys/kern/kern_sdt.c ============================================================================== --- head/sys/kern/kern_sdt.c Sun Oct 22 20:22:11 2017 (r324868) +++ head/sys/kern/kern_sdt.c Sun Oct 22 20:22:23 2017 (r324869) @@ -37,6 +37,7 @@ SDT_PROVIDER_DEFINE(sdt); * dtrace_probe() when it loads. */ sdt_probe_func_t sdt_probe_func = sdt_probe_stub; +volatile bool __read_frequently sdt_probes_enabled; /* * This is a stub for probe calls in case kernel DTrace support isn't Modified: head/sys/sys/sdt.h ============================================================================== --- head/sys/sys/sdt.h Sun Oct 22 20:22:11 2017 (r324868) +++ head/sys/sys/sdt.h Sun Oct 22 20:22:23 2017 (r324869) @@ -80,6 +80,8 @@ #include #include +extern volatile bool sdt_probes_enabled; + #ifndef KDTRACE_HOOKS #define SDT_PROVIDER_DEFINE(prov) @@ -161,10 +163,12 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) do { \ - if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ + if (__predict_false(sdt_probes_enabled)) { \ + if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id)) \ (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id, \ (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2, \ (uintptr_t) arg3, (uintptr_t) arg4); \ + } \ } while (0) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype) \ From owner-svn-src-head@freebsd.org Sun Oct 22 20:43:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95146E34855; Sun, 22 Oct 2017 20:43:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 61DEB7421E; Sun, 22 Oct 2017 20:43:51 +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 v9MKhoBr051511; Sun, 22 Oct 2017 20:43:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MKho8t051509; Sun, 22 Oct 2017 20:43:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201710222043.v9MKho8t051509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 22 Oct 2017 20:43:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324870 - in head/sys: amd64/include kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: amd64/include kern X-SVN-Commit-Revision: 324870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 20:43:51 -0000 Author: mjg Date: Sun Oct 22 20:43:50 2017 New Revision: 324870 URL: https://svnweb.freebsd.org/changeset/base/324870 Log: Make the sleepq chain hash size configurable per-arch and bump on amd64. While here cache-align chains. This shortens longest found chain during poudriere -j 80 from 32 to 16. Pushing this higher up will probably require allocation on boot. Modified: head/sys/amd64/include/param.h head/sys/kern/subr_sleepqueue.c Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Sun Oct 22 20:22:23 2017 (r324869) +++ head/sys/amd64/include/param.h Sun Oct 22 20:43:50 2017 (r324870) @@ -152,4 +152,8 @@ #define INKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < DMAP_MAX_ADDRESS) \ || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS)) +#ifdef SMP +#define SC_TABLESIZE 1024 /* Must be power of 2. */ +#endif + #endif /* !_AMD64_INCLUDE_PARAM_H_ */ Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Sun Oct 22 20:22:23 2017 (r324869) +++ head/sys/kern/subr_sleepqueue.c Sun Oct 22 20:43:50 2017 (r324870) @@ -93,7 +93,10 @@ __FBSDID("$FreeBSD$"); * Constants for the hash table of sleep queue chains. * SC_TABLESIZE must be a power of two for SC_MASK to work properly. */ -#define SC_TABLESIZE 256 /* Must be power of 2. */ +#ifndef SC_TABLESIZE +#define SC_TABLESIZE 256 +#endif +CTASSERT(powerof2(SC_TABLESIZE)); #define SC_MASK (SC_TABLESIZE - 1) #define SC_SHIFT 8 #define SC_HASH(wc) ((((uintptr_t)(wc) >> SC_SHIFT) ^ (uintptr_t)(wc)) & \ @@ -137,7 +140,7 @@ struct sleepqueue_chain { u_int sc_depth; /* Length of sc_queues. */ u_int sc_max_depth; /* Max length of sc_queues. */ #endif -}; +} __aligned(CACHE_LINE_SIZE); #ifdef SLEEPQUEUE_PROFILING u_int sleepq_max_depth; From owner-svn-src-head@freebsd.org Sun Oct 22 21:25:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F4A0E3666B; Sun, 22 Oct 2017 21:25:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf0-x22f.google.com (mail-pf0-x22f.google.com [IPv6:2607:f8b0:400e:c00::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 45D45754C4; Sun, 22 Oct 2017 21:25:09 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf0-x22f.google.com with SMTP id n14so15631633pfh.8; Sun, 22 Oct 2017 14:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=DHybFLCm2xu8fXLEZ0XJ8NzsYwL96bkBU2cq/ZEAy/g=; b=qnMBTqN67rgKHVH1EKPNlD5wk1WsV8nvwbNMpymxSQbXYpXAFl9+of8NWzzMsq2Q79 o0mPH8ecJMg0j5o9YaxdVh/oame7TxLWyarRmZ+NhZJMMIHLoEAsqT9Uj5EC3K7mspIx oqMqHgXsDDUFE0fpFKQe3Ne2gPt1gJ/8DAA52B7bppFbWbsI2u6VwTEjNT7+hVKHzlGw GFuOD2D2CTVlNKruN03M9JOb03GMVoaqAoJxaUMmWN4Ch8f6n+Oe9GB+OuD5Cpw8uQOS yV2tG9ArlPXBP2RUGZBJtt6Bf4K0BLQw7tjsFWb8A7IiQVL9iGAnYUB4umOhQI16SkoG 4HgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=DHybFLCm2xu8fXLEZ0XJ8NzsYwL96bkBU2cq/ZEAy/g=; b=LfVuN0spfD5qP+tHxZLIHyn0Ti3Nw8soA8enRN3y7PqoJ8TbzUazFKjaaq0QzX03Dy uadDgskeKgyDaaMmd0hnfUG5nE5kagwDO5A5IIojNKLup4EoFWvCmQG5qL6q/WLDASiC Ri9WTgSS9co6iYvtVKnGGraPyT7qwrjNUnzzygl/dccIabVEnTlQXmnsr8Lc5UjOTbib ycFfd8x/Gv8RdkIocwoMuQERQi+4Ma/jWq05P0iZCSaXKdvcwG78oLRLWoor0gKlUk1n wJ5fC1ibmIm0uw5OIk+8I8L2BNt6DP119t4M2ihvzDrLhV49Od9vRsk+4Qxbv50oCiVP HUTQ== X-Gm-Message-State: AMCzsaWpumgnF8QkblAh3EnS4vwYpv4RrF1Gxduko2rXFH8jpOu0VF3b /SeNGD009WjH/QjEhQ29tAO/c5ld X-Google-Smtp-Source: ABhQp+QhDYEpJi8Pd+rSgrvw93Dvhkt26U9QrzvzOK3KZpqfbjLH6KV9+quQAyam7CwP3A3VeAzyPg== X-Received: by 10.99.103.5 with SMTP id b5mr10223331pgc.447.1508707508477; Sun, 22 Oct 2017 14:25:08 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id m9sm9831071pff.26.2017.10.22.14.25.07 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Oct 2017 14:25:07 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_38E0815C-E3EA-41CA-A8ED-EC764AC872AF"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r324863 - in head/sys: kern sys From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201710221342.v9MDguCC074682@repo.freebsd.org> Date: Sun, 22 Oct 2017 14:25:06 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201710221342.v9MDguCC074682@repo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 21:25:09 -0000 --Apple-Mail=_38E0815C-E3EA-41CA-A8ED-EC764AC872AF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 22, 2017, at 06:42, Mateusz Guzik wrote: >=20 > Author: mjg > Date: Sun Oct 22 13:42:56 2017 > New Revision: 324863 > URL: https://svnweb.freebsd.org/changeset/base/324863 >=20 > Log: > Change kdb_active type to u_char. >=20 > Fixes warnings from gcc and keeps the small size. Perhaps nesting = should be moved > to another variablle. >=20 > Reported by: ngie Thank you for fixing this. Question though =E2=80=94 since u_char is unsigned, are you concerned = about underflow (-1 -> 255)? Thanks, -Ngie --Apple-Mail=_38E0815C-E3EA-41CA-A8ED-EC764AC872AF Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE5bk3FaGcY5rvqmb79YOpJmkwhhUFAlntDLIACgkQ9YOpJmkw hhWQHQ//SaqVgAL+4datEC4WmgFdOREMKjaidmaCSei2Z3F18Q+1c3cPIaFHUR5O zGwVZmSurENmGucSPUxxJ6uYmX1ZiB13A2bSoGD7Mn3mQpFUlAr51mSANHyS5SLE VOstG91ZfmsB2htAlJN9UuH3TRTREYfblyFIxXYye654gNFGK/7CgpCIvMP3abvr wcAXMsJbMJxMdxpVWe82ReaQpdAlB489SiWJeVRoGNcGtpE9aAvi1xAh8nVl296X 79MMmzBNU5rr7KQV1I2XA74ZqRCbw0tcoAbXdCFOFwS52UYrQip9LCApitw2WHqJ sT4KU7/MAonKZOmiFdZGLK9PMSY8wF8ULyis0vpCAEXz7GS+3micHpFIsf0B6SbJ aHi1iIv9IJa2KrBIzCup1ORrfbqcAFSslaqmgD/xp8PE1Bis6cm2jnTe078OFjzG 5N8eZfzdJhKI9n7dFt6iV8a8vK/qzJRor4FT5hCyfM7wG0O15ASqILIVWwov2q52 iRKVG0CyRA2NnqUszTP/PzsRffrwPPanTq2PUS0qeH3lzBYQ3W9+cKHOKtX3Avj3 KmwPSAtIwwf85Jz4zOu/PFLN0PwVaLdyaeZX1hL7rdwrdurBAbkQgAK216Q01Q6S BVcUyzk6hBNAarSIdEnxA7iUx0Aeb7ahJly4yykvLJxcH2sVLuY= =XENp -----END PGP SIGNATURE----- --Apple-Mail=_38E0815C-E3EA-41CA-A8ED-EC764AC872AF-- From owner-svn-src-head@freebsd.org Sun Oct 22 22:49:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30E0EE38AD3; Sun, 22 Oct 2017 22:49:53 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0B3BA7C44D; Sun, 22 Oct 2017 22:49:52 +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 v9MMnqOn001515; Sun, 22 Oct 2017 22:49:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMnpEG001510; Sun, 22 Oct 2017 22:49:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222249.v9MMnpEG001510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:49:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324876 - in head/sys/boot: . arm/uboot mips/uboot powerpc/uboot uboot/common X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot: . arm/uboot mips/uboot powerpc/uboot uboot/common X-SVN-Commit-Revision: 324876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:49:53 -0000 Author: imp Date: Sun Oct 22 22:49:51 2017 New Revision: 324876 URL: https://svnweb.freebsd.org/changeset/base/324876 Log: Move fdt and uboot defines into common uboot.mk. Sponsored by: Netflix Added: head/sys/boot/uboot.mk (contents, props changed) Deleted: head/sys/boot/uboot/common/Makefile.inc Modified: head/sys/boot/arm/uboot/Makefile head/sys/boot/defs.mk head/sys/boot/mips/uboot/Makefile head/sys/boot/powerpc/uboot/Makefile Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Sun Oct 22 22:05:37 2017 (r324875) +++ head/sys/boot/arm/uboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) @@ -30,14 +30,6 @@ LOADER_GZIP_SUPPORT?= no LOADER_BZIP2_SUPPORT?= no LOADER_FDT_SUPPORT= ${MK_FDT} -.if ${LOADER_FDT_SUPPORT} == "yes" -CFLAGS+= -I${.CURDIR}/../../fdt -CFLAGS+= -I${.OBJDIR}/../../fdt -CFLAGS+= -DLOADER_FDT_SUPPORT -LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a -LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a -.endif - # Always add MI sources .include "../../loader.mk" CFLAGS+= -I. @@ -50,19 +42,9 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MA LDFLAGS+= -Wl,-znotext # Pull in common loader code -.PATH: ${.CURDIR}/../../uboot/common -.include "${.CURDIR}/../../uboot/common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../uboot/common +.include "../../uboot.mk" -# U-Boot standalone support library -LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a -CFLAGS+= -I${.CURDIR}/../../uboot/lib -CFLAGS+= -I${.OBJDIR}/../../uboot/lib - CFLAGS+= -fPIC - -# clang doesn't understand %D as a specifier to printf -NO_WERROR.clang= DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} Modified: head/sys/boot/defs.mk ============================================================================== --- head/sys/boot/defs.mk Sun Oct 22 22:05:37 2017 (r324875) +++ head/sys/boot/defs.mk Sun Oct 22 22:49:51 2017 (r324876) @@ -10,6 +10,8 @@ FICLDIR= ${BOOTDIR}/ficl LDR_MI= ${BOOTDIR}/common SASRC= ${BOOTDIR}/libsa SYSDIR= ${SRCTOP}/sys +FDTSRC= ${BOOTDIR}/fdt +UBOOTSRC= ${BOOTDIR}/uboot BOOTOBJ= ${OBJTOP}/sys/boot Modified: head/sys/boot/mips/uboot/Makefile ============================================================================== --- head/sys/boot/mips/uboot/Makefile Sun Oct 22 22:05:37 2017 (r324875) +++ head/sys/boot/mips/uboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) @@ -26,14 +26,6 @@ LOADER_GZIP_SUPPORT?= no LOADER_BZIP2_SUPPORT?= no LOADER_FDT_SUPPORT= ${MK_FDT} -.if ${LOADER_FDT_SUPPORT} == "yes" -CFLAGS+= -I${.CURDIR}/../../fdt -CFLAGS+= -I${.OBJDIR}/../../fdt -CFLAGS+= -DLOADER_FDT_SUPPORT -LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a -LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a -.endif - # Always add MI sources .include "../../loader.mk" CFLAGS+= -I. @@ -44,19 +36,7 @@ CFLAGS+= -ffreestanding -msoft-float -g LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} -# Pull in common loader code -.PATH: ${.CURDIR}/../../uboot/common -.include "${.CURDIR}/../../uboot/common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../uboot/common - -# U-Boot standalone support library -LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a -CFLAGS+= -I${.CURDIR}/../../uboot/lib -CFLAGS+= -I${.OBJDIR}/../../uboot/lib - -# clang doesn't understand %D as a specifier to printf -#NO_WERROR.clang= -#NO_WERROR= +.include "../../uboot.mk" DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA} Modified: head/sys/boot/powerpc/uboot/Makefile ============================================================================== --- head/sys/boot/powerpc/uboot/Makefile Sun Oct 22 22:05:37 2017 (r324875) +++ head/sys/boot/powerpc/uboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) @@ -22,14 +22,6 @@ LOADER_GZIP_SUPPORT?= no LOADER_BZIP2_SUPPORT?= no LOADER_FDT_SUPPORT= ${MK_FDT} -.if ${LOADER_FDT_SUPPORT} == "yes" -CFLAGS+= -I${.CURDIR}/../../fdt -CFLAGS+= -I${.OBJDIR}/../../fdt -CFLAGS+= -DLOADER_FDT_SUPPORT -LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a -LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a -.endif - # Always add MI sources .include "../../loader.mk" .PATH: ${.CURDIR}/../../../libkern @@ -42,15 +34,7 @@ CFLAGS+= -ffreestanding LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc -# Pull in common loader code -.PATH: ${.CURDIR}/../../uboot/common -.include "${.CURDIR}/../../uboot/common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../uboot/common - -# U-Boot standalone support library -LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a -CFLAGS+= -I${.CURDIR}/../../uboot/lib -CFLAGS+= -I${.OBJDIR}/../../uboot/lib +.include "../../uboot.mk" DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA32} Added: head/sys/boot/uboot.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/uboot.mk Sun Oct 22 22:49:51 2017 (r324876) @@ -0,0 +1,20 @@ +# $FreeBSD$ + +SRCS+= main.c metadata.c + +.PATH: ${UBOOTSRC}/common + +CFLAGS+= -I${UBOOTSRC}/common + +# U-Boot standalone support library +LIBUBOOT= ${BOOTOBJ}/uboot/lib/libuboot.a +CFLAGS+= -I${UBOOTSRC}/lib +CFLAGS+= -I${BOOTOBJ}/uboot/lib + +.if ${LOADER_FDT_SUPPORT} == "yes" +CFLAGS+= -I${FDTSRC} +CFLAGS+= -I${BOOTOBJ}/fdt +CFLAGS+= -DLOADER_FDT_SUPPORT +LIBUBOOT_FDT= ${BOOTOBJ}/uboot/fdt/libuboot_fdt.a +LIBFDT= ${BOOTOBJ}/fdt/libfdt.a +.endif From owner-svn-src-head@freebsd.org Sun Oct 22 22:50:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0C9CE38B36; Sun, 22 Oct 2017 22:50: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 mx1.freebsd.org (Postfix) with ESMTPS id 88A177C566; Sun, 22 Oct 2017 22:50: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 v9MMoAQd001614; Sun, 22 Oct 2017 22:50:10 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMo8gJ001598; Sun, 22 Oct 2017 22:50:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222250.v9MMo8gJ001598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324877 - in head/sys/boot: . arm/uboot ficl i386/gptboot i386/gptzfsboot i386/libi386 i386/loader mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc6... X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot: . arm/uboot ficl i386/gptboot i386/gptzfsboot i386/libi386 i386/loader mips/beri/loader mips/uboot powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc64/loader X-SVN-Commit-Revision: 324877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:50:11 -0000 Author: imp Date: Sun Oct 22 22:50:08 2017 New Revision: 324877 URL: https://svnweb.freebsd.org/changeset/base/324877 Log: End source directories with SRC rather than a hodgepodge of names BOOTDIR->BOOTSRC FICLDIR->FICLSRC LDR_MI->LDRSRC This matches the patterns used in the rest of the system a bit vetter. Suggested by: rgrimes@ Sponsored by: Netflix Modified: head/sys/boot/arm/uboot/Makefile head/sys/boot/defs.mk head/sys/boot/ficl.mk head/sys/boot/ficl/Makefile head/sys/boot/i386/gptboot/Makefile head/sys/boot/i386/gptzfsboot/Makefile head/sys/boot/i386/libi386/Makefile head/sys/boot/i386/loader/Makefile head/sys/boot/loader.mk head/sys/boot/mips/beri/loader/Makefile head/sys/boot/mips/uboot/Makefile head/sys/boot/powerpc/kboot/Makefile head/sys/boot/powerpc/ofw/Makefile head/sys/boot/powerpc/ps3/Makefile head/sys/boot/powerpc/uboot/Makefile head/sys/boot/sparc64/loader/Makefile Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/arm/uboot/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -53,7 +53,7 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g} loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} ldscript.abs: echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET} Modified: head/sys/boot/defs.mk ============================================================================== --- head/sys/boot/defs.mk Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/defs.mk Sun Oct 22 22:50:08 2017 (r324877) @@ -5,13 +5,13 @@ .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} -BOOTDIR= ${SRCTOP}/sys/boot -FICLDIR= ${BOOTDIR}/ficl -LDR_MI= ${BOOTDIR}/common -SASRC= ${BOOTDIR}/libsa +BOOTSRC= ${SRCTOP}/sys/boot +FDTSRC= ${BOOTSRC}/fdt +FICLSRC= ${BOOTSRC}/ficl +LDRSRC= ${BOOTSRC}/common +SASRC= ${BOOTSRC}/libsa SYSDIR= ${SRCTOP}/sys -FDTSRC= ${BOOTDIR}/fdt -UBOOTSRC= ${BOOTDIR}/uboot +UBOOTSRC= ${BOOTSRC}/uboot BOOTOBJ= ${OBJTOP}/sys/boot Modified: head/sys/boot/ficl.mk ============================================================================== --- head/sys/boot/ficl.mk Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/ficl.mk Sun Oct 22 22:50:08 2017 (r324877) @@ -12,7 +12,7 @@ FICL_CPUARCH= mips64 FICL_CPUARCH= ${MACHINE_CPUARCH} .endif -.PATH: ${FICLDIR} ${FICLDIR}/${FICL_CPUARCH} +.PATH: ${FICLSRC} ${FICLSRC}/${FICL_CPUARCH} .if ${MACHINE_CPUARCH} == "amd64" .if defined(FICL32) @@ -26,7 +26,7 @@ CFLAGS+= -fPIC CFLAGS+= -m32 -mcpu=powerpc -I. .endif -CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} -I${LDR_MI} +CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC} CFLAGS+= -DBOOT_FORTH CFLAGS+= -DBF_DICTSIZE=15000 Modified: head/sys/boot/ficl/Makefile ============================================================================== --- head/sys/boot/ficl/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/ficl/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -28,12 +28,12 @@ INTERNALLIB= .endif # Standard softwords -.PATH: ${FICLDIR}/softwords +.PATH: ${FICLSRC}/softwords SOFTWORDS= softcore.fr jhlocal.fr marker.fr freebsd.fr ficllocal.fr \ ifbrack.fr # Optional OO extension softwords #SOFTWORDS+= oo.fr classes.fr softcore.c: ${SOFTWORDS} softcore.awk - (cd ${FICLDIR}/softwords; cat ${SOFTWORDS} \ + (cd ${FICLSRC}/softwords; cat ${SOFTWORDS} \ | awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET} Modified: head/sys/boot/i386/gptboot/Makefile ============================================================================== --- head/sys/boot/i386/gptboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/i386/gptboot/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -43,7 +43,7 @@ CFLAGS.gcc+= --param max-inline-insns-single=100 .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${BOOTDIR}/geli +CFLAGS+= -I${BOOTSRC}/geli CFLAGS+= -I${.CURDIR}/../../.. LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a .PATH: ${.CURDIR}/../../../opencrypto Modified: head/sys/boot/i386/gptzfsboot/Makefile ============================================================================== --- head/sys/boot/i386/gptzfsboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/i386/gptzfsboot/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -50,7 +50,7 @@ CFLAGS+= -DSKEIN_LOOP=111 .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${BOOTDIR}/geli +CFLAGS+= -I${BOOTSRC}/geli LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a .PATH: ${.CURDIR}/../../../opencrypto OPENCRYPTO_XTS= xform_aes_xts.o Modified: head/sys/boot/i386/libi386/Makefile ============================================================================== --- head/sys/boot/i386/libi386/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/i386/libi386/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -28,7 +28,7 @@ CFLAGS+= -DDISK_DEBUG .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" # Decrypt encrypted drives CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${BOOTDIR}/geli +CFLAGS+= -I${BOOTSRC}/geli .endif .if !defined(BOOT_HIDE_SERIAL_NUMBERS) Modified: head/sys/boot/i386/loader/Makefile ============================================================================== --- head/sys/boot/i386/loader/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/i386/loader/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -42,7 +42,7 @@ HAVE_ISABUS= yes .if ${LOADER_GELI_SUPPORT:Uyes} == "yes" CFLAGS+= -DLOADER_GELI_SUPPORT -CFLAGS+= -I${BOOTDIR}/geli +CFLAGS+= -I${BOOTSRC}/geli LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a .PATH: ${.CURDIR}/../../../opencrypto SRCS+= xform_aes_xts.c @@ -80,7 +80,7 @@ ${LOADER}.bin: ${LOADER}.sym strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} loader.help: help.common help.i386 - cat ${.ALLSRC} | awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + cat ${.ALLSRC} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} FILES= ${LOADER} # XXX INSTALLFLAGS_loader= -b Modified: head/sys/boot/loader.mk ============================================================================== --- head/sys/boot/loader.mk Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/loader.mk Sun Oct 22 22:50:08 2017 (r324877) @@ -2,9 +2,9 @@ .include "defs.mk" -.PATH: ${LDR_MI} ${BOOTDIR}/libsa +.PATH: ${LDRSRC} ${BOOTSRC}/libsa -CFLAGS+=-I${LDR_MI} +CFLAGS+=-I${LDRSRC} SRCS+= boot.c commands.c console.c devopen.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c @@ -58,7 +58,7 @@ SRCS+= pnp.c # Forth interpreter .if ${MK_FORTH} != "no" SRCS+= interp_forth.c -.include "${BOOTDIR}/ficl.mk" +.include "${BOOTSRC}/ficl.mk" .endif .if defined(BOOT_PROMPT_123) @@ -74,6 +74,6 @@ VERSION_FILE?= ${.CURDIR}/version .if ${MK_REPRODUCIBLE_BUILD} != no REPRO_FLAG= -r .endif -vers.c: ${LDR_MI}/newvers.sh ${VERSION_FILE} - sh ${LDR_MI}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ +vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} + sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ ${NEWVERSWHAT} Modified: head/sys/boot/mips/beri/loader/Makefile ============================================================================== --- head/sys/boot/mips/beri/loader/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/mips/beri/loader/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -96,7 +96,7 @@ LDADD= ${LIBFICL} ${LIBSA} loader.help: help.common help.mips cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../../forth .include "${.CURDIR}/../../../forth/Makefile.inc" Modified: head/sys/boot/mips/uboot/Makefile ============================================================================== --- head/sys/boot/mips/uboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/mips/uboot/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -45,7 +45,7 @@ OBJS+= ${SRCS:N*.h:R:S/$/.o/g} loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} ldscript.abs: echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET} Modified: head/sys/boot/powerpc/kboot/Makefile ============================================================================== --- head/sys/boot/powerpc/kboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/powerpc/kboot/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -62,7 +62,7 @@ LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" Modified: head/sys/boot/powerpc/ofw/Makefile ============================================================================== --- head/sys/boot/powerpc/ofw/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/powerpc/ofw/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -62,7 +62,7 @@ LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSA32} loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" Modified: head/sys/boot/powerpc/ps3/Makefile ============================================================================== --- head/sys/boot/powerpc/ps3/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/powerpc/ps3/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -63,7 +63,7 @@ font.h: loader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" Modified: head/sys/boot/powerpc/uboot/Makefile ============================================================================== --- head/sys/boot/powerpc/uboot/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/powerpc/uboot/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -41,7 +41,7 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FD loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth FILES= loader.help Modified: head/sys/boot/sparc64/loader/Makefile ============================================================================== --- head/sys/boot/sparc64/loader/Makefile Sun Oct 22 22:49:51 2017 (r324876) +++ head/sys/boot/sparc64/loader/Makefile Sun Oct 22 22:50:08 2017 (r324877) @@ -55,7 +55,7 @@ LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSA} loader.help: help.common help.sparc64 cat ${.ALLSRC} | \ - awk -f ${LDR_MI}/merge_help.awk > ${.TARGET} + awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} .PATH: ${.CURDIR}/../../forth .include "${.CURDIR}/../../forth/Makefile.inc" From owner-svn-src-head@freebsd.org Sun Oct 22 22:50:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DDF1E38B56; Sun, 22 Oct 2017 22:50:16 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3A4A27C599; Sun, 22 Oct 2017 22:50:16 +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 v9MMoFS2001667; Sun, 22 Oct 2017 22:50:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMoFKM001666; Sun, 22 Oct 2017 22:50:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222250.v9MMoFKM001666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:50:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324878 - head/sys/boot/arm/at91/boot2 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/arm/at91/boot2 X-SVN-Commit-Revision: 324878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:50:16 -0000 Author: imp Date: Sun Oct 22 22:50:15 2017 New Revision: 324878 URL: https://svnweb.freebsd.org/changeset/base/324878 Log: Make at91 boot loader compile again. No clue if it actually still works, but it might. Modified: head/sys/boot/arm/at91/boot2/boot2.c Modified: head/sys/boot/arm/at91/boot2/boot2.c ============================================================================== --- head/sys/boot/arm/at91/boot2/boot2.c Sun Oct 22 22:50:08 2017 (r324877) +++ head/sys/boot/arm/at91/boot2/boot2.c Sun Oct 22 22:50:15 2017 (r324878) @@ -54,7 +54,7 @@ unsigned board_id; /* board type to pass to kernel, if unsigned dsk_start; static char cmd[512]; static char kname[1024]; -static uint32_t opts; +uint32_t opts; static uint8_t dsk_meta; int main(void); @@ -359,3 +359,10 @@ fixup_boot_drv(caddr_t addr, int klen, int bs, int bp) DPRINTF("Changed boot device to %s\n", ps); } #endif + +/* Arm EABIs */ +void __aeabi_unwind_cpp_pr0(void); +void +__aeabi_unwind_cpp_pr0(void) +{ +} From owner-svn-src-head@freebsd.org Sun Oct 22 22:50:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA3CCE38B8A; Sun, 22 Oct 2017 22:50:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 95A3F7C5EE; Sun, 22 Oct 2017 22:50: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 v9MMoJFl001721; Sun, 22 Oct 2017 22:50:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMoJMM001719; Sun, 22 Oct 2017 22:50:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222250.v9MMoJMM001719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324879 - in head/sys/boot: geli powerpc/boot1.chrp X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot: geli powerpc/boot1.chrp X-SVN-Commit-Revision: 324879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:50:21 -0000 Author: imp Date: Sun Oct 22 22:50:19 2017 New Revision: 324879 URL: https://svnweb.freebsd.org/changeset/base/324879 Log: Prefer SRCTOP paths for bits we're grabbing from libc. Sponsored by: Netflix Modified: head/sys/boot/geli/Makefile head/sys/boot/powerpc/boot1.chrp/Makefile Modified: head/sys/boot/geli/Makefile ============================================================================== --- head/sys/boot/geli/Makefile Sun Oct 22 22:50:15 2017 (r324878) +++ head/sys/boot/geli/Makefile Sun Oct 22 22:50:19 2017 (r324879) @@ -21,7 +21,7 @@ CFLAGS+= -m32 WARNS?= 0 # string functions from libc -.PATH: ${.CURDIR}/../../../lib/libc/string +.PATH: ${SRCTOP}/lib/libc/string SRCS+= bcmp.c bcopy.c bzero.c # Our password input method Modified: head/sys/boot/powerpc/boot1.chrp/Makefile ============================================================================== --- head/sys/boot/powerpc/boot1.chrp/Makefile Sun Oct 22 22:50:15 2017 (r324878) +++ head/sys/boot/powerpc/boot1.chrp/Makefile Sun Oct 22 22:50:19 2017 (r324879) @@ -19,7 +19,7 @@ LDFLAGS=-nostdlib -static -Wl,-N .include "../Makefile.inc" -.PATH: ${.CURDIR}/../../../libkern ${.CURDIR}/../../../../lib/libc/powerpc/gen ${.CURDIR} +.PATH: ${.CURDIR}/../../../libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR} # The following inserts out objects into a template HFS # created by generate-hfs.sh From owner-svn-src-head@freebsd.org Sun Oct 22 22:50:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DA22E38BDA; Sun, 22 Oct 2017 22:50:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id 005FE7C674; Sun, 22 Oct 2017 22:50:24 +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 v9MMoOiv001773; Sun, 22 Oct 2017 22:50:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMoOWh001772; Sun, 22 Oct 2017 22:50:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222250.v9MMoOWh001772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324880 - head/sys/boot/i386 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/i386 X-SVN-Commit-Revision: 324880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:50:25 -0000 Author: imp Date: Sun Oct 22 22:50:23 2017 New Revision: 324880 URL: https://svnweb.freebsd.org/changeset/base/324880 Log: Use BOOTSRC here. sponsored by: Netflix Modified: head/sys/boot/i386/Makefile.inc Modified: head/sys/boot/i386/Makefile.inc ============================================================================== --- head/sys/boot/i386/Makefile.inc Sun Oct 22 22:50:19 2017 (r324879) +++ head/sys/boot/i386/Makefile.inc Sun Oct 22 22:50:23 2017 (r324880) @@ -29,7 +29,7 @@ BTXKERN= ${BTXDIR}/btx/btx BTXCRT= ${BTXDIR}/lib/crt0.o # compact binary with no padding between text, data, bss -LDSCRIPT= ${SRCTOP}/sys/boot/i386/boot.ldscript +LDSCRIPT= ${BOOTSRC}/i386/boot.ldscript # LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary # LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary From owner-svn-src-head@freebsd.org Sun Oct 22 22:50:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCEABE38C31; Sun, 22 Oct 2017 22:50:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8517A7C6FE; Sun, 22 Oct 2017 22:50:29 +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 v9MMoSGC001828; Sun, 22 Oct 2017 22:50:28 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMoS5N001825; Sun, 22 Oct 2017 22:50:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222250.v9MMoS5N001825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:50:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324881 - in head/sys/boot: geli libsa uboot/lib X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot: geli libsa uboot/lib X-SVN-Commit-Revision: 324881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:50:30 -0000 Author: imp Date: Sun Oct 22 22:50:28 2017 New Revision: 324881 URL: https://svnweb.freebsd.org/changeset/base/324881 Log: Use SYSDIR instead of ${.CURDIR}/../../sys. Sponsored by: Netflix Modified: head/sys/boot/geli/Makefile head/sys/boot/libsa/Makefile head/sys/boot/uboot/lib/Makefile Modified: head/sys/boot/geli/Makefile ============================================================================== --- head/sys/boot/geli/Makefile Sun Oct 22 22:50:23 2017 (r324880) +++ head/sys/boot/geli/Makefile Sun Oct 22 22:50:28 2017 (r324881) @@ -5,6 +5,7 @@ MAN= .include MK_SSP= no +.include LIB= geliboot INTERNALLIB= @@ -28,7 +29,7 @@ SRCS+= bcmp.c bcopy.c bzero.c SRCS+= pwgets.c # sha256 and sha512 from sys/crypto -.PATH: ${SRCTOP}/sys/crypto/sha2 +.PATH: ${SYSDIR}/crypto/sha2 CFLAGS+= -DWEAK_REFS SRCS+= sha256c.c sha512c.c @@ -37,15 +38,15 @@ SRCS+= sha256c.c sha512c.c SRCS+= md5c.c # AES implementation from sys/crypto -.PATH: ${SRCTOP}/sys/crypto/rijndael -CFLAGS+= -I${.CURDIR}/../../ +.PATH: ${SYSDIR}/crypto/rijndael +CFLAGS+= -I${SYSDIR} CFLAGS+= -I${.CURDIR}/../common/ # Remove asserts CFLAGS+= -DNDEBUG SRCS+= rijndael-alg-fst.c rijndael-api-fst.c rijndael-api.c # local GELI Implementation -.PATH: ${SRCTOP}/sys/geom/eli +.PATH: ${SYSDIR}/geom/eli CFLAGS+= -D_STAND SRCS+= geliboot_crypto.c g_eli_hmac.c g_eli_key.c g_eli_key_cache.c pkcs5v2.c Modified: head/sys/boot/libsa/Makefile ============================================================================== --- head/sys/boot/libsa/Makefile Sun Oct 22 22:50:23 2017 (r324880) +++ head/sys/boot/libsa/Makefile Sun Oct 22 22:50:28 2017 (r324881) @@ -154,7 +154,7 @@ SRCS+= nandfs.c .endif # explicit_bzero -.PATH: ${SRCTOP}/sys/libkern +.PATH: ${SYSDIR}/libkern SRCS+= explicit_bzero.c .include Modified: head/sys/boot/uboot/lib/Makefile ============================================================================== --- head/sys/boot/uboot/lib/Makefile Sun Oct 22 22:50:23 2017 (r324880) +++ head/sys/boot/uboot/lib/Makefile Sun Oct 22 22:50:28 2017 (r324881) @@ -28,7 +28,7 @@ CFLAGS+= -DLOADER_FDT_SUPPORT -I${.CURDIR}/../../fdt .endif # Pick up FDT includes -CFLAGS+= -I${.CURDIR}/../../../../sys/contrib/libfdt/ +CFLAGS+= -I${SYSDIR}/contrib/libfdt/ # Pick up the bootstrap header for some interface items CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I. From owner-svn-src-head@freebsd.org Sun Oct 22 22:52:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 469C5E39100; Sun, 22 Oct 2017 22:52:24 +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 mx1.freebsd.org (Postfix) with ESMTPS id 1453D7CEC4; Sun, 22 Oct 2017 22:52:24 +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 v9MMqNXV005531; Sun, 22 Oct 2017 22:52:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMqN99005530; Sun, 22 Oct 2017 22:52:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222252.v9MMqN99005530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324882 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 324882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:52:24 -0000 Author: imp Date: Sun Oct 22 22:52:23 2017 New Revision: 324882 URL: https://svnweb.freebsd.org/changeset/base/324882 Log: Create a shell script to build sys/boot on all the architectures. One could run this from any directory, but it's designed to do regression testing on sys/boot (it only tests on a subset of architectures since all of them would take a lot longer and not help). This will also ensure that future commits to sys/boot compile everywhere. Sponsored by: Netflix Added: head/tools/boot/ head/tools/boot/universe.sh (contents, props changed) Added: head/tools/boot/universe.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/boot/universe.sh Sun Oct 22 22:52:23 2017 (r324882) @@ -0,0 +1,38 @@ +#!/bin/sh + +# $FreeBSD$ + +# +# Full list of all arches, but we only build a subset. All different mips add any +# value, and there's a few others we just don't support. +# +# mips/mipsel mips/mips mips/mips64el mips/mips64 mips/mipsn32 \ +# mips/mipselhf mips/mipshf mips/mips64elhf mips/mips64hf \ +# powerpc/powerpc powerpc/powerpc64 powerpc/powerpcspe \ +# riscv/riscv64 riscv/riscv64sf +# +# This script is expected to be run in sys/boot (though you could run it anywhere +# in the tree). It does a full clean build. For sys/boot you can do all the archs in +# about a minute or two on a fast machine. It's also possible that you need a full +# make universe for this to work completely. +# +# Output is put into _.boot.$TARGET_ARCH.log in sys.boot. +# + +for i in \ + amd64/amd64 \ + arm/arm arm/armeb arm/armv7 \ + arm64/aarch64 \ + i386/i386 \ + mips/mips mips/mips64 \ + powerpc/powerpc powerpc/powerpc64 \ + sparc64/sparc64 \ + ; do + ta=${i##*/} + echo -n "Building $ta..." + ( ( make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make -j 20 clean cleandepend cleandir obj depend all" \ + > _.boot.${ta}.log 2>&1 ) && echo Success ) || echo Fail +done + + + From owner-svn-src-head@freebsd.org Sun Oct 22 22:52:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 483BCE39119; Sun, 22 Oct 2017 22:52:29 +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 mx1.freebsd.org (Postfix) with ESMTPS id BF9787CEDF; Sun, 22 Oct 2017 22:52:28 +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 v9MMqRIR005585; Sun, 22 Oct 2017 22:52:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9MMqRlo005584; Sun, 22 Oct 2017 22:52:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710222252.v9MMqRlo005584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 22 Oct 2017 22:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324883 - head/sys/boot/fdt X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/fdt X-SVN-Commit-Revision: 324883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 22:52:29 -0000 Author: imp Date: Sun Oct 22 22:52:27 2017 New Revision: 324883 URL: https://svnweb.freebsd.org/changeset/base/324883 Log: Use preferred defined paths, rather than relative paths in fdt. Sponsored by: Netflix Modified: head/sys/boot/fdt/Makefile Modified: head/sys/boot/fdt/Makefile ============================================================================== --- head/sys/boot/fdt/Makefile Sun Oct 22 22:52:23 2017 (r324882) +++ head/sys/boot/fdt/Makefile Sun Oct 22 22:52:27 2017 (r324883) @@ -1,7 +1,9 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../contrib/libfdt/ +.include +.PATH: ${SYSDIR}/contrib/libfdt/ + LIB= fdt INTERNALLIB= @@ -12,7 +14,7 @@ SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt # Loader's fdt commands extension sources. SRCS+= fdt_loader_cmd.c fdt_overlay.c -CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ +CFLAGS+= -I${SYSDIR}/contrib/libfdt/ -I${BOOTSRC}/common/ CFLAGS+= -ffreestanding From owner-svn-src-head@freebsd.org Mon Oct 23 00:19:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EAA3FE3ADC4; Mon, 23 Oct 2017 00:19:35 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x22a.google.com (mail-pg0-x22a.google.com [IPv6:2607:f8b0:400e:c05::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 B5B557F37B; Mon, 23 Oct 2017 00:19:35 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x22a.google.com with SMTP id l24so10434895pgu.11; Sun, 22 Oct 2017 17:19:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=zDRlwMlDXD19QqUjRsE2ZMO6uXvASMSrH/kJ2bYLYVI=; b=LqwTS8vEsy0Je4Oz2tZob/j6SpUv0bszKZkfHtwA2gIVB/BadYOAS2PF4yWiBQ0bA1 Dgj9LNjyCqfyddOtkdt+qkh6UO2+dt+ZEr6iuwNCvCvZUGlFBuMPrF7dQHDrZll+dGX+ Mm+y/uihMIB8BbIDJQyjGnW1T6WSduiClBU0gyZ8PYzdM/iMKRRra5KnVLlQvX+bpHrC umKkZIGRQ0FTMj5RhlVx8ZkyF++gdrIq+OA/DgtWKJr/BD56CEb41qQxA/lBnLgGfVSr H7+3Z36k8Zo36PsacNDj+I977BoFojMTdKLKYDKzox6g58ekXSq7ZLlAnQFhL9XtLeya ci9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=zDRlwMlDXD19QqUjRsE2ZMO6uXvASMSrH/kJ2bYLYVI=; b=HDuvgTGDhh9a+GtZzpBBE112Kmqxf/FqMwbNskazv/wNz21A5hvpJPA24yx5aVX9cL xWj2Hz2ROnpMMBJGG97LrSWWl3vYMOHofOXKSS6apnJlwszapIj0UnbMnYrCfXnLZJJo n43gk7FjHdXeoqBtj/W/fDgoYdIsNj6DN4v5b/wsa3/AtLTGTQBeCp4xGur6jLSPRABi mvkUHpH8HZh/TP74w+6tMD5PXBC83lY1I4WmmNgNkyIe+H8eaZdOdm2gWWYVvBzb6hws LdpO8t0hj92PVwXbVBJMzUtap1vOeGcfq0cuH6UyydjCAkkgsxW5O0WqKidllIPOlBZw WL5A== X-Gm-Message-State: AMCzsaWsJ96K4nsNlh01vbqkPRTSO407E3B29lOtHjypNuEE8yIVJUKU 6lmTz0l8rNA5xU6CvQHGyBc9VWTH X-Google-Smtp-Source: ABhQp+T7xDydwtzsZ9eHvPSQ+/e2QI9fdARGR42FkHpGkvUfM4Scu1YU/HDD7tE82fyiOL42JkO4AA== X-Received: by 10.98.189.9 with SMTP id a9mr11634981pff.323.1508717975034; Sun, 22 Oct 2017 17:19:35 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id o9sm10407035pfk.162.2017.10.22.17.19.34 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Oct 2017 17:19:34 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_829762D5-4B5D-46CE-B0D0-3D94F3FE8E4A"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r324870 - in head/sys: amd64/include kern From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201710222043.v9MKho8t051509@repo.freebsd.org> Date: Sun, 22 Oct 2017 17:19:32 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <7F7760AE-DB73-473A-AE2B-96DE7FB5D51B@gmail.com> References: <201710222043.v9MKho8t051509@repo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 00:19:36 -0000 --Apple-Mail=_829762D5-4B5D-46CE-B0D0-3D94F3FE8E4A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 22, 2017, at 13:43, Mateusz Guzik wrote: >=20 > Author: mjg > Date: Sun Oct 22 20:43:50 2017 > New Revision: 324870 > URL: https://svnweb.freebsd.org/changeset/base/324870 >=20 > Log: > Make the sleepq chain hash size configurable per-arch and bump on = amd64. >=20 > While here cache-align chains. >=20 > This shortens longest found chain during poudriere -j 80 from 32 to = 16. >=20 > Pushing this higher up will probably require allocation on boot. Hi Mateusz, This change causes the Jenkins VMs to panic at boot with "panic: = witness_init: pending locks list is too small, increase = WITNESS_PENDLIST=E2=80=9D when WITNESS is enabled: = https://ci.freebsd.org/job/FreeBSD-head-amd64-test/4781/console . Please fix or revert. Thanks, -Ngie --Apple-Mail=_829762D5-4B5D-46CE-B0D0-3D94F3FE8E4A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE5bk3FaGcY5rvqmb79YOpJmkwhhUFAlntNZQACgkQ9YOpJmkw hhWSfA//cJMWZh/kKFYDFBXktTei6BKYRozj6iWC4w+ohxIsdb4V21cNrmLRzKsE XjEZdiHPg6yPaeReF4CxDi1pKz26YAAnLzEjO8YdvXCwQf0a1/+m3Q4Tp2AfCa9c AbV8ZQeueuNORh2A4Qyv9ZtYzQL7mv+NbWeMBc4gZ+S34fd5p42pQO6vO6Or6Mkh S/M2Nb0A7m5QxXAEoc2MMpbhfWIcYKivShZF3g0qOAPuuEp4S7D/zJjNoOjGxjvC 8UBIP5BQY/CLam+H6/d21QKd2dctqUxQAbVi+NhIqkuxBP6YVNXAFIo6bFWsjqK3 zc/SD1SX7j5ZuyigNUv//KxtBqQxAO4yEhT+NWM8bf+xe55LQpMn5I+5FP77KlVi Oq2h6aXr+u6TAgaTqHKuoQRo/5nu2/Q1ZSKgLANBMRL1yPolGI7ZdqQ5KUw7wQr0 2Asw2SsmQChYXs1M6XTqFy6pIgg923Oph6xP77Dq9OqljeKlNLJcBfUTxI+1VAKL 10Tm4Z5M6ZS/iHMgxdvbh42nCzhZElxUYo30ghup2n6K9RuVoPCLDlUl5cCv+9PP Q+MJ3laZcOyX+8O2p/Q7VcARO5if8XAt/LcGmTlgdbYROuoeAyjJk60oOL/cB2S1 VfD5GWIF+eqEdjntcwsBti/iPhX5A7XvUfg/Yh9S+xukBZa+ZAA= =ifPA -----END PGP SIGNATURE----- --Apple-Mail=_829762D5-4B5D-46CE-B0D0-3D94F3FE8E4A-- From owner-svn-src-head@freebsd.org Mon Oct 23 01:00:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0982FE3B9FC; Mon, 23 Oct 2017 01:00:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC468803E4; Mon, 23 Oct 2017 01:00:36 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9N10ale055273; Mon, 23 Oct 2017 01:00:36 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9N10aGv055272; Mon, 23 Oct 2017 01:00:36 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201710230100.v9N10aGv055272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 23 Oct 2017 01:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324890 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 01:00:37 -0000 Author: mjg Date: Mon Oct 23 01:00:35 2017 New Revision: 324890 URL: https://svnweb.freebsd.org/changeset/base/324890 Log: Bump WITNESS_PENDLIST to accomodate sleepq chain bump. Reported by: ngie Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Mon Oct 23 00:56:59 2017 (r324889) +++ head/sys/kern/subr_witness.c Mon Oct 23 01:00:35 2017 (r324890) @@ -137,7 +137,7 @@ __FBSDID("$FreeBSD$"); #define WITNESS_COUNT 1536 #endif #define WITNESS_HASH_SIZE 251 /* Prime, gives load factor < 2 */ -#define WITNESS_PENDLIST (1024 + MAXCPU) +#define WITNESS_PENDLIST (2048 + MAXCPU) /* Allocate 256 KB of stack data space */ #define WITNESS_LO_DATA_COUNT 2048 From owner-svn-src-head@freebsd.org Mon Oct 23 01:01:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CD0FE3BA82; Mon, 23 Oct 2017 01:01:43 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x229.google.com (mail-pg0-x229.google.com [IPv6:2607:f8b0:400e:c05::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 02BEB806EE; Mon, 23 Oct 2017 01:01:43 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x229.google.com with SMTP id s2so10482964pge.10; Sun, 22 Oct 2017 18:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=c1nJ+rQe+2Gz02O1Bht9ZPvtDPJDlAO8ar2hoKBBUfA=; b=EJdP3WfquvaXFaha+1zeuzKyebY4bsNFYwLE/yfkMmrZFJIudA49MCo6/iaKZw9k/J gmpfo4rdm3L9QGYPYeJK8LH7scgOfNRLWeDiMiFI/LBIwSe9RumdFmpxfQq8Jwg0JAil D01hH3FzAoZCHG7wnL2uwWBvOrBFIPYyniyC3xcnyY0NBoexHEZrgQ2A6bgPHhzc7MI9 GnVepCPzJzZju1rbtAtSXhhdemhHvEMV2aB8YrSo/dusRsObeRzEGZN3ESFiDFBTpQMX naJKox9YQl/kZKNqYDG3Pygl81IhVfMnmxy00rvXRYcw7iY942PHTzHHUulBNkUt2Rgf FMDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=c1nJ+rQe+2Gz02O1Bht9ZPvtDPJDlAO8ar2hoKBBUfA=; b=ES2fQ/Srk1sQAAtuGpkfEQzzWdSmpTTbAYkAvIqwkd0iVxtnscolRCbmVeyHowKJbP ibXC9AD2aMGy++ZApmTl8VW1Xkm/a01ORFTz97drfUTjUI9lp1Xbk7IZ0cZ/OT1oaum7 9ZEC4lxz8/0VBLOJCcHe7cUZCK78IN+5fXayTHr+Z45op+XSorr8bJhtkeYH9DDJIuUm /Fr16vx0Wl/wGn27CK3HN1YGP4z6VLpHKcRCY1bJn9K5L3HW47JnvxWEkY8mW+fRz/aJ NYyZBsS2ti1nLYKwxoYigOd4V1T/ZeKbeS3Xtw+qM0qc6CciiVVhH8yaQpA8LWGyZkCA BskQ== X-Gm-Message-State: AMCzsaXuHgpSryv0NJrjTpELGq56kqsj76RRjznqhhv1KMUSjZksolSL 8Ggq2nHbVTbj3vLkpl22ck5UvQuo X-Google-Smtp-Source: ABhQp+SQPNGdhSkGCifmERkcv5K9CnCE8G9XDnKrTdxXUnvphD919+69bhudNPZPw4EqjNDSHnneOA== X-Received: by 10.98.14.195 with SMTP id 64mr11435324pfo.197.1508720502160; Sun, 22 Oct 2017 18:01:42 -0700 (PDT) Received: from pinklady.local (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id e24sm9806961pfl.43.2017.10.22.18.01.41 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Oct 2017 18:01:41 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_CCEFC8AB-4D11-4011-8447-215A08EFD97C"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: svn commit: r324890 - head/sys/kern From: "Ngie Cooper (yaneurabeya)" In-Reply-To: <201710230100.v9N10aGv055272@repo.freebsd.org> Date: Sun, 22 Oct 2017 18:01:40 -0700 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201710230100.v9N10aGv055272@repo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3124) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 01:01:43 -0000 --Apple-Mail=_CCEFC8AB-4D11-4011-8447-215A08EFD97C Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Oct 22, 2017, at 18:00, Mateusz Guzik wrote: > > Author: mjg > Date: Mon Oct 23 01:00:35 2017 > New Revision: 324890 > URL: https://svnweb.freebsd.org/changeset/base/324890 > > Log: > Bump WITNESS_PENDLIST to accomodate sleepq chain bump. > > Reported by: ngie *crosses fingers and waits for next Jenkins run* --Apple-Mail=_CCEFC8AB-4D11-4011-8447-215A08EFD97C Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE5bk3FaGcY5rvqmb79YOpJmkwhhUFAlntP3QACgkQ9YOpJmkw hhW+/Q/9GLwsn0I4gepSeTZxPW5dECwt+VubayHAh2D8SlBVagQZrYBdrPpDL9QD x2ehUOs/dUgewLtry+K6ZxYCxYw7fDDKd+IkhdIXRUKBCUy8JiTNM1w+wLhTISgl 6C/kKEwKh4Qhd54K/dWmiFfVkvtU6en8o+zh55sTnF34bIQng9tDZAZEiuoPnKoZ nAsQs/3NpTvTHVG/F0+8zHDuLOSppqX0t1Ch4A2hvNcTHeV/Wd0C7ynkQmV3vBW4 mtA+Flia9jpf5va2hf88ZRzUJfwy2NfX6VfCHyckYECGfsdDfl+PYXsZBP8Yktd4 OlxWUKJ623GiHC+b0+/SEo7LhMRJM+s5Up0z9J/zbVDZY2IO1kliCcNuYPBSzgeH zuzeDH+dyb6QJvbFpntLMmJEV01ih3YssXyHRNi4mzMq61q82yXeVJY9btsVr28j BZYhNnyHb8zIvS5iGnYHKiaRWUb9+9deqBT4Z5raPmC/ry1RLQATUTM/BvrBc7Cj 458OVgi6JZAj4StE3DuwbBErx2iO6CpyEqA7NYYiDYEZtcA0vCgYz98C5TrDYT9W xKKw0sgpNZ8kUXR/A1Oi2bMgfCL46sV7P00QiEt3pt8OXEQ9d/66x4ko1K8EWSNJ OhN/3wvT4zoZCIM+V08G1HB/RU9xoeMpTtpdE6ucRg55dJSEbaY= =1Ton -----END PGP SIGNATURE----- --Apple-Mail=_CCEFC8AB-4D11-4011-8447-215A08EFD97C-- From owner-svn-src-head@freebsd.org Mon Oct 23 07:56:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A504E444A9; Mon, 23 Oct 2017 07:56:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A252668AF; Mon, 23 Oct 2017 07:56:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9N7uuAL028776; Mon, 23 Oct 2017 07:56:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9N7uujL028775; Mon, 23 Oct 2017 07:56:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201710230756.v9N7uujL028775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 23 Oct 2017 07:56:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324911 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 324911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 07:56:57 -0000 Author: ngie Date: Mon Oct 23 07:56:56 2017 New Revision: 324911 URL: https://svnweb.freebsd.org/changeset/base/324911 Log: Fix an omission in a comment Soft float API support applies to armv7 too after r324340 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Mon Oct 23 07:52:16 2017 (r324910) +++ head/share/mk/src.opts.mk Mon Oct 23 07:56:56 2017 (r324911) @@ -271,7 +271,7 @@ __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC .else __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC .endif -# Only doing soft float API stuff on armv6 +# Only doing soft float API stuff on armv6 and armv7 .if ${__T} != "armv6" && ${__T} != "armv7" BROKEN_OPTIONS+=LIBSOFT .endif From owner-svn-src-head@freebsd.org Mon Oct 23 08:48:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7311CE45E23; Mon, 23 Oct 2017 08:48:53 +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 F322768870; Mon, 23 Oct 2017 08:48:52 +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 v9N8ml80093516 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 23 Oct 2017 11:48:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v9N8ml80093516 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v9N8mlRj093515; Mon, 23 Oct 2017 11:48:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 23 Oct 2017 11:48:47 +0300 From: Konstantin Belousov To: Ngie Cooper Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324911 - head/share/mk Message-ID: <20171023084847.GN2473@kib.kiev.ua> References: <201710230756.v9N7uujL028775@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201710230756.v9N7uujL028775@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 08:48:53 -0000 On Mon, Oct 23, 2017 at 07:56:56AM +0000, Ngie Cooper wrote: > Author: ngie > Date: Mon Oct 23 07:56:56 2017 > New Revision: 324911 > URL: https://svnweb.freebsd.org/changeset/base/324911 > > Log: > Fix an omission in a comment > > Soft float API support applies to armv7 too after r324340 Does it ? From my understanding, requiring hw float was one of the reason for armv7 appearance. > > Modified: > head/share/mk/src.opts.mk > > Modified: head/share/mk/src.opts.mk > ============================================================================== > --- head/share/mk/src.opts.mk Mon Oct 23 07:52:16 2017 (r324910) > +++ head/share/mk/src.opts.mk Mon Oct 23 07:56:56 2017 (r324911) > @@ -271,7 +271,7 @@ __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC > .else > __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC > .endif > -# Only doing soft float API stuff on armv6 > +# Only doing soft float API stuff on armv6 and armv7 > .if ${__T} != "armv6" && ${__T} != "armv7" > BROKEN_OPTIONS+=LIBSOFT > .endif From owner-svn-src-head@freebsd.org Mon Oct 23 12:57:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F2D3E4B1E4; Mon, 23 Oct 2017 12:57:00 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg0-x230.google.com (mail-pg0-x230.google.com [IPv6:2607:f8b0:400e:c05::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 2D3AA6F7A6; Mon, 23 Oct 2017 12:57:00 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x230.google.com with SMTP id s75so11706663pgs.0; Mon, 23 Oct 2017 05:57:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HPCF/AFTEOSvuQ/qZt9P7+t6htqD8cMNUC0nt5vRpSk=; b=Wpw4kqqsELf6aUIuZKHHjesgjIVuvOUpqU1xqsMaqnTc80u6xuAG0qsNXKPlf2m0is S/J3X8UsXIfySHDpv81muGIwI2VEZMb+Q0JNjH5h9sX3cFOiE8Mnzj5jsPIMqP81DbND Y75AtWrKMTxH++7i2848l6USkL19Ug+WYKArC0SZ47EAodr+ZedzSL/HKVqM/Gw7QiZb jExYzFJl7Anwqzn0x7tWlTImhvPZTKd8KTRl5XHTUeVnj9TYH5hXklAtDoxBPgHCITtr ZgPvK1HUi128sgO/qmOMh9eR9h1TaDzQmmfiuHfe1mFWuJ0bFQulpxcroYph7b3JoPwn MDAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HPCF/AFTEOSvuQ/qZt9P7+t6htqD8cMNUC0nt5vRpSk=; b=KNP434KU3JEslovwNxqK8lcpqnLyLAeEO5E2FcqUGstUMX24ZLV6jlqlKTMrNIuvb4 zNYkfnmDfT4OnDo11orsKk5omYb9xC/1TfMeuiYNlBV0fQyQfqbVSsZAhq7nPPq0VF0C qlzc7zNez8zhQUQMRigjUKCcyhj5GfGqFT4n6n0ZXZTwleK/XvtHytpUQGima11p5FhR nyzMfw1ut/mpA4lOkkRgo5ujfnI2pZuXzVklz+zsPQtFKNQhmpPiuhqu4RFm75etEk7s eGfQrIJGG6Lqyj9ZJ34BEFiWuFye0EZRKho6jhyrnJGfzQOHCT/5gxLvDsxgT5ZtRqG2 3WjA== X-Gm-Message-State: AMCzsaX65DzCs7z8rdDbgQCohAXUN3AzfokfWB5Ev2TundEfxmW/dPkD E5LGLgbpS7SEiUSYpLslgPZDzQMY X-Google-Smtp-Source: ABhQp+SRIHr0ifz9yW9L8wN91FQhCzqDDUJUt2iCpnAsCrYynz/77JqKKFbvTnbB7NihYnQozB0CMA== X-Received: by 10.99.114.6 with SMTP id n6mr11838774pgc.115.1508763419391; Mon, 23 Oct 2017 05:56:59 -0700 (PDT) Received: from [192.168.20.13] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id s17sm10419822pgq.25.2017.10.23.05.56.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 05:56:58 -0700 (PDT) Content-Type: text/plain; charset=cp932 Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r324911 - head/share/mk From: Ngie Cooper X-Mailer: iPhone Mail (15A421) In-Reply-To: <20171023084847.GN2473@kib.kiev.ua> Date: Mon, 23 Oct 2017 05:56:46 -0700 Cc: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <11B333F5-0899-4AD8-9F90-2002C3C2359A@gmail.com> References: <201710230756.v9N7uujL028775@repo.freebsd.org> <20171023084847.GN2473@kib.kiev.ua> To: Konstantin Belousov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 12:57:00 -0000 > On Oct 23, 2017, at 01:48, Konstantin Belousov wrote= : >=20 >> On Mon, Oct 23, 2017 at 07:56:56AM +0000, Ngie Cooper wrote: >> Author: ngie >> Date: Mon Oct 23 07:56:56 2017 >> New Revision: 324911 >> URL: https://svnweb.freebsd.org/changeset/base/324911 >>=20 >> Log: >> Fix an omission in a comment >>=20 >> Soft float API support applies to armv7 too after r324340 > Does it ? =46rom my understanding, requiring hw float was one of the > reason for armv7 appearance. Hah... the comment=81fs backwards. Classic! >>=20 >> Modified: >> head/share/mk/src.opts.mk >>=20 >> Modified: head/share/mk/src.opts.mk >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=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/share/mk/src.opts.mk Mon Oct 23 07:52:16 2017 (r324910) >> +++ head/share/mk/src.opts.mk Mon Oct 23 07:56:56 2017 (r324911) >> @@ -271,7 +271,7 @@ __DEFAULT_NO_OPTIONS+=3DGDB_LIBEXEC >> .else >> __DEFAULT_YES_OPTIONS+=3DGDB_LIBEXEC >> .endif >> -# Only doing soft float API stuff on armv6 >> +# Only doing soft float API stuff on armv6 and armv7 >> .if ${__T} !=3D "armv6" && ${__T} !=3D "armv7" >> BROKEN_OPTIONS+=3DLIBSOFT >> .endif From owner-svn-src-head@freebsd.org Mon Oct 23 13:09:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 444F6E4B5E4; Mon, 23 Oct 2017 13:09:43 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com [IPv6:2a00:1450:4010:c07::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 C44526FF44; Mon, 23 Oct 2017 13:09:42 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x236.google.com with SMTP id 90so20048541lfs.13; Mon, 23 Oct 2017 06:09: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=VtzzCgzb7utyTcFkjqrkTKq0yR6/yzS9S/wTCwPXPhA=; b=YDY26fO2PXmI+a6acG0XGEtqIEIsf1FAfbw/86PcSqbKUVbL1ZHzeljD38sOn9zbVn +k/aYfxn4e6L7D5bUBUyxPKXBZI4ZbQO7IYF2yni6g2boJbQW6QOWF4e3sfcw6eE2yRH 57Mwlj8qJDzAyJEcOLsiXV3DxChJWuUp6g2mpNwh6xLidA2CsyCc4hXbfliOlkRfAJQi JKRmMkU2Kmj+Wwo8ThYFkc8HYyVIwY74/kZf81M019CsvmXCTyYcdYo6eDTDAaiArxHP 2hbKBlBxVv0pS5dyCBCjvz420pNb7gxYFNiTEP1ewYyQqczjJp9OgER4wBs0uFgoWDWG ht7Q== 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=VtzzCgzb7utyTcFkjqrkTKq0yR6/yzS9S/wTCwPXPhA=; b=bYZmykMJAExoSAuuumdcje/ctB2WIzOMlDt88nu95ahqYTPL8avkWuR8tIU4tzYo7L UsfUt+p02ysy9FDNUqABwNdO4epuesfwbaGCBFV09U1Zqf4fUEydxxdtSw1PzNhcflhV 0RqS+vH1E0MULIA2p6fW6pBYTYNDugV0oRQjH5gG2jqeOpIQZ+C63AHNmlO3k+HzcvE4 Nq6F8VwveeXEMUFoTxYgStc9uo8oTZB2QCZ/sRLz8JEQrXwnFPw8nxP9a2gkXKV8u3YK K5EaH2FZDVpz+h6455HF1nXSi8YdVuY9Xson+nOe/uuz1Vb8Y9Z1DHHnJoGrTTsDZVwz 5DTg== X-Gm-Message-State: AMCzsaUhvqHoYlgvG14MVG5bkQAgim1sO1ddrZj2890NcD3G1vHdROSE 2Sndd/POxzGLii+LOgYrervDGVItWwP2qWXRkVw= X-Google-Smtp-Source: ABhQp+Sa5ZrcoAT9M02jgl7L3Yumywis3XhA/7E1s4UMhug60/sZixpzn4JjOPAae7wk21Qg5vhHJjomCcxtmb9CPWg= X-Received: by 10.25.16.228 with SMTP id 97mr4781048lfq.74.1508764179807; Mon, 23 Oct 2017 06:09:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.86.7 with HTTP; Mon, 23 Oct 2017 06:09:39 -0700 (PDT) Received: by 10.46.86.7 with HTTP; Mon, 23 Oct 2017 06:09:39 -0700 (PDT) In-Reply-To: <11B333F5-0899-4AD8-9F90-2002C3C2359A@gmail.com> References: <201710230756.v9N7uujL028775@repo.freebsd.org> <20171023084847.GN2473@kib.kiev.ua> <11B333F5-0899-4AD8-9F90-2002C3C2359A@gmail.com> From: Justin Hibbits Date: Mon, 23 Oct 2017 08:09:39 -0500 Message-ID: Subject: Re: svn commit: r324911 - head/share/mk To: Garrett Cooper Cc: Konstantin Belousov , Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 13:09:43 -0000 On Oct 23, 2017 07:57, "Ngie Cooper" wrote: > On Oct 23, 2017, at 01:48, Konstantin Belousov wrote: > >> On Mon, Oct 23, 2017 at 07:56:56AM +0000, Ngie Cooper wrote: >> Author: ngie >> Date: Mon Oct 23 07:56:56 2017 >> New Revision: 324911 >> URL: https://svnweb.freebsd.org/changeset/base/324911 >> >> Log: >> Fix an omission in a comment >> >> Soft float API support applies to armv7 too after r324340 > Does it ? From my understanding, requiring hw float was one of the > reason for armv7 appearance. Hah... the comment=E2=80=99s backwards. Classic! It was my understanding that armv{6,7} use the softfloat ABI but still require a hardware float. - Justin >> >> Modified: >> head/share/mk/src.opts.mk >> >> Modified: head/share/mk/src.opts.mk >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/share/mk/src.opts.mk Mon Oct 23 07:52:16 2017 (r324910) >> +++ head/share/mk/src.opts.mk Mon Oct 23 07:56:56 2017 (r324911) >> @@ -271,7 +271,7 @@ __DEFAULT_NO_OPTIONS+=3DGDB_LIBEXEC >> .else >> __DEFAULT_YES_OPTIONS+=3DGDB_LIBEXEC >> .endif >> -# Only doing soft float API stuff on armv6 >> +# Only doing soft float API stuff on armv6 and armv7 >> .if ${__T} !=3D "armv6" && ${__T} !=3D "armv7" >> BROKEN_OPTIONS+=3DLIBSOFT >> .endif From owner-svn-src-head@freebsd.org Mon Oct 23 13:32:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F2CBE4BD31; Mon, 23 Oct 2017 13:32:03 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from mouf.net (mouf.net [IPv6:2607:fc50:0:4400:216:3eff:fe69:33b3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mouf.net", Issuer "mouf.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 27ADC70B90; Mon, 23 Oct 2017 13:32:03 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from lrrr.mouf.net (cpe-24-163-43-246.nc.res.rr.com [24.163.43.246]) (authenticated bits=0) by mouf.net (8.14.9/8.14.9) with ESMTP id v9NDVlII015988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 23 Oct 2017 13:31:56 GMT (envelope-from swills@FreeBSD.org) Subject: Re: svn commit: r318751 - in head/sys: kern sys To: Allan Jude , Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201705231659.v4NGxOB8013882@repo.freebsd.org> <96e0c0bc-eb9c-2ffa-9216-88678d0e8730@freebsd.org> From: Steve Wills Message-ID: <92f4d6a9-6fc7-5fbd-7fce-8584c090526d@FreeBSD.org> Date: Mon, 23 Oct 2017 09:31:42 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <96e0c0bc-eb9c-2ffa-9216-88678d0e8730@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mouf.net [199.48.129.64]); Mon, 23 Oct 2017 13:31:58 +0000 (UTC) X-Spam-Status: No, score=0.0 required=4.5 tests=none autolearn=unavailable autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mouf.net X-Virus-Scanned: clamav-milter 0.99.2 at mouf.net X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 13:32:03 -0000 Hi, On 10/21/2017 18:55, Allan Jude wrote: > On 2017-10-21 18:45, Steven Hartland wrote: >> Personally I hate that idea as like being able to see all the processes >> from the host. >> >> I have a similar hate of Linux containers where you have to jump though >> hoops just to see whats really happening on the host. >> >> On Sat, 21 Oct 2017 at 20:29, Allan Jude > Note: this does NOT change root's ability to see the processes in the jail. > > I just stops uid 1001 on the host, from using the processes owned by uid > 1001 in each jail, even in the presence of: security.bsd.see_other_uids=0 > > I think we'd be doing our users a service by enabling this by default and avoiding the potential foot-shooting. I'd even be happy if we set the other security.bsd.see_other_* to 0 by default. Or at least change the installer to default that way (if it doesn't already? I'm not sure). Personally, I'm going to do that locally anyway so if we don't do those things, I won't be upset, but saddened for our users sake. Note too that security.bsd.see_jail_proc is partially a work around for the fact that security.bsd.see_other_* doesn't work as you might expect. It's literally the UID/GID, rather than the username, so security.bsd.see_other_* has no idea that the users in the jail are not the same users on the host, which is unexpected and counter-intuitive at best and dangerous at worst. (Even if that were changed, security.bsd.see_jail_proc is still useful for the potential scenario where you don't want/need to set security.bsd.see_other_* but don't want users to see processes in jails.) Steve From owner-svn-src-head@freebsd.org Mon Oct 23 13:34:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDAD1E4BDE0; Mon, 23 Oct 2017 13:34:48 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-oi0-x229.google.com (mail-oi0-x229.google.com [IPv6:2607:f8b0:4003: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 9DA9870E8E; Mon, 23 Oct 2017 13:34:48 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-oi0-x229.google.com with SMTP id f66so30703855oib.2; Mon, 23 Oct 2017 06:34:48 -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=LxV7A12FVrLtywWvMGfejdvtiBLZZd92g+Ou4ll+0qs=; b=d5D5XecNwdESsMJqPUQlOJG7eN9ibksBnqWFTembu4Rj0UmPgQa3tZsRYm5cwapH0V nXz6/JGdlZDPcCKBEAC8C3FIZL2TDgdLC41XhzwN9RZkY4vfdc7KPKZI25T/je17Eykb dNv/8YVQNOO5ZklhunDMpN1B1TOam9ID3nGNZANKApedPH0kLJbeQUY29Q03Gto0XPyJ RDiLPHkWQfrhBYkRbLyMwtIMXmtbVJzarVI1JNSbP0vrGc95u3FiXqudadJF2CBezs7C YWbsvtVm+/1BoswrOC66uLbbp+R6vgera01xiT2ictp19mIOhRjhTx7UiqS75Td0LJKZ s8YA== 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=LxV7A12FVrLtywWvMGfejdvtiBLZZd92g+Ou4ll+0qs=; b=Hb2Yeos50nSejAQI0IsZgbf63uYsksOglq7BbAjDl1/kfyG2g+QKPOMiE9HI1wzA/S i/FGClD0Urcr4O8QsS2bvqIOgYr3FdKVIEZ85yGcMNwF428J391JSbVKDBlh3gwGV9Bg T0e4n7TTvBag5SteAmcNvISrM1Jb4zhTT6yw2R+MzONaYNg1QZrwQJA5PqE28Vqxc6Mi xr02cs+6J46NFF+mWUy3L48nLjAxfc4ZSLXn6eLzWdguqkVe24+8iH4VvyWeTXxBq7nQ Qya1gjupuDz74ET8EUX5ARnD07lU2MKj1Rk1d8yW5vb5YsPjn0pNJwDvxfW6vsGNcGHW ZM1A== X-Gm-Message-State: AMCzsaXBqSwLgbhWLBWToLaXKMkdyY64e/KvsJu0LSr9rOlP0JxKO52D wrvKD9IGwsa0X0xpDDRqRTDeTbXM7CTKu4+zof4= X-Google-Smtp-Source: ABhQp+QWlgMDDTOamrUsPDhPp1yYcMAYKv2rpbBv29oLYPdSqaq6TNSz5uFyO6Zp2D9TqwGZgQhABeRK2/nV+Hs8WMU= X-Received: by 10.202.59.139 with SMTP id i133mr7475368oia.103.1508765687870; Mon, 23 Oct 2017 06:34:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.41.6 with HTTP; Mon, 23 Oct 2017 06:34:47 -0700 (PDT) In-Reply-To: <92f4d6a9-6fc7-5fbd-7fce-8584c090526d@FreeBSD.org> References: <201705231659.v4NGxOB8013882@repo.freebsd.org> <96e0c0bc-eb9c-2ffa-9216-88678d0e8730@freebsd.org> <92f4d6a9-6fc7-5fbd-7fce-8584c090526d@FreeBSD.org> From: Benjamin Kaduk Date: Mon, 23 Oct 2017 08:34:47 -0500 Message-ID: Subject: Re: svn commit: r318751 - in head/sys: kern sys To: Steve Wills Cc: Allan Jude , Steven Hartland , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 13:34:49 -0000 On Mon, Oct 23, 2017 at 8:31 AM, Steve Wills wrote: > > Note too that security.bsd.see_jail_proc is partially a work around for > the fact that security.bsd.see_other_* doesn't work as you might expect. > It's literally the UID/GID, rather than the username, so > security.bsd.see_other_* has no idea that the users in the jail are not the > same users on the host, which is unexpected and counter-intuitive at best > and dangerous at worst. (Even if that were changed, > security.bsd.see_jail_proc is still useful for the potential scenario where > you don't want/need to set security.bsd.see_other_* but don't want users to > see processes in jails.) security.bsd.see_other_* cannot do anything *but* UID/GID -- note that it is supported to have multiple user entries on a single system that share a UID, and the username used to log in is not tracked by the kernel. (E.g., root and toor.) -Ben From owner-svn-src-head@freebsd.org Mon Oct 23 15:08:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3ED22E4DDA5 for ; Mon, 23 Oct 2017 15:08:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (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 F0C6273876 for ; Mon, 23 Oct 2017 15:08:27 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x232.google.com with SMTP id f20so20437683ioj.9 for ; Mon, 23 Oct 2017 08:08:27 -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=1XLo38yCUo9OXhzFm9ok1dbzCGu/tnihPpqCMX3p+2c=; b=GSRMYIRNEt8KUz6saGzvuBn88Ymzw3jyVOVTayk3BKMjlhuAjIAh6IkmWaaTNwHE/+ kAFmJsiGcXTKl2Wn0Hm1Kw3Wnsv+lyrycNwLGYUy2kLN2Q+aNIariHw2H62IWjE0qdp1 1Ve0Qgn/JAnnGb3VOcf2nMQACVCNvAaYtx1Unz0OQH1xC7OyV0Fa0cd3Bot/4VPs62Ni 5wQlI9gsy8YgfGK8WTkSC2O6kzy3RzlIOTmABcw3Z2k+0elgp4eAWF/ZUQkhrI1hnl4P CpuVcqEfzrDi3H5LMhTAcY1+w+uGce6C/M+B55jQp5fFh7SVxbdhUIqW2R2z5KeGSZNF SmoA== 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=1XLo38yCUo9OXhzFm9ok1dbzCGu/tnihPpqCMX3p+2c=; b=JCRLxyIXX6F6kv/mjPknyf4St4FT4Hog9mH6uBON63XzInS+3rjrLikiMsLmLFaXPT Kn7T8SdP+PhNKRS8+kdnfo2/JyaY6i/w4X3F68sgxkFoVEJXOZgIRZiSqO8v/QOouz7H yoHUT/FG410k1VKQdCmjw9HZpSeetjpxNmrPxYytieppvTFL4FHylJVIPcx0zrBksziU FyK+gt4zbg9jB8yAPZgYLs2ZnpcOBhLq0NesFA4cWFQkWnpiBZUt5b7y1tUVFG877y4U 4Xzju0FAQZZ+ZrnjUY/nZ0nC9dbchl6HCNR4fzG5nUY0eu68KJZiSzbYs5PEewOSr9qK 7Pog== X-Gm-Message-State: AMCzsaUPBsXA0RJpL59pmuJ3TqZtT1W2MRkAxTte7vrY+PUkuOlpQPWx B9z8/qIapnlTNw5fL/1cRTavAQlfA2R+dqqQHjcEoA== X-Google-Smtp-Source: ABhQp+RwEtr2RvOyjgfOBhblZjIoN6cKy4a8VTEzy3LtLpWQzWSThJYJZk/aHZ6IGXQ7sl6WZ6S432cWlyDwgbnJUoY= X-Received: by 10.107.81.21 with SMTP id f21mr16484279iob.63.1508771307152; Mon, 23 Oct 2017 08:08:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Mon, 23 Oct 2017 08:08:26 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:df5:793f:4458:5cf6] In-Reply-To: References: <201710230756.v9N7uujL028775@repo.freebsd.org> <20171023084847.GN2473@kib.kiev.ua> <11B333F5-0899-4AD8-9F90-2002C3C2359A@gmail.com> From: Warner Losh Date: Mon, 23 Oct 2017 09:08:26 -0600 X-Google-Sender-Auth: ZZs6ebwToZXqzy_WddVbfRY7qAA Message-ID: Subject: Re: svn commit: r324911 - head/share/mk To: Justin Hibbits Cc: Garrett Cooper , Konstantin Belousov , Ngie Cooper , 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-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 15:08:28 -0000 On Mon, Oct 23, 2017 at 7:09 AM, Justin Hibbits wrote: > On Oct 23, 2017 07:57, "Ngie Cooper" wrote: > > > > On Oct 23, 2017, at 01:48, Konstantin Belousov > wrote: > > > >> On Mon, Oct 23, 2017 at 07:56:56AM +0000, Ngie Cooper wrote: > >> Author: ngie > >> Date: Mon Oct 23 07:56:56 2017 > >> New Revision: 324911 > >> URL: https://svnweb.freebsd.org/changeset/base/324911 > >> > >> Log: > >> Fix an omission in a comment > >> > >> Soft float API support applies to armv7 too after r324340 > > Does it ? From my understanding, requiring hw float was one of the > > reason for armv7 appearance. > > Hah... the comment=E2=80=99s backwards. Classic! > > > It was my understanding that armv{6,7} use the softfloat ABI but still > require a hardware float. > No. Thats not true in FreeBSD 11 and newer. Hard float with hard float ABI is the default, although we can compile armv7 with soft floating point ABI using either software fp or hardware fp. These libraries are meant to bridge the gap between the two worlds, though the armv7 stuff is largely untested. The comment isn't backwards at all. We only do LIBSOFT on amrv6/7. That's why we mark it 'BROKEN' on the other architectures so we don't try it at all. Though mips is a good candidate for it. Warner > - Justin > > > >> > >> Modified: > >> head/share/mk/src.opts.mk > >> > >> Modified: head/share/mk/src.opts.mk > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=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/share/mk/src.opts.mk Mon Oct 23 07:52:16 2017 (r324910) > >> +++ head/share/mk/src.opts.mk Mon Oct 23 07:56:56 2017 (r324911) > >> @@ -271,7 +271,7 @@ __DEFAULT_NO_OPTIONS+=3DGDB_LIBEXEC > >> .else > >> __DEFAULT_YES_OPTIONS+=3DGDB_LIBEXEC > >> .endif > >> -# Only doing soft float API stuff on armv6 > >> +# Only doing soft float API stuff on armv6 and armv7 > >> .if ${__T} !=3D "armv6" && ${__T} !=3D "armv7" > >> BROKEN_OPTIONS+=3DLIBSOFT > >> .endif > > > From owner-svn-src-head@freebsd.org Mon Oct 23 15:15:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28F0CE4DFF1; Mon, 23 Oct 2017 15:15:34 +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 C3C2973D67; Mon, 23 Oct 2017 15:15:33 +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 v9NFFSa8079330 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 23 Oct 2017 18:15:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v9NFFSa8079330 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v9NFFRPc079321; Mon, 23 Oct 2017 18:15:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 23 Oct 2017 18:15:27 +0300 From: Konstantin Belousov To: Steve Wills Cc: Allan Jude , Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r318751 - in head/sys: kern sys Message-ID: <20171023151527.GO2473@kib.kiev.ua> References: <201705231659.v4NGxOB8013882@repo.freebsd.org> <96e0c0bc-eb9c-2ffa-9216-88678d0e8730@freebsd.org> <92f4d6a9-6fc7-5fbd-7fce-8584c090526d@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <92f4d6a9-6fc7-5fbd-7fce-8584c090526d@FreeBSD.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 15:15:34 -0000 On Mon, Oct 23, 2017 at 09:31:42AM -0400, Steve Wills wrote: > Hi, > > On 10/21/2017 18:55, Allan Jude wrote: > > On 2017-10-21 18:45, Steven Hartland wrote: > >> Personally I hate that idea as like being able to see all the processes > >> from the host. > >> > >> I have a similar hate of Linux containers where you have to jump though > >> hoops just to see whats really happening on the host. > >> > >> On Sat, 21 Oct 2017 at 20:29, Allan Jude > > > Note: this does NOT change root's ability to see the processes in the jail. > > > > I just stops uid 1001 on the host, from using the processes owned by uid > > 1001 in each jail, even in the presence of: security.bsd.see_other_uids=0 > > > > > > I think we'd be doing our users a service by enabling this by default > and avoiding the potential foot-shooting. I'd even be happy if we set No, you propose to do exactly the reverse, by making it impossible to properly observe the global system state. E.g. the administrator on host, that is, the machine owner, would be impossible to see processes which eat system resources and jailed. > the other security.bsd.see_other_* to 0 by default. Or at least change > the installer to default that way (if it doesn't already? I'm not sure). And this is plain stupid. The only config where see_other_uids might be not completely detrimental is probably only public-access shell boxes, and even there the harm from it probably outweight the obscurity it provides. > > Personally, I'm going to do that locally anyway so if we don't do those > things, I won't be upset, but saddened for our users sake. Personally, I will have to revert this on all my computers if this ever gets in. > > Note too that security.bsd.see_jail_proc is partially a work around for > the fact that security.bsd.see_other_* doesn't work as you might expect. It work exactly as I expect. > It's literally the UID/GID, rather than the username, so > security.bsd.see_other_* has no idea that the users in the jail are not > the same users on the host, which is unexpected and counter-intuitive at > best and dangerous at worst. (Even if that were changed, > security.bsd.see_jail_proc is still useful for the potential scenario > where you don't want/need to set security.bsd.see_other_* but don't want > users to see processes in jails.) From owner-svn-src-head@freebsd.org Mon Oct 23 15:34:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A02DE4E380; Mon, 23 Oct 2017 15:34:07 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3455E7449F; Mon, 23 Oct 2017 15:34:07 +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 v9NFY6Nx019812; Mon, 23 Oct 2017 15:34:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NFY68r019808; Mon, 23 Oct 2017 15:34:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710231534.v9NFY68r019808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 23 Oct 2017 15:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324920 - in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm/arm arm64/arm64 i386/i386 X-SVN-Commit-Revision: 324920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 15:34:07 -0000 Author: markj Date: Mon Oct 23 15:34:05 2017 New Revision: 324920 URL: https://svnweb.freebsd.org/changeset/base/324920 Log: Fix the VM_NRESERVLEVEL == 0 build. Add VM_NRESERVLEVEL guards in the pmaps that implement transparent superpage promotion using reservations. Reviewed by: alc, kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12764 Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap-v6.c head/sys/arm64/arm64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Oct 23 11:12:09 2017 (r324919) +++ head/sys/amd64/amd64/pmap.c Mon Oct 23 15:34:05 2017 (r324920) @@ -604,8 +604,10 @@ static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_ struct rwlock **lockp); static bool pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pde, u_int flags, struct rwlock **lockp); +#if VM_NRESERVLEVEL > 0 static void pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, struct rwlock **lockp); +#endif static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); @@ -628,8 +630,10 @@ static void pmap_invalidate_pde_page(pmap_t pmap, vm_o pd_entry_t pde); static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask); +#if VM_NRESERVLEVEL > 0 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); +#endif static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); static void pmap_pte_attr(pt_entry_t *pte, int cache_bits, int mask); @@ -3359,6 +3363,7 @@ out: PV_STAT(atomic_subtract_int(&pv_entry_spare, NPTEPG - 1)); } +#if VM_NRESERVLEVEL > 0 /* * After promotion from 512 4KB page mappings to a single 2MB page mapping, * replace the many pv entries for the 4KB page mappings by a single pv entry @@ -3399,6 +3404,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_pa pmap_pvh_free(&m->md, pmap, va); } while (va < va_last); } +#endif /* VM_NRESERVLEVEL > 0 */ /* * First find and then destroy the pv entry for the specified pmap and virtual @@ -4243,6 +4249,7 @@ retry: PMAP_UNLOCK(pmap); } +#if VM_NRESERVLEVEL > 0 /* * Tries to promote the 512, contiguous 4KB page mappings that are within a * single page table page (PTP) to a single 2MB page mapping. For promotion @@ -4371,6 +4378,7 @@ setpte: CTR2(KTR_PMAP, "pmap_promote_pde: success for va %#lx" " in pmap %p", va, pmap); } +#endif /* VM_NRESERVLEVEL > 0 */ /* * Insert the given physical page (p) at @@ -4599,6 +4607,7 @@ validate: unchanged: +#if VM_NRESERVLEVEL > 0 /* * If both the page table page and the reservation are fully * populated, then attempt promotion. @@ -4608,6 +4617,7 @@ unchanged: (m->flags & PG_FICTITIOUS) == 0 && vm_reserv_level_iffullpop(m) == 0) pmap_promote_pde(pmap, pde, va, &lock); +#endif rv = KERN_SUCCESS; out: @@ -7171,7 +7181,9 @@ pmap_emulate_accessed_dirty(pmap_t pmap, vm_offset_t v { int rv; struct rwlock *lock; +#if VM_NRESERVLEVEL > 0 vm_page_t m, mpte; +#endif pd_entry_t *pde; pt_entry_t *pte, PG_A, PG_M, PG_RW, PG_V; @@ -7226,6 +7238,7 @@ pmap_emulate_accessed_dirty(pmap_t pmap, vm_offset_t v *pte |= PG_A; } +#if VM_NRESERVLEVEL > 0 /* try to promote the mapping */ if (va < VM_MAXUSER_ADDRESS) mpte = PHYS_TO_VM_PAGE(*pde & PG_FRAME); @@ -7243,6 +7256,8 @@ pmap_emulate_accessed_dirty(pmap_t pmap, vm_offset_t v atomic_add_long(&ad_emulation_superpage_promotions, 1); #endif } +#endif + #ifdef INVARIANTS if (ftype == VM_PROT_WRITE) atomic_add_long(&num_dirty_emulations, 1); Modified: head/sys/arm/arm/pmap-v6.c ============================================================================== --- head/sys/arm/arm/pmap-v6.c Mon Oct 23 11:12:09 2017 (r324919) +++ head/sys/arm/arm/pmap-v6.c Mon Oct 23 15:34:05 2017 (r324920) @@ -3165,6 +3165,7 @@ pmap_pv_demote_pte1(pmap_t pmap, vm_offset_t va, vm_pa } while (va < va_last); } +#if VM_NRESERVLEVEL > 0 static void pmap_pv_promote_pte1(pmap_t pmap, vm_offset_t va, vm_paddr_t pa) { @@ -3198,6 +3199,7 @@ pmap_pv_promote_pte1(pmap_t pmap, vm_offset_t va, vm_p pmap_pvh_free(&m->md, pmap, va); } while (va < va_last); } +#endif /* * Conditionally create a pv entry. @@ -3405,6 +3407,7 @@ pmap_change_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_o } #endif +#if VM_NRESERVLEVEL > 0 /* * Tries to promote the NPTE2_IN_PT2, contiguous 4KB page mappings that are * within a single page table page (PT2) to a single 1MB page mapping. @@ -3532,6 +3535,7 @@ pmap_promote_pte1(pmap_t pmap, pt1_entry_t *pte1p, vm_ PDEBUG(6, printf("%s(%p): success for va %#x pte1 %#x(%#x) at %p\n", __func__, pmap, va, npte1, pte1_load(pte1p), pte1p)); } +#endif /* VM_NRESERVLEVEL > 0 */ /* * Zero L2 page table page. @@ -4053,6 +4057,8 @@ validate: va, opte2, npte2); } #endif + +#if VM_NRESERVLEVEL > 0 /* * If both the L2 page table page and the reservation are fully * populated, then attempt promotion. @@ -4061,6 +4067,7 @@ validate: sp_enabled && (m->flags & PG_FICTITIOUS) == 0 && vm_reserv_level_iffullpop(m) == 0) pmap_promote_pte1(pmap, pte1p, va); +#endif sched_unpin(); rw_wunlock(&pvh_global_lock); PMAP_UNLOCK(pmap); Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Oct 23 11:12:09 2017 (r324919) +++ head/sys/arm64/arm64/pmap.c Mon Oct 23 15:34:05 2017 (r324920) @@ -105,6 +105,8 @@ __FBSDID("$FreeBSD$"); * and to when physical maps must be made correct. */ +#include "opt_vm.h" + #include #include #include @@ -2677,6 +2679,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent intr_restore(intr); } +#if VM_NRESERVLEVEL > 0 /* * After promotion from 512 4KB page mappings to a single 2MB page mapping, * replace the many pv entries for the 4KB page mappings by a single pv entry @@ -2790,6 +2793,7 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset CTR2(KTR_PMAP, "pmap_promote_l2: success for va %#lx in pmap %p", va, pmap); } +#endif /* VM_NRESERVLEVEL > 0 */ /* * Insert the given physical page (p) at @@ -3045,12 +3049,14 @@ validate: (prot & VM_PROT_EXECUTE) != 0) cpu_icache_sync_range(va, PAGE_SIZE); +#if VM_NRESERVLEVEL > 0 if ((mpte == NULL || mpte->wire_count == NL3PG) && pmap_superpages_enabled() && (m->flags & PG_FICTITIOUS) == 0 && vm_reserv_level_iffullpop(m) == 0) { pmap_promote_l2(pmap, pde, va, &lock); } +#endif } if (lock != NULL) Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Mon Oct 23 11:12:09 2017 (r324919) +++ head/sys/i386/i386/pmap.c Mon Oct 23 15:34:05 2017 (r324920) @@ -100,6 +100,7 @@ __FBSDID("$FreeBSD$"); #include "opt_cpu.h" #include "opt_pmap.h" #include "opt_smp.h" +#include "opt_vm.h" #include "opt_xbox.h" #include @@ -288,7 +289,9 @@ static void free_pv_entry(pmap_t pmap, pv_entry_t pv); static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try); static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); +#if VM_NRESERVLEVEL > 0 static void pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa); +#endif static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va); static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); @@ -309,7 +312,9 @@ static boolean_t pmap_is_referenced_pvh(struct md_page static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static void pmap_kenter_pde(vm_offset_t va, pd_entry_t newpde); static void pmap_pde_attr(pd_entry_t *pde, int cache_bits); +#if VM_NRESERVLEVEL > 0 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); +#endif static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); static void pmap_pte_attr(pt_entry_t *pte, int cache_bits); @@ -2504,6 +2509,7 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_pad } while (va < va_last); } +#if VM_NRESERVLEVEL > 0 static void pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa) { @@ -2537,6 +2543,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_pa pmap_pvh_free(&m->md, pmap, va); } while (va < va_last); } +#endif /* VM_NRESERVLEVEL > 0 */ static void pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va) @@ -3312,6 +3319,7 @@ retry: PMAP_UNLOCK(pmap); } +#if VM_NRESERVLEVEL > 0 /* * Tries to promote the 512 or 1024, contiguous 4KB page mappings that are * within a single page table page (PTP) to a single 2- or 4MB page mapping. @@ -3448,6 +3456,7 @@ setpte: CTR2(KTR_PMAP, "pmap_promote_pde: success for va %#x" " in pmap %p", va, pmap); } +#endif /* VM_NRESERVLEVEL > 0 */ /* * Insert the given physical page (p) at @@ -3664,6 +3673,7 @@ validate: pte_store(pte, newpte); } +#if VM_NRESERVLEVEL > 0 /* * If both the page table page and the reservation are fully * populated, then attempt promotion. @@ -3672,6 +3682,7 @@ validate: pg_ps_enabled && (m->flags & PG_FICTITIOUS) == 0 && vm_reserv_level_iffullpop(m) == 0) pmap_promote_pde(pmap, pde, va); +#endif sched_unpin(); rw_wunlock(&pvh_global_lock); From owner-svn-src-head@freebsd.org Mon Oct 23 15:43:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DB97E4E551; Mon, 23 Oct 2017 15:43:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4027B74942; Mon, 23 Oct 2017 15:43:39 +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 v9NFhcHl023745; Mon, 23 Oct 2017 15:43:38 GMT (envelope-from mjoras@FreeBSD.org) Received: (from mjoras@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NFhcUe023744; Mon, 23 Oct 2017 15:43:38 GMT (envelope-from mjoras@FreeBSD.org) Message-Id: <201710231543.v9NFhcUe023744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjoras set sender to mjoras@FreeBSD.org using -f From: Matt Joras Date: Mon, 23 Oct 2017 15:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324921 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: mjoras X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 324921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 15:43:39 -0000 Author: mjoras Date: Mon Oct 23 15:43:38 2017 New Revision: 324921 URL: https://svnweb.freebsd.org/changeset/base/324921 Log: Move clear_unrhdr to tmpfs_free_tmp. Clearing the unr in tmpfs_unmount is not correct. In the case of multiple references to the tmpfs mount (e.g. when there are lookup threads using it) it will not be the one to finish tmpfs_free_tmp. In those cases tmpfs_free_node_locked will be the final one to execute tmpfs_free_tmp, and until then the unr must be valid. Reported by: pho Approved/reviewed by: rstone (mentor) Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12749 Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 23 15:34:05 2017 (r324920) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 23 15:43:38 2017 (r324921) @@ -317,8 +317,6 @@ tmpfs_unmount(struct mount *mp, int mntflags) TMPFS_NODE_UNLOCK(node); } - clear_unrhdr(tmp->tm_ino_unr); - mp->mnt_data = NULL; tmpfs_free_tmp(tmp); vfs_write_resume(mp, VR_START_WRITE); @@ -344,6 +342,7 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp) uma_zdestroy(tmp->tm_dirent_pool); uma_zdestroy(tmp->tm_node_pool); + clear_unrhdr(tmp->tm_ino_unr); delete_unrhdr(tmp->tm_ino_unr); mtx_destroy(&tmp->tm_allnode_lock); From owner-svn-src-head@freebsd.org Mon Oct 23 16:02:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCE9DE4ECBD; Mon, 23 Oct 2017 16:02:49 +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 mx1.freebsd.org (Postfix) with ESMTPS id A447C7543C; Mon, 23 Oct 2017 16:02:49 +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 v9NG2mEt032016; Mon, 23 Oct 2017 16:02:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NG2mTE032015; Mon, 23 Oct 2017 16:02:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710231602.v9NG2mTE032015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 23 Oct 2017 16:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324923 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 324923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 16:02:50 -0000 Author: markj Date: Mon Oct 23 16:02:48 2017 New Revision: 324923 URL: https://svnweb.freebsd.org/changeset/base/324923 Log: Remove resource_set_*() declarations from sys/bus.h. The corresponding definitions were removed in r78135. PR: 223189 Submitted by: marc.priggemeyer@gmail.com MFC after: 1 week Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Mon Oct 23 16:02:05 2017 (r324922) +++ head/sys/sys/bus.h Mon Oct 23 16:02:48 2017 (r324923) @@ -632,7 +632,6 @@ struct sysctl_oid *devclass_get_sysctl_tree(devclass_t /* * Access functions for device resources. */ - int resource_int_value(const char *name, int unit, const char *resname, int *result); int resource_long_value(const char *name, int unit, const char *resname, @@ -644,12 +643,6 @@ int resource_find_match(int *anchor, const char **name const char *resname, const char *value); int resource_find_dev(int *anchor, const char *name, int *unit, const char *resname, const char *value); -int resource_set_int(const char *name, int unit, const char *resname, - int value); -int resource_set_long(const char *name, int unit, const char *resname, - long value); -int resource_set_string(const char *name, int unit, const char *resname, - const char *value); int resource_unset_value(const char *name, int unit, const char *resname); /* From owner-svn-src-head@freebsd.org Mon Oct 23 16:14:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5EB94E4F20C; Mon, 23 Oct 2017 16:14:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36C3375C71; Mon, 23 Oct 2017 16:14:56 +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 v9NGEtxb036361; Mon, 23 Oct 2017 16:14:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NGEtuP036360; Mon, 23 Oct 2017 16:14:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201710231614.v9NGEtuP036360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 23 Oct 2017 16:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324926 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 324926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 16:14:56 -0000 Author: kib Date: Mon Oct 23 16:14:55 2017 New Revision: 324926 URL: https://svnweb.freebsd.org/changeset/base/324926 Log: Expand explanation of atomicity. Mention per-location total order, out of thin air, and torn writes guarantees. Mention C11 standard' memory model and one most important FreeBSD additional requirement, that is aligned ordinary loads and stores are atomic on processors. The text is introductional and informal. Reference the C11 and C++1{1,4,7} standards for authorative description. In collaboration with: alc Sponsored by: The FreeBSD Foundation (kib) MFC after: 1 week Modified: head/share/man/man9/atomic.9 Modified: head/share/man/man9/atomic.9 ============================================================================== --- head/share/man/man9/atomic.9 Mon Oct 23 16:10:17 2017 (r324925) +++ head/share/man/man9/atomic.9 Mon Oct 23 16:14:55 2017 (r324926) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2017 +.Dd March 23, 2017 .Dt ATOMIC 9 .Os .Sh NAME @@ -76,10 +76,41 @@ .Ft int .Fn atomic_testandset_ "volatile *p" "u_int v" .Sh DESCRIPTION -Each of the atomic operations is guaranteed to be atomic across multiple -threads and in the presence of interrupts. -They can be used to implement reference counts or as building blocks for more -advanced synchronization primitives such as mutexes. +All of these operations are performed atomically across multiple +threads and in the presence of interrupts, meaning that they are +performed in an indivisible manner from the perspective of concurrently +running threads and interrupt handlers. +.Pp +When atomic operations are performed on cache-coherent memory, all +operations on the same location are totally ordered. +.Pp +When an atomic load is performed on a location in cache-coherent memory, +it reads the entire value that was defined by the last atomic store to +each byte of the location. +An atomic load will never return a value out of thin air. +When an atomic store is performed on a location, no other thread or +interrupt handler will observe a +.Em torn write , +or partial modification of the location. +.Pp +On all architectures supported by +.Fx , +ordinary loads and stores of naturally aligned integer types +are atomic, as executed by the processor. +.Pp +Atomic operations can be used to implement reference counts or as +building blocks for synchronization primitives such as mutexes. +.Pp +The semantics of +.Fx Ns 's +atomic operations are almost identical to those of the similarly named +C11 operations. +The one important difference is that the C11 standard does not +require ordinary loads and stores to ever be atomic. +This is is why the +.Fn atomic_load_explicit memory_order_relaxed +operation exists in the C11 standard, but is not provided by +.In machine/atomic.h . .Ss Types Each atomic operation operates on a specific .Fa type . From owner-svn-src-head@freebsd.org Mon Oct 23 16:28:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2797EE4F675 for ; Mon, 23 Oct 2017 16:28:31 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (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 732DE76456 for ; Mon, 23 Oct 2017 16:28:30 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 322c15c8-b80f-11e7-a893-25625093991c X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id 322c15c8-b80f-11e7-a893-25625093991c; Mon, 23 Oct 2017 16:28:27 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v9NGSMIQ001408; Mon, 23 Oct 2017 10:28:22 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1508776102.34364.7.camel@freebsd.org> Subject: Re: svn commit: r324926 - head/share/man/man9 From: Ian Lepore To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 23 Oct 2017 10:28:22 -0600 In-Reply-To: <201710231614.v9NGEtuP036360@repo.freebsd.org> References: <201710231614.v9NGEtuP036360@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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 16:28:31 -0000 On Mon, 2017-10-23 at 16:14 +0000, Konstantin Belousov wrote: > Author: kib > Date: Mon Oct 23 16:14:55 2017 > New Revision: 324926 > URL: https://svnweb.freebsd.org/changeset/base/324926 > > Log: >   Expand explanation of atomicity. >    >   Mention per-location total order, out of thin air, and torn writes >   guarantees.  Mention C11 standard' memory model and one most important >   FreeBSD additional requirement, that is aligned ordinary loads and >   stores are atomic on processors. >    > [...] > > +On all architectures supported by > +.Fx , > +ordinary loads and stores of naturally aligned integer types > +are atomic, as executed by the processor. This is not true on arm{v6,v7}.  64-bit integer types can be atomically loaded and stored with the appropriate functions from atomic.h, but are not ordinarily so, regardless of alignment.  Smaller integer types do meet this requirement. -- Ian From owner-svn-src-head@freebsd.org Mon Oct 23 16:40:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D98CE4FAB3; Mon, 23 Oct 2017 16:40:58 +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 96FEA76A76; Mon, 23 Oct 2017 16:40:57 +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 v9NGepjV099072 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 23 Oct 2017 19:40:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v9NGepjV099072 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v9NGepWc099071; Mon, 23 Oct 2017 19:40:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 23 Oct 2017 19:40:51 +0300 From: Konstantin Belousov To: Ian Lepore Cc: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r324926 - head/share/man/man9 Message-ID: <20171023164051.GP2473@kib.kiev.ua> References: <201710231614.v9NGEtuP036360@repo.freebsd.org> <1508776102.34364.7.camel@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1508776102.34364.7.camel@freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 16:40:58 -0000 On Mon, Oct 23, 2017 at 10:28:22AM -0600, Ian Lepore wrote: > On Mon, 2017-10-23 at 16:14 +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Mon Oct 23 16:14:55 2017 > > New Revision: 324926 > > URL: https://svnweb.freebsd.org/changeset/base/324926 > > > > Log: > > š Expand explanation of atomicity. > > šš > > š Mention per-location total order, out of thin air, and torn writes > > š guarantees.ššMention C11 standard' memory model and one most important > > š FreeBSD additional requirement, that is aligned ordinary loads and > > š stores are atomic on processors. > > šš > > [...] > > > > +On all architectures supported by > > +.Fx , > > +ordinary loads and stores of naturally aligned integer types > > +are atomic, as executed by the processor. > > This is not true on arm{v6,v7}. š64-bit integer types can be atomically > loaded and stored with the appropriate functions from atomic.h, but are > not ordinarily so, regardless of alignment. šSmaller integer types do > meet this requirement. You cannot load 64bit integer on ARM at all, because there is no 64bit GPRs. The LDRD and LDM instructions just reinforce the point. Same is true for all other 32bit arches. But perhaps you are right, mentioning the 'native size' there would be useful. Note that the statement contains the appendix 'as executed by processor'. For instance, there is nothing that would prevent compiler from splitting the access, either explicitly or by executing memcpy() instead of LDR/STR. I thought that this would provide big enough hint to not talk about native integers size. From owner-svn-src-head@freebsd.org Mon Oct 23 16:54:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13DA5E4FDB4; Mon, 23 Oct 2017 16:54:32 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCB2977364; Mon, 23 Oct 2017 16:54:31 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9NGsVbA053192; Mon, 23 Oct 2017 16:54:31 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NGsVcX053191; Mon, 23 Oct 2017 16:54:31 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201710231654.v9NGsVcX053191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 23 Oct 2017 16:54:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324928 - head/lib/libugidfw X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/libugidfw X-SVN-Commit-Revision: 324928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 16:54:32 -0000 Author: ngie Date: Mon Oct 23 16:54:30 2017 New Revision: 324928 URL: https://svnweb.freebsd.org/changeset/base/324928 Log: Remove dead stores The return value of various snprintf calls was stored in `len` and not used in many functions. MFC after: 1 week Reported by: clang-scanbuild Modified: head/lib/libugidfw/ugidfw.c Modified: head/lib/libugidfw/ugidfw.c ============================================================================== --- head/lib/libugidfw/ugidfw.c Mon Oct 23 16:50:33 2017 (r324927) +++ head/lib/libugidfw/ugidfw.c Mon Oct 23 16:54:30 2017 (r324928) @@ -512,7 +512,6 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max uid_t uid1, uid2; char *spec1, *spec2, *endp; unsigned long value; - size_t len; spec2 = spec; spec1 = strsep(&spec2, ":"); @@ -523,8 +522,7 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max else { value = strtoul(spec1, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid uid: '%s'", spec1); + snprintf(errstr, buflen, "invalid uid: '%s'", spec1); return (-1); } uid1 = value; @@ -541,8 +539,7 @@ bsde_parse_uidrange(char *spec, uid_t *min, uid_t *max else { value = strtoul(spec2, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid uid: '%s'", spec2); + snprintf(errstr, buflen, "invalid uid: '%s'", spec2); return (-1); } uid2 = value; @@ -561,7 +558,6 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max gid_t gid1, gid2; char *spec1, *spec2, *endp; unsigned long value; - size_t len; spec2 = spec; spec1 = strsep(&spec2, ":"); @@ -572,8 +568,7 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max else { value = strtoul(spec1, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid gid: '%s'", spec1); + snprintf(errstr, buflen, "invalid gid: '%s'", spec1); return (-1); } gid1 = value; @@ -590,8 +585,7 @@ bsde_parse_gidrange(char *spec, gid_t *min, gid_t *max else { value = strtoul(spec2, &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid gid: '%s'", spec2); + snprintf(errstr, buflen, "invalid gid: '%s'", spec2); return (-1); } gid2 = value; @@ -613,7 +607,6 @@ bsde_parse_subject(int argc, char *argv[], uid_t uid_min, uid_max; gid_t gid_min, gid_max; int jid = 0; - size_t len; long value; current = 0; @@ -630,11 +623,11 @@ bsde_parse_subject(int argc, char *argv[], while (current < argc) { if (strcmp(argv[current], "uid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "uid short"); + snprintf(errstr, buflen, "uid short"); return (-1); } if (flags & MBS_UID_DEFINED) { - len = snprintf(errstr, buflen, "one uid only"); + snprintf(errstr, buflen, "one uid only"); return (-1); } if (bsde_parse_uidrange(argv[current+1], @@ -648,11 +641,11 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "gid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "gid short"); + snprintf(errstr, buflen, "gid short"); return (-1); } if (flags & MBS_GID_DEFINED) { - len = snprintf(errstr, buflen, "one gid only"); + snprintf(errstr, buflen, "one gid only"); return (-1); } if (bsde_parse_gidrange(argv[current+1], @@ -666,17 +659,17 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "jailid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "prison short"); + snprintf(errstr, buflen, "prison short"); return (-1); } if (flags & MBS_PRISON_DEFINED) { - len = snprintf(errstr, buflen, "one jail only"); + snprintf(errstr, buflen, "one jail only"); return (-1); } value = strtol(argv[current+1], &endp, 10); if (*endp != '\0') { - len = snprintf(errstr, buflen, - "invalid jid: '%s'", argv[current+1]); + snprintf(errstr, buflen, "invalid jid: '%s'", + argv[current+1]); return (-1); } jid = value; @@ -688,14 +681,13 @@ bsde_parse_subject(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "!") == 0) { if (nextnot) { - len = snprintf(errstr, buflen, - "double negative"); + snprintf(errstr, buflen, "double negative"); return (-1); } nextnot = 1; current += 1; } else { - len = snprintf(errstr, buflen, "'%s' not expected", + snprintf(errstr, buflen, "'%s' not expected", argv[current]); return (-1); } @@ -723,7 +715,6 @@ bsde_parse_subject(int argc, char *argv[], static int bsde_parse_type(char *spec, int *type, size_t buflen, char *errstr) { - size_t len; int i; *type = 0; @@ -755,10 +746,10 @@ bsde_parse_type(char *spec, int *type, size_t buflen, *type |= MBO_ALL_TYPE; break; default: - len = snprintf(errstr, buflen, "Unknown type code: %c", + snprintf(errstr, buflen, "Unknown type code: %c", spec[i]); return (-1); - } + } } return (0); @@ -767,11 +758,10 @@ bsde_parse_type(char *spec, int *type, size_t buflen, static int bsde_parse_fsid(char *spec, struct fsid *fsid, size_t buflen, char *errstr) { - size_t len; struct statfs buf; if (statfs(spec, &buf) < 0) { - len = snprintf(errstr, buflen, "Unable to get id for %s: %s", + snprintf(errstr, buflen, "Unable to get id for %s: %s", spec, strerror(errno)); return (-1); } @@ -791,7 +781,6 @@ bsde_parse_object(int argc, char *argv[], uid_t uid_min, uid_max; gid_t gid_min, gid_max; struct fsid fsid; - size_t len; current = 0; flags = 0; @@ -808,11 +797,11 @@ bsde_parse_object(int argc, char *argv[], while (current < argc) { if (strcmp(argv[current], "uid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "uid short"); + snprintf(errstr, buflen, "uid short"); return (-1); } if (flags & MBO_UID_DEFINED) { - len = snprintf(errstr, buflen, "one uid only"); + snprintf(errstr, buflen, "one uid only"); return (-1); } if (bsde_parse_uidrange(argv[current+1], @@ -826,11 +815,11 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "gid") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "gid short"); + snprintf(errstr, buflen, "gid short"); return (-1); } if (flags & MBO_GID_DEFINED) { - len = snprintf(errstr, buflen, "one gid only"); + snprintf(errstr, buflen, "one gid only"); return (-1); } if (bsde_parse_gidrange(argv[current+1], @@ -844,11 +833,11 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "filesys") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "filesys short"); + snprintf(errstr, buflen, "filesys short"); return (-1); } if (flags & MBO_FSID_DEFINED) { - len = snprintf(errstr, buflen, "one fsid only"); + snprintf(errstr, buflen, "one fsid only"); return (-1); } if (bsde_parse_fsid(argv[current+1], &fsid, @@ -890,11 +879,11 @@ bsde_parse_object(int argc, char *argv[], current += 1; } else if (strcmp(argv[current], "type") == 0) { if (current + 2 > argc) { - len = snprintf(errstr, buflen, "type short"); + snprintf(errstr, buflen, "type short"); return (-1); } if (flags & MBO_TYPE_DEFINED) { - len = snprintf(errstr, buflen, "one type only"); + snprintf(errstr, buflen, "one type only"); return (-1); } if (bsde_parse_type(argv[current+1], &type, @@ -908,14 +897,14 @@ bsde_parse_object(int argc, char *argv[], current += 2; } else if (strcmp(argv[current], "!") == 0) { if (nextnot) { - len = snprintf(errstr, buflen, + snprintf(errstr, buflen, "double negative'"); return (-1); } nextnot = 1; current += 1; } else { - len = snprintf(errstr, buflen, "'%s' not expected", + snprintf(errstr, buflen, "'%s' not expected", argv[current]); return (-1); } @@ -946,16 +935,15 @@ int bsde_parse_mode(int argc, char *argv[], mode_t *mode, size_t buflen, char *errstr) { - size_t len; int i; if (argc == 0) { - len = snprintf(errstr, buflen, "mode expects mode value"); + snprintf(errstr, buflen, "mode expects mode value"); return (-1); } if (argc != 1) { - len = snprintf(errstr, buflen, "'%s' unexpected", argv[1]); + snprintf(errstr, buflen, "'%s' unexpected", argv[1]); return (-1); } @@ -981,7 +969,7 @@ bsde_parse_mode(int argc, char *argv[], mode_t *mode, /* ignore */ break; default: - len = snprintf(errstr, buflen, "Unknown mode letter: %c", + snprintf(errstr, buflen, "Unknown mode letter: %c", argv[0][i]); return (-1); } @@ -998,17 +986,16 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd int object, object_elements, object_elements_length; int mode, mode_elements, mode_elements_length; int error, i; - size_t len; bzero(rule, sizeof(*rule)); if (argc < 1) { - len = snprintf(errstr, buflen, "Rule must begin with subject"); + snprintf(errstr, buflen, "Rule must begin with subject"); return (-1); } if (strcmp(argv[0], "subject") != 0) { - len = snprintf(errstr, buflen, "Rule must begin with subject"); + snprintf(errstr, buflen, "Rule must begin with subject"); return (-1); } subject = 0; @@ -1022,7 +1009,7 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd object = i; if (object == -1) { - len = snprintf(errstr, buflen, "Rule must contain an object"); + snprintf(errstr, buflen, "Rule must contain an object"); return (-1); } @@ -1033,7 +1020,7 @@ bsde_parse_rule(int argc, char *argv[], struct mac_bsd mode = i; if (mode == -1) { - len = snprintf(errstr, buflen, "Rule must contain mode"); + snprintf(errstr, buflen, "Rule must contain mode"); return (-1); } @@ -1112,12 +1099,12 @@ bsde_check_version(size_t buflen, char *errstr) len = sizeof(version); error = sysctlbyname(MIB ".rule_version", &version, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "version check failed: %s", + snprintf(errstr, buflen, "version check failed: %s", strerror(errno)); return (-1); } if (version != MB_VERSION) { - len = snprintf(errstr, buflen, "module v%d != library v%d", + snprintf(errstr, buflen, "module v%d != library v%d", version, MB_VERSION); return (-1); } @@ -1134,11 +1121,11 @@ bsde_get_rule_count(size_t buflen, char *errstr) len = sizeof(rule_count); error = sysctlbyname(MIB ".rule_count", &rule_count, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "%s", strerror(errno)); + snprintf(errstr, buflen, "%s", strerror(errno)); return (-1); } if (len != sizeof(rule_count)) { - len = snprintf(errstr, buflen, "Data error in %s.rule_count", + snprintf(errstr, buflen, "Data error in %s.rule_count", MIB); return (-1); } @@ -1156,12 +1143,11 @@ bsde_get_rule_slots(size_t buflen, char *errstr) len = sizeof(rule_slots); error = sysctlbyname(MIB ".rule_slots", &rule_slots, &len, NULL, 0); if (error) { - len = snprintf(errstr, buflen, "%s", strerror(errno)); + snprintf(errstr, buflen, "%s", strerror(errno)); return (-1); } if (len != sizeof(rule_slots)) { - len = snprintf(errstr, buflen, "Data error in %s.rule_slots", - MIB); + snprintf(errstr, buflen, "Data error in %s.rule_slots", MIB); return (-1); } @@ -1187,7 +1173,7 @@ bsde_get_rule(int rulenum, struct mac_bsdextended_rule len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, errlen, "%s: %s", MIB ".rules", + snprintf(errstr, errlen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1199,11 +1185,11 @@ bsde_get_rule(int rulenum, struct mac_bsdextended_rule if (error == -1 && errno == ENOENT) return (-2); if (error) { - len = snprintf(errstr, errlen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, errlen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } else if (size != sizeof(*rule)) { - len = snprintf(errstr, errlen, "Data error in %s.%d: %s", + snprintf(errstr, errlen, "Data error in %s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1225,7 +1211,7 @@ bsde_delete_rule(int rulenum, size_t buflen, char *err len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1235,7 +1221,7 @@ bsde_delete_rule(int rulenum, size_t buflen, char *err error = sysctl(name, len, NULL, NULL, &rule, 0); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1257,7 +1243,7 @@ bsde_set_rule(int rulenum, struct mac_bsdextended_rule len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } @@ -1267,7 +1253,7 @@ bsde_set_rule(int rulenum, struct mac_bsdextended_rule error = sysctl(name, len, NULL, NULL, rule, sizeof(*rule)); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rulenum, strerror(errno)); return (-1); } @@ -1290,14 +1276,14 @@ bsde_add_rule(int *rulenum, struct mac_bsdextended_rul len = 10; error = bsde_get_mib(MIB ".rules", name, &len); if (error) { - len = snprintf(errstr, buflen, "%s: %s", MIB ".rules", + snprintf(errstr, buflen, "%s: %s", MIB ".rules", strerror(errno)); return (-1); } rule_slots = bsde_get_rule_slots(BUFSIZ, charstr); if (rule_slots == -1) { - len = snprintf(errstr, buflen, "unable to get rule slots: %s", + snprintf(errstr, buflen, "unable to get rule slots: %s", strerror(errno)); return (-1); } @@ -1307,7 +1293,7 @@ bsde_add_rule(int *rulenum, struct mac_bsdextended_rul error = sysctl(name, len, NULL, NULL, rule, sizeof(*rule)); if (error) { - len = snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", + snprintf(errstr, buflen, "%s.%d: %s", MIB ".rules", rule_slots, strerror(errno)); return (-1); } From owner-svn-src-head@freebsd.org Mon Oct 23 16:55:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 064D1E4FE19; Mon, 23 Oct 2017 16:55:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8686774B0; Mon, 23 Oct 2017 16:55:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9NGtN7P053293; Mon, 23 Oct 2017 16:55:23 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NGtMwE053291; Mon, 23 Oct 2017 16:55:22 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201710231655.v9NGtMwE053291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Mon, 23 Oct 2017 16:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324929 - head/lib/libugidfw X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/lib/libugidfw X-SVN-Commit-Revision: 324929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 16:55:24 -0000 Author: ngie Date: Mon Oct 23 16:55:22 2017 New Revision: 324929 URL: https://svnweb.freebsd.org/changeset/base/324929 Log: Clean up trailing whitespace MFC after: 1 week Modified: head/lib/libugidfw/Makefile head/lib/libugidfw/ugidfw.c Modified: head/lib/libugidfw/Makefile ============================================================================== --- head/lib/libugidfw/Makefile Mon Oct 23 16:54:30 2017 (r324928) +++ head/lib/libugidfw/Makefile Mon Oct 23 16:55:22 2017 (r324929) @@ -2,7 +2,7 @@ PACKAGE=lib${LIB} LIB= ugidfw -SHLIB_MAJOR= 5 +SHLIB_MAJOR= 5 SRCS= ugidfw.c INCS= ugidfw.h Modified: head/lib/libugidfw/ugidfw.c ============================================================================== --- head/lib/libugidfw/ugidfw.c Mon Oct 23 16:54:30 2017 (r324928) +++ head/lib/libugidfw/ugidfw.c Mon Oct 23 16:55:22 2017 (r324929) @@ -194,7 +194,7 @@ bsde_rule_to_string(struct mac_bsdextended_rule *rule, cur += len; } if (rule->mbr_subject.mbs_flags & MBS_PRISON_DEFINED) { - len = snprintf(cur, left, "jailid %d ", + len = snprintf(cur, left, "jailid %d ", rule->mbr_subject.mbs_prison); if (len < 0 || len > left) goto truncated; @@ -334,7 +334,7 @@ bsde_rule_to_string(struct mac_bsdextended_rule *rule, &(mntbuf[i].f_fsid), sizeof(mntbuf[i].f_fsid)) == 0) break; - len = snprintf(cur, left, "filesys %s ", + len = snprintf(cur, left, "filesys %s ", i == numfs ? "???" : mntbuf[i].f_mntonname); if (len < 0 || len > left) goto truncated; @@ -972,7 +972,7 @@ bsde_parse_mode(int argc, char *argv[], mode_t *mode, snprintf(errstr, buflen, "Unknown mode letter: %c", argv[0][i]); return (-1); - } + } } return (0); From owner-svn-src-head@freebsd.org Mon Oct 23 20:32:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A88AE54753; Mon, 23 Oct 2017 20:32:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 080EC836BC; Mon, 23 Oct 2017 20:32:18 +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 v9NKWIhj044179; Mon, 23 Oct 2017 20:32:18 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NKWImw044178; Mon, 23 Oct 2017 20:32:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201710232032.v9NKWImw044178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 23 Oct 2017 20:32:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324936 - head/share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man8 X-SVN-Commit-Revision: 324936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 20:32:19 -0000 Author: emaste Date: Mon Oct 23 20:32:18 2017 New Revision: 324936 URL: https://svnweb.freebsd.org/changeset/base/324936 Log: uefi.8: mention use on (32-bit) arm Sponsored by: The FreeBSD Foundation Modified: head/share/man/man8/uefi.8 Modified: head/share/man/man8/uefi.8 ============================================================================== --- head/share/man/man8/uefi.8 Mon Oct 23 19:15:51 2017 (r324935) +++ head/share/man/man8/uefi.8 Mon Oct 23 20:32:18 2017 (r324936) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 11, 2016 +.Dd October 23, 2017 .Dt UEFI 8 .Os .Sh NAME @@ -37,7 +37,7 @@ Unified Extensible Firmware Interface provides boot- a to operating systems. .Nm is a replacement for the legacy BIOS on the i386 and amd64 CPU architectures, -and is also used on arm64 and ia64. +and is also used on arm, arm64 and ia64. .Pp The .Nm From owner-svn-src-head@freebsd.org Mon Oct 23 20:50:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA329E54E70; Mon, 23 Oct 2017 20:50:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id B9C0B8420D; Mon, 23 Oct 2017 20:50:09 +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 v9NKo8M3051201; Mon, 23 Oct 2017 20:50:08 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NKo8fP051200; Mon, 23 Oct 2017 20:50:08 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201710232050.v9NKo8fP051200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Mon, 23 Oct 2017 20:50:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324937 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 324937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 20:50:10 -0000 Author: shurd Date: Mon Oct 23 20:50:08 2017 New Revision: 324937 URL: https://svnweb.freebsd.org/changeset/base/324937 Log: Some cache related optimizations 1. prefetch 128 bytes of mbufs. 2. Re-order filling the pkt_info so cache stalls happen at the end 3. Define empty prefetch2cachelines() macro when the function isn't present. Provides small performance improvments on some hardware Reviewed by: sbruno Approved by: sbruno (mentor) Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D12447 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Mon Oct 23 20:32:18 2017 (r324936) +++ head/sys/net/iflib.c Mon Oct 23 20:50:08 2017 (r324937) @@ -1227,8 +1227,17 @@ prefetch(void *x) { __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); } +static __inline void +prefetch2cachelines(void *x) +{ + __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); +#if (CACHE_LINE_SIZE < 128) + __asm volatile("prefetcht0 %0" :: "m" (*(((unsigned long *)x)+CACHE_LINE_SIZE/(sizeof(unsigned long))))); +#endif +} #else #define prefetch(x) +#define prefetch2cachelines(x) #endif static void @@ -3086,12 +3095,12 @@ iflib_encap(iflib_txq_t txq, struct mbuf **m_headp) m_head = *m_headp; pkt_info_zero(&pi); - pi.ipi_len = m_head->m_pkthdr.len; pi.ipi_mflags = (m_head->m_flags & (M_VLANTAG|M_BCAST|M_MCAST)); - pi.ipi_csum_flags = m_head->m_pkthdr.csum_flags; - pi.ipi_vtag = (m_head->m_flags & M_VLANTAG) ? m_head->m_pkthdr.ether_vtag : 0; pi.ipi_pidx = pidx; pi.ipi_qsidx = txq->ift_id; + pi.ipi_len = m_head->m_pkthdr.len; + pi.ipi_csum_flags = m_head->m_pkthdr.csum_flags; + pi.ipi_vtag = (m_head->m_flags & M_VLANTAG) ? m_head->m_pkthdr.ether_vtag : 0; /* deliberate bitwise OR to make one condition */ if (__predict_true((pi.ipi_csum_flags | pi.ipi_vtag))) { @@ -3323,10 +3332,10 @@ _ring_peek_one(struct ifmp_ring *r, int cidx, int offs prefetch(items[(cidx + offset) & (size-1)]); if (remaining > 1) { - prefetch(&items[next]); - prefetch(items[(cidx + offset + 1) & (size-1)]); - prefetch(items[(cidx + offset + 2) & (size-1)]); - prefetch(items[(cidx + offset + 3) & (size-1)]); + prefetch2cachelines(&items[next]); + prefetch2cachelines(items[(cidx + offset + 1) & (size-1)]); + prefetch2cachelines(items[(cidx + offset + 2) & (size-1)]); + prefetch2cachelines(items[(cidx + offset + 3) & (size-1)]); } return (__DEVOLATILE(struct mbuf **, &r->items[(cidx + offset) & (size-1)])); } From owner-svn-src-head@freebsd.org Mon Oct 23 21:31:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EC2EE558F3; Mon, 23 Oct 2017 21:31:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A50EAAA; Mon, 23 Oct 2017 21:31:05 +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 v9NLV4h3068826; Mon, 23 Oct 2017 21:31:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NLV4Rb068825; Mon, 23 Oct 2017 21:31:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201710232131.v9NLV4Rb068825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 23 Oct 2017 21:31:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/jemalloc/include/jemalloc/internal X-SVN-Commit-Revision: 324938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 21:31:05 -0000 Author: dim Date: Mon Oct 23 21:31:04 2017 New Revision: 324938 URL: https://svnweb.freebsd.org/changeset/base/324938 Log: After jemalloc was updated to version 5.0.0 in r319971, i386 executables linked with AddressSanitizer (even those linked on earlier versions of FreeBSD, or with external versions of clang) started failing with errors similar to: ==14688==AddressSanitizer CHECK failed: /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36 "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0) This is because AddressSanitizer expects all the TLS data in the program to be aligned to at least 8 bytes. Before the jemalloc 5.0.0 update, all the TLS data in the i386 version of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this grow to 2404 bytes (not a multiple of 8). This is due to added caching data in jemalloc's internal struct tsd_s. To fix AddressSanitizer, ensure this struct is aligned to at least 16 bytes, which can be done unconditionally for all architectures. (An earlier version of the fix aligned the struct to 8 bytes, but only for ILP32 architectures. This was deemed unnecessarily complicated.) PR: 221337 X-MFC-With: r319971 Modified: head/contrib/jemalloc/include/jemalloc/internal/tsd.h Modified: head/contrib/jemalloc/include/jemalloc/internal/tsd.h ============================================================================== --- head/contrib/jemalloc/include/jemalloc/internal/tsd.h Mon Oct 23 20:50:08 2017 (r324937) +++ head/contrib/jemalloc/include/jemalloc/internal/tsd.h Mon Oct 23 21:31:04 2017 (r324938) @@ -120,7 +120,8 @@ struct tsd_s { t use_a_getter_or_setter_instead_##n; MALLOC_TSD #undef O -}; +/* AddressSanitizer requires TLS data to be aligned to at least 8 bytes. */ +} JEMALLOC_ALIGNED(16); /* * Wrapper around tsd_t that makes it possible to avoid implicit conversion From owner-svn-src-head@freebsd.org Mon Oct 23 23:05:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 514EBE57B15; Mon, 23 Oct 2017 23:05:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 126D663959; Mon, 23 Oct 2017 23:05:30 +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 v9NN5TIv009364; Mon, 23 Oct 2017 23:05:29 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NN5T7K009363; Mon, 23 Oct 2017 23:05:29 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201710232305.v9NN5T7K009363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 23 Oct 2017 23:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324940 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 324940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 23:05:30 -0000 Author: asomers Date: Mon Oct 23 23:05:29 2017 New Revision: 324940 URL: https://svnweb.freebsd.org/changeset/base/324940 Log: Fix the error message when creating a zpool on a too-small device Don't check for SPA_MINDEVSIZE in vdev_geom_attach when opening by path. It's redundant with the check in vdev_open, and failing to attach here results in the wrong error message being printed. However, still check for it in some other situations: * When opening by guids, so we don't get bogged down reading from slow devices like floppy drives. * In vdev_geom_read_pool_label for the same reason, because we iterate over all providers. * If the caller requests that we verify the guid, because then we'll have to read from the device before vdev_open verifies the size. PR: 222227 Reported by: Marie Helene Kvello-Aune Reviewed by: avg, mav MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12531 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Oct 23 22:50:37 2017 (r324939) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Oct 23 23:05:29 2017 (r324940) @@ -193,7 +193,7 @@ vdev_geom_orphan(struct g_consumer *cp) } static struct g_consumer * -vdev_geom_attach(struct g_provider *pp, vdev_t *vd) +vdev_geom_attach(struct g_provider *pp, vdev_t *vd, boolean_t sanity) { struct g_geom *gp; struct g_consumer *cp; @@ -203,14 +203,18 @@ vdev_geom_attach(struct g_provider *pp, vdev_t *vd) ZFS_LOG(1, "Attaching to %s.", pp->name); - if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) { - ZFS_LOG(1, "Failing attach of %s. Incompatible sectorsize %d\n", - pp->name, pp->sectorsize); - return (NULL); - } else if (pp->mediasize < SPA_MINDEVSIZE) { - ZFS_LOG(1, "Failing attach of %s. Incompatible mediasize %ju\n", - pp->name, pp->mediasize); - return (NULL); + if (sanity) { + if (pp->sectorsize > VDEV_PAD_SIZE || !ISP2(pp->sectorsize)) { + ZFS_LOG(1, "Failing attach of %s. " + "Incompatible sectorsize %d\n", + pp->name, pp->sectorsize); + return (NULL); + } else if (pp->mediasize < SPA_MINDEVSIZE) { + ZFS_LOG(1, "Failing attach of %s. " + "Incompatible mediasize %ju\n", + pp->name, pp->mediasize); + return (NULL); + } } /* Do we have geom already? No? Create one. */ @@ -587,7 +591,7 @@ vdev_geom_read_pool_label(const char *name, LIST_FOREACH(pp, &gp->provider, provider) { if (pp->flags & G_PF_WITHER) continue; - zcp = vdev_geom_attach(pp, NULL); + zcp = vdev_geom_attach(pp, NULL, B_TRUE); if (zcp == NULL) continue; g_topology_unlock(); @@ -627,7 +631,7 @@ vdev_attach_ok(vdev_t *vd, struct g_provider *pp) struct g_consumer *cp; int nlabels; - cp = vdev_geom_attach(pp, NULL); + cp = vdev_geom_attach(pp, NULL, B_TRUE); if (cp == NULL) { ZFS_LOG(1, "Unable to attach tasting instance to %s.", pp->name); @@ -635,14 +639,12 @@ vdev_attach_ok(vdev_t *vd, struct g_provider *pp) } g_topology_unlock(); nlabels = vdev_geom_read_config(cp, &config); + g_topology_lock(); + vdev_geom_detach(cp, B_TRUE); if (nlabels == 0) { - g_topology_lock(); - vdev_geom_detach(cp, B_TRUE); ZFS_LOG(1, "Unable to read config from %s.", pp->name); return (NO_MATCH); } - g_topology_lock(); - vdev_geom_detach(cp, B_TRUE); pool_guid = 0; (void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &pool_guid); @@ -714,7 +716,7 @@ vdev_geom_attach_by_guids(vdev_t *vd) out: if (best_pp) { - cp = vdev_geom_attach(best_pp, vd); + cp = vdev_geom_attach(best_pp, vd, B_TRUE); if (cp == NULL) { printf("ZFS WARNING: Unable to attach to %s.\n", best_pp->name); @@ -768,7 +770,7 @@ vdev_geom_open_by_path(vdev_t *vd, int check_guid) if (pp != NULL) { ZFS_LOG(1, "Found provider by name %s.", vd->vdev_path); if (!check_guid || vdev_attach_ok(vd, pp) == FULL_MATCH) - cp = vdev_geom_attach(pp, vd); + cp = vdev_geom_attach(pp, vd, B_FALSE); } return (cp); From owner-svn-src-head@freebsd.org Mon Oct 23 23:12:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 085BDE57DB8; Mon, 23 Oct 2017 23:12:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D677F640CB; Mon, 23 Oct 2017 23:12:02 +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 v9NNC1xB011028; Mon, 23 Oct 2017 23:12:01 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9NNC1B0011025; Mon, 23 Oct 2017 23:12:01 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201710232312.v9NNC1B0011025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 23 Oct 2017 23:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324941 - in head: lib/libc/sys sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: lib/libc/sys sys/kern X-SVN-Commit-Revision: 324941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Oct 2017 23:12:03 -0000 Author: asomers Date: Mon Oct 23 23:12:01 2017 New Revision: 324941 URL: https://svnweb.freebsd.org/changeset/base/324941 Log: Remove artificial restriction on lio_listio's operation count In r322258 I made p1003_1b.aio_listio_max a tunable. However, further investigation shows that there was never any good reason for that limit to exist in the first place. It's used in two completely different ways: * To size a UMA zone, which globally limits the number of concurrent aio_suspend calls. * To artifically limit the number of operations in a single lio_listio call. There doesn't seem to be any memory allocation associated with this limit. This change does two things: * Properly names aio_suspend's UMA zone, and sizes it based on a new constant. * Eliminates the artifical restriction on lio_listio. Instead, lio_listio calls will now be limited by the more generous max_aio_queue_per_proc. The old p1003_1b.aio_listio_max is now an alias for vfs.aio.max_aio_queue_per_proc, so sysconf(3) will still work with _SC_AIO_LISTIO_MAX. Reported by: bde Reviewed by: jhb MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12120 Modified: head/lib/libc/sys/aio_suspend.2 head/lib/libc/sys/lio_listio.2 head/sys/kern/vfs_aio.c Modified: head/lib/libc/sys/aio_suspend.2 ============================================================================== --- head/lib/libc/sys/aio_suspend.2 Mon Oct 23 23:05:29 2017 (r324940) +++ head/lib/libc/sys/aio_suspend.2 Mon Oct 23 23:12:01 2017 (r324941) @@ -85,10 +85,10 @@ expired before any I/O requests completed. The .Fa iocbs argument -contains more than -.Dv AIO_LISTIO_MAX -asynchronous I/O requests, or at least one of the requests is not -valid. +contains more asynchronous I/O requests than the +.Va vfs.aio.max_aio_queue_per_proc +.Xr sysctl 8 +variable, or at least one of the requests is not valid. .It Bq Er EINTR the suspend was interrupted by a signal. .El Modified: head/lib/libc/sys/lio_listio.2 ============================================================================== --- head/lib/libc/sys/lio_listio.2 Mon Oct 23 23:05:29 2017 (r324940) +++ head/lib/libc/sys/lio_listio.2 Mon Oct 23 23:12:01 2017 (r324941) @@ -161,7 +161,7 @@ function will fail if: There are not enough resources to enqueue the requests. .It Bq Er EAGAIN The request would cause the system-wide limit -.Dv AIO_MAX +.Dv {AIO_MAX} to be exceeded. .It Bq Er EINVAL The @@ -173,7 +173,7 @@ nor or .Fa nent is greater than -.Dv AIO_LISTIO_MAX . +.Dv {AIO_LISTIO_MAX} . .It Bq Er EINVAL The asynchronous notification method in .Fa sig->sigev_notify Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Mon Oct 23 23:05:29 2017 (r324940) +++ head/sys/kern/vfs_aio.c Mon Oct 23 23:12:01 2017 (r324941) @@ -90,11 +90,11 @@ static uint64_t jobseqno; #endif #ifndef MAX_AIO_QUEUE_PER_PROC -#define MAX_AIO_QUEUE_PER_PROC 256 /* Bigger than AIO_LISTIO_MAX */ +#define MAX_AIO_QUEUE_PER_PROC 256 #endif #ifndef MAX_AIO_QUEUE -#define MAX_AIO_QUEUE 1024 /* Bigger than AIO_LISTIO_MAX */ +#define MAX_AIO_QUEUE 1024 /* Bigger than MAX_AIO_QUEUE_PER_PROC */ #endif #ifndef MAX_BUF_AIO @@ -105,6 +105,7 @@ FEATURE(aio, "Asynchronous I/O"); SYSCTL_DECL(_p1003_1b); static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list"); +static MALLOC_DEFINE(M_AIOS, "aios", "aio_suspend aio control block list"); static SYSCTL_NODE(_vfs, OID_AUTO, aio, CTLFLAG_RW, 0, "Async IO management"); @@ -169,10 +170,14 @@ static int max_buf_aio = MAX_BUF_AIO; SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0, "Maximum buf aio requests per process (stored in the process)"); -static int aio_listio_max = AIO_LISTIO_MAX; +/* + * Though redundant with vfs.aio.max_aio_queue_per_proc, POSIX requires + * sysconf(3) to support AIO_LISTIO_MAX, and we implement that with + * vfs.aio.aio_listio_max. + */ SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max, - CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0, - "Maximum aio requests for a single lio_listio call"); + CTLFLAG_RD | CTLFLAG_CAPRD, &max_aio_queue_per_proc, + 0, "Maximum aio requests for a single lio_listio call"); #ifdef COMPAT_FREEBSD6 typedef struct oaiocb { @@ -334,10 +339,9 @@ static int filt_lio(struct knote *kn, long hint); * kaio Per process async io info * aiop async io process data * aiocb async io jobs - * aiol list io job pointer - internal to aio_suspend XXX * aiolio list io jobs */ -static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiol_zone, aiolio_zone; +static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiolio_zone; /* kqueue filters for aio */ static struct filterops aio_filtops = { @@ -394,11 +398,6 @@ static int aio_onceonly(void) { - if (aio_listio_max < AIO_LISTIO_MAX) - aio_listio_max = AIO_LISTIO_MAX; - if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)) - aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count); - exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, EVENTHANDLER_PRI_ANY); exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec, @@ -416,8 +415,6 @@ aio_onceonly(void) NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - aiol_zone = uma_zcreate("AIOL", aio_listio_max * sizeof(intptr_t) , - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiod_lifetime = AIOD_LIFETIME_DEFAULT; @@ -1953,7 +1950,7 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_ struct aiocb **ujoblist; int error; - if (uap->nent < 0 || uap->nent > aio_listio_max) + if (uap->nent < 0 || uap->nent > max_aio_queue_per_proc) return (EINVAL); if (uap->timeout) { @@ -1964,11 +1961,11 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_ } else tsp = NULL; - ujoblist = uma_zalloc(aiol_zone, M_WAITOK); + ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK); error = copyin(uap->aiocbp, ujoblist, uap->nent * sizeof(ujoblist[0])); if (error == 0) error = kern_aio_suspend(td, uap->nent, ujoblist, tsp); - uma_zfree(aiol_zone, ujoblist); + free(ujoblist, M_AIOS); return (error); } @@ -2161,7 +2158,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT)) return (EINVAL); - if (nent < 0 || nent > aio_listio_max) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (p->p_aioinfo == NULL) @@ -2293,7 +2290,7 @@ freebsd6_lio_listio(struct thread *td, struct freebsd6 return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > aio_listio_max) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2330,7 +2327,7 @@ sys_lio_listio(struct thread *td, struct lio_listio_ar return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > aio_listio_max) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2799,7 +2796,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs uint32_t *ujoblist32; int error, i; - if (uap->nent < 0 || uap->nent > aio_listio_max) + if (uap->nent < 0 || uap->nent > max_aio_queue_per_proc) return (EINVAL); if (uap->timeout) { @@ -2812,7 +2809,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs } else tsp = NULL; - ujoblist = uma_zalloc(aiol_zone, M_WAITOK); + ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK); ujoblist32 = (uint32_t *)ujoblist; error = copyin(uap->aiocbp, ujoblist32, uap->nent * sizeof(ujoblist32[0])); @@ -2822,7 +2819,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs error = kern_aio_suspend(td, uap->nent, ujoblist, tsp); } - uma_zfree(aiol_zone, ujoblist); + free(ujoblist, M_AIOS); return (error); } @@ -2925,7 +2922,7 @@ freebsd6_freebsd32_lio_listio(struct thread *td, return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > aio_listio_max) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2971,7 +2968,7 @@ freebsd32_lio_listio(struct thread *td, struct freebsd return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > aio_listio_max) + if (nent < 0 || nent > max_aio_queue_per_proc) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { From owner-svn-src-head@freebsd.org Tue Oct 24 02:25:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1327E37F5A; Tue, 24 Oct 2017 02:25:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7EF7D6B034; Tue, 24 Oct 2017 02:25:43 +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 v9O2PgGH092045; Tue, 24 Oct 2017 02:25:42 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9O2PgnK092044; Tue, 24 Oct 2017 02:25:42 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710240225.v9O2PgnK092044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 24 Oct 2017 02:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324944 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 324944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 02:25:43 -0000 Author: imp Date: Tue Oct 24 02:25:42 2017 New Revision: 324944 URL: https://svnweb.freebsd.org/changeset/base/324944 Log: Treat a 'current' value of 0 as unlimited as a failsfe. When limiting I/O, a value of 0 makes no sense as a limit. No progress can be made. Trade the possibility that someone might be doing something clever to achieve ultra-low I/O limits vs the damage of not ever making progress on an I/O in favor of making progress. Now the machine won't be useless if this accidentally gets requested. Sponsored by: Netflix Modified: head/sys/cam/cam_iosched.c Modified: head/sys/cam/cam_iosched.c ============================================================================== --- head/sys/cam/cam_iosched.c Tue Oct 24 00:51:11 2017 (r324943) +++ head/sys/cam/cam_iosched.c Tue Oct 24 02:25:42 2017 (r324944) @@ -457,9 +457,10 @@ cam_iosched_iops_caniop(struct iop_stats *ios, struct /* * So if we have any more IOPs left, allow it, - * otherwise wait. + * otherwise wait. If current iops is 0, treat that + * as unlimited as a failsafe. */ - if (ios->l_value1 <= 0) + if (ios->current > 0 && ios->l_value1 <= 0) return EAGAIN; return 0; } @@ -525,8 +526,11 @@ cam_iosched_bw_caniop(struct iop_stats *ios, struct bi * what we let through this quantum (to prevent the * starvation), at the cost of getting a little less * next quantum. + * + * Also note that if the current limit is <= 0, + * we treat it as unlimited as a failsafe. */ - if (ios->l_value1 <= 0) + if (ios->current > 0 && ios->l_value1 <= 0) return EAGAIN; From owner-svn-src-head@freebsd.org Tue Oct 24 05:41:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11ABBE40A50; Tue, 24 Oct 2017 05:41:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id E0A4C711DF; Tue, 24 Oct 2017 05:41:49 +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 v9O5fnR3072418; Tue, 24 Oct 2017 05:41:49 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9O5fmmn072412; Tue, 24 Oct 2017 05:41:48 GMT (envelope-from np@FreeBSD.org) Message-Id: <201710240541.v9O5fmmn072412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 24 Oct 2017 05:41:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324945 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 324945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 05:41:50 -0000 Author: np Date: Tue Oct 24 05:41:48 2017 New Revision: 324945 URL: https://svnweb.freebsd.org/changeset/base/324945 Log: cxgbe(4): Read the MPS buffer group map from the firmware as it could be different from hardware defaults. The congestion channel map, which is still fixed, needs to be tracked separately now. Change the congestion setting for TOE rx queues to match the drivers on other OSes while here. MFC after: 2 weeks Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue Oct 24 02:25:42 2017 (r324944) +++ head/sys/dev/cxgbe/adapter.h Tue Oct 24 05:41:48 2017 (r324945) @@ -287,7 +287,8 @@ struct port_info { uint8_t mod_type; uint8_t port_id; uint8_t tx_chan; - uint8_t rx_chan_map; /* rx MPS channel bitmap */ + uint8_t mps_bg_map; /* rx MPS buffer group bitmap */ + uint8_t rx_e_chan_map; /* rx TP e-channel bitmap */ struct link_config link_cfg; struct link_config old_link_cfg; @@ -796,7 +797,7 @@ struct adapter { struct taskqueue *tq[MAX_NCHAN]; /* General purpose taskqueues */ struct port_info *port[MAX_NPORTS]; - uint8_t chan_map[MAX_NCHAN]; + uint8_t chan_map[MAX_NCHAN]; /* channel -> port */ void *tom_softc; /* (struct tom_data *) */ struct tom_tunables tt; Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Tue Oct 24 02:25:42 2017 (r324944) +++ head/sys/dev/cxgbe/common/common.h Tue Oct 24 05:41:48 2017 (r324945) @@ -369,6 +369,8 @@ struct adapter_params { unsigned int max_ordird_qp; unsigned int max_ird_adapter; + + uint32_t mps_bg_map; /* rx buffer group map for all ports (upto 4) */ }; #define CHELSIO_T4 0x4 Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Tue Oct 24 02:25:42 2017 (r324944) +++ head/sys/dev/cxgbe/common/t4_hw.c Tue Oct 24 05:41:48 2017 (r324945) @@ -5895,6 +5895,24 @@ void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[] */ static unsigned int t4_get_mps_bg_map(struct adapter *adap, int idx) { + u32 n; + + if (adap->params.mps_bg_map) + return ((adap->params.mps_bg_map >> (idx << 3)) & 0xff); + + n = G_NUMPORTS(t4_read_reg(adap, A_MPS_CMN_CTL)); + if (n == 0) + return idx == 0 ? 0xf : 0; + if (n == 1 && chip_id(adap) <= CHELSIO_T5) + return idx < 2 ? (3 << (2 * idx)) : 0; + return 1 << idx; +} + +/* + * TP RX e-channels associated with the port. + */ +static unsigned int t4_get_rx_e_chan_map(struct adapter *adap, int idx) +{ u32 n = G_NUMPORTS(t4_read_reg(adap, A_MPS_CMN_CTL)); if (n == 0) @@ -5972,7 +5990,7 @@ void t4_get_port_stats_offset(struct adapter *adap, in */ void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) { - u32 bgmap = t4_get_mps_bg_map(adap, idx); + u32 bgmap = adap2pinfo(adap, idx)->mps_bg_map; u32 stat_ctl = t4_read_reg(adap, A_MPS_STAT_CTL); #define GET_STAT(name) \ @@ -6074,7 +6092,7 @@ void t4_get_port_stats(struct adapter *adap, int idx, */ void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) { - u32 bgmap = t4_get_mps_bg_map(adap, idx); + u32 bgmap = adap2pinfo(adap, idx)->mps_bg_map; #define GET_STAT(name) \ t4_read_reg64(adap, \ @@ -8379,7 +8397,8 @@ int t4_port_init(struct adapter *adap, int mbox, int p else p->vi[0].smt_idx = (ret & 0x7f); p->tx_chan = j; - p->rx_chan_map = t4_get_mps_bg_map(adap, j); + p->mps_bg_map = t4_get_mps_bg_map(adap, j); + p->rx_e_chan_map = t4_get_rx_e_chan_map(adap, j); p->lport = j; p->vi[0].rss_size = rss_size; t4_os_set_hw_addr(p, addr); @@ -9374,7 +9393,7 @@ int t4_set_filter_mode(struct adapter *adap, unsigned void t4_clr_port_stats(struct adapter *adap, int idx) { unsigned int i; - u32 bgmap = t4_get_mps_bg_map(adap, idx); + u32 bgmap = adap2pinfo(adap, idx)->mps_bg_map; u32 port_base_addr; if (is_t4(adap)) Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Oct 24 02:25:42 2017 (r324944) +++ head/sys/dev/cxgbe/t4_main.c Tue Oct 24 05:41:48 2017 (r324945) @@ -3563,6 +3563,19 @@ get_params__post_init(struct adapter *sc) ("%s: L2 table size (%u) larger than expected (%u)", __func__, sc->vres.l2t.size, L2T_SIZE)); + /* + * MPSBGMAP is queried separately because only recent firmwares support + * it as a parameter and we don't want the compound query above to fail + * on older firmwares. + */ + param[0] = FW_PARAM_DEV(MPSBGMAP); + val[0] = 0; + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) + sc->params.mps_bg_map = val[0]; + else + sc->params.mps_bg_map = 0; + /* get capabilites */ bzero(&caps, sizeof(caps)); caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | @@ -5061,8 +5074,7 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *v static void cxgbe_refresh_stats(struct adapter *sc, struct port_info *pi) { - int i; - u_int v, tnl_cong_drops; + u_int i, v, tnl_cong_drops, bg_map; struct timeval tv; const struct timeval interval = {0, 250000}; /* 250ms */ @@ -5073,14 +5085,15 @@ cxgbe_refresh_stats(struct adapter *sc, struct port_in tnl_cong_drops = 0; t4_get_port_stats(sc, pi->tx_chan, &pi->stats); - for (i = 0; i < sc->chip_params->nchan; i++) { - if (pi->rx_chan_map & (1 << i)) { - mtx_lock(&sc->reg_lock); - t4_read_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, - 1, A_TP_MIB_TNL_CNG_DROP_0 + i); - mtx_unlock(&sc->reg_lock); - tnl_cong_drops += v; - } + bg_map = pi->mps_bg_map; + while (bg_map) { + i = ffs(bg_map) - 1; + mtx_lock(&sc->reg_lock); + t4_read_indirect(sc, A_TP_MIB_INDEX, A_TP_MIB_DATA, &v, 1, + A_TP_MIB_TNL_CNG_DROP_0 + i); + mtx_unlock(&sc->reg_lock); + tnl_cong_drops += v; + bg_map &= ~(1 << i); } pi->tnl_cong_drops = tnl_cong_drops; getmicrotime(&pi->last_refreshed); @@ -5672,6 +5685,10 @@ cxgbe_sysctls(struct port_info *pi) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "max_speed", CTLFLAG_RD, NULL, port_top_speed(pi), "max speed (in Gbps)"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "mps_bg_map", CTLFLAG_RD, NULL, + pi->mps_bg_map, "MPS buffer group map"); + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "rx_e_chan_map", CTLFLAG_RD, + NULL, pi->rx_e_chan_map, "TP rx e-channel map"); if (sc->flags & IS_VF) return; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Tue Oct 24 02:25:42 2017 (r324944) +++ head/sys/dev/cxgbe/t4_sge.c Tue Oct 24 05:41:48 2017 (r324945) @@ -3085,7 +3085,7 @@ tnl_cong(struct port_info *pi, int drop) else if (drop == 1) return (0); else - return (pi->rx_chan_map); + return (pi->rx_e_chan_map); } static int @@ -3195,8 +3195,7 @@ alloc_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq struct sysctl_oid_list *children; char name[16]; - rc = alloc_iq_fl(vi, &ofld_rxq->iq, &ofld_rxq->fl, intr_idx, - pi->rx_chan_map); + rc = alloc_iq_fl(vi, &ofld_rxq->iq, &ofld_rxq->fl, intr_idx, 0); if (rc != 0) return (rc); From owner-svn-src-head@freebsd.org Tue Oct 24 08:39:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17968E44B70; Tue, 24 Oct 2017 08:39:07 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0CD47591C; Tue, 24 Oct 2017 08:39:06 +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 v9O8d6ud044400; Tue, 24 Oct 2017 08:39:06 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9O8d6u0044399; Tue, 24 Oct 2017 08:39:06 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201710240839.v9O8d6u0044399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 24 Oct 2017 08:39:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324947 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 324947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 08:39:07 -0000 Author: ae Date: Tue Oct 24 08:39:05 2017 New Revision: 324947 URL: https://svnweb.freebsd.org/changeset/base/324947 Log: Add IPv6 support for O_TCPDATALEN opcode. PR: 222746 MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Tue Oct 24 06:49:06 2017 (r324946) +++ head/sys/netpfil/ipfw/ip_fw2.c Tue Oct 24 08:39:05 2017 (r324947) @@ -963,7 +963,7 @@ ipfw_chk(struct ip_fw_args *args) uint8_t proto; uint16_t src_port = 0, dst_port = 0; /* NOTE: host format */ struct in_addr src_ip, dst_ip; /* NOTE: network format */ - uint16_t iplen=0; + int iplen = 0; int pktlen; uint16_t etype = 0; /* Host order stored ether type */ @@ -1205,6 +1205,7 @@ do { \ args->f_id.src_ip = 0; args->f_id.dst_ip = 0; args->f_id.flow_id6 = ntohl(ip6->ip6_flow); + iplen = ntohs(ip6->ip6_plen) + sizeof(*ip6); } else if (pktlen >= sizeof(struct ip) && (args->eh == NULL || etype == ETHERTYPE_IP) && ip->ip_v == 4) { is_ipv4 = 1; @@ -1219,7 +1220,6 @@ do { \ dst_ip = ip->ip_dst; offset = ntohs(ip->ip_off) & IP_OFFMASK; iplen = ntohs(ip->ip_len); - pktlen = iplen < pktlen ? iplen : pktlen; if (offset == 0) { switch (proto) { @@ -1258,6 +1258,7 @@ do { \ args->f_id.dst_ip = ntohl(dst_ip.s_addr); } #undef PULLUP_TO + pktlen = iplen < pktlen ? iplen: pktlen; if (proto) { /* we may have port numbers, store them */ args->f_id.proto = proto; args->f_id.src_port = src_port = ntohs(src_port); @@ -1771,10 +1772,25 @@ do { \ uint16_t x; uint16_t *p; int i; +#ifdef INET6 + if (is_ipv6) { + struct ip6_hdr *ip6; + ip6 = (struct ip6_hdr *)ip; + if (ip6->ip6_plen == 0) { + /* + * Jumbo payload is not + * supported by this + * opcode. + */ + break; + } + x = iplen - hlen; + } else +#endif /* INET6 */ + x = iplen - (ip->ip_hl << 2); tcp = TCP(ulp); - x = iplen - - ((ip->ip_hl + tcp->th_off) << 2); + x -= tcp->th_off << 2; if (cmdlen == 1) { match = (cmd->arg1 == x); break; From owner-svn-src-head@freebsd.org Tue Oct 24 10:48:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22AF3E48D05; Tue, 24 Oct 2017 10:48:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id E11767E6E9; Tue, 24 Oct 2017 10:48:27 +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 v9OAmRig098245; Tue, 24 Oct 2017 10:48:27 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OAmR0d098244; Tue, 24 Oct 2017 10:48:27 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710241048.v9OAmR0d098244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 24 Oct 2017 10:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324949 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 324949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 10:48:28 -0000 Author: trasz Date: Tue Oct 24 10:48:26 2017 New Revision: 324949 URL: https://svnweb.freebsd.org/changeset/base/324949 Log: Use xmalloc and read(2) instead of mmap(2) to read in libmap.conf(5). This removes the need to call munmap(2) afterwards. MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12767 Modified: head/libexec/rtld-elf/libmap.c Modified: head/libexec/rtld-elf/libmap.c ============================================================================== --- head/libexec/rtld-elf/libmap.c Tue Oct 24 08:56:11 2017 (r324948) +++ head/libexec/rtld-elf/libmap.c Tue Oct 24 10:48:26 2017 (r324949) @@ -100,6 +100,7 @@ lmc_parse_file(char *path) { struct lmc *p; struct stat st; + ssize_t retval; int fd; char *lm_map; @@ -128,10 +129,11 @@ lmc_parse_file(char *path) } } - lm_map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); - if (lm_map == (const char *)MAP_FAILED) { + lm_map = xmalloc(st.st_size); + retval = read(fd, lm_map, st.st_size); + if (retval != st.st_size) { close(fd); - dbg("lm_parse_file: mmap(\"%s\") failed, %s", path, + dbg("lm_parse_file: read(\"%s\") failed, %s", path, rtld_strerror(errno)); return; } @@ -142,7 +144,7 @@ lmc_parse_file(char *path) p->ino = st.st_ino; TAILQ_INSERT_HEAD(&lmc_head, p, next); lmc_parse(lm_map, st.st_size); - munmap(lm_map, st.st_size); + free(lm_map); } static void From owner-svn-src-head@freebsd.org Tue Oct 24 11:16:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F362E498A2; Tue, 24 Oct 2017 11:16:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6B9DE7F5DE; Tue, 24 Oct 2017 11:16:39 +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 v9OBGcSD010915; Tue, 24 Oct 2017 11:16:38 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OBGcq8010914; Tue, 24 Oct 2017 11:16:38 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710241116.v9OBGcq8010914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 24 Oct 2017 11:16:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324950 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 324950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 11:16:39 -0000 Author: trasz Date: Tue Oct 24 11:16:38 2017 New Revision: 324950 URL: https://svnweb.freebsd.org/changeset/base/324950 Log: Reword the conditional; it was ugly, and adding another parameter, which I'm going to do in a subsequent commit, would make it even uglier. No functional changes. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Oct 24 10:48:26 2017 (r324949) +++ head/libexec/rtld-elf/rtld.c Tue Oct 24 11:16:38 2017 (r324950) @@ -1620,27 +1620,54 @@ find_library(const char *xname, const Obj_Entry *refob * nodeflib. */ if (objgiven && refobj->rpath != NULL && ld_library_path_rpath) { - if ((pathname = search_library_path(name, ld_library_path)) != NULL || - (refobj != NULL && - (pathname = search_library_path(name, refobj->rpath)) != NULL) || - (pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL || - (pathname = search_library_path(name, gethints(false))) != NULL || - (pathname = search_library_path(name, ld_standard_library_path)) != NULL) + pathname = search_library_path(name, ld_library_path); + if (pathname != NULL) return (pathname); + if (refobj != NULL) { + pathname = search_library_path(name, refobj->rpath); + if (pathname != NULL) + return (pathname); + } + pathname = search_library_pathfds(name, ld_library_dirs, fdp); + if (pathname != NULL) + return (pathname); + pathname = search_library_path(name, gethints(false)); + if (pathname != NULL) + return (pathname); + pathname = search_library_path(name, ld_standard_library_path); + if (pathname != NULL) + return (pathname); } else { nodeflib = objgiven ? refobj->z_nodeflib : false; - if ((objgiven && - (pathname = search_library_path(name, refobj->rpath)) != NULL) || - (objgiven && refobj->runpath == NULL && refobj != obj_main && - (pathname = search_library_path(name, obj_main->rpath)) != NULL) || - (pathname = search_library_path(name, ld_library_path)) != NULL || - (objgiven && - (pathname = search_library_path(name, refobj->runpath)) != NULL) || - (pathname = search_library_pathfds(name, ld_library_dirs, fdp)) != NULL || - (pathname = search_library_path(name, gethints(nodeflib))) != NULL || - (objgiven && !nodeflib && - (pathname = search_library_path(name, ld_standard_library_path)) != NULL)) + if (objgiven) { + pathname = search_library_path(name, refobj->rpath); + if (pathname != NULL) + return (pathname); + } + if (objgiven && refobj->runpath == NULL && refobj != obj_main) { + pathname = search_library_path(name, obj_main->rpath); + if (pathname != NULL) + return (pathname); + } + pathname = search_library_path(name, ld_library_path); + if (pathname != NULL) return (pathname); + if (objgiven) { + pathname = search_library_path(name, refobj->runpath); + if (pathname != NULL) + return (pathname); + } + pathname = search_library_pathfds(name, ld_library_dirs, fdp); + if (pathname != NULL) + return (pathname); + pathname = search_library_path(name, gethints(nodeflib)); + if (pathname != NULL) + return (pathname); + if (objgiven && !nodeflib) { + pathname = search_library_path(name, ld_standard_library_path); + if (pathname != NULL) + return (pathname); + } } if (objgiven && refobj->path != NULL) { From owner-svn-src-head@freebsd.org Tue Oct 24 11:24:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 307BFE49B17; Tue, 24 Oct 2017 11:24:55 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0AB617FA14; Tue, 24 Oct 2017 11:24:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OBOsKR014816; Tue, 24 Oct 2017 11:24:54 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OBOsO4014815; Tue, 24 Oct 2017 11:24:54 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710241124.v9OBOsO4014815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 24 Oct 2017 11:24:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324951 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 324951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 11:24:55 -0000 Author: trasz Date: Tue Oct 24 11:24:54 2017 New Revision: 324951 URL: https://svnweb.freebsd.org/changeset/base/324951 Log: Make find_library() conform to style(9). No functional changes. Suggested by: kib MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Oct 24 11:16:38 2017 (r324950) +++ head/libexec/rtld-elf/rtld.c Tue Oct 24 11:24:54 2017 (r324951) @@ -1591,92 +1591,93 @@ gnu_hash(const char *s) static char * find_library(const char *xname, const Obj_Entry *refobj, int *fdp) { - char *pathname; - char *name; - bool nodeflib, objgiven; + char *pathname; + char *name; + bool nodeflib, objgiven; - objgiven = refobj != NULL; + objgiven = refobj != NULL; - if (libmap_disable || !objgiven || - (name = lm_find(refobj->path, xname)) == NULL) - name = (char *)xname; + if (libmap_disable || !objgiven || + (name = lm_find(refobj->path, xname)) == NULL) + name = (char *)xname; - if (strchr(name, '/') != NULL) { /* Hard coded pathname */ - if (name[0] != '/' && !trust) { - _rtld_error("Absolute pathname required for shared object \"%s\"", - name); - return (NULL); + if (strchr(name, '/') != NULL) { /* Hard coded pathname */ + if (name[0] != '/' && !trust) { + _rtld_error("Absolute pathname required " + "for shared object \"%s\"", name); + return (NULL); + } + return (origin_subst(__DECONST(Obj_Entry *, refobj), + __DECONST(char *, name))); } - return (origin_subst(__DECONST(Obj_Entry *, refobj), - __DECONST(char *, name))); - } - dbg(" Searching for \"%s\"", name); + dbg(" Searching for \"%s\"", name); - /* - * If refobj->rpath != NULL, then refobj->runpath is NULL. Fall - * back to pre-conforming behaviour if user requested so with - * LD_LIBRARY_PATH_RPATH environment variable and ignore -z - * nodeflib. - */ - if (objgiven && refobj->rpath != NULL && ld_library_path_rpath) { - pathname = search_library_path(name, ld_library_path); - if (pathname != NULL) - return (pathname); - if (refobj != NULL) { - pathname = search_library_path(name, refobj->rpath); - if (pathname != NULL) - return (pathname); + /* + * If refobj->rpath != NULL, then refobj->runpath is NULL. Fall + * back to pre-conforming behaviour if user requested so with + * LD_LIBRARY_PATH_RPATH environment variable and ignore -z + * nodeflib. + */ + if (objgiven && refobj->rpath != NULL && ld_library_path_rpath) { + pathname = search_library_path(name, ld_library_path); + if (pathname != NULL) + return (pathname); + if (refobj != NULL) { + pathname = search_library_path(name, refobj->rpath); + if (pathname != NULL) + return (pathname); + } + pathname = search_library_pathfds(name, ld_library_dirs, fdp); + if (pathname != NULL) + return (pathname); + pathname = search_library_path(name, gethints(false)); + if (pathname != NULL) + return (pathname); + pathname = search_library_path(name, ld_standard_library_path); + if (pathname != NULL) + return (pathname); + } else { + nodeflib = objgiven ? refobj->z_nodeflib : false; + if (objgiven) { + pathname = search_library_path(name, refobj->rpath); + if (pathname != NULL) + return (pathname); + } + if (objgiven && refobj->runpath == NULL && refobj != obj_main) { + pathname = search_library_path(name, obj_main->rpath); + if (pathname != NULL) + return (pathname); + } + pathname = search_library_path(name, ld_library_path); + if (pathname != NULL) + return (pathname); + if (objgiven) { + pathname = search_library_path(name, refobj->runpath); + if (pathname != NULL) + return (pathname); + } + pathname = search_library_pathfds(name, ld_library_dirs, fdp); + if (pathname != NULL) + return (pathname); + pathname = search_library_path(name, gethints(nodeflib)); + if (pathname != NULL) + return (pathname); + if (objgiven && !nodeflib) { + pathname = search_library_path(name, + ld_standard_library_path); + if (pathname != NULL) + return (pathname); + } } - pathname = search_library_pathfds(name, ld_library_dirs, fdp); - if (pathname != NULL) - return (pathname); - pathname = search_library_path(name, gethints(false)); - if (pathname != NULL) - return (pathname); - pathname = search_library_path(name, ld_standard_library_path); - if (pathname != NULL) - return (pathname); - } else { - nodeflib = objgiven ? refobj->z_nodeflib : false; - if (objgiven) { - pathname = search_library_path(name, refobj->rpath); - if (pathname != NULL) - return (pathname); - } - if (objgiven && refobj->runpath == NULL && refobj != obj_main) { - pathname = search_library_path(name, obj_main->rpath); - if (pathname != NULL) - return (pathname); - } - pathname = search_library_path(name, ld_library_path); - if (pathname != NULL) - return (pathname); - if (objgiven) { - pathname = search_library_path(name, refobj->runpath); - if (pathname != NULL) - return (pathname); - } - pathname = search_library_pathfds(name, ld_library_dirs, fdp); - if (pathname != NULL) - return (pathname); - pathname = search_library_path(name, gethints(nodeflib)); - if (pathname != NULL) - return (pathname); - if (objgiven && !nodeflib) { - pathname = search_library_path(name, ld_standard_library_path); - if (pathname != NULL) - return (pathname); - } - } - if (objgiven && refobj->path != NULL) { - _rtld_error("Shared object \"%s\" not found, required by \"%s\"", - name, basename(refobj->path)); - } else { - _rtld_error("Shared object \"%s\" not found", name); - } - return NULL; + if (objgiven && refobj->path != NULL) { + _rtld_error("Shared object \"%s\" not found, " + "required by \"%s\"", name, basename(refobj->path)); + } else { + _rtld_error("Shared object \"%s\" not found", name); + } + return (NULL); } /* From owner-svn-src-head@freebsd.org Tue Oct 24 12:04:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 12E14E4B1F5; Tue, 24 Oct 2017 12:04:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id D51D180FB0; Tue, 24 Oct 2017 12:04:08 +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 v9OC48cj031365; Tue, 24 Oct 2017 12:04:08 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OC48oO031364; Tue, 24 Oct 2017 12:04:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710241204.v9OC48oO031364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 24 Oct 2017 12:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324952 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 324952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 12:04:09 -0000 Author: trasz Date: Tue Oct 24 12:04:07 2017 New Revision: 324952 URL: https://svnweb.freebsd.org/changeset/base/324952 Log: Replace lseek(2)/read(2) pair with pread(2), removing yet another syscall from the binary startup code. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Oct 24 11:24:54 2017 (r324951) +++ head/libexec/rtld-elf/rtld.c Tue Oct 24 12:04:07 2017 (r324952) @@ -1824,10 +1824,9 @@ cleanup1: if (dl > hint_stat.st_size) goto cleanup1; p = xmalloc(hdr.dirlistlen + 1); - - if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 || - read(fd, p, hdr.dirlistlen + 1) != - (ssize_t)hdr.dirlistlen + 1 || p[hdr.dirlistlen] != '\0') { + if (pread(fd, p, hdr.dirlistlen + 1, + hdr.strtab + hdr.dirlist) != (ssize_t)hdr.dirlistlen + 1 || + p[hdr.dirlistlen] != '\0') { free(p); goto cleanup1; } From owner-svn-src-head@freebsd.org Tue Oct 24 12:56:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2DF98E4C452; Tue, 24 Oct 2017 12:56:10 +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 mx1.freebsd.org (Postfix) with ESMTPS id 081B982640; Tue, 24 Oct 2017 12:56:09 +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 v9OCu9Fo052151; Tue, 24 Oct 2017 12:56:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OCu9ie052150; Tue, 24 Oct 2017 12:56:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710241256.v9OCu9ie052150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 24 Oct 2017 12:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324953 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 324953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 12:56:10 -0000 Author: trasz Date: Tue Oct 24 12:56:08 2017 New Revision: 324953 URL: https://svnweb.freebsd.org/changeset/base/324953 Log: Remove unneeded calls to access(2) from rtld(1); just call open(2) instead. The result looks like this: --- przed 2017-10-21 23:19:21.445034000 +0100 +++ po 2017-10-21 23:18:50.031865000 +0100 @@ -11,7 +11,6 @@ mmap(0x0,102,PROT_READ,MAP_PRIVATE,3,0x0) = 343665418 close(3) = 0 (0x0) open("/usr/local/etc/libmap.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,0165) ERR#2 'No such file or directory' munmap(0x80067d000,102) = 0 (0x0) -access("/usr/local/lib/libintl.so.8",F_OK) = 0 (0x0) openat(AT_FDCWD,"/usr/local/lib/libintl.so.8",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3) fstat(3,{ mode=-rw-r--r-- ,inode=642560,size=55188,blksize=32768 }) = 0 (0x0) mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34366541824 (0x80067d000) @@ -20,14 +19,13 @@ mmap(0x800877000,40960,PROT_READ|PROT_EXEC,MAP_PRIVATE mmap(0x800a81000,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0xa000) = 34370752512 (0x800a81000) munmap(0x80067d000,4096) = 0 (0x0) close(3) = 0 (0x0) -access("/usr/local/lib/libc.so.7",F_OK) ERR#2 'No such file or directory' +openat(AT_FDCWD,"/usr/local/lib/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) ERR#2 'No such file or directory' openat(AT_FDCWD,"/var/run/ld-elf.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3) read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\M-2\0\0"...,128) = 128 (0x80) fstat(3,{ mode=-r--r--r-- ,inode=970684,size=306,blksize=32768 }) = 0 (0x0) lseek(3,0x80,SEEK_SET) = 128 (0x80) read(3,"/lib:/usr/lib:/usr/lib/compat:/u"...,178) = 178 (0xb2) close(3) = 0 (0x0) -access("/lib/libc.so.7",F_OK) = 0 (0x0) openat(AT_FDCWD,"/lib/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3) fstat(3,{ mode=-r--r--r-- ,inode=1605239,size=1910320,blksize=32768 }) = 0 (0x0) mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34366541824 (0x80067d000) Reviewed by: kib MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12766 Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Oct 24 12:04:07 2017 (r324952) +++ head/libexec/rtld-elf/rtld.c Tue Oct 24 12:56:08 2017 (r324953) @@ -138,7 +138,7 @@ static int rtld_dirname(const char *, char *); static int rtld_dirname_abs(const char *, char *); static void *rtld_dlopen(const char *name, int fd, int mode); static void rtld_exit(void); -static char *search_library_path(const char *, const char *); +static char *search_library_path(const char *, const char *, int *); static char *search_library_pathfds(const char *, const char *, int *); static const void **get_program_var_addr(const char *, RtldLockState *); static void set_program_var(const char *, const void *); @@ -1620,52 +1620,52 @@ find_library(const char *xname, const Obj_Entry *refob * nodeflib. */ if (objgiven && refobj->rpath != NULL && ld_library_path_rpath) { - pathname = search_library_path(name, ld_library_path); + pathname = search_library_path(name, ld_library_path, fdp); if (pathname != NULL) return (pathname); if (refobj != NULL) { - pathname = search_library_path(name, refobj->rpath); + pathname = search_library_path(name, refobj->rpath, fdp); if (pathname != NULL) return (pathname); } pathname = search_library_pathfds(name, ld_library_dirs, fdp); if (pathname != NULL) return (pathname); - pathname = search_library_path(name, gethints(false)); + pathname = search_library_path(name, gethints(false), fdp); if (pathname != NULL) return (pathname); - pathname = search_library_path(name, ld_standard_library_path); + pathname = search_library_path(name, ld_standard_library_path, fdp); if (pathname != NULL) return (pathname); } else { nodeflib = objgiven ? refobj->z_nodeflib : false; if (objgiven) { - pathname = search_library_path(name, refobj->rpath); + pathname = search_library_path(name, refobj->rpath, fdp); if (pathname != NULL) return (pathname); } if (objgiven && refobj->runpath == NULL && refobj != obj_main) { - pathname = search_library_path(name, obj_main->rpath); + pathname = search_library_path(name, obj_main->rpath, fdp); if (pathname != NULL) return (pathname); } - pathname = search_library_path(name, ld_library_path); + pathname = search_library_path(name, ld_library_path, fdp); if (pathname != NULL) return (pathname); if (objgiven) { - pathname = search_library_path(name, refobj->runpath); + pathname = search_library_path(name, refobj->runpath, fdp); if (pathname != NULL) return (pathname); } pathname = search_library_pathfds(name, ld_library_dirs, fdp); if (pathname != NULL) return (pathname); - pathname = search_library_path(name, gethints(nodeflib)); + pathname = search_library_path(name, gethints(nodeflib), fdp); if (pathname != NULL) return (pathname); if (objgiven && !nodeflib) { pathname = search_library_path(name, - ld_standard_library_path); + ld_standard_library_path, fdp); if (pathname != NULL) return (pathname); } @@ -3022,12 +3022,14 @@ struct try_library_args { size_t namelen; char *buffer; size_t buflen; + int fd; }; static void * try_library_path(const char *dir, size_t dirlen, void *param) { struct try_library_args *arg; + int fd; arg = param; if (*dir == '/' || trust) { @@ -3042,17 +3044,23 @@ try_library_path(const char *dir, size_t dirlen, void strcpy(pathname + dirlen + 1, arg->name); dbg(" Trying \"%s\"", pathname); - if (access(pathname, F_OK) == 0) { /* We found it */ + fd = open(pathname, O_RDONLY | O_CLOEXEC | O_VERIFY); + if (fd >= 0) { + dbg(" Opened \"%s\", fd %d", pathname, fd); pathname = xmalloc(dirlen + 1 + arg->namelen + 1); strcpy(pathname, arg->buffer); + arg->fd = fd; return (pathname); + } else { + dbg(" Failed to open \"%s\": %s", + pathname, rtld_strerror(errno)); } } return (NULL); } static char * -search_library_path(const char *name, const char *path) +search_library_path(const char *name, const char *path, int *fdp) { char *p; struct try_library_args arg; @@ -3064,8 +3072,10 @@ search_library_path(const char *name, const char *path arg.namelen = strlen(name); arg.buffer = xmalloc(PATH_MAX); arg.buflen = PATH_MAX; + arg.fd = -1; p = path_enumerate(path, try_library_path, &arg); + *fdp = arg.fd; free(arg.buffer); From owner-svn-src-head@freebsd.org Tue Oct 24 14:28:58 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E707E4F01E; Tue, 24 Oct 2017 14:28:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0C2B1F6E; Tue, 24 Oct 2017 14:28:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OESv9k089830; Tue, 24 Oct 2017 14:28:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OESvkm089829; Tue, 24 Oct 2017 14:28:57 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201710241428.v9OESvkm089829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 24 Oct 2017 14:28:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324954 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 324954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 14:28:58 -0000 Author: tuexen Date: Tue Oct 24 14:28:56 2017 New Revision: 324954 URL: https://svnweb.freebsd.org/changeset/base/324954 Log: Fix a locking issue found by running AFL on the userland stack. Thanks to Felix Weinrank for reporting the issue. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Tue Oct 24 12:56:08 2017 (r324953) +++ head/sys/netinet/sctp_input.c Tue Oct 24 14:28:56 2017 (r324954) @@ -4863,9 +4863,6 @@ process_control_chunks: if ((stcb != NULL) && (stcb->asoc.total_output_queue_size)) { ; } else { - if (stcb != NULL) { - SCTP_TCB_UNLOCK(stcb); - } *offset = length; if (stcb != NULL) { #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) From owner-svn-src-head@freebsd.org Tue Oct 24 14:34:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDD37E4F4B5; Tue, 24 Oct 2017 14:34:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B2AA2A4C; Tue, 24 Oct 2017 14:34:26 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OEYPKs093915; Tue, 24 Oct 2017 14:34:25 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OEYP2l093913; Tue, 24 Oct 2017 14:34:25 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201710241434.v9OEYP2l093913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 24 Oct 2017 14:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324956 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 324956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 14:34:26 -0000 Author: asomers Date: Tue Oct 24 14:34:25 2017 New Revision: 324956 URL: https://svnweb.freebsd.org/changeset/base/324956 Log: Bump man page revision dates for r324941 Reported by: jhb MFC after: 20 days X-MFC-with: 324941 Sponsored by: Spectra Logic Corp Modified: head/lib/libc/sys/aio_suspend.2 head/lib/libc/sys/lio_listio.2 Modified: head/lib/libc/sys/aio_suspend.2 ============================================================================== --- head/lib/libc/sys/aio_suspend.2 Tue Oct 24 14:33:38 2017 (r324955) +++ head/lib/libc/sys/aio_suspend.2 Tue Oct 24 14:34:25 2017 (r324956) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 1999 +.Dd Oct 23, 2017 .Dt AIO_SUSPEND 2 .Os .Sh NAME Modified: head/lib/libc/sys/lio_listio.2 ============================================================================== --- head/lib/libc/sys/lio_listio.2 Tue Oct 24 14:33:38 2017 (r324955) +++ head/lib/libc/sys/lio_listio.2 Tue Oct 24 14:34:25 2017 (r324956) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 15, 2016 +.Dd Oct 23, 2017 .Dt LIO_LISTIO 2 .Os .Sh NAME From owner-svn-src-head@freebsd.org Tue Oct 24 14:59:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA4B8E4FEA3; Tue, 24 Oct 2017 14:59:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9BC539EC; Tue, 24 Oct 2017 14:59:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OExVC1003080; Tue, 24 Oct 2017 14:59:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OExVSF003079; Tue, 24 Oct 2017 14:59:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201710241459.v9OExVSF003079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 24 Oct 2017 14:59:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324957 - head/sys/dev/iscsi X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/iscsi X-SVN-Commit-Revision: 324957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 14:59:33 -0000 Author: avg Date: Tue Oct 24 14:59:31 2017 New Revision: 324957 URL: https://svnweb.freebsd.org/changeset/base/324957 Log: iscsi_shutdown_post: do nothing if panic-ing There is nothing that that routine should or could really do in that context. Reported by: Ben RUBSON MFC after: 1 week Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Tue Oct 24 14:34:25 2017 (r324956) +++ head/sys/dev/iscsi/iscsi.c Tue Oct 24 14:59:31 2017 (r324957) @@ -2458,8 +2458,10 @@ static void iscsi_shutdown_post(struct iscsi_softc *sc) { - ISCSI_DEBUG("removing all sessions due to shutdown"); - iscsi_terminate_sessions(sc); + if (panicstr == NULL) { + ISCSI_DEBUG("removing all sessions due to shutdown"); + iscsi_terminate_sessions(sc); + } } static int From owner-svn-src-head@freebsd.org Tue Oct 24 16:24:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 684A2E51EDD; Tue, 24 Oct 2017 16:24:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40E1F65BB8; Tue, 24 Oct 2017 16:24:13 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OGOC8S039883; Tue, 24 Oct 2017 16:24:12 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OGOC9a039882; Tue, 24 Oct 2017 16:24:12 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201710241624.v9OGOC9a039882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 24 Oct 2017 16:24:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324958 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 324958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 16:24:13 -0000 Author: tuexen Date: Tue Oct 24 16:24:12 2017 New Revision: 324958 URL: https://svnweb.freebsd.org/changeset/base/324958 Log: Fix a bug in handling special ABORT chunks. Thanks to Felix Weinrank for finding this issue using libfuzzer with the userland stack. MFC after: 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Tue Oct 24 14:59:31 2017 (r324957) +++ head/sys/netinet/sctp_input.c Tue Oct 24 16:24:12 2017 (r324958) @@ -763,7 +763,8 @@ sctp_handle_nat_missing_state(struct sctp_tcb *stcb, } -static void +/* Returns 1 if the stcb was aborted, 0 otherwise */ +static int sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { @@ -775,29 +776,29 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: handling ABORT\n"); if (stcb == NULL) - return; + return (0); len = ntohs(abort->ch.chunk_length); - if (len > sizeof(struct sctp_chunkhdr)) { + if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_error_cause)) { /* * Need to check the cause codes for our two magic nat * aborts which don't kill the assoc necessarily. */ - struct sctp_gen_error_cause *cause; + struct sctp_error_cause *cause; - cause = (struct sctp_gen_error_cause *)(abort + 1); + cause = (struct sctp_error_cause *)(abort + 1); error = ntohs(cause->code); if (error == SCTP_CAUSE_NAT_COLLIDING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received Colliding state abort flags:%x\n", abort->ch.chunk_flags); if (sctp_handle_nat_colliding_state(stcb)) { - return; + return (0); } } else if (error == SCTP_CAUSE_NAT_MISSING_STATE) { SCTPDBG(SCTP_DEBUG_INPUT2, "Received missing state abort flags:%x\n", abort->ch.chunk_flags); if (sctp_handle_nat_missing_state(stcb, net)) { - return; + return (0); } } } else { @@ -832,6 +833,7 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, SCTP_SOCKET_UNLOCK(so, 1); #endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: finished\n"); + return (1); } static void @@ -5121,11 +5123,16 @@ process_control_chunks: case SCTP_ABORT_ASSOCIATION: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_ABORT, stcb %p\n", (void *)stcb); - if ((stcb) && netp && *netp) - sctp_handle_abort((struct sctp_abort_chunk *)ch, - stcb, *netp); *offset = length; - return (NULL); + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if (sctp_handle_abort((struct sctp_abort_chunk *)ch, stcb, *netp)) { + return (NULL); + } else { + return (stcb); + } + } else { + return (NULL); + } break; case SCTP_SHUTDOWN: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN, stcb %p\n", From owner-svn-src-head@freebsd.org Tue Oct 24 16:28:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49E7BE52000; Tue, 24 Oct 2017 16:28:02 +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 mx1.freebsd.org (Postfix) with ESMTPS id 008B865D7E; Tue, 24 Oct 2017 16:28:01 +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 v9OGS1Id040052; Tue, 24 Oct 2017 16:28:01 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OGS0k2040046; Tue, 24 Oct 2017 16:28:00 GMT (envelope-from br@FreeBSD.org) Message-Id: <201710241628.v9OGS0k2040046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 24 Oct 2017 16:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324959 - in head: lib lib/libpmcstat share/mk usr.sbin/pmcstat X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head: lib lib/libpmcstat share/mk usr.sbin/pmcstat X-SVN-Commit-Revision: 324959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 16:28:02 -0000 Author: br Date: Tue Oct 24 16:28:00 2017 New Revision: 324959 URL: https://svnweb.freebsd.org/changeset/base/324959 Log: Extract a set of pmcstat functions and interfaces to the new internal library -- libpmcstat. This includes PMC logging module, symbols lookup functions, ELF parsing, process management, PMC attachment, etc. This allows to reuse code while building new hwpmc(4)-based applications. Also add pmcstat_symbol_search_by_name() function that allows to find mapped IP range for a given function name. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D12718 Added: head/lib/libpmcstat/ head/lib/libpmcstat/Makefile (contents, props changed) head/lib/libpmcstat/libpmcstat.h (contents, props changed) head/lib/libpmcstat/libpmcstat_event.c (contents, props changed) head/lib/libpmcstat/libpmcstat_image.c (contents, props changed) head/lib/libpmcstat/libpmcstat_logging.c (contents, props changed) head/lib/libpmcstat/libpmcstat_process.c (contents, props changed) head/lib/libpmcstat/libpmcstat_string.c (contents, props changed) head/lib/libpmcstat/libpmcstat_symbol.c (contents, props changed) Modified: head/lib/Makefile head/share/mk/src.libnames.mk head/usr.sbin/pmcstat/Makefile head/usr.sbin/pmcstat/pmcpl_callgraph.c head/usr.sbin/pmcstat/pmcpl_callgraph.h head/usr.sbin/pmcstat/pmcpl_calltree.c head/usr.sbin/pmcstat/pmcpl_calltree.h head/usr.sbin/pmcstat/pmcpl_gprof.c head/usr.sbin/pmcstat/pmcstat.c head/usr.sbin/pmcstat/pmcstat.h head/usr.sbin/pmcstat/pmcstat_log.c head/usr.sbin/pmcstat/pmcstat_log.h Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Tue Oct 24 16:24:12 2017 (r324958) +++ head/lib/Makefile Tue Oct 24 16:28:00 2017 (r324959) @@ -186,7 +186,7 @@ _libdl= libdl .endif SUBDIR.${MK_OPENSSL}+= libmp -SUBDIR.${MK_PMC}+= libpmc +SUBDIR.${MK_PMC}+= libpmc libpmcstat SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil SUBDIR.${MK_TELNET}+= libtelnet Added: head/lib/libpmcstat/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmcstat/Makefile Tue Oct 24 16:28:00 2017 (r324959) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +PACKAGE=lib${LIB} +LIB= pmcstat +INTERNALLIB= + +SRCS= \ + libpmcstat_event.c \ + libpmcstat_image.c \ + libpmcstat_logging.c \ + libpmcstat_process.c \ + libpmcstat_string.c \ + libpmcstat_symbol.c +INCS= libpmcstat.h + +.include Added: head/lib/libpmcstat/libpmcstat.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmcstat/libpmcstat.h Tue Oct 24 16:28:00 2017 (r324959) @@ -0,0 +1,382 @@ +/*- + * Copyright (c) 2005-2007, Joseph Koshy + * Copyright (c) 2007 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed by A. Joseph Koshy under + * sponsorship from the FreeBSD Foundation and Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LIBPMCSTAT_H_ +#define _LIBPMCSTAT_H_ + +#include +#include + +#include +#include + +#define PMCSTAT_ALLOCATE 1 + +#define NSOCKPAIRFD 2 +#define PARENTSOCKET 0 +#define CHILDSOCKET 1 + +#define PMCSTAT_OPEN_FOR_READ 0 +#define PMCSTAT_OPEN_FOR_WRITE 1 +#define READPIPEFD 0 +#define WRITEPIPEFD 1 +#define NPIPEFD 2 + +#define PMCSTAT_NHASH 256 +#define PMCSTAT_HASH_MASK 0xFF + +typedef const void *pmcstat_interned_string; +struct pmc_plugins; + +enum pmcstat_state { + PMCSTAT_FINISHED = 0, + PMCSTAT_EXITING = 1, + PMCSTAT_RUNNING = 2 +}; + +struct pmcstat_ev { + STAILQ_ENTRY(pmcstat_ev) ev_next; + int ev_count; /* associated count if in sampling mode */ + uint32_t ev_cpu; /* cpus for this event */ + int ev_cumulative; /* show cumulative counts */ + int ev_flags; /* PMC_F_* */ + int ev_fieldskip; /* #leading spaces */ + int ev_fieldwidth; /* print width */ + enum pmc_mode ev_mode; /* desired mode */ + char *ev_name; /* (derived) event name */ + pmc_id_t ev_pmcid; /* allocated ID */ + pmc_value_t ev_saved; /* for incremental counts */ + char *ev_spec; /* event specification */ +}; + +struct pmcstat_target { + SLIST_ENTRY(pmcstat_target) pt_next; + pid_t pt_pid; +}; + +struct pmcstat_args { + int pa_flags; /* argument flags */ +#define FLAG_HAS_TARGET 0x00000001 /* process target */ +#define FLAG_HAS_WAIT_INTERVAL 0x00000002 /* -w secs */ +#define FLAG_HAS_OUTPUT_LOGFILE 0x00000004 /* -O file or pipe */ +#define FLAG_HAS_COMMANDLINE 0x00000008 /* command */ +#define FLAG_HAS_SAMPLING_PMCS 0x00000010 /* -S or -P */ +#define FLAG_HAS_COUNTING_PMCS 0x00000020 /* -s or -p */ +#define FLAG_HAS_PROCESS_PMCS 0x00000040 /* -P or -p */ +#define FLAG_HAS_SYSTEM_PMCS 0x00000080 /* -S or -s */ +#define FLAG_HAS_PIPE 0x00000100 /* implicit log */ +#define FLAG_READ_LOGFILE 0x00000200 /* -R file */ +#define FLAG_DO_GPROF 0x00000400 /* -g */ +#define FLAG_HAS_SAMPLESDIR 0x00000800 /* -D dir */ +#define FLAG_HAS_KERNELPATH 0x00001000 /* -k kernel */ +#define FLAG_DO_PRINT 0x00002000 /* -o */ +#define FLAG_DO_CALLGRAPHS 0x00004000 /* -G or -F */ +#define FLAG_DO_ANNOTATE 0x00008000 /* -m */ +#define FLAG_DO_TOP 0x00010000 /* -T */ +#define FLAG_DO_ANALYSIS 0x00020000 /* -g or -G or -m or -T */ +#define FLAGS_HAS_CPUMASK 0x00040000 /* -c */ +#define FLAG_HAS_DURATION 0x00080000 /* -l secs */ +#define FLAG_DO_WIDE_GPROF_HC 0x00100000 /* -e */ + + int pa_required; /* required features */ + int pa_pplugin; /* pre-processing plugin */ + int pa_plugin; /* analysis plugin */ + int pa_verbosity; /* verbosity level */ + FILE *pa_printfile; /* where to send printed output */ + int pa_logfd; /* output log file */ + char *pa_inputpath; /* path to input log */ + char *pa_outputpath; /* path to output log */ + void *pa_logparser; /* log file parser */ + const char *pa_fsroot; /* FS root where executables reside */ + char *pa_kernel; /* pathname of the kernel */ + const char *pa_samplesdir; /* directory for profile files */ + const char *pa_mapfilename;/* mapfile name */ + FILE *pa_graphfile; /* where to send the callgraph */ + int pa_graphdepth; /* print depth for callgraphs */ + double pa_interval; /* printing interval in seconds */ + cpuset_t pa_cpumask; /* filter for CPUs analysed */ + int pa_ctdumpinstr; /* dump instructions with calltree */ + int pa_topmode; /* delta or accumulative */ + int pa_toptty; /* output to tty or file */ + int pa_topcolor; /* terminal support color */ + int pa_mergepmc; /* merge PMC with same name */ + double pa_duration; /* time duration */ + int pa_argc; + char **pa_argv; + STAILQ_HEAD(, pmcstat_ev) pa_events; + SLIST_HEAD(, pmcstat_target) pa_targets; +}; + +/* + * Each function symbol tracked by pmcstat(8). + */ + +struct pmcstat_symbol { + pmcstat_interned_string ps_name; + uint64_t ps_start; + uint64_t ps_end; +}; + +/* + * A 'pmcstat_image' structure describes an executable program on + * disk. 'pi_execpath' is a cookie representing the pathname of + * the executable. 'pi_start' and 'pi_end' are the least and greatest + * virtual addresses for the text segments in the executable. + * 'pi_gmonlist' contains a linked list of gmon.out files associated + * with this image. + */ + +enum pmcstat_image_type { + PMCSTAT_IMAGE_UNKNOWN = 0, /* never looked at the image */ + PMCSTAT_IMAGE_INDETERMINABLE, /* can't tell what the image is */ + PMCSTAT_IMAGE_ELF32, /* ELF 32 bit object */ + PMCSTAT_IMAGE_ELF64, /* ELF 64 bit object */ + PMCSTAT_IMAGE_AOUT /* AOUT object */ +}; + +struct pmcstat_image { + LIST_ENTRY(pmcstat_image) pi_next; /* hash link */ + pmcstat_interned_string pi_execpath; /* cookie */ + pmcstat_interned_string pi_samplename; /* sample path name */ + pmcstat_interned_string pi_fullpath; /* path to FS object */ + pmcstat_interned_string pi_name; /* display name */ + + enum pmcstat_image_type pi_type; /* executable type */ + + /* + * Executables have pi_start and pi_end; these are zero + * for shared libraries. + */ + uintfptr_t pi_start; /* start address (inclusive) */ + uintfptr_t pi_end; /* end address (exclusive) */ + uintfptr_t pi_entry; /* entry address */ + uintfptr_t pi_vaddr; /* virtual address where loaded */ + int pi_isdynamic; /* whether a dynamic object */ + int pi_iskernelmodule; + pmcstat_interned_string pi_dynlinkerpath; /* path in .interp */ + + /* All symbols associated with this object. */ + struct pmcstat_symbol *pi_symbols; + size_t pi_symcount; + + /* Handle to addr2line for this image. */ + FILE *pi_addr2line; + + /* + * Plugins private data + */ + + /* gprof: + * An image can be associated with one or more gmon.out files; + * one per PMC. + */ + LIST_HEAD(,pmcstat_gmonfile) pi_gmlist; +}; + +extern LIST_HEAD(pmcstat_image_hash_list, pmcstat_image) pmcstat_image_hash[PMCSTAT_NHASH]; + +/* + * A simple implementation of interned strings. Each interned string + * is assigned a unique address, so that subsequent string compares + * can be done by a simple pointer comparison instead of using + * strcmp(). This speeds up hash table lookups and saves memory if + * duplicate strings are the norm. + */ +struct pmcstat_string { + LIST_ENTRY(pmcstat_string) ps_next; /* hash link */ + int ps_len; + int ps_hash; + char *ps_string; +}; + +/* + * A 'pmcstat_pcmap' structure maps a virtual address range to an + * underlying 'pmcstat_image' descriptor. + */ +struct pmcstat_pcmap { + TAILQ_ENTRY(pmcstat_pcmap) ppm_next; + uintfptr_t ppm_lowpc; + uintfptr_t ppm_highpc; + struct pmcstat_image *ppm_image; +}; + +/* + * A 'pmcstat_process' structure models processes. Each process is + * associated with a set of pmcstat_pcmap structures that map + * addresses inside it to executable objects. This set is implemented + * as a list, kept sorted in ascending order of mapped addresses. + * + * 'pp_pid' holds the pid of the process. When a process exits, the + * 'pp_isactive' field is set to zero, but the process structure is + * not immediately reclaimed because there may still be samples in the + * log for this process. + */ + +struct pmcstat_process { + LIST_ENTRY(pmcstat_process) pp_next; /* hash-next */ + pid_t pp_pid; /* associated pid */ + int pp_isactive; /* whether active */ + uintfptr_t pp_entryaddr; /* entry address */ + TAILQ_HEAD(,pmcstat_pcmap) pp_map; /* address range map */ +}; +extern LIST_HEAD(pmcstat_process_hash_list, pmcstat_process) pmcstat_process_hash[PMCSTAT_NHASH]; + +/* + * 'pmcstat_pmcrecord' is a mapping from PMC ids to human-readable + * names. + */ + +struct pmcstat_pmcrecord { + LIST_ENTRY(pmcstat_pmcrecord) pr_next; + pmc_id_t pr_pmcid; + int pr_pmcin; + pmcstat_interned_string pr_pmcname; + int pr_samples; + int pr_dubious_frames; + struct pmcstat_pmcrecord *pr_merge; +}; +extern LIST_HEAD(pmcstat_pmcs, pmcstat_pmcrecord) pmcstat_pmcs; /* PMC list */ + +struct pmc_plugins { + const char *pl_name; + + /* configure */ + int (*pl_configure)(char *opt); + + /* init and shutdown */ + int (*pl_init)(void); + void (*pl_shutdown)(FILE *mf); + + /* sample processing */ + void (*pl_process)(struct pmcstat_process *pp, + struct pmcstat_pmcrecord *pmcr, uint32_t nsamples, + uintfptr_t *cc, int usermode, uint32_t cpu); + + /* image */ + void (*pl_initimage)(struct pmcstat_image *pi); + void (*pl_shutdownimage)(struct pmcstat_image *pi); + + /* pmc */ + void (*pl_newpmc)(pmcstat_interned_string ps, + struct pmcstat_pmcrecord *pr); + + /* top display */ + void (*pl_topdisplay)(void); + + /* top keypress */ + int (*pl_topkeypress)(int c, void *w); +}; + +/* + * Misc. statistics + */ +struct pmcstat_stats { + int ps_exec_aout; /* # a.out executables seen */ + int ps_exec_elf; /* # elf executables seen */ + int ps_exec_errors; /* # errors processing executables */ + int ps_exec_indeterminable; /* # unknown executables seen */ + int ps_samples_total; /* total number of samples processed */ + int ps_samples_skipped; /* #samples filtered out for any reason */ + int ps_samples_unknown_offset; /* #samples of rank 0 not in a map */ + int ps_samples_indeterminable; /* #samples in indeterminable images */ + int ps_samples_unknown_function;/* #samples with unknown function at offset */ + int ps_callchain_dubious_frames;/* #dubious frame pointers seen */ +}; + +__BEGIN_DECLS +int pmcstat_symbol_compare(const void *a, const void *b); +struct pmcstat_symbol *pmcstat_symbol_search(struct pmcstat_image *image, + uintfptr_t addr); +void pmcstat_image_add_symbols(struct pmcstat_image *image, Elf *e, + Elf_Scn *scn, GElf_Shdr *sh); + +const char *pmcstat_string_unintern(pmcstat_interned_string _is); +pmcstat_interned_string pmcstat_string_intern(const char *_s); +int pmcstat_string_compute_hash(const char *s); +pmcstat_interned_string pmcstat_string_lookup(const char *_s); +void pmcstat_image_get_elf_params(struct pmcstat_image *image, struct pmcstat_args *args); + +struct pmcstat_image * + pmcstat_image_from_path(pmcstat_interned_string internedpath, + int iskernelmodule, struct pmcstat_args *args, + struct pmc_plugins *plugins); +int pmcstat_string_lookup_hash(pmcstat_interned_string _is); + +void pmcstat_process_elf_exec(struct pmcstat_process *_pp, + struct pmcstat_image *_image, uintfptr_t _entryaddr, + struct pmcstat_args *args, struct pmc_plugins *plugins, + struct pmcstat_stats *pmcstat_stats); + +void pmcstat_image_link(struct pmcstat_process *_pp, + struct pmcstat_image *_i, uintfptr_t _lpc); + +void pmcstat_process_aout_exec(struct pmcstat_process *_pp, + struct pmcstat_image *_image, uintfptr_t _entryaddr); +void pmcstat_process_exec(struct pmcstat_process *_pp, + pmcstat_interned_string _path, uintfptr_t _entryaddr, + struct pmcstat_args *args, struct pmc_plugins *plugins, + struct pmcstat_stats *pmcstat_stats); +void pmcstat_image_determine_type(struct pmcstat_image *_image, struct pmcstat_args *args); +void pmcstat_image_get_aout_params(struct pmcstat_image *_image, struct pmcstat_args *args); +struct pmcstat_pcmap *pmcstat_process_find_map(struct pmcstat_process *_p, + uintfptr_t _pc); +void pmcstat_initialize_logging(struct pmcstat_process **pmcstat_kernproc, + struct pmcstat_args *args, struct pmc_plugins *plugins, + int *pmcstat_npmcs, int *pmcstat_mergepmc); +void pmcstat_shutdown_logging(struct pmcstat_args *args, + struct pmc_plugins *plugins, + struct pmcstat_stats *pmcstat_stats); +struct pmcstat_process *pmcstat_process_lookup(pid_t _pid, int _allocate); +void pmcstat_clone_event_descriptor(struct pmcstat_ev *ev, const cpuset_t *cpumask, struct pmcstat_args *args); + +void pmcstat_create_process(int *pmcstat_sockpair, struct pmcstat_args *args, int pmcstat_kq); +void pmcstat_start_process(int *pmcstat_sockpair); + +void pmcstat_attach_pmcs(struct pmcstat_args *args); +struct pmcstat_symbol *pmcstat_symbol_search_by_name(struct pmcstat_process *pp, const char *pi_name, const char *name, uintptr_t *, uintptr_t *); + +void pmcstat_string_initialize(void); +void pmcstat_string_shutdown(void); + +int pmcstat_analyze_log(struct pmcstat_args *args, + struct pmc_plugins *plugins, + struct pmcstat_stats *pmcstat_stats, + struct pmcstat_process *pmcstat_kernproc, + int pmcstat_mergepmc, + int *pmcstat_npmcs, + int *ps_samples_period); + +int pmcstat_open_log(const char *_p, int _mode); +int pmcstat_close_log(struct pmcstat_args *args); +__END_DECLS + +#endif /* !_LIBPMCSTAT_H_ */ Added: head/lib/libpmcstat/libpmcstat_event.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmcstat/libpmcstat_event.c Tue Oct 24 16:28:00 2017 (r324959) @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2003-2008 Joseph Koshy + * 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 "libpmcstat.h" + +void +pmcstat_clone_event_descriptor(struct pmcstat_ev *ev, const cpuset_t *cpumask, + struct pmcstat_args *args) +{ + int cpu; + struct pmcstat_ev *ev_clone; + + for (cpu = 0; cpu < CPU_SETSIZE; cpu++) { + if (!CPU_ISSET(cpu, cpumask)) + continue; + + if ((ev_clone = malloc(sizeof(*ev_clone))) == NULL) + errx(EX_SOFTWARE, "ERROR: Out of memory"); + (void) memset(ev_clone, 0, sizeof(*ev_clone)); + + ev_clone->ev_count = ev->ev_count; + ev_clone->ev_cpu = cpu; + ev_clone->ev_cumulative = ev->ev_cumulative; + ev_clone->ev_flags = ev->ev_flags; + ev_clone->ev_mode = ev->ev_mode; + ev_clone->ev_name = strdup(ev->ev_name); + if (ev_clone->ev_name == NULL) + errx(EX_SOFTWARE, "ERROR: Out of memory"); + ev_clone->ev_pmcid = ev->ev_pmcid; + ev_clone->ev_saved = ev->ev_saved; + ev_clone->ev_spec = strdup(ev->ev_spec); + if (ev_clone->ev_spec == NULL) + errx(EX_SOFTWARE, "ERROR: Out of memory"); + + STAILQ_INSERT_TAIL(&args->pa_events, ev_clone, ev_next); + } +} Added: head/lib/libpmcstat/libpmcstat_image.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libpmcstat/libpmcstat_image.c Tue Oct 24 16:28:00 2017 (r324959) @@ -0,0 +1,517 @@ +/*- + * Copyright (c) 2003-2008 Joseph Koshy + * 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 "libpmcstat.h" + +#define min(A,B) ((A) < (B) ? (A) : (B)) +#define max(A,B) ((A) > (B) ? (A) : (B)) + +/* + * Add the list of symbols in the given section to the list associated + * with the object. + */ +void +pmcstat_image_add_symbols(struct pmcstat_image *image, Elf *e, + Elf_Scn *scn, GElf_Shdr *sh) +{ + int firsttime; + size_t n, newsyms, nshsyms, nfuncsyms; + struct pmcstat_symbol *symptr; + char *fnname; + GElf_Sym sym; + Elf_Data *data; + + if ((data = elf_getdata(scn, NULL)) == NULL) + return; + + /* + * Determine the number of functions named in this + * section. + */ + + nshsyms = sh->sh_size / sh->sh_entsize; + for (n = nfuncsyms = 0; n < nshsyms; n++) { + if (gelf_getsym(data, (int) n, &sym) != &sym) + return; + if (GELF_ST_TYPE(sym.st_info) == STT_FUNC) + nfuncsyms++; + } + + if (nfuncsyms == 0) + return; + + /* + * Allocate space for the new entries. + */ + firsttime = image->pi_symbols == NULL; + symptr = reallocarray(image->pi_symbols, + image->pi_symcount + nfuncsyms, sizeof(*symptr)); + if (symptr == image->pi_symbols) /* realloc() failed. */ + return; + image->pi_symbols = symptr; + + /* + * Append new symbols to the end of the current table. + */ + symptr += image->pi_symcount; + + for (n = newsyms = 0; n < nshsyms; n++) { + if (gelf_getsym(data, (int) n, &sym) != &sym) + return; + if (GELF_ST_TYPE(sym.st_info) != STT_FUNC) + continue; + + if (sym.st_shndx == STN_UNDEF) + continue; + + if (!firsttime && pmcstat_symbol_search(image, sym.st_value)) + continue; /* We've seen this symbol already. */ + + if ((fnname = elf_strptr(e, sh->sh_link, sym.st_name)) + == NULL) + continue; +#ifdef __arm__ + /* Remove spurious ARM function name. */ + if (fnname[0] == '$' && + (fnname[1] == 'a' || fnname[1] == 't' || + fnname[1] == 'd') && + fnname[2] == '\0') + continue; +#endif + + symptr->ps_name = pmcstat_string_intern(fnname); + symptr->ps_start = sym.st_value - image->pi_vaddr; + symptr->ps_end = symptr->ps_start + sym.st_size; + + symptr++; + newsyms++; + } + + image->pi_symcount += newsyms; + if (image->pi_symcount == 0) + return; + + assert(newsyms <= nfuncsyms); + + /* + * Return space to the system if there were duplicates. + */ + if (newsyms < nfuncsyms) + image->pi_symbols = reallocarray(image->pi_symbols, + image->pi_symcount, sizeof(*symptr)); + + /* + * Keep the list of symbols sorted. + */ + qsort(image->pi_symbols, image->pi_symcount, sizeof(*symptr), + pmcstat_symbol_compare); + + /* + * Deal with function symbols that have a size of 'zero' by + * making them extend to the next higher address. These + * symbols are usually defined in assembly code. + */ + for (symptr = image->pi_symbols; + symptr < image->pi_symbols + (image->pi_symcount - 1); + symptr++) + if (symptr->ps_start == symptr->ps_end) + symptr->ps_end = (symptr+1)->ps_start; +} + +/* + * Record the fact that PC values from 'start' to 'end' come from + * image 'image'. + */ + +void +pmcstat_image_link(struct pmcstat_process *pp, struct pmcstat_image *image, + uintfptr_t start) +{ + struct pmcstat_pcmap *pcm, *pcmnew; + uintfptr_t offset; + + assert(image->pi_type != PMCSTAT_IMAGE_UNKNOWN && + image->pi_type != PMCSTAT_IMAGE_INDETERMINABLE); + + if ((pcmnew = malloc(sizeof(*pcmnew))) == NULL) + err(EX_OSERR, "ERROR: Cannot create a map entry"); + + /* + * Adjust the map entry to only cover the text portion + * of the object. + */ + + offset = start - image->pi_vaddr; + pcmnew->ppm_lowpc = image->pi_start + offset; + pcmnew->ppm_highpc = image->pi_end + offset; + pcmnew->ppm_image = image; + + assert(pcmnew->ppm_lowpc < pcmnew->ppm_highpc); + + /* Overlapped mmap()'s are assumed to never occur. */ + TAILQ_FOREACH(pcm, &pp->pp_map, ppm_next) + if (pcm->ppm_lowpc >= pcmnew->ppm_highpc) + break; + + if (pcm == NULL) + TAILQ_INSERT_TAIL(&pp->pp_map, pcmnew, ppm_next); + else + TAILQ_INSERT_BEFORE(pcm, pcmnew, ppm_next); +} + +/* + * Determine whether a given executable image is an A.OUT object, and + * if so, fill in its parameters from the text file. + * Sets image->pi_type. + */ + +void +pmcstat_image_get_aout_params(struct pmcstat_image *image, + struct pmcstat_args *args) +{ + int fd; + ssize_t nbytes; + struct exec ex; + const char *path; + char buffer[PATH_MAX]; + + path = pmcstat_string_unintern(image->pi_execpath); + assert(path != NULL); + + if (image->pi_iskernelmodule) + errx(EX_SOFTWARE, + "ERROR: a.out kernel modules are unsupported \"%s\"", path); + + (void) snprintf(buffer, sizeof(buffer), "%s%s", + args->pa_fsroot, path); + + if ((fd = open(buffer, O_RDONLY, 0)) < 0 || + (nbytes = read(fd, &ex, sizeof(ex))) < 0) { + if (args->pa_verbosity >= 2) + warn("WARNING: Cannot determine type of \"%s\"", + path); + image->pi_type = PMCSTAT_IMAGE_INDETERMINABLE; + if (fd != -1) + (void) close(fd); + return; + } + + (void) close(fd); + + if ((unsigned) nbytes != sizeof(ex) || + N_BADMAG(ex)) + return; + + image->pi_type = PMCSTAT_IMAGE_AOUT; + + /* TODO: the rest of a.out processing */ + + return; +} + +/* + * Examine an ELF file to determine the size of its text segment. + * Sets image->pi_type if anything conclusive can be determined about + * this image. + */ + +void +pmcstat_image_get_elf_params(struct pmcstat_image *image, + struct pmcstat_args *args) +{ + int fd; + size_t i, nph, nsh; + const char *path, *elfbase; + char *p, *endp; + uintfptr_t minva, maxva; + Elf *e; + Elf_Scn *scn; + GElf_Ehdr eh; + GElf_Phdr ph; + GElf_Shdr sh; + enum pmcstat_image_type image_type; + char buffer[PATH_MAX]; + + assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); + + image->pi_start = minva = ~(uintfptr_t) 0; + image->pi_end = maxva = (uintfptr_t) 0; + image->pi_type = image_type = PMCSTAT_IMAGE_INDETERMINABLE; + image->pi_isdynamic = 0; + image->pi_dynlinkerpath = NULL; + image->pi_vaddr = 0; + + path = pmcstat_string_unintern(image->pi_execpath); + assert(path != NULL); + + /* + * Look for kernel modules under FSROOT/KERNELPATH/NAME, + * and user mode executable objects under FSROOT/PATHNAME. + */ + if (image->pi_iskernelmodule) + (void) snprintf(buffer, sizeof(buffer), "%s%s/%s", + args->pa_fsroot, args->pa_kernel, path); + else + (void) snprintf(buffer, sizeof(buffer), "%s%s", + args->pa_fsroot, path); + + e = NULL; + if ((fd = open(buffer, O_RDONLY, 0)) < 0) { + warnx("WARNING: Cannot open \"%s\".", + buffer); + goto done; + } + + if (elf_version(EV_CURRENT) == EV_NONE) { + warnx("WARNING: failed to init elf\n"); + goto done; + } + + if ((e = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { + warnx("WARNING: Cannot read \"%s\".", + buffer); + goto done; + } + + if (elf_kind(e) != ELF_K_ELF) { + if (args->pa_verbosity >= 2) + warnx("WARNING: Cannot determine the type of \"%s\".", + buffer); + goto done; + } + + if (gelf_getehdr(e, &eh) != &eh) { + warnx( + "WARNING: Cannot retrieve the ELF Header for \"%s\": %s.", + buffer, elf_errmsg(-1)); + goto done; + } + + if (eh.e_type != ET_EXEC && eh.e_type != ET_DYN && + !(image->pi_iskernelmodule && eh.e_type == ET_REL)) { + warnx("WARNING: \"%s\" is of an unsupported ELF type.", + buffer); + goto done; + } + + image_type = eh.e_ident[EI_CLASS] == ELFCLASS32 ? + PMCSTAT_IMAGE_ELF32 : PMCSTAT_IMAGE_ELF64; + + /* + * Determine the virtual address where an executable would be + * loaded. Additionally, for dynamically linked executables, + * save the pathname to the runtime linker. + */ + if (eh.e_type == ET_EXEC) { + if (elf_getphnum(e, &nph) == 0) { + warnx( +"WARNING: Could not determine the number of program headers in \"%s\": %s.", + buffer, + elf_errmsg(-1)); + goto done; + } + for (i = 0; i < eh.e_phnum; i++) { + if (gelf_getphdr(e, i, &ph) != &ph) { + warnx( +"WARNING: Retrieval of PHDR entry #%ju in \"%s\" failed: %s.", + (uintmax_t) i, buffer, elf_errmsg(-1)); + goto done; + } + switch (ph.p_type) { + case PT_DYNAMIC: + image->pi_isdynamic = 1; + break; + case PT_INTERP: + if ((elfbase = elf_rawfile(e, NULL)) == NULL) { + warnx( +"WARNING: Cannot retrieve the interpreter for \"%s\": %s.", + buffer, elf_errmsg(-1)); + goto done; + } + image->pi_dynlinkerpath = + pmcstat_string_intern(elfbase + + ph.p_offset); + break; + case PT_LOAD: + if ((ph.p_flags & PF_X) != 0 && + (ph.p_offset & (-ph.p_align)) == 0) + image->pi_vaddr = ph.p_vaddr & (-ph.p_align); + break; + } + } + } + + /* + * Get the min and max VA associated with this ELF object. + */ + if (elf_getshnum(e, &nsh) == 0) { + warnx( +"WARNING: Could not determine the number of sections for \"%s\": %s.", + buffer, elf_errmsg(-1)); + goto done; + } + + for (i = 0; i < nsh; i++) { + if ((scn = elf_getscn(e, i)) == NULL || + gelf_getshdr(scn, &sh) != &sh) { + warnx( +"WARNING: Could not retrieve section header #%ju in \"%s\": %s.", + (uintmax_t) i, buffer, elf_errmsg(-1)); + goto done; + } + if (sh.sh_flags & SHF_EXECINSTR) { + minva = min(minva, sh.sh_addr); + maxva = max(maxva, sh.sh_addr + sh.sh_size); + } + if (sh.sh_type == SHT_SYMTAB || sh.sh_type == SHT_DYNSYM) + pmcstat_image_add_symbols(image, e, scn, &sh); + } + + image->pi_start = minva; + image->pi_end = maxva; + image->pi_type = image_type; + image->pi_fullpath = pmcstat_string_intern(buffer); + + /* Build display name + */ + endp = buffer; + for (p = buffer; *p; p++) + if (*p == '/') + endp = p+1; + image->pi_name = pmcstat_string_intern(endp); + + done: + (void) elf_end(e); + if (fd >= 0) + (void) close(fd); + return; +} + +/* + * Given an image descriptor, determine whether it is an ELF, or AOUT. + * If no handler claims the image, set its type to 'INDETERMINABLE'. + */ + +void +pmcstat_image_determine_type(struct pmcstat_image *image, + struct pmcstat_args *args) +{ + assert(image->pi_type == PMCSTAT_IMAGE_UNKNOWN); + + /* Try each kind of handler in turn */ + if (image->pi_type == PMCSTAT_IMAGE_UNKNOWN) + pmcstat_image_get_elf_params(image, args); + if (image->pi_type == PMCSTAT_IMAGE_UNKNOWN) + pmcstat_image_get_aout_params(image, args); + + /* + * Otherwise, remember that we tried to determine + * the object's type and had failed. + */ + if (image->pi_type == PMCSTAT_IMAGE_UNKNOWN) + image->pi_type = PMCSTAT_IMAGE_INDETERMINABLE; +} + +/* + * Locate an image descriptor given an interned path, adding a fresh + * descriptor to the cache if necessary. This function also finds a + * suitable name for this image's sample file. + * + * We defer filling in the file format specific parts of the image + * structure till the time we actually see a sample that would fall + * into this image. + */ + +struct pmcstat_image * +pmcstat_image_from_path(pmcstat_interned_string internedpath, + int iskernelmodule, struct pmcstat_args *args, + struct pmc_plugins *plugins) +{ + int hash; + struct pmcstat_image *pi; + + hash = pmcstat_string_lookup_hash(internedpath); + + /* First, look for an existing entry. */ + LIST_FOREACH(pi, &pmcstat_image_hash[hash], pi_next) + if (pi->pi_execpath == internedpath && + pi->pi_iskernelmodule == iskernelmodule) + return (pi); + + /* + * Allocate a new entry and place it at the head of the hash + * and LRU lists. + */ + pi = malloc(sizeof(*pi)); + if (pi == NULL) + return (NULL); + + pi->pi_type = PMCSTAT_IMAGE_UNKNOWN; + pi->pi_execpath = internedpath; + pi->pi_start = ~0; + pi->pi_end = 0; + pi->pi_entry = 0; + pi->pi_vaddr = 0; + pi->pi_isdynamic = 0; + pi->pi_iskernelmodule = iskernelmodule; + pi->pi_dynlinkerpath = NULL; + pi->pi_symbols = NULL; + pi->pi_symcount = 0; + pi->pi_addr2line = NULL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Oct 24 17:14:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A8FEE533BC; Tue, 24 Oct 2017 17:14:55 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC23567AE5; Tue, 24 Oct 2017 17:14:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OHEsQl061326; Tue, 24 Oct 2017 17:14:54 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OHErqo061325; Tue, 24 Oct 2017 17:14:54 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201710241714.v9OHErqo061325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 24 Oct 2017 17:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324960 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 324960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 17:14:55 -0000 Author: alc Date: Tue Oct 24 17:14:53 2017 New Revision: 324960 URL: https://svnweb.freebsd.org/changeset/base/324960 Log: Micro-optimize the handling of fictitious pages in vm_page_free_prep(). A fictitious page is always wired, so there is no point in trying to remove one from the page queues. Completely remove one inaccurate comment from vm_page_free_prep() and correct another. Reviewed by: kib, markj MFC after: 1 week Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Oct 24 16:28:00 2017 (r324959) +++ head/sys/vm/vm_page.c Tue Oct 24 17:14:53 2017 (r324960) @@ -2802,27 +2802,26 @@ vm_page_free_prep(vm_page_t m, bool pagequeue_locked) if (vm_page_sbusied(m)) panic("vm_page_free: freeing busy page %p", m); + vm_page_remove(m); + /* - * Unqueue, then remove page. Note that we cannot destroy - * the page here because we do not want to call the pager's - * callback routine until after we've put the page on the - * appropriate free queue. + * If fictitious remove object association and + * return. */ + if ((m->flags & PG_FICTITIOUS) != 0) { + KASSERT(m->wire_count == 1, + ("fictitious page %p is not wired", m)); + KASSERT(m->queue == PQ_NONE, + ("fictitious page %p is queued", m)); + return (false); + } + if (m->queue != PQ_NONE) { if (pagequeue_locked) vm_page_dequeue_locked(m); else vm_page_dequeue(m); } - vm_page_remove(m); - - /* - * If fictitious remove object association and - * return, otherwise delay object association removal. - */ - if ((m->flags & PG_FICTITIOUS) != 0) - return (false); - m->valid = 0; vm_page_undirty(m); From owner-svn-src-head@freebsd.org Tue Oct 24 18:19:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9BB65E552E3; Tue, 24 Oct 2017 18:19:21 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-pg0-f42.google.com (mail-pg0-f42.google.com [74.125.83.42]) (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 786A06B1EB; Tue, 24 Oct 2017 18:19:21 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-pg0-f42.google.com with SMTP id v78so15173339pgb.5; Tue, 24 Oct 2017 11:19: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:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+g/sGidYXEONMycm3C/cQScZT5UxrAiPVmhOY41oW+M=; b=SlkU26UD3L77nQsq6MOmxC2jQaJbV37nwSAlWp+zRjkxrw256TFcKDlQycn5le84mp YOvJlRcJp/oAFr/IXGUWNdf+WQVT+tPKAmDYCTjK48n2NJXK+IVOigtQRN7TVye/13tY 0k1itmET7uQo3J3X4o6SiqwrEkfrr7X/zwZDgdJc0YDmfjxU5brK87nMmoNfmMfrDyws Sn7t9sGoFjnsf3OkI9q8j9Q2dxCUSQHRO228YVJwJ7Hj5zEbijyBIg777sztSaaC8+CR KbXrAfuvRBRUnxyZg4Gb0HBQ0eU0LqDz7KQreSEwlApGrBp+RJDdPGja0H2X+DFUyEGI tIhA== X-Gm-Message-State: AMCzsaV9RSywTVfvaKQ/SzHV8c1QxEFcdIuMLOTZ+tZp9f75I5Txpi9y VfKhU56mFsmGnhVBMaMV/kXYofHtn4s= X-Google-Smtp-Source: ABhQp+Ra+1b6wnUB8Fn8Nak1XOK+nSjeUFUi5Zq5Yhs3iggwEHxJRwJJrEeIzklspOdhpq3Ls7hf2g== X-Received: by 10.98.60.23 with SMTP id j23mr17285274pfa.190.1508869160092; Tue, 24 Oct 2017 11:19:20 -0700 (PDT) Received: from [172.16.30.6] ([12.179.176.147]) by smtp.googlemail.com with ESMTPSA id a81sm1526396pfe.32.2017.10.24.11.19.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 11:19:19 -0700 (PDT) Subject: Re: svn commit: r324957 - head/sys/dev/iscsi To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710241459.v9OExVSF003079@repo.freebsd.org> From: Andriy Gapon Message-ID: <79303709-fed8-210a-16e8-2209cce58dbc@FreeBSD.org> Date: Tue, 24 Oct 2017 21:19:15 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201710241459.v9OExVSF003079@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 18:19:21 -0000 On 24/10/2017 17:59, Andriy Gapon wrote: > Author: avg > Date: Tue Oct 24 14:59:31 2017 > New Revision: 324957 > URL: https://svnweb.freebsd.org/changeset/base/324957 > > Log: > iscsi_shutdown_post: do nothing if panic-ing By the way, this change raised a question if we even should post shutdown_pre_sync and shutdown_post_sync events if the sync itself is disabled via RB_NOSYNC. From the purely semantic point of view it feels that the answer should be no. But there could be some dependencies on those events being posted in all cases. On the other hand, it seems like at present almost every handler has to check for either RB_NOSYNC or panicstr. Opinions are welcome :-) > There is nothing that that routine should or could really do in that > context. > > Reported by: Ben RUBSON > MFC after: 1 week > > Modified: > head/sys/dev/iscsi/iscsi.c > > Modified: head/sys/dev/iscsi/iscsi.c > ============================================================================== > --- head/sys/dev/iscsi/iscsi.c Tue Oct 24 14:34:25 2017 (r324956) > +++ head/sys/dev/iscsi/iscsi.c Tue Oct 24 14:59:31 2017 (r324957) > @@ -2458,8 +2458,10 @@ static void > iscsi_shutdown_post(struct iscsi_softc *sc) > { > > - ISCSI_DEBUG("removing all sessions due to shutdown"); > - iscsi_terminate_sessions(sc); > + if (panicstr == NULL) { > + ISCSI_DEBUG("removing all sessions due to shutdown"); > + iscsi_terminate_sessions(sc); > + } > } > > static int > -- Andriy Gapon From owner-svn-src-head@freebsd.org Tue Oct 24 19:14:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71359E56441; Tue, 24 Oct 2017 19:14:34 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E9356D07B; Tue, 24 Oct 2017 19:14:34 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OJEXcp013932; Tue, 24 Oct 2017 19:14:33 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OJEXYV013931; Tue, 24 Oct 2017 19:14:33 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201710241914.v9OJEXYV013931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Tue, 24 Oct 2017 19:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324961 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 324961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 19:14:34 -0000 Author: fsu Date: Tue Oct 24 19:14:33 2017 New Revision: 324961 URL: https://svnweb.freebsd.org/changeset/base/324961 Log: Do not free bufs in case of extents metadata blocks + remove unneeded asserts. Approved by: pfg (mentor) MFC after: 6 months Modified: head/sys/fs/ext2fs/ext2_extents.c Modified: head/sys/fs/ext2fs/ext2_extents.c ============================================================================== --- head/sys/fs/ext2fs/ext2_extents.c Tue Oct 24 17:14:53 2017 (r324960) +++ head/sys/fs/ext2fs/ext2_extents.c Tue Oct 24 19:14:33 2017 (r324961) @@ -420,7 +420,7 @@ ext4_ext_find_extent(struct inode *ip, daddr_t block, } ext4_ext_fill_path_bdata(&path[ppos], bp, blk); - brelse(bp); + bqrelse(bp); eh = ext4_ext_block_header(path[ppos].ep_data); error = ext4_ext_check_header(ip, eh); @@ -1228,7 +1228,7 @@ ext4_ext_get_blocks(struct inode *ip, e4fs_daddr_t ibl } if ((ex = path[depth].ep_ext)) { - uint64_t lblk = ex->e_blk; + uint64_t lblk = ex->e_blk; uint16_t e_len = ex->e_len; e4fs_daddr_t e_start = ext4_ext_extent_pblock(ex); @@ -1397,9 +1397,6 @@ ext4_ext_rm_leaf(struct inode *ip, struct ext4_extent_ /* Remove whole extent. */ block = ex_blk; num = 0; - KASSERT(a == ex_blk, ("ext4_ext_rm_leaf: bad a")); - KASSERT(b != ex_blk + ex_len - 1, - ("ext4_ext_rm_leaf: bad b")); } if (ex == EXT_FIRST_EXTENT(eh)) @@ -1508,7 +1505,7 @@ ext4_ext_remove_space(struct inode *ip, off_t length, return (error); path = malloc(sizeof(struct ext4_extent_path) * (depth + 1), - M_EXT2EXTENTS, M_WAITOK | M_ZERO); + M_EXT2EXTENTS, M_WAITOK | M_ZERO); if (!path) return (ENOMEM); From owner-svn-src-head@freebsd.org Tue Oct 24 19:16:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C9C2E5650C; Tue, 24 Oct 2017 19:16:26 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A4846D31D; Tue, 24 Oct 2017 19:16:26 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OJGPRp014154; Tue, 24 Oct 2017 19:16:25 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OJGPEp014153; Tue, 24 Oct 2017 19:16:25 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201710241916.v9OJGPEp014153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Tue, 24 Oct 2017 19:16:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324962 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 324962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 19:16:26 -0000 Author: fsu Date: Tue Oct 24 19:16:25 2017 New Revision: 324962 URL: https://svnweb.freebsd.org/changeset/base/324962 Log: Set doreallocblks sysctl value to zero by default because of possibility of filesystem corruption. Approved by: pfg (mentor) MFC after: 2 weeks Modified: head/sys/fs/ext2fs/ext2_alloc.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Tue Oct 24 19:14:33 2017 (r324961) +++ head/sys/fs/ext2fs/ext2_alloc.c Tue Oct 24 19:16:25 2017 (r324962) @@ -173,7 +173,7 @@ static int doasyncfree = 1; SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyncfree, CTLFLAG_RW, &doasyncfree, 0, "Use asychronous writes to update block pointers when freeing blocks"); -static int doreallocblks = 1; +static int doreallocblks = 0; SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, ""); From owner-svn-src-head@freebsd.org Tue Oct 24 20:10:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90F61E574F6; Tue, 24 Oct 2017 20:10:10 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 604836ED4A; Tue, 24 Oct 2017 20:10:10 +0000 (UTC) (envelope-from fsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9OKA9AP035339; Tue, 24 Oct 2017 20:10:09 GMT (envelope-from fsu@FreeBSD.org) Received: (from fsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OKA9HH035335; Tue, 24 Oct 2017 20:10:09 GMT (envelope-from fsu@FreeBSD.org) Message-Id: <201710242010.v9OKA9HH035335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fsu set sender to fsu@FreeBSD.org using -f From: Fedor Uporov Date: Tue, 24 Oct 2017 20:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324963 - head/sys/fs/ext2fs X-SVN-Group: head X-SVN-Commit-Author: fsu X-SVN-Commit-Paths: head/sys/fs/ext2fs X-SVN-Commit-Revision: 324963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 20:10:10 -0000 Author: fsu Date: Tue Oct 24 20:10:08 2017 New Revision: 324963 URL: https://svnweb.freebsd.org/changeset/base/324963 Log: Fix physical block number overflow in different places. Approved by: pfg (mentor) MFC after: 6 months Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/fs/ext2fs/ext2_extern.h head/sys/fs/ext2fs/ext2_inode.c head/sys/fs/ext2fs/ext2_subr.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Tue Oct 24 19:16:25 2017 (r324962) +++ head/sys/fs/ext2fs/ext2_alloc.c Tue Oct 24 20:10:08 2017 (r324963) @@ -56,8 +56,8 @@ static daddr_t ext2_alloccg(struct inode *, int, daddr_t, int); static daddr_t ext2_clusteralloc(struct inode *, int, daddr_t, int); static u_long ext2_dirpref(struct inode *); -static u_long ext2_hashalloc(struct inode *, int, long, int, - daddr_t (*)(struct inode *, int, daddr_t, +static e4fs_daddr_t ext2_hashalloc(struct inode *, int, long, int, + daddr_t (*)(struct inode *, int, daddr_t, int)); static daddr_t ext2_nodealloccg(struct inode *, int, daddr_t, int); static daddr_t ext2_mapsearch(struct m_ext2fs *, char *, daddr_t); @@ -85,7 +85,7 @@ ext2_alloc(struct inode *ip, daddr_t lbn, e4fs_daddr_t { struct m_ext2fs *fs; struct ext2mount *ump; - int32_t bno; + e4fs_daddr_t bno; int cg; *bnp = 0; @@ -134,7 +134,7 @@ nospace: /* * Allocate EA's block for inode. */ -daddr_t +e4fs_daddr_t ext2_alloc_meta(struct inode *ip) { struct m_ext2fs *fs; @@ -617,12 +617,12 @@ ext2_blkpref(struct inode *ip, e2fs_lbn_t lbn, int ind * 2) quadradically rehash on the cylinder group number. * 3) brute force search for a free block. */ -static u_long +static e4fs_daddr_t ext2_hashalloc(struct inode *ip, int cg, long pref, int size, daddr_t (*allocator) (struct inode *, int, daddr_t, int)) { struct m_ext2fs *fs; - ino_t result; + e4fs_daddr_t result; int i, icg = cg; mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED); @@ -1181,7 +1181,7 @@ ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long fs = ip->i_e2fs; ump = ip->i_ump; cg = dtog(fs, bno); - if ((u_int)bno >= fs->e2fs->e2fs_bcount) { + if (bno >= fs->e2fs->e2fs_bcount) { printf("bad block %lld, ino %ju\n", (long long)bno, (uintmax_t)ip->i_number); ext2_fserr(fs, ip->i_uid, "bad block"); Modified: head/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- head/sys/fs/ext2fs/ext2_extern.h Tue Oct 24 19:16:25 2017 (r324962) +++ head/sys/fs/ext2fs/ext2_extern.h Tue Oct 24 20:10:08 2017 (r324963) @@ -51,7 +51,7 @@ struct vnode; int ext2_add_entry(struct vnode *, struct ext2fs_direct_2 *); int ext2_alloc(struct inode *, daddr_t, e4fs_daddr_t, int, struct ucred *, e4fs_daddr_t *); -daddr_t ext2_alloc_meta(struct inode *ip); +e4fs_daddr_t ext2_alloc_meta(struct inode *ip); int ext2_balloc(struct inode *, e2fs_lbn_t, int, struct ucred *, struct buf **, int); int ext2_blkatoff(struct vnode *, off_t, char **, struct buf **); @@ -61,7 +61,7 @@ e4fs_daddr_t ext2_blkpref(struct inode *, e2fs_lbn_t, int ext2_bmap(struct vop_bmap_args *); int ext2_bmaparray(struct vnode *, daddr_t, daddr_t *, int *, int *); int ext4_bmapext(struct vnode *, int32_t, int64_t *, int *, int *); -void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); +void ext2_clusteracct(struct m_ext2fs *, char *, int, e4fs_daddr_t, int); void ext2_dirbad(struct inode *ip, doff_t offset, char *how); void ext2_fserr(struct m_ext2fs *, uid_t, char *); void ext2_ei2i(struct ext2fs_dinode *, struct inode *); Modified: head/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- head/sys/fs/ext2fs/ext2_inode.c Tue Oct 24 19:16:25 2017 (r324962) +++ head/sys/fs/ext2fs/ext2_inode.c Tue Oct 24 20:10:08 2017 (r324963) @@ -224,9 +224,9 @@ ext2_ind_truncate(struct vnode *vp, off_t length, int struct thread *td) { struct vnode *ovp = vp; - int32_t lastblock; + e4fs_daddr_t lastblock; struct inode *oip; - int32_t bn, lbn, lastiblock[EXT2_NIADDR], indir_lbn[EXT2_NIADDR]; + e4fs_daddr_t bn, lbn, lastiblock[EXT2_NIADDR], indir_lbn[EXT2_NIADDR]; uint32_t oldblks[EXT2_NDADDR + EXT2_NIADDR]; uint32_t newblks[EXT2_NDADDR + EXT2_NIADDR]; struct m_ext2fs *fs; Modified: head/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- head/sys/fs/ext2fs/ext2_subr.c Tue Oct 24 19:16:25 2017 (r324962) +++ head/sys/fs/ext2fs/ext2_subr.c Tue Oct 24 20:10:08 2017 (r324963) @@ -91,11 +91,12 @@ ext2_blkatoff(struct vnode *vp, off_t offset, char **r * Cnt == 1 means free; cnt == -1 means allocating. */ void -ext2_clusteracct(struct m_ext2fs *fs, char *bbp, int cg, daddr_t bno, int cnt) +ext2_clusteracct(struct m_ext2fs *fs, char *bbp, int cg, e4fs_daddr_t bno, int cnt) { int32_t *sump = fs->e2fs_clustersum[cg].cs_sum; int32_t *lp; - int back, bit, end, forw, i, loc, start; + e4fs_daddr_t start, end, loc, forw, back; + int bit, i; /* Initialize the cluster summary array. */ if (fs->e2fs_clustersum[cg].cs_init == 0) { From owner-svn-src-head@freebsd.org Tue Oct 24 21:18:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6AEFE2BB9D; Tue, 24 Oct 2017 21:18:51 +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 mx1.freebsd.org (Postfix) with ESMTPS id 9C36071116; Tue, 24 Oct 2017 21:18:51 +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 v9OLIo2X064245; Tue, 24 Oct 2017 21:18:50 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9OLIoNl064239; Tue, 24 Oct 2017 21:18:50 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201710242118.v9OLIoNl064239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 24 Oct 2017 21:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324964 - head/sys/dev/bnxt X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/dev/bnxt X-SVN-Commit-Revision: 324964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2017 21:18:52 -0000 Author: shurd Date: Tue Oct 24 21:18:50 2017 New Revision: 324964 URL: https://svnweb.freebsd.org/changeset/base/324964 Log: bnxt: add support for Flow control setting using sysctl Created sysctl node dev.bnxt.0.fc with following options. A. dev.bnxt.0.fc.autoneg B. dev.bnxt.0.fc.rx C. dev.bnxt.0.fc.tx Description:- dev.bnxt.0.fc: flow ctrl dev.bnxt.0.fc.autoneg: Enable or Disable Autoneg Flow Ctrl: 0 / 1 dev.bnxt.0.fc.rx: Enable or Disable Rx Flow Ctrl: 0 / 1 dev.bnxt.0.fc.tx: Enable or Disable Tx Flow Ctrl: 0 / 1 Submitted by: Bhargava Chenna Marreddy Reviewed by: shurd, sbruno Approved by: sbruno (mentor) Sponsored by: Broadcom Limited Differential Revision: https://reviews.freebsd.org/D12599 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/bnxt_hwrm.c head/sys/dev/bnxt/bnxt_hwrm.h head/sys/dev/bnxt/bnxt_sysctl.c head/sys/dev/bnxt/bnxt_sysctl.h head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/bnxt.h ============================================================================== --- head/sys/dev/bnxt/bnxt.h Tue Oct 24 20:10:08 2017 (r324963) +++ head/sys/dev/bnxt/bnxt.h Tue Oct 24 21:18:50 2017 (r324964) @@ -211,6 +211,10 @@ __FBSDID("$FreeBSD$"); #define BNXT_HWRM_LOCK_DESTROY(_softc) mtx_destroy(&(_softc)->hwrm_lock) #define BNXT_HWRM_LOCK_ASSERT(_softc) mtx_assert(&(_softc)->hwrm_lock, \ MA_OWNED) +#define BNXT_IS_FLOW_CTRL_CHANGED(link_info) \ + ((link_info->last_flow_ctrl.tx != link_info->flow_ctrl.tx) || \ + (link_info->last_flow_ctrl.rx != link_info->flow_ctrl.rx) || \ + (link_info->last_flow_ctrl.autoneg != link_info->flow_ctrl.autoneg)) /* Chip info */ #define BNXT_TSO_SIZE UINT16_MAX @@ -288,6 +292,12 @@ struct bnxt_bar_info { int rid; }; +struct bnxt_flow_ctrl { + bool rx; + bool tx; + bool autoneg; +}; + struct bnxt_link_info { uint8_t media_type; uint8_t transceiver; @@ -299,10 +309,8 @@ struct bnxt_link_info { uint8_t last_link_up; uint8_t duplex; uint8_t last_duplex; - uint8_t pause; - uint8_t last_pause; - uint8_t auto_pause; - uint8_t force_pause; + struct bnxt_flow_ctrl flow_ctrl; + struct bnxt_flow_ctrl last_flow_ctrl; uint8_t duplex_setting; uint8_t auto_mode; #define PHY_VER_LEN 3 @@ -320,7 +328,6 @@ struct bnxt_link_info { #define BNXT_AUTONEG_SPEED 1 #define BNXT_AUTONEG_FLOW_CTRL 2 uint8_t req_duplex; - uint8_t req_flow_ctrl; uint16_t req_link_speed; }; @@ -596,6 +603,8 @@ struct bnxt_softc { struct sysctl_oid *hw_stats_oid; struct sysctl_ctx_list hw_lro_ctx; struct sysctl_oid *hw_lro_oid; + struct sysctl_ctx_list flow_ctrl_ctx; + struct sysctl_oid *flow_ctrl_oid; struct bnxt_ver_info *ver_info; struct bnxt_nvram_info *nvm_info; Modified: head/sys/dev/bnxt/bnxt_hwrm.c ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.c Tue Oct 24 20:10:08 2017 (r324963) +++ head/sys/dev/bnxt/bnxt_hwrm.c Tue Oct 24 21:18:50 2017 (r324964) @@ -503,33 +503,28 @@ static void bnxt_hwrm_set_pause_common(struct bnxt_softc *softc, struct hwrm_port_phy_cfg_input *req) { - if (softc->link_info.autoneg & BNXT_AUTONEG_FLOW_CTRL) { + struct bnxt_link_info *link_info = &softc->link_info; + + if (link_info->flow_ctrl.autoneg) { req->auto_pause = HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_AUTONEG_PAUSE; - if (softc->link_info.req_flow_ctrl & - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) + if (link_info->flow_ctrl.rx) req->auto_pause |= HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX; - if (softc->link_info.req_flow_ctrl & - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX) + if (link_info->flow_ctrl.tx) req->auto_pause |= - HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX; + HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX; req->enables |= htole32(HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE); } else { - if (softc->link_info.req_flow_ctrl & - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) + if (link_info->flow_ctrl.rx) req->force_pause |= HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX; - if (softc->link_info.req_flow_ctrl & - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX) + if (link_info->flow_ctrl.tx) req->force_pause |= HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX; req->enables |= htole32(HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAUSE); - req->auto_pause = req->force_pause; - req->enables |= htole32( - HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE); } } @@ -563,49 +558,41 @@ bnxt_hwrm_set_eee(struct bnxt_softc *softc, struct hwr int bnxt_hwrm_set_link_setting(struct bnxt_softc *softc, bool set_pause, - bool set_eee) + bool set_eee, bool set_link) { struct hwrm_port_phy_cfg_input req = {0}; + int rc; if (softc->flags & BNXT_FLAG_NPAR) return ENOTSUP; bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_CFG); - if (set_pause) + + if (set_pause) { bnxt_hwrm_set_pause_common(softc, &req); - bnxt_hwrm_set_link_common(softc, &req); - if (set_eee) - bnxt_hwrm_set_eee(softc, &req); - return hwrm_send_message(softc, &req, sizeof(req)); -} + if (softc->link_info.flow_ctrl.autoneg) + set_link = true; + } - -int -bnxt_hwrm_set_pause(struct bnxt_softc *softc) -{ - struct hwrm_port_phy_cfg_input req = {0}; - int rc; - - if (softc->flags & BNXT_FLAG_NPAR) - return ENOTSUP; - - bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_PHY_CFG); - bnxt_hwrm_set_pause_common(softc, &req); - - if (softc->link_info.autoneg & BNXT_AUTONEG_FLOW_CTRL) + if (set_link) bnxt_hwrm_set_link_common(softc, &req); - + + if (set_eee) + bnxt_hwrm_set_eee(softc, &req); + BNXT_HWRM_LOCK(softc); rc = _hwrm_send_message(softc, &req, sizeof(req)); - if (!rc && !(softc->link_info.autoneg & BNXT_AUTONEG_FLOW_CTRL)) { - /* since changing of pause setting doesn't trigger any link - * change event, the driver needs to update the current pause - * result upon successfully return of the phy_cfg command */ - softc->link_info.pause = - softc->link_info.force_pause = softc->link_info.req_flow_ctrl; - softc->link_info.auto_pause = 0; - bnxt_report_link(softc); + + if (!rc) { + if (set_pause) { + /* since changing of 'force pause' setting doesn't + * trigger any link change event, the driver needs to + * update the current pause result upon successfully i + * return of the phy_cfg command */ + if (!softc->link_info.flow_ctrl.autoneg) + bnxt_report_link(softc); + } } BNXT_HWRM_UNLOCK(softc); return rc; @@ -1536,10 +1523,43 @@ bnxt_hwrm_port_phy_qcfg(struct bnxt_softc *softc) link_info->phy_link_status = resp->link; link_info->duplex = resp->duplex_cfg; - link_info->pause = resp->pause; link_info->auto_mode = resp->auto_mode; - link_info->auto_pause = resp->auto_pause; - link_info->force_pause = resp->force_pause; + + /* + * When AUTO_PAUSE_AUTONEG_PAUSE bit is set to 1, + * the advertisement of pause is enabled. + * 1. When the auto_mode is not set to none and this flag is set to 1, + * then the auto_pause bits on this port are being advertised and + * autoneg pause results are being interpreted. + * 2. When the auto_mode is not set to none and this flag is set to 0, + * the pause is forced as indicated in force_pause, and also + * advertised as auto_pause bits, but the autoneg results are not + * interpreted since the pause configuration is being forced. + * 3. When the auto_mode is set to none and this flag is set to 1, + * auto_pause bits should be ignored and should be set to 0. + */ + + link_info->flow_ctrl.autoneg = false; + link_info->flow_ctrl.tx = false; + link_info->flow_ctrl.rx = false; + + if ((resp->auto_mode) && + (resp->auto_pause & BNXT_AUTO_PAUSE_AUTONEG_PAUSE)) { + link_info->flow_ctrl.autoneg = true; + } + + if (link_info->flow_ctrl.autoneg) { + if (resp->auto_pause & BNXT_PAUSE_TX) + link_info->flow_ctrl.tx = true; + if (resp->auto_pause & BNXT_PAUSE_RX) + link_info->flow_ctrl.rx = true; + } else { + if (resp->force_pause & BNXT_PAUSE_TX) + link_info->flow_ctrl.tx = true; + if (resp->force_pause & BNXT_PAUSE_RX) + link_info->flow_ctrl.rx = true; + } + link_info->duplex_setting = resp->duplex_cfg; if (link_info->phy_link_status == HWRM_PORT_PHY_QCFG_OUTPUT_LINK_LINK) link_info->link_speed = le16toh(resp->link_speed); Modified: head/sys/dev/bnxt/bnxt_hwrm.h ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.h Tue Oct 24 20:10:08 2017 (r324963) +++ head/sys/dev/bnxt/bnxt_hwrm.h Tue Oct 24 21:18:50 2017 (r324964) @@ -32,6 +32,11 @@ __FBSDID("$FreeBSD$"); #ifndef _BNXT_HWRM_H #define _BNXT_HWRM_H +#define BNXT_PAUSE_TX (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX) +#define BNXT_PAUSE_RX (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) +#define BNXT_AUTO_PAUSE_AUTONEG_PAUSE \ + (HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_PAUSE_AUTONEG_PAUSE) + /* HWRM Function Prototypes */ int bnxt_alloc_hwrm_dma_mem(struct bnxt_softc *softc); void bnxt_free_hwrm_dma_mem(struct bnxt_softc *softc); @@ -45,8 +50,8 @@ int bnxt_hwrm_func_drv_unrgtr(struct bnxt_softc *softc int bnxt_hwrm_func_qcaps(struct bnxt_softc *softc); int bnxt_hwrm_func_qcfg(struct bnxt_softc *softc); int bnxt_hwrm_func_reset(struct bnxt_softc *softc); -int bnxt_hwrm_set_link_setting(struct bnxt_softc *, bool set_pause, - bool set_eee); +int bnxt_hwrm_set_link_setting(struct bnxt_softc *softc, bool set_pause, + bool set_eee, bool set_link); int bnxt_hwrm_set_pause(struct bnxt_softc *softc); int bnxt_hwrm_vnic_ctx_alloc(struct bnxt_softc *softc, uint16_t *ctx_id); int bnxt_hwrm_vnic_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic); Modified: head/sys/dev/bnxt/bnxt_sysctl.c ============================================================================== --- head/sys/dev/bnxt/bnxt_sysctl.c Tue Oct 24 20:10:08 2017 (r324963) +++ head/sys/dev/bnxt/bnxt_sysctl.c Tue Oct 24 21:18:50 2017 (r324964) @@ -94,6 +94,16 @@ bnxt_init_sysctl_ctx(struct bnxt_softc *softc) return ENOMEM; } + sysctl_ctx_init(&softc->flow_ctrl_ctx); + ctx = device_get_sysctl_ctx(softc->dev); + softc->flow_ctrl_oid = SYSCTL_ADD_NODE(ctx, + SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, + "fc", CTLFLAG_RD, 0, "flow ctrl"); + if (!softc->flow_ctrl_oid) { + sysctl_ctx_free(&softc->flow_ctrl_ctx); + return ENOMEM; + } + return 0; } @@ -132,6 +142,14 @@ bnxt_free_sysctl_ctx(struct bnxt_softc *softc) softc->hw_lro_oid = NULL; } + if (softc->flow_ctrl_oid != NULL) { + orc = sysctl_ctx_free(&softc->flow_ctrl_ctx); + if (orc) + rc = orc; + else + softc->flow_ctrl_oid = NULL; + } + return rc; } @@ -1257,6 +1275,62 @@ BNXT_HW_LRO_FN(bnxt_hw_lro_set_mode, is_mode_gro) BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_agg_segs, max_agg_segs) BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_aggs, max_aggs) BNXT_HW_LRO_FN(bnxt_hw_lro_set_min_agg_len, min_agg_len) + +#define BNXT_FLOW_CTRL_FN(fn_name, arg) \ +static int \ +fn_name(SYSCTL_HANDLER_ARGS) { \ + struct bnxt_softc *softc = arg1; \ + int rc; \ + int val; \ + \ + if (softc == NULL) \ + return EBUSY; \ + \ + val = softc->link_info.flow_ctrl.arg; \ + rc = sysctl_handle_int(oidp, &val, 0, req); \ + if (rc || !req->newptr) \ + return rc; \ + \ + if (val) \ + val = 1; \ + \ + if (softc->link_info.flow_ctrl.arg != val) { \ + softc->link_info.flow_ctrl.arg = val; \ + rc = bnxt_hwrm_set_link_setting(softc, true, false, false);\ + rc = bnxt_hwrm_port_phy_qcfg(softc); \ + } \ + \ + return rc; \ +} + +BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_tx, tx) +BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_rx, rx) +BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_autoneg, autoneg) +int +bnxt_create_pause_fc_sysctls(struct bnxt_softc *softc) +{ + struct sysctl_oid *oid = softc->flow_ctrl_oid; + + if (!oid) + return ENOMEM; + + SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "tx", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, + bnxt_flow_ctrl_tx, "A", + "Enable or Disable Tx Flow Ctrl: 0 / 1"); + + SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "rx", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, + bnxt_flow_ctrl_rx, "A", + "Enable or Disable Tx Flow Ctrl: 0 / 1"); + + SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, + "autoneg", CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, + bnxt_flow_ctrl_autoneg, "A", + "Enable or Disable Autoneg Flow Ctrl: 0 / 1"); + + return 0; +} int bnxt_create_hw_lro_sysctls(struct bnxt_softc *softc) Modified: head/sys/dev/bnxt/bnxt_sysctl.h ============================================================================== --- head/sys/dev/bnxt/bnxt_sysctl.h Tue Oct 24 20:10:08 2017 (r324963) +++ head/sys/dev/bnxt/bnxt_sysctl.h Tue Oct 24 21:18:50 2017 (r324964) @@ -41,3 +41,4 @@ int bnxt_create_nvram_sysctls(struct bnxt_nvram_info * int bnxt_create_config_sysctls_pre(struct bnxt_softc *softc); int bnxt_create_config_sysctls_post(struct bnxt_softc *softc); int bnxt_create_hw_lro_sysctls(struct bnxt_softc *softc); +int bnxt_create_pause_fc_sysctls(struct bnxt_softc *softc); Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Tue Oct 24 20:10:08 2017 (r324963) +++ head/sys/dev/bnxt/if_bnxt.c Tue Oct 24 21:18:50 2017 (r324964) @@ -878,6 +878,10 @@ bnxt_attach_pre(if_ctx_t ctx) if (rc) goto failed; + rc = bnxt_create_pause_fc_sysctls(softc); + if (rc) + goto failed; + /* Initialize the vlan list */ SLIST_INIT(&softc->vnic_info.vlan_tags); softc->vnic_info.vlan_tag_list.idi_vaddr = NULL; @@ -1377,13 +1381,10 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * if return; } - if (link_info->pause == (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX | - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX)) - ifmr->ifm_active |= (IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE); - else if (link_info->pause == HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX) - ifmr->ifm_active |= IFM_ETH_TXPAUSE; - else if (link_info->pause == HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) + if (link_info->flow_ctrl.rx) ifmr->ifm_active |= IFM_ETH_RXPAUSE; + if (link_info->flow_ctrl.tx) + ifmr->ifm_active |= IFM_ETH_TXPAUSE; bnxt_report_link(softc); return; @@ -1471,7 +1472,7 @@ bnxt_media_change(if_ctx_t ctx) softc->link_info.autoneg |= BNXT_AUTONEG_SPEED; break; } - rc = bnxt_hwrm_set_link_setting(softc, true, true); + rc = bnxt_hwrm_set_link_setting(softc, true, true, true); bnxt_media_status(softc->ctx, &ifmr); return rc; } @@ -2096,18 +2097,6 @@ bnxt_probe_phy(struct bnxt_softc *softc) if (link_info->auto_mode != HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE) link_info->autoneg |= BNXT_AUTONEG_SPEED; - if (link_info->auto_pause & (HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX | - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX)) { - if (link_info->auto_pause == ( - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX | - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX)) - link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL; - link_info->req_flow_ctrl = link_info->auto_pause; - } else if (link_info->force_pause & ( - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX | - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX)) { - link_info->req_flow_ctrl = link_info->force_pause; - } link_info->req_duplex = link_info->duplex_setting; if (link_info->autoneg & BNXT_AUTONEG_SPEED) link_info->req_link_speed = link_info->auto_link_speed; @@ -2352,47 +2341,46 @@ exit: void bnxt_report_link(struct bnxt_softc *softc) { + struct bnxt_link_info *link_info = &softc->link_info; const char *duplex = NULL, *flow_ctrl = NULL; - if (softc->link_info.link_up == softc->link_info.last_link_up) { - if (!softc->link_info.link_up) + if (link_info->link_up == link_info->last_link_up) { + if (!link_info->link_up) return; - if (softc->link_info.pause == softc->link_info.last_pause && - softc->link_info.duplex == softc->link_info.last_duplex) + if ((link_info->duplex == link_info->last_duplex) && + (!(BNXT_IS_FLOW_CTRL_CHANGED(link_info)))) return; } - if (softc->link_info.link_up) { - if (softc->link_info.duplex == + if (link_info->link_up) { + if (link_info->duplex == HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_CFG_FULL) duplex = "full duplex"; else duplex = "half duplex"; - if (softc->link_info.pause == ( - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX | - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX)) + if (link_info->flow_ctrl.tx & link_info->flow_ctrl.rx) flow_ctrl = "FC - receive & transmit"; - else if (softc->link_info.pause == - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_TX) + else if (link_info->flow_ctrl.tx) flow_ctrl = "FC - transmit"; - else if (softc->link_info.pause == - HWRM_PORT_PHY_QCFG_OUTPUT_PAUSE_RX) + else if (link_info->flow_ctrl.rx) flow_ctrl = "FC - receive"; else flow_ctrl = "FC - none"; iflib_link_state_change(softc->ctx, LINK_STATE_UP, IF_Gbps(100)); device_printf(softc->dev, "Link is UP %s, %s - %d Mbps \n", duplex, - flow_ctrl, (softc->link_info.link_speed * 100)); + flow_ctrl, (link_info->link_speed * 100)); } else { iflib_link_state_change(softc->ctx, LINK_STATE_DOWN, bnxt_get_baudrate(&softc->link_info)); device_printf(softc->dev, "Link is Down\n"); } - softc->link_info.last_link_up = softc->link_info.link_up; - softc->link_info.last_pause = softc->link_info.pause; - softc->link_info.last_duplex = softc->link_info.duplex; + link_info->last_link_up = link_info->link_up; + link_info->last_duplex = link_info->duplex; + link_info->last_flow_ctrl.tx = link_info->flow_ctrl.tx; + link_info->last_flow_ctrl.rx = link_info->flow_ctrl.rx; + link_info->last_flow_ctrl.autoneg = link_info->flow_ctrl.autoneg; } static int From owner-svn-src-head@freebsd.org Wed Oct 25 00:51:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F763E39732; Wed, 25 Oct 2017 00:51:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CADAC76E6A; Wed, 25 Oct 2017 00:51:02 +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 v9P0p2jB052944; Wed, 25 Oct 2017 00:51:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9P0p0Tl052928; Wed, 25 Oct 2017 00:51:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710250051.v9P0p0Tl052928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 25 Oct 2017 00:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324965 - in head: etc/defaults etc/rc.d sbin/dumpon sbin/savecore share/man/man5 sys/dev/null sys/geom sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: etc/defaults etc/rc.d sbin/dumpon sbin/savecore share/man/man5 sys/dev/null sys/geom sys/kern sys/sys X-SVN-Commit-Revision: 324965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 00:51:03 -0000 Author: markj Date: Wed Oct 25 00:51:00 2017 New Revision: 324965 URL: https://svnweb.freebsd.org/changeset/base/324965 Log: Add support for compressed kernel dumps. When using a kernel built with the GZIO config option, dumpon -z can be used to configure gzip compression using the in-kernel copy of zlib. This is useful on systems with large amounts of RAM, which require a correspondingly large dump device. Recovery of compressed dumps is also faster since fewer bytes need to be copied from the dump device. Because we have no way of knowing the final size of a compressed dump until it is written, the kernel will always attempt to dump when compression is configured, regardless of the dump device size. If the dump is aborted because we run out of space, an error is reported on the console. savecore(8) is modified to handle compressed dumps and save them to vmcore..gz, as it does when given the -z option. A new rc.conf variable, dumpon_flags, is added. Its value is added to the boot-time dumpon(8) invocation that occurs when a dump device is configured in rc.conf. Reviewed by: cem (earlier version) Discussed with: def, rgrimes Relnotes: yes Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11723 Modified: head/etc/defaults/rc.conf head/etc/rc.d/dumpon head/sbin/dumpon/dumpon.8 head/sbin/dumpon/dumpon.c head/sbin/savecore/savecore.8 head/sbin/savecore/savecore.c head/share/man/man5/rc.conf.5 head/sys/dev/null/null.c head/sys/geom/geom_dev.c head/sys/kern/kern_gzio.c head/sys/kern/kern_shutdown.c head/sys/sys/conf.h head/sys/sys/disk.h head/sys/sys/gzio.h head/sys/sys/kerneldump.h Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Tue Oct 24 21:18:50 2017 (r324964) +++ head/etc/defaults/rc.conf Wed Oct 25 00:51:00 2017 (r324965) @@ -596,9 +596,8 @@ nscd_enable="NO" # Run the nsswitch caching daemon. chkprintcap_enable="NO" # Run chkprintcap(8) before running lpd. chkprintcap_flags="-d" # Create missing directories by default. dumpdev="AUTO" # Device to crashdump to (device name, AUTO, or NO). +dumpon_flags="" # Options to pass to dumpon(8), followed by dumpdev. dumpdir="/var/crash" # Directory where crash dumps are to be stored -dumppubkey="" # Public key for encrypted kernel crash dumps. - # See dumpon(8) for more details. savecore_enable="YES" # Extract core from dump devices if any savecore_flags="-m 10" # Used if dumpdev is enabled above, and present. # By default, only the 10 most recent kernel dumps Modified: head/etc/rc.d/dumpon ============================================================================== --- head/etc/rc.d/dumpon Tue Oct 24 21:18:50 2017 (r324964) +++ head/etc/rc.d/dumpon Wed Oct 25 00:51:00 2017 (r324965) @@ -16,11 +16,14 @@ stop_cmd="dumpon_stop" dumpon_try() { + local flags + + flags=${dumpon_flags} if [ -n "${dumppubkey}" ]; then - /sbin/dumpon -k "${dumppubkey}" "${1}" - else - /sbin/dumpon "${1}" + warn "The dumppubkey variable is deprecated. Use dumpon_flags." + flags="${flags} -k ${dumppubkey}" fi + /sbin/dumpon ${flags} "${1}" if [ $? -eq 0 ]; then # Make a symlink in devfs for savecore ln -fs "${1}" /dev/dumpdev Modified: head/sbin/dumpon/dumpon.8 ============================================================================== --- head/sbin/dumpon/dumpon.8 Tue Oct 24 21:18:50 2017 (r324964) +++ head/sbin/dumpon/dumpon.8 Wed Oct 25 00:51:00 2017 (r324965) @@ -28,7 +28,7 @@ .\" From: @(#)swapon.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd December 10, 2016 +.Dd October 24, 2017 .Dt DUMPON 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Nm .Op Fl v .Op Fl k Ar public_key_file +.Op Fl z .Ar special_file .Nm .Op Fl v @@ -114,6 +115,22 @@ This flag requires a kernel compiled with the kernel option. .Pp The +.Fl z +option configures the kernel to compress the dump in gzip format before writing +it to the dump device. +This reduces the amount of space required for the dump and accelerates +recovery with +.Xr savecore 8 +since less data needs to be copied from the dump device. +When compression is enabled, the +.Nm +utility will not verify that the dump device is sufficiently large for a full +dump. +This flag requires a kernel compiled with the +.Dv GZIO +kernel option. +.Pp +The .Fl l flag causes .Nm @@ -272,3 +289,7 @@ utility appeared in .Sh BUGS Because the file system layer is already dead by the time a crash dump is taken, it is not possible to send crash dumps directly to a file. +.Pp +It is currently not possible to configure both compression and encryption. +The encrypted dump format assumes that the kernel dump size is a multiple +of the cipher block size, which may not be true when the dump is compressed. Modified: head/sbin/dumpon/dumpon.c ============================================================================== --- head/sbin/dumpon/dumpon.c Tue Oct 24 21:18:50 2017 (r324964) +++ head/sbin/dumpon/dumpon.c Wed Oct 25 00:51:00 2017 (r324965) @@ -71,7 +71,7 @@ static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n", - "usage: dumpon [-v] [-k public_key_file] special_file", + "usage: dumpon [-v] [-k public_key_file] [-z] special_file", " dumpon [-v] off", " dumpon [-v] -l"); exit(EX_USAGE); @@ -190,11 +190,12 @@ main(int argc, char *argv[]) int ch; int i, fd; int do_listdumpdev = 0; - bool enable; + bool enable, gzip; + gzip = false; pubkeyfile = NULL; - while ((ch = getopt(argc, argv, "k:lv")) != -1) + while ((ch = getopt(argc, argv, "k:lvz")) != -1) switch((char)ch) { case 'k': pubkeyfile = optarg; @@ -205,6 +206,9 @@ main(int argc, char *argv[]) case 'v': verbose = 1; break; + case 'z': + gzip = true; + break; default: usage(); } @@ -247,9 +251,11 @@ main(int argc, char *argv[]) fd = open(dumpdev, O_RDONLY); if (fd < 0) err(EX_OSFILE, "%s", dumpdev); - check_size(fd, dumpdev); - bzero(&kda, sizeof(kda)); + if (!gzip) + check_size(fd, dumpdev); + + bzero(&kda, sizeof(kda)); kda.kda_enable = 0; i = ioctl(fd, DIOCSKERNELDUMP, &kda); explicit_bzero(&kda, sizeof(kda)); @@ -260,6 +266,8 @@ main(int argc, char *argv[]) #endif kda.kda_enable = 1; + kda.kda_compression = gzip ? KERNELDUMP_COMP_GZIP : + KERNELDUMP_COMP_NONE; i = ioctl(fd, DIOCSKERNELDUMP, &kda); explicit_bzero(kda.kda_encryptedkey, kda.kda_encryptedkeysize); free(kda.kda_encryptedkey); Modified: head/sbin/savecore/savecore.8 ============================================================================== --- head/sbin/savecore/savecore.8 Tue Oct 24 21:18:50 2017 (r324964) +++ head/sbin/savecore/savecore.8 Wed Oct 25 00:51:00 2017 (r324965) @@ -28,7 +28,7 @@ .\" From: @(#)savecore.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd December 10, 2016 +.Dd October 24, 2017 .Dt SAVECORE 8 .Os .Sh NAME @@ -96,8 +96,12 @@ the counter will restart from Print out some additional debugging information. Specify twice for more information. .It Fl z -Compress the core dump and kernel (see +Compress the dump (see .Xr gzip 1 ) . +The dump may already be compressed if the kernel was configured to +do so by +.Xr dumpon 8 . +In this case, the option has no effect. .El .Pp The Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Tue Oct 24 21:18:50 2017 (r324964) +++ head/sbin/savecore/savecore.c Wed Oct 25 00:51:00 2017 (r324965) @@ -121,6 +121,9 @@ printheader(xo_handle_t *xo, const struct kerneldumphe (long long)dumplen); xo_emit_h(xo, "{P: }{Lwc:Blocksize}{:blocksize/%d}\n", dtoh32(h->blocksize)); + xo_emit_h(xo, "{P: }{Lwc:Compression}{:compression/%s}\n", + h->compression == KERNELDUMP_COMP_GZIP ? + "gzip" : "none"); t = dtoh64(h->dumptime); xo_emit_h(xo, "{P: }{Lwc:Dumptime}{:dumptime/%s}", ctime(&t)); @@ -357,7 +360,7 @@ compare_magic(const struct kerneldumpheader *kdh, cons #define BLOCKMASK (~(BLOCKSIZE-1)) static int -DoRegularFile(int fd, bool isencrypted, off_t dumpsize, char *buf, +DoRegularFile(int fd, off_t dumpsize, u_int sectorsize, bool sparse, char *buf, const char *device, const char *filename, FILE *fp) { int he, hs, nr, nw, wl; @@ -370,8 +373,8 @@ DoRegularFile(int fd, bool isencrypted, off_t dumpsize wl = BUFFERSIZE; if (wl > dumpsize) wl = dumpsize; - nr = read(fd, buf, wl); - if (nr != wl) { + nr = read(fd, buf, roundup(wl, sectorsize)); + if (nr != (int)roundup(wl, sectorsize)) { if (nr == 0) syslog(LOG_WARNING, "WARNING: EOF on dump device"); @@ -380,7 +383,7 @@ DoRegularFile(int fd, bool isencrypted, off_t dumpsize nerr++; return (-1); } - if (compress || isencrypted) { + if (!sparse) { nw = fwrite(buf, 1, wl, fp); } else { for (nw = 0; nw < nr; nw = he) { @@ -506,15 +509,14 @@ DoFile(const char *savedir, const char *device) char *temp = NULL; struct kerneldumpheader kdhf, kdhl; uint8_t *dumpkey; - off_t mediasize, dumpsize, firsthd, lasthd; + off_t mediasize, dumpextent, dumplength, firsthd, lasthd; FILE *info, *fp; mode_t oumask; int fd, fdinfo, error; int bounds, status; u_int sectorsize, xostyle; - int istextdump; uint32_t dumpkeysize; - bool isencrypted, ret; + bool iscompressed, isencrypted, istextdump, ret; bounds = getbounds(); dumpkey = NULL; @@ -582,12 +584,12 @@ DoFile(const char *savedir, const char *device) goto closefd; } memcpy(&kdhl, temp, sizeof(kdhl)); - istextdump = 0; + iscompressed = istextdump = false; if (compare_magic(&kdhl, TEXTDUMPMAGIC)) { if (verbose) printf("textdump magic on last dump header on %s\n", device); - istextdump = 1; + istextdump = true; if (dtoh32(kdhl.version) != KERNELDUMP_TEXT_VERSION) { syslog(LOG_ERR, "unknown version (%d) in last dump header on %s", @@ -607,6 +609,20 @@ DoFile(const char *savedir, const char *device) if (force == 0) goto closefd; } + switch (kdhl.compression) { + case KERNELDUMP_COMP_NONE: + break; + case KERNELDUMP_COMP_GZIP: + if (compress && verbose) + printf("dump is already compressed\n"); + compress = false; + iscompressed = true; + break; + default: + syslog(LOG_ERR, "unknown compression type %d on %s", + kdhl.compression, device); + break; + } } else { if (verbose) printf("magic mismatch on last dump header on %s\n", @@ -619,8 +635,7 @@ DoFile(const char *savedir, const char *device) if (compare_magic(&kdhl, KERNELDUMPMAGIC_CLEARED)) { if (verbose) printf("forcing magic on %s\n", device); - memcpy(kdhl.magic, KERNELDUMPMAGIC, - sizeof kdhl.magic); + memcpy(kdhl.magic, KERNELDUMPMAGIC, sizeof(kdhl.magic)); } else { syslog(LOG_ERR, "unable to force dump - bad magic"); goto closefd; @@ -648,9 +663,10 @@ DoFile(const char *savedir, const char *device) if (force == 0) goto closefd; } - dumpsize = dtoh64(kdhl.dumplength); + dumpextent = dtoh64(kdhl.dumpextent); + dumplength = dtoh64(kdhl.dumplength); dumpkeysize = dtoh32(kdhl.dumpkeysize); - firsthd = lasthd - dumpsize - sectorsize - dumpkeysize; + firsthd = lasthd - dumpextent - sectorsize - dumpkeysize; if (lseek(fd, firsthd, SEEK_SET) != firsthd || read(fd, temp, sectorsize) != (ssize_t)sectorsize) { syslog(LOG_ERR, @@ -696,7 +712,7 @@ DoFile(const char *savedir, const char *device) if (verbose) printf("Checking for available free space\n"); - if (!check_space(savedir, dumpsize, bounds)) { + if (!check_space(savedir, dumplength, bounds)) { nerr++; goto closefd; } @@ -724,6 +740,9 @@ DoFile(const char *savedir, const char *device) istextdump ? "textdump.tar" : (isencrypted ? "vmcore_encrypted" : "vmcore"), bounds); fp = zopen(corename, "w"); + } else if (iscompressed && !isencrypted) { + snprintf(corename, sizeof(corename), "vmcore.%d.gz", bounds); + fp = fopen(corename, "w"); } else { snprintf(corename, sizeof(corename), "%s.%d", istextdump ? "textdump.tar" : @@ -792,11 +811,12 @@ DoFile(const char *savedir, const char *device) savedir, corename); if (istextdump) { - if (DoTextdumpFile(fd, dumpsize, lasthd, buf, device, + if (DoTextdumpFile(fd, dumplength, lasthd, buf, device, corename, fp) < 0) goto closeall; } else { - if (DoRegularFile(fd, isencrypted, dumpsize, buf, device, + if (DoRegularFile(fd, dumplength, sectorsize, + !(compress || iscompressed || isencrypted), buf, device, corename, fp) < 0) { goto closeall; } @@ -822,7 +842,7 @@ DoFile(const char *savedir, const char *device) "key.last"); } } - if (compress) { + if (compress || iscompressed) { snprintf(linkname, sizeof(linkname), "%s.last.gz", istextdump ? "textdump.tar" : (isencrypted ? "vmcore_encrypted" : "vmcore")); Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Tue Oct 24 21:18:50 2017 (r324964) +++ head/share/man/man5/rc.conf.5 Wed Oct 25 00:51:00 2017 (r324965) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2017 +.Dd October 24, 2017 .Dt RC.CONF 5 .Os .Sh NAME @@ -3380,6 +3380,13 @@ Otherwise, the value of this variable is passed as the .Xr dumpon 8 . To disable crash dumps, set this variable to .Dq Li NO . +.It Va dumpon_flags +.Pq Vt str +Flags to pass to +.Xr dumpon 8 +when configuring +.Va dumpdev +as the system dump device. .It Va dumpdir .Pq Vt str When the system reboots after a crash and a crash dump is found on the @@ -3400,18 +3407,6 @@ to not run at boot time when .Va dumpdir is set. -.It Va dumppubkey -.Pq Vt str -Path to a public key. -It is used by -.Xr dumpon 8 -to encrypt a one-time key for a crash dump. -The public key has to match a private key used by -.Xr decryptcore 8 -to decrypt a crash dump after reboot. -See -.Xr dumpon 8 -for more details. .It Va savecore_enable .Pq Vt bool If set to Modified: head/sys/dev/null/null.c ============================================================================== --- head/sys/dev/null/null.c Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/dev/null/null.c Wed Oct 25 00:51:00 2017 (r324965) @@ -114,7 +114,7 @@ null_ioctl(struct cdev *dev __unused, u_long cmd, cadd case DIOCSKERNELDUMP_FREEBSD11: #endif case DIOCSKERNELDUMP: - error = set_dumper(NULL, NULL, td, 0, NULL, 0, NULL); + error = set_dumper(NULL, NULL, td, 0, 0, NULL, 0, NULL); break; case FIONBIO: break; Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/geom/geom_dev.c Wed Oct 25 00:51:00 2017 (r324965) @@ -138,7 +138,7 @@ g_dev_setdumpdev(struct cdev *dev, struct diocskerneld int error, len; if (dev == NULL || kda == NULL) - return (set_dumper(NULL, NULL, td, 0, NULL, 0, NULL)); + return (set_dumper(NULL, NULL, td, 0, 0, NULL, 0, NULL)); cp = dev->si_drv2; len = sizeof(kd); @@ -148,8 +148,9 @@ g_dev_setdumpdev(struct cdev *dev, struct diocskerneld if (error != 0) return (error); - error = set_dumper(&kd.di, devtoname(dev), td, kda->kda_encryption, - kda->kda_key, kda->kda_encryptedkeysize, kda->kda_encryptedkey); + error = set_dumper(&kd.di, devtoname(dev), td, kda->kda_compression, + kda->kda_encryption, kda->kda_key, kda->kda_encryptedkeysize, + kda->kda_encryptedkey); if (error == 0) dev->si_flags |= SI_DUMPDEV; @@ -832,7 +833,7 @@ g_dev_orphan(struct g_consumer *cp) /* Reset any dump-area set on this device */ if (dev->si_flags & SI_DUMPDEV) - (void)set_dumper(NULL, NULL, curthread, 0, NULL, 0, NULL); + (void)set_dumper(NULL, NULL, curthread, 0, 0, NULL, 0, NULL); /* Destroy the struct cdev *so we get no more requests */ destroy_dev_sched_cb(dev, g_dev_callback, cp); Modified: head/sys/kern/kern_gzio.c ============================================================================== --- head/sys/kern/kern_gzio.c Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/kern/kern_gzio.c Wed Oct 25 00:51:00 2017 (r324965) @@ -60,7 +60,6 @@ struct gzio_stream * gzio_init(gzio_cb cb, enum gzio_mode mode, size_t bufsz, int level, void *arg) { struct gzio_stream *s; - uint8_t *hdr; int error; if (bufsz < KERN_GZ_HDRLEN) @@ -72,7 +71,6 @@ gzio_init(gzio_cb cb, enum gzio_mode mode, size_t bufs s->gz_bufsz = bufsz; s->gz_buffer = gz_alloc(NULL, 1, s->gz_bufsz); s->gz_mode = mode; - s->gz_crc = ~0U; s->gz_cb = cb; s->gz_arg = arg; @@ -87,6 +85,26 @@ gzio_init(gzio_cb cb, enum gzio_mode mode, size_t bufs if (error != 0) goto fail; + gzio_reset(s); + + return (s); + +fail: + gz_free(NULL, s->gz_buffer); + gz_free(NULL, s); + return (NULL); +} + +void +gzio_reset(struct gzio_stream *s) +{ + uint8_t *hdr; + + (void)deflateReset(&s->gz_stream); + + s->gz_off = 0; + s->gz_crc = ~0U; + s->gz_stream.avail_out = s->gz_bufsz; s->gz_stream.next_out = s->gz_buffer; @@ -99,13 +117,6 @@ gzio_init(gzio_cb cb, enum gzio_mode mode, size_t bufs hdr[9] = OS_CODE; s->gz_stream.next_out += KERN_GZ_HDRLEN; s->gz_stream.avail_out -= KERN_GZ_HDRLEN; - - return (s); - -fail: - gz_free(NULL, s->gz_buffer); - gz_free(NULL, s); - return (NULL); } int Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/kern/kern_shutdown.c Wed Oct 25 00:51:00 2017 (r324965) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_ekcd.h" +#include "opt_gzio.h" #include "opt_kdb.h" #include "opt_panic.h" #include "opt_sched.h" @@ -52,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -162,6 +164,24 @@ struct kerneldumpcrypto { }; #endif +#ifdef GZIO +struct kerneldumpgz { + struct gzio_stream *kdgz_stream; + uint8_t *kdgz_buf; + size_t kdgz_resid; +}; + +static struct kerneldumpgz *kerneldumpgz_create(struct dumperinfo *di, + uint8_t compression); +static void kerneldumpgz_destroy(struct dumperinfo *di); +static int kerneldumpgz_write_cb(void *cb, size_t len, off_t off, void *arg); + +static int kerneldump_gzlevel = 6; +SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLAG_RWTUN, + &kerneldump_gzlevel, 0, + "Kernel crash dump gzip compression level"); +#endif /* GZIO */ + /* * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. @@ -857,6 +877,9 @@ static char dumpdevname[sizeof(((struct cdev*)NULL)->s SYSCTL_STRING(_kern_shutdown, OID_AUTO, dumpdevname, CTLFLAG_RD, dumpdevname, 0, "Device for kernel dumps"); +static int _dump_append(struct dumperinfo *di, void *virtual, + vm_offset_t physical, size_t length); + #ifdef EKCD static struct kerneldumpcrypto * kerneldumpcrypto_create(size_t blocksize, uint8_t encryption, @@ -947,11 +970,45 @@ kerneldumpcrypto_dumpkeysize(const struct kerneldumpcr } #endif /* EKCD */ +#ifdef GZIO +static struct kerneldumpgz * +kerneldumpgz_create(struct dumperinfo *di, uint8_t compression) +{ + struct kerneldumpgz *kdgz; + + if (compression != KERNELDUMP_COMP_GZIP) + return (NULL); + kdgz = malloc(sizeof(*kdgz), M_DUMPER, M_WAITOK | M_ZERO); + kdgz->kdgz_stream = gzio_init(kerneldumpgz_write_cb, GZIO_DEFLATE, + di->maxiosize, kerneldump_gzlevel, di); + if (kdgz->kdgz_stream == NULL) { + free(kdgz, M_DUMPER); + return (NULL); + } + kdgz->kdgz_buf = malloc(di->maxiosize, M_DUMPER, M_WAITOK | M_NODUMP); + return (kdgz); +} + +static void +kerneldumpgz_destroy(struct dumperinfo *di) +{ + struct kerneldumpgz *kdgz; + + kdgz = di->kdgz; + if (kdgz == NULL) + return; + gzio_fini(kdgz->kdgz_stream); + explicit_bzero(kdgz->kdgz_buf, di->maxiosize); + free(kdgz->kdgz_buf, M_DUMPER); + free(kdgz, M_DUMPER); +} +#endif /* GZIO */ + /* Registration of dumpers */ int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td, - uint8_t encryption, const uint8_t *key, uint32_t encryptedkeysize, - const uint8_t *encryptedkey) + uint8_t compression, uint8_t encryption, const uint8_t *key, + uint32_t encryptedkeysize, const uint8_t *encryptedkey) { size_t wantcopy; int error; @@ -969,6 +1026,7 @@ set_dumper(struct dumperinfo *di, const char *devname, dumper = *di; dumper.blockbuf = NULL; dumper.kdc = NULL; + dumper.kdgz = NULL; if (encryption != KERNELDUMP_ENC_NONE) { #ifdef EKCD @@ -987,9 +1045,30 @@ set_dumper(struct dumperinfo *di, const char *devname, wantcopy = strlcpy(dumpdevname, devname, sizeof(dumpdevname)); if (wantcopy >= sizeof(dumpdevname)) { printf("set_dumper: device name truncated from '%s' -> '%s'\n", - devname, dumpdevname); + devname, dumpdevname); } + if (compression != KERNELDUMP_COMP_NONE) { +#ifdef GZIO + /* + * We currently can't support simultaneous encryption and + * compression. + */ + if (encryption != KERNELDUMP_ENC_NONE) { + error = EOPNOTSUPP; + goto cleanup; + } + dumper.kdgz = kerneldumpgz_create(&dumper, compression); + if (dumper.kdgz == NULL) { + error = EINVAL; + goto cleanup; + } +#else + error = EOPNOTSUPP; + goto cleanup; +#endif + } + dumper.blockbuf = malloc(di->blocksize, M_DUMPER, M_WAITOK | M_ZERO); return (0); cleanup: @@ -1000,6 +1079,11 @@ cleanup: free(dumper.kdc, M_EKCD); } #endif + +#ifdef GZIO + kerneldumpgz_destroy(&dumper); +#endif + if (dumper.blockbuf != NULL) { explicit_bzero(dumper.blockbuf, dumper.blocksize); free(dumper.blockbuf, M_DUMPER); @@ -1090,22 +1174,57 @@ dump_encrypted_write(struct dumperinfo *di, void *virt } static int -dump_write_key(struct dumperinfo *di, vm_offset_t physical, off_t offset) +dump_write_key(struct dumperinfo *di, off_t offset) { struct kerneldumpcrypto *kdc; kdc = di->kdc; if (kdc == NULL) return (0); - - return (dump_write(di, kdc->kdc_dumpkey, physical, offset, + return (dump_write(di, kdc->kdc_dumpkey, 0, offset, kdc->kdc_dumpkeysize)); } #endif /* EKCD */ +#ifdef GZIO static int +kerneldumpgz_write_cb(void *base, size_t length, off_t offset, void *arg) +{ + struct dumperinfo *di; + size_t resid, rlength; + int error; + + di = arg; + + if (length % di->blocksize != 0) { + /* + * This must be the final write after flushing the compression + * stream. Write as many full blocks as possible and stash the + * residual data in the dumper's block buffer. It will be + * padded and written in dump_finish(). + */ + rlength = rounddown(length, di->blocksize); + if (rlength != 0) { + error = _dump_append(di, base, 0, rlength); + if (error != 0) + return (error); + } + resid = length - rlength; + memmove(di->blockbuf, (uint8_t *)base + rlength, resid); + di->kdgz->kdgz_resid = resid; + return (EAGAIN); + } + return (_dump_append(di, base, 0, length)); +} +#endif /* GZIO */ + +/* + * Write a kerneldumpheader at the specified offset. The header structure is 512 + * bytes in size, but we must pad to the device sector size. + */ +static int dump_write_header(struct dumperinfo *di, struct kerneldumpheader *kdh, - vm_offset_t physical, off_t offset) + off_t offset) { void *buf; size_t hdrsz; @@ -1122,7 +1241,7 @@ dump_write_header(struct dumperinfo *di, struct kernel memcpy(buf, kdh, hdrsz); } - return (dump_write(di, buf, physical, offset, di->blocksize)); + return (dump_write(di, buf, 0, offset, di->blocksize)); } /* @@ -1132,19 +1251,30 @@ dump_write_header(struct dumperinfo *di, struct kernel #define SIZEOF_METADATA (64 * 1024) /* - * Do some preliminary setup for a kernel dump: verify that we have enough space - * on the dump device, write the leading header, and optionally write the crypto - * key. + * Do some preliminary setup for a kernel dump: initialize state for encryption, + * if requested, and make sure that we have enough space on the dump device. + * + * We set things up so that the dump ends before the last sector of the dump + * device, at which the trailing header is written. + * + * +-----------+------+-----+----------------------------+------+ + * | | lhdr | key | ... kernel dump ... | thdr | + * +-----------+------+-----+----------------------------+------+ + * 1 blk opt <------- dump extent --------> 1 blk + * + * Dumps written using dump_append() start at the beginning of the extent. + * Uncompressed dumps will use the entire extent, but compressed dumps typically + * will not. The true length of the dump is recorded in the leading and trailing + * headers once the dump has been completed. */ int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh) { - uint64_t dumpsize; + uint64_t dumpextent; uint32_t keysize; - int error; #ifdef EKCD - error = kerneldumpcrypto_init(di->kdc); + int error = kerneldumpcrypto_init(di->kdc); if (error != 0) return (error); keysize = kerneldumpcrypto_dumpkeysize(di->kdc); @@ -1152,30 +1282,36 @@ dump_start(struct dumperinfo *di, struct kerneldumphea keysize = 0; #endif - dumpsize = dtoh64(kdh->dumplength) + 2 * di->blocksize + keysize; - if (di->mediasize < SIZEOF_METADATA + dumpsize) - return (E2BIG); - - di->dumpoff = di->mediaoffset + di->mediasize - dumpsize; - - error = dump_write_header(di, kdh, 0, di->dumpoff); - if (error != 0) - return (error); - di->dumpoff += di->blocksize; - -#ifdef EKCD - error = dump_write_key(di, 0, di->dumpoff); - if (error != 0) - return (error); - di->dumpoff += keysize; + dumpextent = dtoh64(kdh->dumpextent); + if (di->mediasize < SIZEOF_METADATA + dumpextent + 2 * di->blocksize + + keysize) { +#ifdef GZIO + if (di->kdgz != NULL) { + /* + * We don't yet know how much space the compressed dump + * will occupy, so try to use the whole swap partition + * (minus the first 64KB) in the hope that the + * compressed dump will fit. If that doesn't turn out to + * be enouch, the bounds checking in dump_write() + * will catch us and cause the dump to fail. + */ + dumpextent = di->mediasize - SIZEOF_METADATA - + 2 * di->blocksize - keysize; + kdh->dumpextent = htod64(dumpextent); + } else #endif + return (E2BIG); + } + /* The offset at which to begin writing the dump. */ + di->dumpoff = di->mediaoffset + di->mediasize - di->blocksize - + dumpextent; + return (0); } -/* Write to the dump device at the current dump offset. */ -int -dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical, +static int +_dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical, size_t length) { int error; @@ -1192,8 +1328,34 @@ dump_append(struct dumperinfo *di, void *virtual, vm_o return (error); } -/* Perform a raw write to the dump device at the specified offset. */ +/* + * Write to the dump device starting at dumpoff. When compression is enabled, + * writes to the device will be performed using a callback that gets invoked + * when the compression stream's output buffer is full. + */ int +dump_append(struct dumperinfo *di, void *virtual, vm_offset_t physical, + size_t length) +{ +#ifdef GZIO + void *buf; + + if (di->kdgz != NULL) { + /* Bounce through a buffer to avoid gzip CRC errors. */ + if (length > di->maxiosize) + return (EINVAL); + buf = di->kdgz->kdgz_buf; + memmove(buf, virtual, length); + return (gzio_write(di->kdgz->kdgz_stream, buf, length)); + } +#endif + return (_dump_append(di, virtual, physical, length)); +} + +/* + * Write to the dump device at the specified offset. + */ +int dump_write(struct dumperinfo *di, void *virtual, vm_offset_t physical, off_t offset, size_t length) { @@ -1206,18 +1368,74 @@ dump_write(struct dumperinfo *di, void *virtual, vm_of } /* - * Write the trailing kernel dump header and signal to the lower layers that the - * dump has completed. + * Perform kernel dump finalization: flush the compression stream, if necessary, + * write the leading and trailing kernel dump headers now that we know the true + * length of the dump, and optionally write the encryption key following the + * leading header. */ int dump_finish(struct dumperinfo *di, struct kerneldumpheader *kdh) { + uint64_t extent; + uint32_t keysize; int error; - error = dump_write_header(di, kdh, 0, di->dumpoff); + extent = dtoh64(kdh->dumpextent); + +#ifdef EKCD + keysize = kerneldumpcrypto_dumpkeysize(di->kdc); +#else + keysize = 0; +#endif + +#ifdef GZIO + if (di->kdgz != NULL) { + error = gzio_flush(di->kdgz->kdgz_stream); + if (error == EAGAIN) { + /* We have residual data in di->blockbuf. */ + error = dump_write(di, di->blockbuf, 0, di->dumpoff, + di->blocksize); + di->dumpoff += di->kdgz->kdgz_resid; + di->kdgz->kdgz_resid = 0; + } + if (error != 0) + return (error); + + /* + * We now know the size of the compressed dump, so update the + * header accordingly and recompute parity. + */ + kdh->dumplength = htod64(di->dumpoff - + (di->mediaoffset + di->mediasize - di->blocksize - extent)); + kdh->parity = 0; + kdh->parity = kerneldump_parity(kdh); + + gzio_reset(di->kdgz->kdgz_stream); + } +#endif + + /* + * Write kerneldump headers at the beginning and end of the dump extent. + * Write the key after the leading header. + */ + error = dump_write_header(di, kdh, + di->mediaoffset + di->mediasize - 2 * di->blocksize - extent - + keysize); if (error != 0) return (error); +#ifdef EKCD + error = dump_write_key(di, + di->mediaoffset + di->mediasize - di->blocksize - extent - keysize); + if (error != 0) + return (error); +#endif + + error = dump_write_header(di, kdh, + di->mediaoffset + di->mediasize - di->blocksize); + if (error != 0) + return (error); + (void)dump_write(di, NULL, 0, 0, 0); return (0); } @@ -1234,6 +1452,7 @@ dump_init_header(const struct dumperinfo *di, struct k kdh->version = htod32(KERNELDUMPVERSION); kdh->architectureversion = htod32(archver); kdh->dumplength = htod64(dumplen); + kdh->dumpextent = kdh->dumplength; kdh->dumptime = htod64(time_second); #ifdef EKCD kdh->dumpkeysize = htod32(kerneldumpcrypto_dumpkeysize(di->kdc)); @@ -1247,6 +1466,10 @@ dump_init_header(const struct dumperinfo *di, struct k kdh->versionstring[dstsize - 2] = '\n'; if (panicstr != NULL) strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); +#ifdef GZIO + if (di->kdgz != NULL) + kdh->compression = KERNELDUMP_COMP_GZIP; +#endif kdh->parity = kerneldump_parity(kdh); } Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/sys/conf.h Wed Oct 25 00:51:00 2017 (r324965) @@ -338,14 +338,15 @@ struct dumperinfo { void *blockbuf; /* Buffer for padding shorter dump blocks */ off_t dumpoff; /* Offset of ongoing kernel dump. */ struct kerneldumpcrypto *kdc; /* Kernel dump crypto. */ + struct kerneldumpgz *kdgz; /* Kernel dump compression. */ }; extern int dumping; /* system is dumping */ int doadump(boolean_t); int set_dumper(struct dumperinfo *di, const char *devname, struct thread *td, - uint8_t encrypt, const uint8_t *key, uint32_t encryptedkeysize, - const uint8_t *encryptedkey); + uint8_t compression, uint8_t encryption, const uint8_t *key, + uint32_t encryptedkeysize, const uint8_t *encryptedkey); int dump_start(struct dumperinfo *di, struct kerneldumpheader *kdh); int dump_append(struct dumperinfo *, void *, vm_offset_t, size_t); Modified: head/sys/sys/disk.h ============================================================================== --- head/sys/sys/disk.h Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/sys/disk.h Wed Oct 25 00:51:00 2017 (r324965) @@ -143,6 +143,7 @@ struct diocgattr_arg { struct diocskerneldump_arg { uint8_t kda_enable; + uint8_t kda_compression; uint8_t kda_encryption; uint8_t kda_key[KERNELDUMP_KEY_MAX_SIZE]; uint32_t kda_encryptedkeysize; Modified: head/sys/sys/gzio.h ============================================================================== --- head/sys/sys/gzio.h Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/sys/gzio.h Wed Oct 25 00:51:00 2017 (r324965) @@ -40,6 +40,7 @@ typedef int (*gzio_cb)(void *, size_t, off_t, void *); struct gzio_stream; struct gzio_stream *gzio_init(gzio_cb cb, enum gzio_mode, size_t, int, void *); +void gzio_reset(struct gzio_stream *); int gzio_write(struct gzio_stream *, void *, u_int); int gzio_flush(struct gzio_stream *); void gzio_fini(struct gzio_stream *); Modified: head/sys/sys/kerneldump.h ============================================================================== --- head/sys/sys/kerneldump.h Tue Oct 24 21:18:50 2017 (r324964) +++ head/sys/sys/kerneldump.h Wed Oct 25 00:51:00 2017 (r324965) @@ -55,6 +55,9 @@ #define htod64(x) (x) #endif +#define KERNELDUMP_COMP_NONE 0 +#define KERNELDUMP_COMP_GZIP 1 + #define KERNELDUMP_ENC_NONE 0 #define KERNELDUMP_ENC_AES_256_CBC 1 @@ -75,8 +78,8 @@ struct kerneldumpheader { #define KERNELDUMPMAGIC_CLEARED "Cleared Kernel Dump" char architecture[12]; uint32_t version; -#define KERNELDUMPVERSION 2 -#define KERNELDUMP_TEXT_VERSION 2 +#define KERNELDUMPVERSION 3 +#define KERNELDUMP_TEXT_VERSION 3 uint32_t architectureversion; #define KERNELDUMP_AARCH64_VERSION 1 #define KERNELDUMP_AMD64_VERSION 2 @@ -87,12 +90,14 @@ struct kerneldumpheader { #define KERNELDUMP_RISCV_VERSION 1 #define KERNELDUMP_SPARC64_VERSION 1 uint64_t dumplength; /* excl headers */ + uint64_t dumpextent; uint64_t dumptime; uint32_t dumpkeysize; uint32_t blocksize; + uint8_t compression; char hostname[64]; char versionstring[192]; - char panicstring[188]; + char panicstring[179]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Oct 25 09:12:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AABD2E43B7C; Wed, 25 Oct 2017 09:12:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 781136369B; Wed, 25 Oct 2017 09:12:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9P9CMtx060974; Wed, 25 Oct 2017 09:12:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9P9CMar060973; Wed, 25 Oct 2017 09:12:22 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201710250912.v9P9CMar060973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 25 Oct 2017 09:12:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324971 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 324971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 09:12:23 -0000 Author: tuexen Date: Wed Oct 25 09:12:22 2017 New Revision: 324971 URL: https://svnweb.freebsd.org/changeset/base/324971 Log: Fix a bug reported by Felix Weinrank using the libfuzzer on the userland stack. MFC after: 3 days Modified: head/sys/netinet/sctp_auth.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Wed Oct 25 05:55:13 2017 (r324970) +++ head/sys/netinet/sctp_auth.c Wed Oct 25 09:12:22 2017 (r324971) @@ -1606,9 +1606,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_ /* now use the rest of the mbuf chain */ while ((m_tmp != NULL) && (size > 0)) { data = mtod(m_tmp, uint8_t *)+m_offset; - if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { - memset(data, 0, SCTP_BUF_LEN(m_tmp)); - size -= SCTP_BUF_LEN(m_tmp); + if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) { + memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset); + size -= SCTP_BUF_LEN(m_tmp) - m_offset; } else { memset(data, 0, size); size = 0; From owner-svn-src-head@freebsd.org Wed Oct 25 11:44:48 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D6A1E47939; Wed, 25 Oct 2017 11:44:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DEBFF6997A; Wed, 25 Oct 2017 11:44:47 +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 v9PBileb023717; Wed, 25 Oct 2017 11:44:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PBilVB023716; Wed, 25 Oct 2017 11:44:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201710251144.v9PBilVB023716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 25 Oct 2017 11:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324972 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 324972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 11:44:48 -0000 Author: kib Date: Wed Oct 25 11:44:46 2017 New Revision: 324972 URL: https://svnweb.freebsd.org/changeset/base/324972 Log: Limit top display of total swap size by the max swap size system can handle. Keep both pagesize and the new swap_maxpages in the static variables to save sysctl calls. Submitted by: ota@j.email.ne.jp PR: 223149 MFC after: 2 weeks Modified: head/usr.bin/top/machine.c Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Wed Oct 25 09:12:22 2017 (r324971) +++ head/usr.bin/top/machine.c Wed Oct 25 11:44:46 2017 (r324972) @@ -1671,8 +1671,9 @@ static int swapmode(int *retavail, int *retfree) { int n; - int pagesize = getpagesize(); struct kvm_swap swapary[1]; + static int pagesize = 0; + static u_long swap_maxpages = 0; *retavail = 0; *retfree = 0; @@ -1682,6 +1683,16 @@ swapmode(int *retavail, int *retfree) n = kvm_getswapinfo(kd, swapary, 1, 0); if (n < 0 || swapary[0].ksw_total == 0) return (0); + + if (pagesize == 0) + pagesize = getpagesize(); + if (swap_maxpages == 0) + GETSYSCTL("vm.swap_maxpages", swap_maxpages); + + /* ksw_total contains the total size of swap all devices which may + exceed the maximum swap size allocatable in the system */ + if ( swapary[0].ksw_total > swap_maxpages ) + swapary[0].ksw_total = swap_maxpages; *retavail = CONVERT(swapary[0].ksw_total); *retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used); From owner-svn-src-head@freebsd.org Wed Oct 25 14:57:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7846E4C50C; Wed, 25 Oct 2017 14:57:18 +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 B5E697012B; Wed, 25 Oct 2017 14:57:17 +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 v9PEvECP052399; Wed, 25 Oct 2017 07:57:14 -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 v9PEvEZU052398; Wed, 25 Oct 2017 07:57:14 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201710251457.v9PEvEZU052398@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r324971 - head/sys/netinet In-Reply-To: <201710250912.v9P9CMar060973@repo.freebsd.org> To: Michael Tuexen Date: Wed, 25 Oct 2017 07:57:14 -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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 14:57:19 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: tuexen > Date: Wed Oct 25 09:12:22 2017 > New Revision: 324971 > URL: https://svnweb.freebsd.org/changeset/base/324971 > > Log: > Fix a bug reported by Felix Weinrank using the libfuzzer on the > userland stack. Please try to say what the bug was, why it was a bug, and how it was fixed in any bug commit message. External vague references are of little value when reading through a files svn history. Thanks, > > MFC after: 3 days > > Modified: > head/sys/netinet/sctp_auth.c > > Modified: head/sys/netinet/sctp_auth.c > ============================================================================== > --- head/sys/netinet/sctp_auth.c Wed Oct 25 05:55:13 2017 (r324970) > +++ head/sys/netinet/sctp_auth.c Wed Oct 25 09:12:22 2017 (r324971) > @@ -1606,9 +1606,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, uint32_ > /* now use the rest of the mbuf chain */ > while ((m_tmp != NULL) && (size > 0)) { > data = mtod(m_tmp, uint8_t *)+m_offset; > - if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { > - memset(data, 0, SCTP_BUF_LEN(m_tmp)); > - size -= SCTP_BUF_LEN(m_tmp); > + if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) { > + memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset); > + size -= SCTP_BUF_LEN(m_tmp) - m_offset; > } else { > memset(data, 0, size); > size = 0; > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Oct 25 15:25:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3141EE4D3BA; Wed, 25 Oct 2017 15:25:56 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0D8497177F; Wed, 25 Oct 2017 15:25: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 v9PFPtAk017731; Wed, 25 Oct 2017 15:25:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFPttt017730; Wed, 25 Oct 2017 15:25:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251525.v9PFPttt017730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:25:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324977 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 324977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:25:56 -0000 Author: imp Date: Wed Oct 25 15:25:55 2017 New Revision: 324977 URL: https://svnweb.freebsd.org/changeset/base/324977 Log: Add nvme_controller_data argument to all print functions. It's desirable to access controler data to inform printing log pages (such as limiting the printing to valid ranges). Sponsored by: Netflix Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:18:09 2017 (r324976) +++ head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:25:55 2017 (r324977) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_SIZE (4096) #define MAX_FW_SLOTS (7) -typedef void (*print_fn_t)(void *buf, uint32_t size); +typedef void (*print_fn_t)(const struct nvme_controller_data *cdata, void *buf, uint32_t size); struct kv_name { @@ -75,8 +75,16 @@ kv_lookup(const struct kv_name *kv, size_t kv_count, u } static void -print_bin(void *data, uint32_t length) +print_log_hex(const struct nvme_controller_data *cdata __unused, void *data, uint32_t length) { + + print_hex(data, length); +} + +static void +print_bin(const struct nvme_controller_data *cdata __unused, void *data, uint32_t length) +{ + write(STDOUT_FILENO, data, length); } @@ -115,7 +123,7 @@ read_logpage(int fd, uint8_t log_page, int nsid, void } static void -print_log_error(void *buf, uint32_t size) +print_log_error(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) { int i, nentries; struct nvme_error_information_entry *entry = buf; @@ -162,7 +170,7 @@ print_temp(uint16_t t) static void -print_log_health(void *buf, uint32_t size __unused) +print_log_health(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { struct nvme_health_information_page *health = buf; char cbuf[UINT128_DIG + 1]; @@ -224,7 +232,7 @@ print_log_health(void *buf, uint32_t size __unused) } static void -print_log_firmware(void *buf, uint32_t size __unused) +print_log_firmware(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { int i; const char *status; @@ -260,7 +268,7 @@ print_log_firmware(void *buf, uint32_t size __unused) * offset 147: it is only 1 byte, not 6. */ static void -print_intel_temp_stats(void *buf, uint32_t size __unused) +print_intel_temp_stats(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { struct intel_log_temp_stats *temp = buf; @@ -287,7 +295,7 @@ print_intel_temp_stats(void *buf, uint32_t size __unus * Read and write stats pages have identical encoding. */ static void -print_intel_read_write_lat_log(void *buf, uint32_t size __unused) +print_intel_read_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { const char *walker = buf; int i; @@ -303,28 +311,28 @@ print_intel_read_write_lat_log(void *buf, uint32_t siz } static void -print_intel_read_lat_log(void *buf, uint32_t size) +print_intel_read_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) { printf("Intel Read Latency Log\n"); printf("======================\n"); - print_intel_read_write_lat_log(buf, size); + print_intel_read_write_lat_log(cdata, buf, size); } static void -print_intel_write_lat_log(void *buf, uint32_t size) +print_intel_write_lat_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size) { printf("Intel Write Latency Log\n"); printf("=======================\n"); - print_intel_read_write_lat_log(buf, size); + print_intel_read_write_lat_log(cdata, buf, size); } /* * Table 19. 5.4 SMART Attributes. Samsung also implements this and some extra data not documented. */ static void -print_intel_add_smart(void *buf, uint32_t size __unused) +print_intel_add_smart(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { uint8_t *walker = buf; uint8_t *end = walker + 150; @@ -753,7 +761,7 @@ kv_indirect(void *buf, uint32_t subtype, uint8_t res, } static void -print_hgst_info_log(void *buf, uint32_t size __unused) +print_hgst_info_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { uint8_t *walker, *end, *subpage; int pages; @@ -928,7 +936,7 @@ logpage(int argc, char *argv[]) "smart/health information"); } - print_fn = print_hex; + print_fn = print_log_hex; size = DEFAULT_SIZE; if (binflag) print_fn = print_bin; @@ -960,7 +968,7 @@ logpage(int argc, char *argv[]) /* Read the log page */ buf = get_log_buffer(size); read_logpage(fd, log_page, nsid, buf, size); - print_fn(buf, size); + print_fn(&cdata, buf, size); close(fd); exit(0); From owner-svn-src-head@freebsd.org Wed Oct 25 15:26:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 452E8E4D3E4; Wed, 25 Oct 2017 15:26:05 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0F4D3717E6; Wed, 25 Oct 2017 15:26: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 v9PFQ4kC017790; Wed, 25 Oct 2017 15:26:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFQ44d017789; Wed, 25 Oct 2017 15:26:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251526.v9PFQ44d017789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:26:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324978 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 324978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:26:05 -0000 Author: imp Date: Wed Oct 25 15:26:03 2017 New Revision: 324978 URL: https://svnweb.freebsd.org/changeset/base/324978 Log: Report only the valid slots in the firmware log page. Printing the entire log page is causing confusion over available slots. Report only those slots that are valid. In the case where the firmware download isn't supported, assume that only the first slot is valid (I have no hardware to test this assumption though) Sponsored by: Netflix Modified: head/sbin/nvmecontrol/logpage.c Modified: head/sbin/nvmecontrol/logpage.c ============================================================================== --- head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:25:55 2017 (r324977) +++ head/sbin/nvmecontrol/logpage.c Wed Oct 25 15:26:03 2017 (r324978) @@ -234,14 +234,19 @@ print_log_health(const struct nvme_controller_data *cd static void print_log_firmware(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { - int i; + int i, slots; const char *status; struct nvme_firmware_page *fw = buf; printf("Firmware Slot Log\n"); printf("=================\n"); - for (i = 0; i < MAX_FW_SLOTS; i++) { + if (cdata->oacs.firmware == 0) + slots = 1; + else + slots = MIN(cdata->frmw.num_slots, MAX_FW_SLOTS); + + for (i = 0; i < slots; i++) { printf("Slot %d: ", i + 1); if (fw->afi.slot == i + 1) status = " Active"; From owner-svn-src-head@freebsd.org Wed Oct 25 15:27:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7666EE4D4FE; Wed, 25 Oct 2017 15:27:49 +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 mx1.freebsd.org (Postfix) with ESMTPS id 444C871A44; Wed, 25 Oct 2017 15:27:49 +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 v9PFRmAj017900; Wed, 25 Oct 2017 15:27:48 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFRmAU017899; Wed, 25 Oct 2017 15:27:48 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251527.v9PFRmAU017899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324979 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 324979 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:27:49 -0000 Author: imp Date: Wed Oct 25 15:27:48 2017 New Revision: 324979 URL: https://svnweb.freebsd.org/changeset/base/324979 Log: Do a chdir to SRCTOP/sys/boot before starting the run. This lets one run this script from anywhere, but makes it only work on sys/boot. Sponsored by: Netflix Modified: head/tools/boot/universe.sh Modified: head/tools/boot/universe.sh ============================================================================== --- head/tools/boot/universe.sh Wed Oct 25 15:26:03 2017 (r324978) +++ head/tools/boot/universe.sh Wed Oct 25 15:27:48 2017 (r324979) @@ -19,6 +19,9 @@ # Output is put into _.boot.$TARGET_ARCH.log in sys.boot. # +top=$(make -V SRCTOP) +cd $top/sys/boot + for i in \ amd64/amd64 \ arm/arm arm/armeb arm/armv7 \ From owner-svn-src-head@freebsd.org Wed Oct 25 15:27:54 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 520FFE4D522; Wed, 25 Oct 2017 15:27: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 mx1.freebsd.org (Postfix) with ESMTPS id 1F7FA71A4F; Wed, 25 Oct 2017 15:27: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 v9PFRreq017952; Wed, 25 Oct 2017 15:27:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFRrTv017951; Wed, 25 Oct 2017 15:27:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251527.v9PFRrTv017951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324980 - head/sys/boot/arm/uboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/boot/arm/uboot X-SVN-Commit-Revision: 324980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:27:54 -0000 Author: imp Date: Wed Oct 25 15:27:53 2017 New Revision: 324980 URL: https://svnweb.freebsd.org/changeset/base/324980 Log: Use BOOTDIR consistently. We need to include bsd.init.mk early to make this happen. This will cause src.opts.mk to be included, so remove that. This needs to propigate through the sys/boot tree. Sponsored by: Netflix Modified: head/sys/boot/arm/uboot/Makefile Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Wed Oct 25 15:27:48 2017 (r324979) +++ head/sys/boot/arm/uboot/Makefile Wed Oct 25 15:27:53 2017 (r324980) @@ -1,6 +1,6 @@ # $FreeBSD$ -.include +.include FILES= ubldr ubldr.bin @@ -31,7 +31,7 @@ LOADER_BZIP2_SUPPORT?= no LOADER_FDT_SUPPORT= ${MK_FDT} # Always add MI sources -.include "../../loader.mk" +.include "${BOOTSRC}/loader.mk" CFLAGS+= -I. CLEANFILES+= loader.help @@ -42,7 +42,7 @@ LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MA LDFLAGS+= -Wl,-znotext # Pull in common loader code -.include "../../uboot.mk" +.include "${BOOTSRC}/uboot.mk" CFLAGS+= -fPIC @@ -51,7 +51,7 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FD OBJS+= ${SRCS:N*.h:R:S/$/.o/g} -loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt +loader.help: help.common help.uboot ${BOOTSRC}/fdt/help.fdt cat ${.ALLSRC} | \ awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} @@ -75,8 +75,8 @@ ubldr.bin: ubldr.pie CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin .if !defined(LOADER_ONLY) -.PATH: ${.CURDIR}/../../forth -.include "${.CURDIR}/../../forth/Makefile.inc" +.PATH: ${BOOTSRC}/forth +.include "${BOOTSRC}/forth/Makefile.inc" # Install loader.rc. FILES+= loader.rc From owner-svn-src-head@freebsd.org Wed Oct 25 15:28:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 550E7E4D573; Wed, 25 Oct 2017 15:28: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 mx1.freebsd.org (Postfix) with ESMTPS id 2C30F71B04; Wed, 25 Oct 2017 15:28:01 +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 v9PFS0Ip018022; Wed, 25 Oct 2017 15:28:00 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFRxIM018005; Wed, 25 Oct 2017 15:27:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251527.v9PFRxIM018005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:27:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324981 - in head/sys/boot: . arm/uboot efi i386 mips/beri mips/beri/boot2 mips/uboot powerpc/boot1.chrp powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc64 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot: . arm/uboot efi i386 mips/beri mips/beri/boot2 mips/uboot powerpc/boot1.chrp powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc64 X-SVN-Commit-Revision: 324981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:28:01 -0000 Author: imp Date: Wed Oct 25 15:27:58 2017 New Revision: 324981 URL: https://svnweb.freebsd.org/changeset/base/324981 Log: Move BINDIR definition to defs.mk, and override where it isn't /boot (those files already do that so weren't changed). Sponsored by: Netflix Modified: head/sys/boot/arm/uboot/Makefile head/sys/boot/defs.mk head/sys/boot/efi/Makefile.inc head/sys/boot/i386/Makefile.inc head/sys/boot/mips/beri/Makefile.inc head/sys/boot/mips/beri/boot2/Makefile head/sys/boot/mips/uboot/Makefile head/sys/boot/powerpc/boot1.chrp/Makefile head/sys/boot/powerpc/kboot/Makefile head/sys/boot/powerpc/ofw/Makefile head/sys/boot/powerpc/ps3/Makefile head/sys/boot/powerpc/uboot/Makefile head/sys/boot/sparc64/Makefile.inc Modified: head/sys/boot/arm/uboot/Makefile ============================================================================== --- head/sys/boot/arm/uboot/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/arm/uboot/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -5,7 +5,6 @@ FILES= ubldr ubldr.bin NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b WARNS?= 1 # Address at which ubldr will be loaded. Modified: head/sys/boot/defs.mk ============================================================================== --- head/sys/boot/defs.mk Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/defs.mk Wed Oct 25 15:27:58 2017 (r324981) @@ -15,6 +15,9 @@ UBOOTSRC= ${BOOTSRC}/uboot BOOTOBJ= ${OBJTOP}/sys/boot +# BINDIR is where we install +BINDIR?= /boot + # NB: The makefiles depend on these being empty when we don't build forth. .if ${MK_FORTH} != "no" LIBFICL= ${BOOTOBJ}/ficl/libficl.a Modified: head/sys/boot/efi/Makefile.inc ============================================================================== --- head/sys/boot/efi/Makefile.inc Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/efi/Makefile.inc Wed Oct 25 15:27:58 2017 (r324981) @@ -1,7 +1,5 @@ # $FreeBSD$ -BINDIR?= /boot - .if ${MACHINE_CPUARCH} == "i386" CFLAGS+= -march=i386 CFLAGS+= -mno-aes Modified: head/sys/boot/i386/Makefile.inc ============================================================================== --- head/sys/boot/i386/Makefile.inc Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/i386/Makefile.inc Wed Oct 25 15:27:58 2017 (r324981) @@ -2,8 +2,6 @@ # # $FreeBSD$ -BINDIR?= /boot - LOADER_ADDRESS?=0x200000 CFLAGS+= -march=i386 -ffreestanding CFLAGS.gcc+= -mpreferred-stack-boundary=2 Modified: head/sys/boot/mips/beri/Makefile.inc ============================================================================== --- head/sys/boot/mips/beri/Makefile.inc Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/mips/beri/Makefile.inc Wed Oct 25 15:27:58 2017 (r324981) @@ -1,6 +1,5 @@ # $FreeBSD$ -BINDIR?= /boot CFLAGS+= -ffreestanding LDFLAGS+= -nostdlib Modified: head/sys/boot/mips/beri/boot2/Makefile ============================================================================== --- head/sys/boot/mips/beri/boot2/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/mips/beri/boot2/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -29,7 +29,6 @@ # # $FreeBSD$ -BINDIR?= /boot INSTALLFLAGS= -b LOADERS= flashboot jtagboot Modified: head/sys/boot/mips/uboot/Makefile ============================================================================== --- head/sys/boot/mips/uboot/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/mips/uboot/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -5,7 +5,6 @@ FILES= ubldr NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b WARNS?= 1 # Address at which ubldr will be loaded. Modified: head/sys/boot/powerpc/boot1.chrp/Makefile ============================================================================== --- head/sys/boot/powerpc/boot1.chrp/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/powerpc/boot1.chrp/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -4,7 +4,6 @@ SSP_CFLAGS= PROG= boot1.elf NEWVERSWHAT= "Open Firmware boot block" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b FILES= boot1.hfs Modified: head/sys/boot/powerpc/kboot/Makefile ============================================================================== --- head/sys/boot/powerpc/kboot/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/powerpc/kboot/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -6,7 +6,6 @@ MAN= PROG= loader.kboot NEWVERSWHAT= "kboot loader" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b # Architecture-specific loader code Modified: head/sys/boot/powerpc/ofw/Makefile ============================================================================== --- head/sys/boot/powerpc/ofw/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/powerpc/ofw/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -6,7 +6,6 @@ MAN= PROG= loader NEWVERSWHAT= "Open Firmware loader" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b # Architecture-specific loader code Modified: head/sys/boot/powerpc/ps3/Makefile ============================================================================== --- head/sys/boot/powerpc/ps3/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/powerpc/ps3/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -6,7 +6,6 @@ MAN= PROG= loader.ps3 NEWVERSWHAT= "Playstation 3 loader" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b # Architecture-specific loader code Modified: head/sys/boot/powerpc/uboot/Makefile ============================================================================== --- head/sys/boot/powerpc/uboot/Makefile Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/powerpc/uboot/Makefile Wed Oct 25 15:27:58 2017 (r324981) @@ -4,7 +4,6 @@ PROG= ubldr NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} -BINDIR?= /boot INSTALLFLAGS= -b MAN= Modified: head/sys/boot/sparc64/Makefile.inc ============================================================================== --- head/sys/boot/sparc64/Makefile.inc Wed Oct 25 15:27:53 2017 (r324980) +++ head/sys/boot/sparc64/Makefile.inc Wed Oct 25 15:27:58 2017 (r324981) @@ -1,6 +1,5 @@ # $FreeBSD$ -BINDIR?= /boot CFLAGS+= -ffreestanding LDFLAGS+= -nostdlib From owner-svn-src-head@freebsd.org Wed Oct 25 15:28:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3B5BE4D5C5; Wed, 25 Oct 2017 15:28: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 mx1.freebsd.org (Postfix) with ESMTPS id CCE2771B98; Wed, 25 Oct 2017 15:28: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 v9PFS52k018075; Wed, 25 Oct 2017 15:28:05 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFS5It018074; Wed, 25 Oct 2017 15:28:05 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251528.v9PFS5It018074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324982 - in head/sys/boot/arm: at91 at91/boot0 at91/boot0iic at91/boot0spi at91/boot2 at91/bootiic at91/bootspi at91/libat91 ixp425 ixp425/boot2 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot/arm: at91 at91/boot0 at91/boot0iic at91/boot0spi at91/boot2 at91/bootiic at91/bootspi at91/libat91 ixp425 ixp425/boot2 X-SVN-Commit-Revision: 324982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:28:07 -0000 Author: imp Date: Wed Oct 25 15:28:05 2017 New Revision: 324982 URL: https://svnweb.freebsd.org/changeset/base/324982 Log: Remove sys/boot/arm/at91 and ixp425 Remove at91 bootloader. It only worked on AT91RM9200, and only specific boards that were all EOLd 10 years ago. Remove ixp425. It doesn't build anymore and is for boards that were EOLd 8 years ago. Sponsored by: Netflix Deleted: head/sys/boot/arm/at91/Makefile head/sys/boot/arm/at91/Makefile.inc head/sys/boot/arm/at91/boot0/Makefile head/sys/boot/arm/at91/boot0/README head/sys/boot/arm/at91/boot0/linker.cfg head/sys/boot/arm/at91/boot0/main.c head/sys/boot/arm/at91/boot0iic/Makefile head/sys/boot/arm/at91/boot0iic/main.c head/sys/boot/arm/at91/boot0spi/Makefile head/sys/boot/arm/at91/boot0spi/main.c head/sys/boot/arm/at91/boot2/Makefile head/sys/boot/arm/at91/boot2/board.h head/sys/boot/arm/at91/boot2/boot2.c head/sys/boot/arm/at91/boot2/bwct_board.c head/sys/boot/arm/at91/boot2/centipad_board.c head/sys/boot/arm/at91/boot2/kb920x_board.c head/sys/boot/arm/at91/bootiic/Makefile head/sys/boot/arm/at91/bootiic/README head/sys/boot/arm/at91/bootiic/env_vars.c head/sys/boot/arm/at91/bootiic/env_vars.h head/sys/boot/arm/at91/bootiic/loader_prompt.c head/sys/boot/arm/at91/bootiic/loader_prompt.h head/sys/boot/arm/at91/bootiic/main.c head/sys/boot/arm/at91/bootspi/Makefile head/sys/boot/arm/at91/bootspi/README head/sys/boot/arm/at91/bootspi/ee.c head/sys/boot/arm/at91/bootspi/ee.h head/sys/boot/arm/at91/bootspi/env_vars.c head/sys/boot/arm/at91/bootspi/env_vars.h head/sys/boot/arm/at91/bootspi/loader_prompt.c head/sys/boot/arm/at91/bootspi/loader_prompt.h head/sys/boot/arm/at91/bootspi/main.c head/sys/boot/arm/at91/libat91/Makefile head/sys/boot/arm/at91/libat91/arm_init.S head/sys/boot/arm/at91/libat91/at91rm9200.h head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.c head/sys/boot/arm/at91/libat91/at91rm9200_lowlevel.h head/sys/boot/arm/at91/libat91/delay.c head/sys/boot/arm/at91/libat91/eeprom.c head/sys/boot/arm/at91/libat91/emac.c head/sys/boot/arm/at91/libat91/emac.h head/sys/boot/arm/at91/libat91/emac_init.c head/sys/boot/arm/at91/libat91/getc.c head/sys/boot/arm/at91/libat91/lib.h head/sys/boot/arm/at91/libat91/lib_AT91RM9200.h head/sys/boot/arm/at91/libat91/mci_device.h head/sys/boot/arm/at91/libat91/memcmp.c head/sys/boot/arm/at91/libat91/memcpy.c head/sys/boot/arm/at91/libat91/memset.c head/sys/boot/arm/at91/libat91/p_string.c head/sys/boot/arm/at91/libat91/printf.c head/sys/boot/arm/at91/libat91/putchar.c head/sys/boot/arm/at91/libat91/reset.c head/sys/boot/arm/at91/libat91/sd-card.c head/sys/boot/arm/at91/libat91/sd-card.h head/sys/boot/arm/at91/libat91/spi_flash.c head/sys/boot/arm/at91/libat91/spi_flash.h head/sys/boot/arm/at91/libat91/strcmp.c head/sys/boot/arm/at91/libat91/strcpy.c head/sys/boot/arm/at91/libat91/strcvt.c head/sys/boot/arm/at91/libat91/strlen.c head/sys/boot/arm/at91/libat91/tag_list.c head/sys/boot/arm/at91/libat91/tag_list.h head/sys/boot/arm/at91/libat91/xmodem.c head/sys/boot/arm/at91/linker.cfg head/sys/boot/arm/ixp425/Makefile.inc head/sys/boot/arm/ixp425/boot2/Makefile head/sys/boot/arm/ixp425/boot2/arm_init.S head/sys/boot/arm/ixp425/boot2/boot2.c head/sys/boot/arm/ixp425/boot2/cf_ata.h head/sys/boot/arm/ixp425/boot2/ixp425_board.c head/sys/boot/arm/ixp425/boot2/lib.h From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE7EDE4D6CB; Wed, 25 Oct 2017 15:30: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 mx1.freebsd.org (Postfix) with ESMTPS id 7C0F971FA8; Wed, 25 Oct 2017 15:30:21 +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 v9PFUK8I018219; Wed, 25 Oct 2017 15:30:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUKoA018217; Wed, 25 Oct 2017 15:30:20 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUKoA018217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324983 - in head: lib/libc/sys sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: lib/libc/sys sys/sys X-SVN-Commit-Revision: 324983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:21 -0000 Author: imp Date: Wed Oct 25 15:30:20 2017 New Revision: 324983 URL: https://svnweb.freebsd.org/changeset/base/324983 Log: Define RB_POWERCYCLE RB_POWERCYCLE instructs the platform to power off and then power back on a short time later, if that's possible. Otherwise, degrade to the RB_POWEROFF behavior. Sponsored by: Netflix Modified: head/lib/libc/sys/reboot.2 head/sys/sys/reboot.h Modified: head/lib/libc/sys/reboot.2 ============================================================================== --- head/lib/libc/sys/reboot.2 Wed Oct 25 15:28:05 2017 (r324982) +++ head/lib/libc/sys/reboot.2 Wed Oct 25 15:30:20 2017 (r324983) @@ -28,7 +28,7 @@ .\" @(#)reboot.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 18, 2015 +.Dd October 24, 2017 .Dt REBOOT 2 .Os .Sh NAME @@ -84,6 +84,14 @@ for more information. .It Dv RB_HALT The processor is simply halted; no reboot takes place. This option should be used with caution. +.It Dv RB_POWERCYCLE +After halting, the shutdown code will do what it can to turn +off the power and then turn the power back on. +This requires hardware support, usually an auxiliary microprocessor +that can sequence the power supply. +At present only the +.Xr ipmi 4 +driver implements this feature. .It Dv RB_POWEROFF After halting, the shutdown code will do what it can to turn off the power. Modified: head/sys/sys/reboot.h ============================================================================== --- head/sys/sys/reboot.h Wed Oct 25 15:28:05 2017 (r324982) +++ head/sys/sys/reboot.h Wed Oct 25 15:30:20 2017 (r324983) @@ -60,6 +60,7 @@ #define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */ #define RB_PAUSE 0x100000 /* pause after each output line during probe */ #define RB_REROOT 0x200000 /* unmount the rootfs and mount it again */ +#define RB_POWERCYCLE 0x400000 /* Power cycle if possible */ #define RB_MULTIPLE 0x20000000 /* use multiple consoles */ #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 242CEE4D6E3; Wed, 25 Oct 2017 15:30:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id E408671FC4; Wed, 25 Oct 2017 15:30:26 +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 v9PFUQDf018273; Wed, 25 Oct 2017 15:30:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUQUt018272; Wed, 25 Oct 2017 15:30:26 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUQUt018272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324984 - head/lib/libsysdecode X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/lib/libsysdecode X-SVN-Commit-Revision: 324984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:27 -0000 Author: imp Date: Wed Oct 25 15:30:25 2017 New Revision: 324984 URL: https://svnweb.freebsd.org/changeset/base/324984 Log: RB_POWERCYCLE needs to be handled like RB_POWEROFF for decoding. Sponsored by: Netflix Modified: head/lib/libsysdecode/flags.c Modified: head/lib/libsysdecode/flags.c ============================================================================== --- head/lib/libsysdecode/flags.c Wed Oct 25 15:30:20 2017 (r324983) +++ head/lib/libsysdecode/flags.c Wed Oct 25 15:30:25 2017 (r324984) @@ -647,9 +647,9 @@ sysdecode_reboot_howto(FILE *fp, int howto, int *rem) /* * RB_AUTOBOOT is special in that its value is zero, but it is * also an implied argument if a different operation is not - * requested via RB_HALT, RB_POWEROFF, or RB_REROOT. + * requested via RB_HALT, RB_POWERCYCLE, RB_POWEROFF, or RB_REROOT. */ - if (howto != 0 && (howto & (RB_HALT | RB_POWEROFF | RB_REROOT)) == 0) { + if (howto != 0 && (howto & (RB_HALT | RB_POWEROFF | RB_REROOT | RB_POWERCYCLE)) == 0) { fputs("RB_AUTOBOOT|", fp); printed = true; } else From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA7D0E4D731; Wed, 25 Oct 2017 15:30:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id B4DD572043; Wed, 25 Oct 2017 15:30:31 +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 v9PFUUAx018327; Wed, 25 Oct 2017 15:30:30 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUUeU018324; Wed, 25 Oct 2017 15:30:30 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUUeU018324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324985 - head/sbin/shutdown X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/shutdown X-SVN-Commit-Revision: 324985 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:32 -0000 Author: imp Date: Wed Oct 25 15:30:30 2017 New Revision: 324985 URL: https://svnweb.freebsd.org/changeset/base/324985 Log: Add power cycle support (-c) to shutdown. Sponsored by: Netflix Modified: head/sbin/shutdown/shutdown.8 head/sbin/shutdown/shutdown.c Modified: head/sbin/shutdown/shutdown.8 ============================================================================== --- head/sbin/shutdown/shutdown.8 Wed Oct 25 15:30:25 2017 (r324984) +++ head/sbin/shutdown/shutdown.8 Wed Oct 25 15:30:30 2017 (r324985) @@ -28,7 +28,7 @@ .\" @(#)shutdown.8 8.2 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd September 21, 2016 +.Dd October 23, 2017 .Dt SHUTDOWN 8 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nm .Op Fl .Oo -.Fl h | Fl p | +.Fl c | Fl h | Fl p | .Fl r | Fl k .Oc .Oo @@ -59,12 +59,22 @@ would otherwise not bother with such niceties. .Pp The following options are available: .Bl -tag -width indent +.It Fl c +The system is power cycled (power turned off and then back on) +at the specified time. +If the hardware doesn't support power cycle, the system will be +halted. +At the present time, only systems with BMC supported by the +.Xr ipmi 4 +driver that implement this functionality support this flag. +The amount of time the system is off is dependent on the device +that implements this feature. .It Fl h The system is halted at the specified .Ar time . .It Fl p The system is halted and the power is turned off -(hardware support required) +(hardware support required, otherwise the system is halted) at the specified .Ar time . .It Fl r @@ -79,6 +89,7 @@ does not actually halt the system, but leaves the system multi-user with logins disabled (for all but super-user). .It Fl o If one of the +.Fl c , .Fl h , .Fl p or Modified: head/sbin/shutdown/shutdown.c ============================================================================== --- head/sbin/shutdown/shutdown.c Wed Oct 25 15:30:25 2017 (r324984) +++ head/sbin/shutdown/shutdown.c Wed Oct 25 15:30:30 2017 (r324985) @@ -89,7 +89,7 @@ static struct interval { #undef S static time_t offset, shuttime; -static int dohalt, dopower, doreboot, killflg, mbuflen, oflag; +static int docycle, dohalt, dopower, doreboot, killflg, mbuflen, oflag; static char mbuf[BUFSIZ]; static const char *nosync, *whom; @@ -141,11 +141,14 @@ main(int argc, char **argv) goto poweroff; } - while ((ch = getopt(argc, argv, "-hknopr")) != -1) + while ((ch = getopt(argc, argv, "-chknopr")) != -1) switch (ch) { case '-': readstdin = 1; break; + case 'c': + docycle = 1; + break; case 'h': dohalt = 1; break; @@ -174,11 +177,11 @@ main(int argc, char **argv) if (argc < 1) usage((char *)NULL); - if (killflg + doreboot + dohalt + dopower > 1) - usage("incompatible switches -h, -k, -p and -r"); + if (killflg + doreboot + dohalt + dopower + docycle > 1) + usage("incompatible switches -c, -h, -k, -p and -r"); - if (oflag && !(dohalt || dopower || doreboot)) - usage("-o requires -h, -p or -r"); + if (oflag && !(dohalt || dopower || doreboot || docycle)) + usage("-o requires -c, -h, -p or -r"); if (nosync != NULL && !oflag) usage("-n requires -o"); @@ -356,8 +359,8 @@ die_you_gravy_sucking_pig_dog(void) char *empty_environ[] = { NULL }; syslog(LOG_NOTICE, "%s by %s: %s", - doreboot ? "reboot" : dohalt ? "halt" : dopower ? "power-down" : - "shutdown", whom, mbuf); + doreboot ? "reboot" : dohalt ? "halt" : dopower ? "power-down" : + docycle ? "power-cycle" : "shutdown", whom, mbuf); (void)printf("\r\nSystem shutdown time has arrived\007\007\r\n"); if (killflg) { @@ -367,6 +370,8 @@ die_you_gravy_sucking_pig_dog(void) #ifdef DEBUG if (doreboot) (void)printf("reboot"); + else if (docycle) + (void)printf("power-cycle"); else if (dohalt) (void)printf("halt"); else if (dopower) @@ -379,6 +384,7 @@ die_you_gravy_sucking_pig_dog(void) (void)kill(1, doreboot ? SIGINT : /* reboot */ dohalt ? SIGUSR1 : /* halt */ dopower ? SIGUSR2 : /* power-down */ + docycle ? SIGWINCH : /* power-cycle */ SIGTERM); /* single-user */ } else { if (doreboot) { @@ -397,6 +403,13 @@ die_you_gravy_sucking_pig_dog(void) } else if (dopower) { execle(_PATH_HALT, "halt", "-l", "-p", nosync, + (char *)NULL, empty_environ); + syslog(LOG_ERR, "shutdown: can't exec %s: %m.", + _PATH_HALT); + warn(_PATH_HALT); + } + else if (docycle) { + execle(_PATH_HALT, "halt", "-l", "-c", nosync, (char *)NULL, empty_environ); syslog(LOG_ERR, "shutdown: can't exec %s: %m.", _PATH_HALT); From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 632FEE4D75B; Wed, 25 Oct 2017 15:30:36 +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 mx1.freebsd.org (Postfix) with ESMTPS id 40362720C7; Wed, 25 Oct 2017 15:30:36 +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 v9PFUZQh018842; Wed, 25 Oct 2017 15:30:35 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUZWG018619; Wed, 25 Oct 2017 15:30:35 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUZWG018619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324986 - head/sbin/reboot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/reboot X-SVN-Commit-Revision: 324986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:36 -0000 Author: imp Date: Wed Oct 25 15:30:35 2017 New Revision: 324986 URL: https://svnweb.freebsd.org/changeset/base/324986 Log: Add power cycle support to reboot/halt as -c. When -c is specified, the system will be power cycled if the underlying hardware supports it. Otherwise the system will be halted or rebooted depending on which command was used. Sponsored by: Netflix Modified: head/sbin/reboot/reboot.8 head/sbin/reboot/reboot.c Modified: head/sbin/reboot/reboot.8 ============================================================================== --- head/sbin/reboot/reboot.8 Wed Oct 25 15:30:30 2017 (r324985) +++ head/sbin/reboot/reboot.8 Wed Oct 25 15:30:35 2017 (r324986) @@ -28,7 +28,7 @@ .\" @(#)reboot.8 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd March 19, 2017 +.Dd October 23, 2017 .Dt REBOOT 8 .Os .Sh NAME @@ -42,7 +42,7 @@ .Op Fl lNnpq .Op Fl k Ar kernel .Nm -.Op Fl dlNnpqr +.Op Fl cdlNnpqr .Op Fl k Ar kernel .Nm fasthalt .Op Fl lNnpq @@ -66,6 +66,20 @@ accounting database. .Pp The options are as follows: .Bl -tag -width indent +.It Fl c +The system will turn off the power and then turn it back on if it can. +If the power down action fails, the system +will halt or reboot normally, depending on whether +.Nm halt +or +.Nm +was called. +At the present time, only the +.Xr ipmi 4 +driver implements the power cycle functionality and only on hardware +with a BMC that supports power cycling. +Unlike power off, the amount of hardware that supports power cycling +is small. .It Fl d The system is requested to create a crash dump. This option is @@ -162,6 +176,7 @@ reboot -r .Sh SEE ALSO .Xr kenv 1 , .Xr getutxent 3 , +.Xr ipmi 4 , .Xr boot 8 , .Xr dumpon 8 , .Xr nextboot 8 , Modified: head/sbin/reboot/reboot.c ============================================================================== --- head/sbin/reboot/reboot.c Wed Oct 25 15:30:30 2017 (r324985) +++ head/sbin/reboot/reboot.c Wed Oct 25 15:30:35 2017 (r324986) @@ -77,8 +77,11 @@ main(int argc, char *argv[]) } else howto = 0; lflag = nflag = qflag = Nflag = 0; - while ((ch = getopt(argc, argv, "dk:lNnpqr")) != -1) + while ((ch = getopt(argc, argv, "cdk:lNnpqr")) != -1) switch(ch) { + case 'c': + howto |= RB_POWERCYCLE; + break; case 'd': howto |= RB_DUMP; break; @@ -116,8 +119,10 @@ main(int argc, char *argv[]) errx(1, "cannot dump (-d) when halting; must reboot instead"); if (Nflag && (howto & RB_NOSYNC) != 0) errx(1, "-N cannot be used with -n"); + if ((howto & RB_POWEROFF) && (howto & RB_POWERCYCLE)) + errx(1, "-c and -p cannot be used together"); if ((howto & RB_REROOT) != 0 && howto != RB_REROOT) - errx(1, "-r cannot be used with -d, -n, or -p"); + errx(1, "-r cannot be used with -c, -d, -n, or -p"); if (geteuid()) { errno = EPERM; err(1, NULL); @@ -151,6 +156,12 @@ main(int argc, char *argv[]) } else if (howto & RB_REROOT) { openlog("reroot", 0, LOG_AUTH | LOG_CONS); syslog(LOG_CRIT, "rerooted by %s", user); + } else if (howto & RB_POWEROFF) { + openlog("reboot", 0, LOG_AUTH | LOG_CONS); + syslog(LOG_CRIT, "powered off by %s", user); + } else if (howto & RB_POWERCYCLE) { + openlog("reboot", 0, LOG_AUTH | LOG_CONS); + syslog(LOG_CRIT, "power cycled by %s", user); } else { openlog("reboot", 0, LOG_AUTH | LOG_CONS); syslog(LOG_CRIT, "rebooted by %s", user); From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFF41E4D7E8; Wed, 25 Oct 2017 15:30: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 mx1.freebsd.org (Postfix) with ESMTPS id AC431721F1; Wed, 25 Oct 2017 15:30: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 v9PFUiaX020637; Wed, 25 Oct 2017 15:30:44 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUiBf020636; Wed, 25 Oct 2017 15:30:44 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUiBf020636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324988 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 324988 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:46 -0000 Author: imp Date: Wed Oct 25 15:30:44 2017 New Revision: 324988 URL: https://svnweb.freebsd.org/changeset/base/324988 Log: Handle RB_POWERCYCLE in the MI part of the kernel Signal init with SIGWINCH in shutdown_nice for RB_POWERCYCLE. Sponsored by: Netflix Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Wed Oct 25 15:30:40 2017 (r324987) +++ head/sys/kern/kern_shutdown.c Wed Oct 25 15:30:44 2017 (r324988) @@ -283,6 +283,8 @@ shutdown_nice(int howto) 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 @@ -817,7 +819,7 @@ static void poweroff_wait(void *junk, int howto) { - if (!(howto & RB_POWEROFF) || poweroff_delay <= 0) + if ((howto & (RB_POWEROFF | RB_POWERCYCLE)) == 0 || poweroff_delay <= 0) return; DELAY(poweroff_delay * 1000); } From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CFE3E4D824; Wed, 25 Oct 2017 15:30:50 +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 mx1.freebsd.org (Postfix) with ESMTPS id 06EA472288; Wed, 25 Oct 2017 15:30:49 +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 v9PFUn51020694; Wed, 25 Oct 2017 15:30:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUnwq020693; Wed, 25 Oct 2017 15:30:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUnwq020693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324989 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 324989 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:50 -0000 Author: imp Date: Wed Oct 25 15:30:48 2017 New Revision: 324989 URL: https://svnweb.freebsd.org/changeset/base/324989 Log: Handle RB_POWERCYCLE in ada driver Allow the disks to be spun down when doing a POWERCYCLE as well as POWEROFF. Sponsored by: Netflix Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Wed Oct 25 15:30:44 2017 (r324988) +++ head/sys/cam/ata/ata_da.c Wed Oct 25 15:30:48 2017 (r324989) @@ -3513,7 +3513,7 @@ adashutdown(void *arg, int howto) adaflush(); if (ada_spindown_shutdown != 0 && - (howto & (RB_HALT | RB_POWEROFF)) != 0) + (howto & (RB_HALT | RB_POWEROFF | RB_POWERCYCLE)) != 0) adaspindown(ATA_STANDBY_IMMEDIATE, 0); } From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D5ABE4D796; Wed, 25 Oct 2017 15:30: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 mx1.freebsd.org (Postfix) with ESMTPS id 3931572166; Wed, 25 Oct 2017 15:30: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 v9PFUelx020586; Wed, 25 Oct 2017 15:30:40 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUeGv020584; Wed, 25 Oct 2017 15:30:40 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUeGv020584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324987 - head/sbin/init X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/init X-SVN-Commit-Revision: 324987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:41 -0000 Author: imp Date: Wed Oct 25 15:30:40 2017 New Revision: 324987 URL: https://svnweb.freebsd.org/changeset/base/324987 Log: Implement power cycle in init. If SIGWINCH is received, then halt with power cycle. Sponsored by: Netflix Modified: head/sbin/init/init.8 head/sbin/init/init.c Modified: head/sbin/init/init.8 ============================================================================== --- head/sbin/init/init.8 Wed Oct 25 15:30:35 2017 (r324986) +++ head/sbin/init/init.8 Wed Oct 25 15:30:40 2017 (r324987) @@ -286,6 +286,7 @@ as follows: .It Sy "Run-level Signal Action" .It Cm 0 Ta Dv SIGUSR1 Ta "Halt" .It Cm 0 Ta Dv SIGUSR2 Ta "Halt and turn the power off" +.It Cm 0 Ta Dv SIGWINCH Ta "Halt and turn the power off and then back on" .It Cm 1 Ta Dv SIGTERM Ta "Go to single-user mode" .It Cm 6 Ta Dv SIGINT Ta "Reboot the machine" .It Cm c Ta Dv SIGTSTP Ta "Block further logins" Modified: head/sbin/init/init.c ============================================================================== --- head/sbin/init/init.c Wed Oct 25 15:30:35 2017 (r324986) +++ head/sbin/init/init.c Wed Oct 25 15:30:40 2017 (r324987) @@ -305,12 +305,12 @@ invalid: handle(disaster, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGXCPU, SIGXFSZ, 0); handle(transition_handler, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP, - SIGUSR1, SIGUSR2, 0); + SIGUSR1, SIGUSR2, SIGWINCH, 0); handle(alrm_handler, SIGALRM, 0); sigfillset(&mask); delset(&mask, SIGABRT, SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGSYS, SIGXCPU, SIGXFSZ, SIGHUP, SIGINT, SIGEMT, SIGTERM, SIGTSTP, - SIGALRM, SIGUSR1, SIGUSR2, 0); + SIGALRM, SIGUSR1, SIGUSR2, SIGWINCH, 0); sigprocmask(SIG_SETMASK, &mask, (sigset_t *) 0); sigemptyset(&sa.sa_mask); sa.sa_flags = 0; @@ -1557,8 +1557,9 @@ transition_handler(int sig) current_state == clean_ttys || current_state == catatonia) requested_transition = clean_ttys; break; + case SIGWINCH: case SIGUSR2: - howto = RB_POWEROFF; + howto = sig == SIGUSR2 ? RB_POWEROFF : RB_POWERCYCLE; case SIGUSR1: howto |= RB_HALT; case SIGINT: From owner-svn-src-head@freebsd.org Wed Oct 25 15:30:55 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F9AFE4D86E; Wed, 25 Oct 2017 15:30: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 mx1.freebsd.org (Postfix) with ESMTPS id 4AF2172336; Wed, 25 Oct 2017 15:30: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 v9PFUs9j020749; Wed, 25 Oct 2017 15:30:54 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PFUsSw020745; Wed, 25 Oct 2017 15:30:54 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710251530.v9PFUsSw020745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 15:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324990 - in head: share/man/man4 sys/dev/ipmi sys/sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/ipmi sys/sys X-SVN-Commit-Revision: 324990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:30:55 -0000 Author: imp Date: Wed Oct 25 15:30:53 2017 New Revision: 324990 URL: https://svnweb.freebsd.org/changeset/base/324990 Log: Implement IPMI support for RB_POWRECYCLE Some BMCs support power cycling the chassis via the chassis control command 2 subcommand 2 (ipmitool called it 'chassis power cycle'). If the BMC supports the chassis device, register a shutdown_final handler that sends the power cycle command if request and waits up to 10s for it to take effect. To minimize stack strain, we preallocate a ipmi request in the softc. At the moment, we're verbose about what we're doing. Sponsored by: Netflix Modified: head/share/man/man4/ipmi.4 head/sys/dev/ipmi/ipmi.c head/sys/dev/ipmi/ipmivars.h head/sys/sys/ipmi.h Modified: head/share/man/man4/ipmi.4 ============================================================================== --- head/share/man/man4/ipmi.4 Wed Oct 25 15:30:48 2017 (r324989) +++ head/share/man/man4/ipmi.4 Wed Oct 25 15:30:53 2017 (r324990) @@ -90,6 +90,17 @@ is heavily adopted from the standard and .Tn Linux driver; however, not all features described in the standard are supported. +.Pp +The +.Nm +driver implements the power cycling option to +.Xr shutdown 8 +to implement power cycling of the system. +The motherboard's BMC must support the chassis device and the optional +power cycle subcomand of the chassis control command as described in section 28.3 +if the IPMI standard. +The length of time the system is off will be at least one second, but +may be longer if the power cycle interval has been set (see section 28.9). .Sh IOCTLS Sending and receiving messages through the .Nm @@ -179,6 +190,8 @@ An address supplied was invalid. .Sh SEE ALSO .Xr ioctl 2 , .Xr watchdog 4 , +.Xr reboot 8 , +.Xr shutdown 8 , .Xr watchdog 8 , .Xr watchdogd 8 , .Xr watchdog 9 Modified: head/sys/dev/ipmi/ipmi.c ============================================================================== --- head/sys/dev/ipmi/ipmi.c Wed Oct 25 15:30:48 2017 (r324989) +++ head/sys/dev/ipmi/ipmi.c Wed Oct 25 15:30:53 2017 (r324990) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -690,6 +691,45 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error) } static void +ipmi_power_cycle(void *arg, int howto) +{ + struct ipmi_softc *sc = arg; + struct ipmi_request *req; + + /* + * Ignore everything except power cycling requests + */ + if ((howto & RB_POWERCYCLE) == 0) + return; + + device_printf(sc->ipmi_dev, "Power cycling using IPMI\n"); + + /* + * Send a CHASSIS_CONTROL command to the CHASSIS device, subcommand 2 + * as described in IPMI v2.0 spec section 28.3. + */ + IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_CHASSIS_REQUEST, 0), + IPMI_CHASSIS_CONTROL, 1, 0); + req->ir_request[0] = IPMI_CC_POWER_CYCLE; + + ipmi_submit_driver_request(sc, req, MAX_TIMEOUT); + + if (req->ir_error != 0 || req->ir_compcode != 0) { + device_printf(sc->ipmi_dev, "Power cycling via IPMI failed code %#x %#x\n", + req->ir_error, req->ir_compcode); + return; + } + + /* + * BMCs are notoriously slow, give it up to 10s to effect the power + * down leg of the power cycle. If that fails, fallback to the next + * hanlder in the shutdown_final chain and/or the platform failsafe. + */ + DELAY(10 * 1000 * 1000); + device_printf(sc->ipmi_dev, "Power cycling via IPMI timed out\n"); +} + +static void ipmi_startup(void *arg) { struct ipmi_softc *sc = arg; @@ -737,11 +777,13 @@ ipmi_startup(void *arg) } device_printf(dev, "IPMI device rev. %d, firmware rev. %d.%d%d, " - "version %d.%d\n", - req->ir_reply[1] & 0x0f, - req->ir_reply[2] & 0x7f, req->ir_reply[3] >> 4, req->ir_reply[3] & 0x0f, - req->ir_reply[4] & 0x0f, req->ir_reply[4] >> 4); + "version %d.%d, device support mask %#x\n", + req->ir_reply[1] & 0x0f, + req->ir_reply[2] & 0x7f, req->ir_reply[3] >> 4, req->ir_reply[3] & 0x0f, + req->ir_reply[4] & 0x0f, req->ir_reply[4] >> 4, req->ir_reply[5]); + sc->ipmi_dev_support = req->ir_reply[5]; + IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_CLEAR_FLAGS, 1, 0); @@ -792,6 +834,17 @@ ipmi_startup(void *arg) return; } sc->ipmi_cdev->si_drv1 = sc; + + /* + * Power cycle the system off using IPMI. We use last - 1 since we don't + * handle all the other kinds of reboots. We'll let others handle them. + * We only try to do this if the BMC supports the Chassis device. + */ + if (sc->ipmi_dev_support & IPMI_ADS_CHASSIS) { + device_printf(dev, "Establishing power cycle handler\n"); + sc->ipmi_power_cycle_tag = EVENTHANDLER_REGISTER(shutdown_final, + ipmi_power_cycle, sc, SHUTDOWN_PRI_LAST - 1); + } } int @@ -843,6 +896,10 @@ ipmi_detach(device_t dev) EVENTHANDLER_DEREGISTER(watchdog_list, sc->ipmi_watchdog_tag); ipmi_set_watchdog(sc, 0); } + + /* Detach from shutdown handling for power cycle reboot */ + if (sc->ipmi_power_cycle_tag) + EVENTHANDLER_DEREGISTER(shutdown_final, sc->ipmi_power_cycle_tag); /* XXX: should use shutdown callout I think. */ /* If the backend uses a kthread, shut it down. */ Modified: head/sys/dev/ipmi/ipmivars.h ============================================================================== --- head/sys/dev/ipmi/ipmivars.h Wed Oct 25 15:30:48 2017 (r324989) +++ head/sys/dev/ipmi/ipmivars.h Wed Oct 25 15:30:53 2017 (r324990) @@ -103,9 +103,11 @@ struct ipmi_softc { void *ipmi_irq; int ipmi_detaching; int ipmi_opened; + uint8_t ipmi_dev_support; /* IPMI_ADS_* */ struct cdev *ipmi_cdev; TAILQ_HEAD(,ipmi_request) ipmi_pending_requests; int ipmi_driver_requests_polled; + eventhandler_tag ipmi_power_cycle_tag; eventhandler_tag ipmi_watchdog_tag; int ipmi_watchdog_active; struct intr_config_hook ipmi_ich; Modified: head/sys/sys/ipmi.h ============================================================================== --- head/sys/sys/ipmi.h Wed Oct 25 15:30:48 2017 (r324989) +++ head/sys/sys/ipmi.h Wed Oct 25 15:30:53 2017 (r324990) @@ -56,8 +56,25 @@ #define IPMI_ASYNC_EVENT_RECV_TYPE 2 #define IPMI_CMD_RECV_TYPE 3 +#define IPMI_CHASSIS_REQUEST 0x00 +# define IPMI_CHASSIS_CONTROL 0x02 +# define IPMI_CC_POWER_DOWN 0x0 +# define IPMI_CC_POWER_UP 0x1 +# define IPMI_CC_POWER_CYCLE 0x2 +# define IPMI_CC_HARD_RESET 0x3 +# define IPMI_CC_PULSE_DI 0x4 +# define IPMI_CC_SOFT_OVERTEMP 0x5 + #define IPMI_APP_REQUEST 0x06 #define IPMI_GET_DEVICE_ID 0x01 +# define IPMI_ADS_CHASSIS 0x80 +# define IPMI_ADS_BRIDGE 0x40 +# define IPMI_ADS_EVENT_GEN 0x20 +# define IPMI_ADS_EVENT_RCV 0x10 +# define IPMI_ADS_FRU_INV 0x08 +# define IPMI_ADS_SEL 0x04 +# define IPMI_ADS_SDR 0x02 +# define IPMI_ADS_SENSOR 0x01 #define IPMI_CLEAR_FLAGS 0x30 #define IPMI_GET_MSG_FLAGS 0x31 # define IPMI_MSG_AVAILABLE 0x01 From owner-svn-src-head@freebsd.org Wed Oct 25 15:43:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A69D5E4DEF1 for ; Wed, 25 Oct 2017 15:43:51 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) 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 3597173123 for ; Wed, 25 Oct 2017 15:43:51 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x234.google.com with SMTP id r196so2741751wmf.2 for ; Wed, 25 Oct 2017 08:43:51 -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=PmxEjRLoZ05f2wstVKRo6H2oasGaWegleF84kH+Hgho=; b=V9ySLkzdUrVnxwbONFEjtlSUVIJN+diEJ3XyUtExJ/lUC/D9fTbqKcHKWqH9JjXI7o H5ftIpkM8EzlH4jlNP5w7e1zapoLbMqQ1VFAHzqhJaQiTrdQ9sVSclAL0dukZKEV3xfR 2nVNrQAVeDn4U1u+RIP4OumOY5Sxst3+QEywTn48cBJ5GEomdtHqPgNBbvosrWohoogC 9hZDE3lPYfbXzorIlt0BswCTr4K/rsgG2SibEiYbhmFyRPf7j9v+cnYDJDL3GrF2ELm+ J3lnHqROyWNinqcP6Ic1+pc0Xg+T1I51hWBFFqwAGCPqHFeEgP1+EGWRtELyYXpfgfIV LRCg== 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=PmxEjRLoZ05f2wstVKRo6H2oasGaWegleF84kH+Hgho=; b=ZgSGwFqVa3Pt4Nae61zlJAe1e/zgx7G+LBAst4TUn8saiGyPfaPAXt/ISp6tbXsJM5 H1cFE0xkYOTczXwa1HIndPC2nLS5FvIhBWQVMmdwT51Id9pCxhZotg2r8EcDPwHwaQ25 RgEaVjBFP7/0MYO517vnxE4b68qEbQ1yzyZl6Dkc2R/MElcPBVkS6+DAPipLdSA6444i L0ZbR0EHizSxUSQJ6PXGRCmZTIiJ/Ew0EgSblab1FQ7X5K7t7ifVcFJIsE/EXLbDgVWv xSMXBByw0mB9gn/BUXLbN1L05hKcOu68WV8HZj+Na5BCn3SNNFVLqNQgQdOISKIFvgCd wSgg== X-Gm-Message-State: AMCzsaUMmvA0kU8ot74dNCpeBjTVO62P+oRRabTV07/qsrQ/vKBJSKps hKNKieQp9AJtB/DULnJ3csC+mcPsp4M= X-Google-Smtp-Source: ABhQp+RtiPawBw9/TRQbLVHd/lUNFVr0EcAMjbWLE5Ys0viNq4EyldidP8GqlXSxv7qiIDaELKDQhQ== X-Received: by 10.28.153.85 with SMTP id b82mr2044219wme.121.1508946228921; Wed, 25 Oct 2017 08:43:48 -0700 (PDT) Received: from [10.10.1.111] ([185.97.61.1]) by smtp.gmail.com with ESMTPSA id j5sm3095249wmg.8.2017.10.25.08.43.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 08:43:47 -0700 (PDT) Subject: Re: svn commit: r324983 - in head: lib/libc/sys sys/sys To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710251530.v9PFUKoA018217@repo.freebsd.org> From: Steven Hartland Message-ID: Date: Wed, 25 Oct 2017 16:43:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201710251530.v9PFUKoA018217@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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 15:43:51 -0000 Personally I would expect the fallback to be reboot as without the ability to power back on remotely e.g. IPMI this could render the machine inaccessible, which is not ideal, thoughts? On 25/10/2017 16:30, Warner Losh wrote: > Author: imp > Date: Wed Oct 25 15:30:20 2017 > New Revision: 324983 > URL: https://svnweb.freebsd.org/changeset/base/324983 > > Log: > Define RB_POWERCYCLE > > RB_POWERCYCLE instructs the platform to power off and then power back > on a short time later, if that's possible. Otherwise, degrade to the > RB_POWEROFF behavior. > > Sponsored by: Netflix > > Modified: > head/lib/libc/sys/reboot.2 > head/sys/sys/reboot.h > > Modified: head/lib/libc/sys/reboot.2 > ============================================================================== > --- head/lib/libc/sys/reboot.2 Wed Oct 25 15:28:05 2017 (r324982) > +++ head/lib/libc/sys/reboot.2 Wed Oct 25 15:30:20 2017 (r324983) > @@ -28,7 +28,7 @@ > .\" @(#)reboot.2 8.1 (Berkeley) 6/4/93 > .\" $FreeBSD$ > .\" > -.Dd September 18, 2015 > +.Dd October 24, 2017 > .Dt REBOOT 2 > .Os > .Sh NAME > @@ -84,6 +84,14 @@ for more information. > .It Dv RB_HALT > The processor is simply halted; no reboot takes place. > This option should be used with caution. > +.It Dv RB_POWERCYCLE > +After halting, the shutdown code will do what it can to turn > +off the power and then turn the power back on. > +This requires hardware support, usually an auxiliary microprocessor > +that can sequence the power supply. > +At present only the > +.Xr ipmi 4 > +driver implements this feature. > .It Dv RB_POWEROFF > After halting, the shutdown code will do what it can to turn > off the power. > > Modified: head/sys/sys/reboot.h > ============================================================================== > --- head/sys/sys/reboot.h Wed Oct 25 15:28:05 2017 (r324982) > +++ head/sys/sys/reboot.h Wed Oct 25 15:30:20 2017 (r324983) > @@ -60,6 +60,7 @@ > #define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */ > #define RB_PAUSE 0x100000 /* pause after each output line during probe */ > #define RB_REROOT 0x200000 /* unmount the rootfs and mount it again */ > +#define RB_POWERCYCLE 0x400000 /* Power cycle if possible */ > #define RB_MULTIPLE 0x20000000 /* use multiple consoles */ > > #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ > From owner-svn-src-head@freebsd.org Wed Oct 25 16:01:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40A99E4E38A; Wed, 25 Oct 2017 16:01:20 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0EAD57396C; Wed, 25 Oct 2017 16:01:19 +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 v9PG1JWl032408; Wed, 25 Oct 2017 16:01:19 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PG1JKC032407; Wed, 25 Oct 2017 16:01:19 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201710251601.v9PG1JKC032407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 25 Oct 2017 16:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324991 - head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 324991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 16:01:20 -0000 Author: asomers Date: Wed Oct 25 16:01:19 2017 New Revision: 324991 URL: https://svnweb.freebsd.org/changeset/base/324991 Log: Fix zpool_read_all_labels when vfs.aio.enable_unsafe=0 Previously, zpool_read_all_labels was trying to do 256KB reads, which are greater than the default MAXPHYS and therefore must go through the slow, unsafe AIO path. Shrink these reads to 112KB so they can use the safe, fast AIO path instead. MFC after: 1 week X-MFC-With: 324568 Sponsored by: Spectra Logic Corp Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 25 15:30:53 2017 (r324990) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Wed Oct 25 16:01:19 2017 (r324991) @@ -930,7 +930,7 @@ zpool_read_all_labels(int fd, nvlist_t **config) struct aiocb aiocbs[VDEV_LABELS]; struct aiocb *aiocbps[VDEV_LABELS]; int l; - vdev_label_t *labels; + vdev_phys_t *labels; uint64_t state, txg, size; int nlabels = 0; @@ -940,15 +940,15 @@ zpool_read_all_labels(int fd, nvlist_t **config) return (0); size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); - if ((labels = calloc(VDEV_LABELS, sizeof (vdev_label_t))) == NULL) + if ((labels = calloc(VDEV_LABELS, sizeof (vdev_phys_t))) == NULL) return (0); memset(aiocbs, 0, sizeof(aiocbs)); for (l = 0; l < VDEV_LABELS; l++) { aiocbs[l].aio_fildes = fd; - aiocbs[l].aio_offset = label_offset(size, l); + aiocbs[l].aio_offset = label_offset(size, l) + VDEV_SKIP_SIZE; aiocbs[l].aio_buf = &labels[l]; - aiocbs[l].aio_nbytes = sizeof(vdev_label_t); + aiocbs[l].aio_nbytes = sizeof(vdev_phys_t); aiocbs[l].aio_lio_opcode = LIO_READ; aiocbps[l] = &aiocbs[l]; } @@ -962,17 +962,18 @@ zpool_read_all_labels(int fd, nvlist_t **config) (void)aio_return(&aiocbs[l]); } } + free(labels); return (0); } for (l = 0; l < VDEV_LABELS; l++) { nvlist_t *temp = NULL; - if (aio_return(&aiocbs[l]) != sizeof(vdev_label_t)) + if (aio_return(&aiocbs[l]) != sizeof(vdev_phys_t)) continue; - if (nvlist_unpack(labels[l].vl_vdev_phys.vp_nvlist, - sizeof (labels[l].vl_vdev_phys.vp_nvlist), &temp, 0) != 0) + if (nvlist_unpack(labels[l].vp_nvlist, + sizeof (labels[l].vp_nvlist), &temp, 0) != 0) continue; if (nvlist_lookup_uint64(temp, ZPOOL_CONFIG_POOL_STATE, From owner-svn-src-head@freebsd.org Wed Oct 25 16:29:22 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9760E4EA96; Wed, 25 Oct 2017 16:29:22 +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 A40587440C; Wed, 25 Oct 2017 16:29:22 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 017B41DFFF; Wed, 25 Oct 2017 16:29:21 +0000 (UTC) Date: Wed, 25 Oct 2017 16:29:21 +0000 From: Alexey Dokuchaev To: rgrimes@freebsd.org Cc: Michael Tuexen , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r324971 - head/sys/netinet Message-ID: <20171025162921.GA84006@FreeBSD.org> References: <201710250912.v9P9CMar060973@repo.freebsd.org> <201710251457.v9PEvEZU052398@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201710251457.v9PEvEZU052398@pdx.rh.CN85.dnsmgr.net> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 16:29:22 -0000 On Wed, Oct 25, 2017 at 07:57:14AM -0700, Rodney W. Grimes wrote: > > New Revision: 324971 > > URL: https://svnweb.freebsd.org/changeset/base/324971 > > > > Log: > > Fix a bug reported by Felix Weinrank using the libfuzzer on the > > userland stack. > > Please try to say what the bug was, why it was a bug, and > how it was fixed in any bug commit message. > > External vague references are of little value when reading > through a files svn history. Honestly, I don't understand at all why this topic comes up again and again. It's beaten to death, aren't people supposed to read svn-* mail? :-( ./danfe From owner-svn-src-head@freebsd.org Wed Oct 25 16:38:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9248E4F121; Wed, 25 Oct 2017 16:38:37 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8212F74B46; Wed, 25 Oct 2017 16:38:37 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [10.54.148.69] (unknown [88.128.80.78]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 22E0672106C11; Wed, 25 Oct 2017 18:38:34 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.0 \(3445.1.7\)) Subject: Re: svn commit: r324971 - head/sys/netinet From: Michael Tuexen In-Reply-To: <201710251457.v9PEvEZU052398@pdx.rh.CN85.dnsmgr.net> Date: Wed, 25 Oct 2017 18:38:21 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2342CC17-27C7-40B2-8FA4-E224A7BE1F38@freebsd.org> References: <201710251457.v9PEvEZU052398@pdx.rh.CN85.dnsmgr.net> To: rgrimes@freebsd.org X-Mailer: Apple Mail (2.3445.1.7) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 16:38:37 -0000 > On 25. Oct 2017, at 16:57, Rodney W. Grimes = wrote: >=20 > [ Charset UTF-8 unsupported, converting... ] >> Author: tuexen >> Date: Wed Oct 25 09:12:22 2017 >> New Revision: 324971 >> URL: https://svnweb.freebsd.org/changeset/base/324971 >>=20 >> Log: >> Fix a bug reported by Felix Weinrank using the libfuzzer on the >> userland stack. >=20 > Please try to say what the bug was, why it was a bug, and > how it was fixed in any bug commit message. Yepp, you are right. The bug was that when taking the length of what is used in a buffer, the offset was not taken into account. The fix is to do that... Best regards Michael >=20 > External vague references are of little value when reading > through a files svn history. >=20 > Thanks, >>=20 >> MFC after: 3 days >>=20 >> Modified: >> head/sys/netinet/sctp_auth.c >>=20 >> Modified: head/sys/netinet/sctp_auth.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- head/sys/netinet/sctp_auth.c Wed Oct 25 05:55:13 2017 = (r324970) >> +++ head/sys/netinet/sctp_auth.c Wed Oct 25 09:12:22 2017 = (r324971) >> @@ -1606,9 +1606,9 @@ sctp_zero_m(struct mbuf *m, uint32_t m_offset, = uint32_ >> /* now use the rest of the mbuf chain */ >> while ((m_tmp !=3D NULL) && (size > 0)) { >> data =3D mtod(m_tmp, uint8_t *)+m_offset; >> - if (size > (uint32_t)SCTP_BUF_LEN(m_tmp)) { >> - memset(data, 0, SCTP_BUF_LEN(m_tmp)); >> - size -=3D SCTP_BUF_LEN(m_tmp); >> + if (size > (uint32_t)(SCTP_BUF_LEN(m_tmp) - m_offset)) { >> + memset(data, 0, SCTP_BUF_LEN(m_tmp) - m_offset); >> + size -=3D SCTP_BUF_LEN(m_tmp) - m_offset; >> } else { >> memset(data, 0, size); >> size =3D 0; >>=20 >>=20 >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org >=20 From owner-svn-src-head@freebsd.org Wed Oct 25 17:20:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DA5CE4FCBF; Wed, 25 Oct 2017 17:20:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2C9537635A; Wed, 25 Oct 2017 17:20:19 +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 v9PHKIvG064018; Wed, 25 Oct 2017 17:20:18 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PHKIYY064017; Wed, 25 Oct 2017 17:20:18 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710251720.v9PHKIYY064017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 25 Oct 2017 17:20:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324992 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 324992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 17:20:19 -0000 Author: markj Date: Wed Oct 25 17:20:18 2017 New Revision: 324992 URL: https://svnweb.freebsd.org/changeset/base/324992 Log: Make drain_output() use bufobj_wwait(). No functional change intended. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12790 Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Oct 25 16:01:19 2017 (r324991) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Oct 25 17:20:18 2017 (r324992) @@ -14289,25 +14289,14 @@ softdep_get_depcounts(struct mount *mp, /* * Wait for pending output on a vnode to complete. - * Must be called with vnode lock and interlock locked. - * - * XXX: Should just be a call to bufobj_wwait(). */ static void drain_output(vp) struct vnode *vp; { - struct bufobj *bo; - bo = &vp->v_bufobj; ASSERT_VOP_LOCKED(vp, "drain_output"); - ASSERT_BO_WLOCKED(bo); - - while (bo->bo_numoutput) { - bo->bo_flag |= BO_WWAIT; - msleep((caddr_t)&bo->bo_numoutput, - BO_LOCKPTR(bo), PRIBIO + 1, "drainvp", 0); - } + (void)bufobj_wwait(&vp->v_bufobj, 0, 0); } /* From owner-svn-src-head@freebsd.org Wed Oct 25 17:20:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82F35E4FE29; Wed, 25 Oct 2017 17:20:38 +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 2C80A76493; Wed, 25 Oct 2017 17:20:37 +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 v9PHKTdA052971; Wed, 25 Oct 2017 10:20:29 -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 v9PHKTnQ052970; Wed, 25 Oct 2017 10:20:29 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201710251720.v9PHKTnQ052970@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r324971 - head/sys/netinet In-Reply-To: <20171025162921.GA84006@FreeBSD.org> To: Alexey Dokuchaev Date: Wed, 25 Oct 2017 10:20:29 -0700 (PDT) CC: rgrimes@freebsd.org, Michael Tuexen , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 17:20:38 -0000 > On Wed, Oct 25, 2017 at 07:57:14AM -0700, Rodney W. Grimes wrote: > > > New Revision: 324971 > > > URL: https://svnweb.freebsd.org/changeset/base/324971 > > > > > > Log: > > > Fix a bug reported by Felix Weinrank using the libfuzzer on the > > > userland stack. > > > > Please try to say what the bug was, why it was a bug, and > > how it was fixed in any bug commit message. > > > > External vague references are of little value when reading > > through a files svn history. > > Honestly, I don't understand at all why this topic comes up again and > again. It's beaten to death, aren't people supposed to read svn-* mail? > > :-( I think one thing that causes some of this is that many work in private repositories with no one else seeing there commits and they develope a bad habit of writting very brief commit messages and then these get carried into public repositories. > ./danfe -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Oct 25 17:23:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DD9DE4FED2; Wed, 25 Oct 2017 17:23:34 +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 mx1.freebsd.org (Postfix) with ESMTPS id 578CA76888; Wed, 25 Oct 2017 17:23:34 +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 v9PHNXPo067756; Wed, 25 Oct 2017 17:23:33 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PHNXOo067755; Wed, 25 Oct 2017 17:23:33 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201710251723.v9PHNXOo067755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 25 Oct 2017 17:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324993 - head/tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/tests/sys/kern X-SVN-Commit-Revision: 324993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 17:23:34 -0000 Author: jhb Date: Wed Oct 25 17:23:33 2017 New Revision: 324993 URL: https://svnweb.freebsd.org/changeset/base/324993 Log: Add a test for sending a signal while stepping a thread via PT_STEP. MFC after: 1 week Modified: head/tests/sys/kern/ptrace_test.c Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Wed Oct 25 17:20:18 2017 (r324992) +++ head/tests/sys/kern/ptrace_test.c Wed Oct 25 17:23:33 2017 (r324993) @@ -3377,6 +3377,92 @@ ATF_TC_BODY(ptrace__PT_ATTACH_with_SBDRY_thread, tc) ATF_REQUIRE(close(fd) == 0); } +static void +sigusr1_step_handler(int sig) +{ + + CHILD_REQUIRE(sig == SIGUSR1); + raise(SIGABRT); +} + +/* + * Verify that PT_STEP with a signal invokes the signal before + * stepping the next instruction (and that the next instruction is + * stepped correctly). + */ +ATF_TC_WITHOUT_HEAD(ptrace__PT_STEP_with_signal); +ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + signal(SIGUSR1, sigusr1_step_handler); + raise(SIGABRT); + exit(1); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The next stop should report the SIGABRT in the child body. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGABRT); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT); + + /* Step the child process inserting SIGUSR1. */ + ATF_REQUIRE(ptrace(PT_STEP, fpid, (caddr_t)1, SIGUSR1) == 0); + + /* The next stop should report the SIGABRT in the signal handler. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGABRT); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGABRT); + + /* Continue the child process discarding the signal. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The next stop should report a trace trap from PT_STEP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE(pl.pl_flags & PL_FLAG_SI); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP); + ATF_REQUIRE(pl.pl_siginfo.si_code == TRAP_TRACE); + + /* Continue the child to let it exit. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -3428,6 +3514,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__parent_terminate_with_pending_sigstop2); ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard); ATF_TP_ADD_TC(tp, ptrace__PT_ATTACH_with_SBDRY_thread); + ATF_TP_ADD_TC(tp, ptrace__PT_STEP_with_signal); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Wed Oct 25 17:49:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 588A9E507F4; Wed, 25 Oct 2017 17:49:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2152F773E0; Wed, 25 Oct 2017 17:49:19 +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 v9PHnI6h076175; Wed, 25 Oct 2017 17:49:18 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PHnH3Z076163; Wed, 25 Oct 2017 17:49:17 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201710251749.v9PHnH3Z076163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 25 Oct 2017 17:49:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324994 - in head/sys: dev/liquidio dev/liquidio/base modules X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: in head/sys: dev/liquidio dev/liquidio/base modules X-SVN-Commit-Revision: 324994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 17:49:19 -0000 Author: sbruno Date: Wed Oct 25 17:49:17 2017 New Revision: 324994 URL: https://svnweb.freebsd.org/changeset/base/324994 Log: Enable i386 build of the Cavium LiquidIO driver (lio) module. Submitted by: pkanneganti@cavium.com (Prasad V Kanneganti) MFC after: 1 week Sponsored by: Cavium Networks Differential Revision: https://reviews.freebsd.org/D12415 Modified: head/sys/dev/liquidio/base/cn23xx_pf_device.c head/sys/dev/liquidio/base/lio_device.c head/sys/dev/liquidio/base/lio_device.h head/sys/dev/liquidio/base/lio_droq.c head/sys/dev/liquidio/base/lio_mem_ops.c head/sys/dev/liquidio/base/lio_request_manager.c head/sys/dev/liquidio/lio_main.c head/sys/dev/liquidio/lio_main.h head/sys/dev/liquidio/lio_rxtx.c head/sys/dev/liquidio/lio_sysctl.c head/sys/modules/Makefile Modified: head/sys/dev/liquidio/base/cn23xx_pf_device.c ============================================================================== --- head/sys/dev/liquidio/base/cn23xx_pf_device.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/base/cn23xx_pf_device.c Wed Oct 25 17:49:17 2017 (r324994) @@ -162,11 +162,11 @@ lio_cn23xx_pf_setup_global_mac_regs(struct octeon_devi lio_write_csr64(oct, LIO_CN23XX_SLI_PKT_MAC_RINFO64(mac_no, pf_num), reg_val); - lio_dev_dbg(oct, "SLI_PKT_MAC(%d)_PF(%d)_RINFO : 0x%016lx\n", mac_no, + lio_dev_dbg(oct, "SLI_PKT_MAC(%d)_PF(%d)_RINFO : 0x%016llx\n", mac_no, pf_num, - lio_read_csr64(oct, + LIO_CAST64(lio_read_csr64(oct, LIO_CN23XX_SLI_PKT_MAC_RINFO64(mac_no, - pf_num))); + pf_num)))); } static int Modified: head/sys/dev/liquidio/base/lio_device.c ============================================================================== --- head/sys/dev/liquidio/base/lio_device.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/base/lio_device.c Wed Oct 25 17:49:17 2017 (r324994) @@ -817,8 +817,8 @@ lio_core_drv_init(struct lio_recv_info *recv_info, voi cs = &core_setup[oct->octeon_id]; if (recv_pkt->buffer_size[0] != (sizeof(*cs) + LIO_DROQ_INFO_SIZE)) { - lio_dev_dbg(oct, "Core setup bytes expected %lu found %d\n", - (uint32_t)sizeof(*cs) + LIO_DROQ_INFO_SIZE, + lio_dev_dbg(oct, "Core setup bytes expected %llu found %d\n", + LIO_CAST64(sizeof(*cs) + LIO_DROQ_INFO_SIZE), recv_pkt->buffer_size[0]); } Modified: head/sys/dev/liquidio/base/lio_device.h ============================================================================== --- head/sys/dev/liquidio/base/lio_device.h Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/base/lio_device.h Wed Oct 25 17:49:17 2017 (r324994) @@ -873,16 +873,26 @@ static inline uint64_t lio_read_csr64(struct octeon_device *oct, uint32_t reg) { +#ifdef __i386__ + return (lio_read_csr32(oct, reg) | + ((uint64_t)lio_read_csr32(oct, reg + 4) << 32)); +#else return (bus_space_read_8(oct->mem_bus_space[0].tag, oct->mem_bus_space[0].handle, reg)); +#endif } static inline void lio_write_csr64(struct octeon_device *oct, uint32_t reg, uint64_t val) { +#ifdef __i386__ + lio_write_csr32(oct, reg, (uint32_t)val); + lio_write_csr32(oct, reg + 4, val >> 32); +#else bus_space_write_8(oct->mem_bus_space[0].tag, oct->mem_bus_space[0].handle, reg, val); +#endif } #endif /* _LIO_DEVICE_H_ */ Modified: head/sys/dev/liquidio/base/lio_droq.c ============================================================================== --- head/sys/dev/liquidio/base/lio_droq.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/base/lio_droq.c Wed Oct 25 17:49:17 2017 (r324994) @@ -294,8 +294,8 @@ lio_init_droq(struct octeon_device *oct, uint32_t q_no return (1); } - lio_dev_dbg(oct, "droq[%d]: desc_ring: virt: 0x%p, dma: %lx\n", q_no, - droq->desc_ring, droq->desc_ring_dma); + lio_dev_dbg(oct, "droq[%d]: desc_ring: virt: 0x%p, dma: %llx\n", q_no, + droq->desc_ring, LIO_CAST64(droq->desc_ring_dma)); lio_dev_dbg(oct, "droq[%d]: num_desc: %d\n", q_no, droq->max_count); size = droq->max_count * LIO_DROQ_RECVBUF_SIZE; Modified: head/sys/dev/liquidio/base/lio_mem_ops.c ============================================================================== --- head/sys/dev/liquidio/base/lio_mem_ops.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/base/lio_mem_ops.c Wed Oct 25 17:49:17 2017 (r324994) @@ -65,20 +65,48 @@ lio_write_bar1_mem8(struct octeon_device *oct, uint32_ oct->mem_bus_space[1].handle, reg, val); } +#ifdef __i386__ +static inline uint32_t +lio_read_bar1_mem32(struct octeon_device *oct, uint32_t reg) +{ + + return (bus_space_read_4(oct->mem_bus_space[1].tag, + oct->mem_bus_space[1].handle, reg)); +} + +static inline void +lio_write_bar1_mem32(struct octeon_device *oct, uint32_t reg, uint32_t val) +{ + + bus_space_write_4(oct->mem_bus_space[1].tag, + oct->mem_bus_space[1].handle, reg, val); +} +#endif + static inline uint64_t lio_read_bar1_mem64(struct octeon_device *oct, uint32_t reg) { +#ifdef __i386__ + return (lio_read_bar1_mem32(oct, reg) | + ((uint64_t)lio_read_bar1_mem32(oct, reg + 4) << 32)); +#else return (bus_space_read_8(oct->mem_bus_space[1].tag, oct->mem_bus_space[1].handle, reg)); +#endif } static inline void lio_write_bar1_mem64(struct octeon_device *oct, uint32_t reg, uint64_t val) { +#ifdef __i386__ + lio_write_bar1_mem32(oct, reg, (uint32_t)val); + lio_write_bar1_mem32(oct, reg + 4, val >> 32); +#else bus_space_write_8(oct->mem_bus_space[1].tag, oct->mem_bus_space[1].handle, reg, val); +#endif } static void Modified: head/sys/dev/liquidio/base/lio_request_manager.c ============================================================================== --- head/sys/dev/liquidio/base/lio_request_manager.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/base/lio_request_manager.c Wed Oct 25 17:49:17 2017 (r324994) @@ -97,7 +97,7 @@ lio_init_instr_queue(struct octeon_device *oct, union return (1); } - iq->base_addr = lio_dma_alloc(q_size, &iq->base_addr_dma); + iq->base_addr = lio_dma_alloc(q_size, (vm_paddr_t *)&iq->base_addr_dma); if (!iq->base_addr) { lio_dev_err(oct, "Cannot allocate memory for instr queue %d\n", iq_no); @@ -118,8 +118,9 @@ lio_init_instr_queue(struct octeon_device *oct, union return (1); } - lio_dev_dbg(oct, "IQ[%d]: base: %p basedma: %lx count: %d\n", - iq_no, iq->base_addr, iq->base_addr_dma, iq->max_count); + lio_dev_dbg(oct, "IQ[%d]: base: %p basedma: %llx count: %d\n", + iq_no, iq->base_addr, LIO_CAST64(iq->base_addr_dma), + iq->max_count); /* Create the descriptor buffer dma maps */ request_buf = iq->request_list; @@ -736,7 +737,7 @@ lio_setup_sc_buffer_pool(struct octeon_device *oct) for (i = 0; i < LIO_MAX_SOFT_COMMAND_BUFFERS; i++) { sc = (struct lio_soft_command *) - lio_dma_alloc(LIO_SOFT_COMMAND_BUFFER_SIZE, &dma_addr); + lio_dma_alloc(LIO_SOFT_COMMAND_BUFFER_SIZE, (vm_paddr_t *)&dma_addr); if (sc == NULL) { lio_free_sc_buffer_pool(oct); return (1); Modified: head/sys/dev/liquidio/lio_main.c ============================================================================== --- head/sys/dev/liquidio/lio_main.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/lio_main.c Wed Oct 25 17:49:17 2017 (r324994) @@ -1013,7 +1013,7 @@ lio_get_media_subtype(struct octeon_device *oct) return (IFM_10G_SR); } -static unsigned long +static uint64_t lio_get_baudrate(struct octeon_device *oct) { @@ -1318,15 +1318,16 @@ lio_setup_nic_devices(struct octeon_device *octeon_dev if (!(num_iqueues) || !(num_oqueues)) { lio_dev_err(octeon_dev, - "Got bad iqueues (%016lX) or oqueues (%016lX) from firmware.\n", - resp->cfg_info.iqmask, - resp->cfg_info.oqmask); + "Got bad iqueues (%016llX) or oqueues (%016llX) from firmware.\n", + LIO_CAST64(resp->cfg_info.iqmask), + LIO_CAST64(resp->cfg_info.oqmask)); goto setup_nic_dev_fail; } lio_dev_dbg(octeon_dev, - "interface %d, iqmask %016lx, oqmask %016lx, numiqueues %d, numoqueues %d\n", - i, resp->cfg_info.iqmask, resp->cfg_info.oqmask, + "interface %d, iqmask %016llx, oqmask %016llx, numiqueues %d, numoqueues %d\n", + i, LIO_CAST64(resp->cfg_info.iqmask), + LIO_CAST64(resp->cfg_info.oqmask), num_iqueues, num_oqueues); ifp = if_alloc(IFT_ETHER); Modified: head/sys/dev/liquidio/lio_main.h ============================================================================== --- head/sys/dev/liquidio/lio_main.h Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/lio_main.h Wed Oct 25 17:49:17 2017 (r324994) @@ -43,11 +43,7 @@ extern unsigned int lio_hwlro; -#ifdef __LP64__ #define LIO_CAST64(v) ((long long)(long)(v)) -#else -#error "Unknown system architecture" -#endif #define LIO_DRV_NAME "lio" @@ -107,9 +103,9 @@ lio_map_pci_barx(struct octeon_device *oct, int baridx oct->mem_bus_space[baridx].handle = rman_get_bushandle(oct->mem_bus_space[baridx].pci_mem); - lio_dev_dbg(oct, "BAR%d Tag 0x%lx Handle 0x%lx\n", - baridx, oct->mem_bus_space[baridx].tag, - oct->mem_bus_space[baridx].handle); + lio_dev_dbg(oct, "BAR%d Tag 0x%llx Handle 0x%llx\n", + baridx, LIO_CAST64(oct->mem_bus_space[baridx].tag), + LIO_CAST64(oct->mem_bus_space[baridx].handle)); return (0); } Modified: head/sys/dev/liquidio/lio_rxtx.c ============================================================================== --- head/sys/dev/liquidio/lio_rxtx.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/lio_rxtx.c Wed Oct 25 17:49:17 2017 (r324994) @@ -218,8 +218,8 @@ retry: drop_packet: stats->tx_dropped++; - lio_dev_err(oct, "IQ%d Transmit dropped: %lu\n", iq_no, - stats->tx_dropped); + lio_dev_err(oct, "IQ%d Transmit dropped: %llu\n", iq_no, + LIO_CAST64(stats->tx_dropped)); m_freem(*m_headp); *m_headp = NULL; Modified: head/sys/dev/liquidio/lio_sysctl.c ============================================================================== --- head/sys/dev/liquidio/lio_sysctl.c Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/dev/liquidio/lio_sysctl.c Wed Oct 25 17:49:17 2017 (r324994) @@ -634,13 +634,15 @@ lio_get_eeprom(SYSCTL_HANDLER_ARGS) board_info = (struct lio_board_info *)(&oct_dev->boardinfo); if (oct_dev->uboot_len == 0) - sprintf(buf, "boardname:%s serialnum:%s maj:%ld min:%ld", + sprintf(buf, "boardname:%s serialnum:%s maj:%lld min:%lld", board_info->name, board_info->serial_number, - board_info->major, board_info->minor); + LIO_CAST64(board_info->major), + LIO_CAST64(board_info->minor)); else { - sprintf(buf, "boardname:%s serialnum:%s maj:%ld min:%ld\n%s", + sprintf(buf, "boardname:%s serialnum:%s maj:%lld min:%lld\n%s", board_info->name, board_info->serial_number, - board_info->major, board_info->minor, + LIO_CAST64(board_info->major), + LIO_CAST64(board_info->minor), &oct_dev->uboot_version[oct_dev->uboot_sidx]); } @@ -777,184 +779,184 @@ lio_cn23xx_pf_read_csr_reg(char *s, struct octeon_devi /* 0x29030 or 0x29040 */ reg = LIO_CN23XX_SLI_PKT_MAC_RINFO64(oct->pcie_port, oct->pf_num); - len += sprintf(s + len, "[%08x] (SLI_PKT_MAC%d_PF%d_RINFO): %016lx\n", + len += sprintf(s + len, "[%08x] (SLI_PKT_MAC%d_PF%d_RINFO): %016llx\n", reg, oct->pcie_port, oct->pf_num, - lio_read_csr64(oct, reg)); + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x27080 or 0x27090 */ reg = LIO_CN23XX_SLI_MAC_PF_INT_ENB64(oct->pcie_port, oct->pf_num); - len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_INT_ENB): %016lx\n", + len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_INT_ENB): %016llx\n", reg, oct->pcie_port, oct->pf_num, - lio_read_csr64(oct, reg)); + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x27000 or 0x27010 */ reg = LIO_CN23XX_SLI_MAC_PF_INT_SUM64(oct->pcie_port, oct->pf_num); - len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_INT_SUM): %016lx\n", + len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_INT_SUM): %016llx\n", reg, oct->pcie_port, oct->pf_num, - lio_read_csr64(oct, reg)); + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x29120 */ reg = 0x29120; - len += sprintf(s + len, "[%08x] (SLI_PKT_MEM_CTL): %016lx\n", reg, - lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_MEM_CTL): %016llx\n", reg, + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x27300 */ reg = 0x27300 + oct->pcie_port * LIO_CN23XX_MAC_INT_OFFSET + (oct->pf_num) * LIO_CN23XX_PF_INT_OFFSET; - len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_PKT_VF_INT): %016lx\n", + len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_PKT_VF_INT): %016llx\n", reg, oct->pcie_port, oct->pf_num, - lio_read_csr64(oct, reg)); + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x27200 */ reg = 0x27200 + oct->pcie_port * LIO_CN23XX_MAC_INT_OFFSET + (oct->pf_num) * LIO_CN23XX_PF_INT_OFFSET; - len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_PP_VF_INT): %016lx\n", + len += sprintf(s + len, "[%08x] (SLI_MAC%d_PF%d_PP_VF_INT): %016llx\n", reg, oct->pcie_port, oct->pf_num, - lio_read_csr64(oct, reg)); + LIO_CAST64(lio_read_csr64(oct, reg))); /* 29130 */ reg = LIO_CN23XX_SLI_PKT_CNT_INT; - len += sprintf(s + len, "[%08x] (SLI_PKT_CNT_INT): %016lx\n", reg, - lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_CNT_INT): %016llx\n", reg, + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x29140 */ reg = LIO_CN23XX_SLI_PKT_TIME_INT; - len += sprintf(s + len, "[%08x] (SLI_PKT_TIME_INT): %016lx\n", reg, - lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_TIME_INT): %016llx\n", reg, + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x29160 */ reg = 0x29160; - len += sprintf(s + len, "[%08x] (SLI_PKT_INT): %016lx\n", reg, - lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_INT): %016llx\n", reg, + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x29180 */ reg = LIO_CN23XX_SLI_OQ_WMARK; - len += sprintf(s + len, "[%08x] (SLI_PKT_OUTPUT_WMARK): %016lx\n", - reg, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_OUTPUT_WMARK): %016llx\n", + reg, LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x291E0 */ reg = LIO_CN23XX_SLI_PKT_IOQ_RING_RST; - len += sprintf(s + len, "[%08x] (SLI_PKT_RING_RST): %016lx\n", reg, - lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_RING_RST): %016llx\n", reg, + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x29210 */ reg = LIO_CN23XX_SLI_GBL_CONTROL; - len += sprintf(s + len, "[%08x] (SLI_PKT_GBL_CONTROL): %016lx\n", reg, - lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_GBL_CONTROL): %016llx\n", reg, + LIO_CAST64(lio_read_csr64(oct, reg))); /* 0x29220 */ reg = 0x29220; - len += sprintf(s + len, "[%08x] (SLI_PKT_BIST_STATUS): %016lx\n", - reg, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_BIST_STATUS): %016llx\n", + reg, LIO_CAST64(lio_read_csr64(oct, reg))); /* PF only */ if (pf_num == 0) { /* 0x29260 */ reg = LIO_CN23XX_SLI_OUT_BP_EN_W1S; - len += sprintf(s + len, "[%08x] (SLI_PKT_OUT_BP_EN_W1S): %016lx\n", - reg, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_OUT_BP_EN_W1S): %016llx\n", + reg, LIO_CAST64(lio_read_csr64(oct, reg))); } else if (pf_num == 1) { /* 0x29270 */ reg = LIO_CN23XX_SLI_OUT_BP_EN2_W1S; - len += sprintf(s + len, "[%08x] (SLI_PKT_OUT_BP_EN2_W1S): %016lx\n", - reg, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_OUT_BP_EN2_W1S): %016llx\n", + reg, LIO_CAST64(lio_read_csr64(oct, reg))); } for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_OQ_BUFF_INFO_SIZE(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_OUT_SIZE): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_OUT_SIZE): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10040 */ for (i = 0; i < LIO_CN23XX_PF_MAX_INPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_IQ_INSTR_COUNT64(i); - len += sprintf(s + len, "[%08x] (SLI_PKT_IN_DONE%d_CNTS): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_IN_DONE%d_CNTS): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10080 */ for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_OQ_PKTS_CREDIT(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_SLIST_BAOFF_DBELL): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_SLIST_BAOFF_DBELL): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10090 */ for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_OQ_SIZE(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_SLIST_FIFO_RSIZE): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_SLIST_FIFO_RSIZE): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10050 */ for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_OQ_PKT_CONTROL(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d__OUTPUT_CONTROL): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d__OUTPUT_CONTROL): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10070 */ for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_OQ_BASE_ADDR64(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_SLIST_BADDR): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_SLIST_BADDR): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x100a0 */ for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_OQ_PKT_INT_LEVELS(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_INT_LEVELS): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_INT_LEVELS): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x100b0 */ for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_OQ_PKTS_SENT(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_CNTS): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_CNTS): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x100c0 */ for (i = 0; i < LIO_CN23XX_PF_MAX_OUTPUT_QUEUES; i++) { reg = 0x100c0 + i * LIO_CN23XX_OQ_OFFSET; - len += sprintf(s + len, "[%08x] (SLI_PKT%d_ERROR_INFO): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_ERROR_INFO): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10000 */ for (i = 0; i < LIO_CN23XX_PF_MAX_INPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_IQ_PKT_CONTROL64(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_INPUT_CONTROL): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_INPUT_CONTROL): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10010 */ for (i = 0; i < LIO_CN23XX_PF_MAX_INPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_IQ_BASE_ADDR64(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_INSTR_BADDR): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_INSTR_BADDR): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10020 */ for (i = 0; i < LIO_CN23XX_PF_MAX_INPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_IQ_DOORBELL(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_INSTR_BAOFF_DBELL): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_INSTR_BAOFF_DBELL): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10030 */ for (i = 0; i < LIO_CN23XX_PF_MAX_INPUT_QUEUES; i++) { reg = LIO_CN23XX_SLI_IQ_SIZE(i); - len += sprintf(s + len, "[%08x] (SLI_PKT%d_INSTR_FIFO_RSIZE): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT%d_INSTR_FIFO_RSIZE): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); } /* 0x10040 */ for (i = 0; i < LIO_CN23XX_PF_MAX_INPUT_QUEUES; i++) reg = LIO_CN23XX_SLI_IQ_INSTR_COUNT64(i); - len += sprintf(s + len, "[%08x] (SLI_PKT_IN_DONE%d_CNTS): %016lx\n", - reg, i, lio_read_csr64(oct, reg)); + len += sprintf(s + len, "[%08x] (SLI_PKT_IN_DONE%d_CNTS): %016llx\n", + reg, i, LIO_CAST64(lio_read_csr64(oct, reg))); return (len); } @@ -1574,8 +1576,8 @@ lio_set_intrmod_cfg(struct lio *lio, struct octeon_int lio_dev_err(oct_dev, "intrmod config failed. Status: %llx\n", LIO_CAST64(retval)); else - lio_dev_info(oct_dev, "Rx-Adaptive Interrupt moderation enabled:%lx\n", - intr_cfg->rx_enable); + lio_dev_info(oct_dev, "Rx-Adaptive Interrupt moderation enabled:%llx\n", + LIO_CAST64(intr_cfg->rx_enable)); lio_free_soft_command(oct_dev, sc); Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Wed Oct 25 17:23:33 2017 (r324993) +++ head/sys/modules/Makefile Wed Oct 25 17:49:17 2017 (r324994) @@ -603,6 +603,9 @@ _ixv= ixv _linprocfs= linprocfs _linsysfs= linsysfs _linux= linux +.if ${MK_SOURCELESS_UCODE} != "no" +_lio= lio +.endif _nctgpio= nctgpio _ndis= ndis _pccard= pccard @@ -711,9 +714,6 @@ _ixl= ixl _ixlv= ixlv _linux64= linux64 _linux_common= linux_common -.if ${MK_SOURCELESS_UCODE} != "no" -_lio= lio -.endif _ntb= ntb _pms= pms _qlxge= qlxge From owner-svn-src-head@freebsd.org Wed Oct 25 18:55:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11440E51EAD; Wed, 25 Oct 2017 18:55:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id CDA937E6A0; Wed, 25 Oct 2017 18:55:05 +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 v9PIt4S6009502; Wed, 25 Oct 2017 18:55:04 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PIt4bq009495; Wed, 25 Oct 2017 18:55:04 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201710251855.v9PIt4bq009495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 25 Oct 2017 18:55:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324995 - in head/sys: arm64/include boot/efi/loader boot/efi/loader/arch/amd64 X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/include boot/efi/loader boot/efi/loader/arch/amd64 X-SVN-Commit-Revision: 324995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 18:55:06 -0000 Author: manu Date: Wed Oct 25 18:55:04 2017 New Revision: 324995 URL: https://svnweb.freebsd.org/changeset/base/324995 Log: loader.efi: Make framebuffer commands available for arm64 Move framebuffer.{c,h} to sys/boot/efi/loader and add the efifb related metadata and pass it to the kernel Reviewed by: imp, andrew Differential Revision: https://reviews.freebsd.org/D12757 Added: head/sys/boot/efi/loader/framebuffer.c - copied unchanged from r324994, head/sys/boot/efi/loader/arch/amd64/framebuffer.c head/sys/boot/efi/loader/framebuffer.h - copied unchanged from r324994, head/sys/boot/efi/loader/arch/amd64/framebuffer.h Deleted: head/sys/boot/efi/loader/arch/amd64/framebuffer.c head/sys/boot/efi/loader/arch/amd64/framebuffer.h Modified: head/sys/arm64/include/metadata.h head/sys/boot/efi/loader/Makefile head/sys/boot/efi/loader/arch/amd64/Makefile.inc head/sys/boot/efi/loader/bootinfo.c Modified: head/sys/arm64/include/metadata.h ============================================================================== --- head/sys/arm64/include/metadata.h Wed Oct 25 17:49:17 2017 (r324994) +++ head/sys/arm64/include/metadata.h Wed Oct 25 18:55:04 2017 (r324995) @@ -31,11 +31,24 @@ #define MODINFOMD_EFI_MAP 0x1001 #define MODINFOMD_DTBP 0x1002 +#define MODINFOMD_EFI_FB 0x1003 struct efi_map_header { size_t memory_size; size_t descriptor_size; uint32_t descriptor_version; +}; + +struct efi_fb { + uint64_t fb_addr; + uint64_t fb_size; + uint32_t fb_height; + uint32_t fb_width; + uint32_t fb_stride; + uint32_t fb_mask_red; + uint32_t fb_mask_green; + uint32_t fb_mask_blue; + uint32_t fb_mask_reserved; }; #endif /* !_MACHINE_METADATA_H_ */ Modified: head/sys/boot/efi/loader/Makefile ============================================================================== --- head/sys/boot/efi/loader/Makefile Wed Oct 25 17:49:17 2017 (r324994) +++ head/sys/boot/efi/loader/Makefile Wed Oct 25 18:55:04 2017 (r324995) @@ -22,6 +22,7 @@ SRCS= autoload.c \ conf.c \ copy.c \ efi_main.c \ + framebuffer.c \ main.c \ self_reloc.c \ smbios.c \ Modified: head/sys/boot/efi/loader/arch/amd64/Makefile.inc ============================================================================== --- head/sys/boot/efi/loader/arch/amd64/Makefile.inc Wed Oct 25 17:49:17 2017 (r324994) +++ head/sys/boot/efi/loader/arch/amd64/Makefile.inc Wed Oct 25 18:55:04 2017 (r324995) @@ -2,7 +2,6 @@ SRCS+= amd64_tramp.S \ start.S \ - framebuffer.c \ elf64_freebsd.c \ trap.c \ exc.S Modified: head/sys/boot/efi/loader/bootinfo.c ============================================================================== --- head/sys/boot/efi/loader/bootinfo.c Wed Oct 25 17:49:17 2017 (r324994) +++ head/sys/boot/efi/loader/bootinfo.c Wed Oct 25 18:55:04 2017 (r324995) @@ -48,9 +48,10 @@ __FBSDID("$FreeBSD$"); #if defined(__amd64__) #include -#include "framebuffer.h" #endif +#include "framebuffer.h" + #if defined(LOADER_FDT_SUPPORT) #include #endif @@ -247,12 +248,12 @@ bi_load_efi_data(struct preloaded_file *kfp) UINT32 mmver; struct efi_map_header *efihdr; -#if defined(__amd64__) +#if defined(__amd64__) || defined(__aarch64__) struct efi_fb efifb; if (efi_find_framebuffer(&efifb) == 0) { printf("EFI framebuffer information:\n"); - printf("addr, size 0x%lx, 0x%lx\n", efifb.fb_addr, + printf("addr, size 0x%jx, 0x%jx\n", efifb.fb_addr, efifb.fb_size); printf("dimensions %d x %d\n", efifb.fb_width, efifb.fb_height); Copied: head/sys/boot/efi/loader/framebuffer.c (from r324994, head/sys/boot/efi/loader/arch/amd64/framebuffer.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/efi/loader/framebuffer.c Wed Oct 25 18:55:04 2017 (r324995, copy of r324994, head/sys/boot/efi/loader/arch/amd64/framebuffer.c) @@ -0,0 +1,568 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Benno Rice under sponsorship from + * the FreeBSD Foundation. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "framebuffer.h" + +static EFI_GUID gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; +static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; +static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID; + +static u_int +efifb_color_depth(struct efi_fb *efifb) +{ + uint32_t mask; + u_int depth; + + mask = efifb->fb_mask_red | efifb->fb_mask_green | + efifb->fb_mask_blue | efifb->fb_mask_reserved; + if (mask == 0) + return (0); + for (depth = 1; mask != 1; depth++) + mask >>= 1; + return (depth); +} + +static int +efifb_mask_from_pixfmt(struct efi_fb *efifb, EFI_GRAPHICS_PIXEL_FORMAT pixfmt, + EFI_PIXEL_BITMASK *pixinfo) +{ + int result; + + result = 0; + switch (pixfmt) { + case PixelRedGreenBlueReserved8BitPerColor: + efifb->fb_mask_red = 0x000000ff; + efifb->fb_mask_green = 0x0000ff00; + efifb->fb_mask_blue = 0x00ff0000; + efifb->fb_mask_reserved = 0xff000000; + break; + case PixelBlueGreenRedReserved8BitPerColor: + efifb->fb_mask_red = 0x00ff0000; + efifb->fb_mask_green = 0x0000ff00; + efifb->fb_mask_blue = 0x000000ff; + efifb->fb_mask_reserved = 0xff000000; + break; + case PixelBitMask: + efifb->fb_mask_red = pixinfo->RedMask; + efifb->fb_mask_green = pixinfo->GreenMask; + efifb->fb_mask_blue = pixinfo->BlueMask; + efifb->fb_mask_reserved = pixinfo->ReservedMask; + break; + default: + result = 1; + break; + } + return (result); +} + +static int +efifb_from_gop(struct efi_fb *efifb, EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *mode, + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info) +{ + int result; + + efifb->fb_addr = mode->FrameBufferBase; + efifb->fb_size = mode->FrameBufferSize; + efifb->fb_height = info->VerticalResolution; + efifb->fb_width = info->HorizontalResolution; + efifb->fb_stride = info->PixelsPerScanLine; + result = efifb_mask_from_pixfmt(efifb, info->PixelFormat, + &info->PixelInformation); + return (result); +} + +static ssize_t +efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOCOL *uga, u_int line, + EFI_PCI_IO_PROTOCOL *pciio, uint64_t addr, uint64_t size) +{ + EFI_UGA_PIXEL pix0, pix1; + uint8_t *data1, *data2; + size_t count, maxcount = 1024; + ssize_t ofs; + EFI_STATUS status; + u_int idx; + + status = uga->Blt(uga, &pix0, EfiUgaVideoToBltBuffer, + 0, line, 0, 0, 1, 1, 0); + if (EFI_ERROR(status)) { + printf("UGA BLT operation failed (video->buffer)"); + return (-1); + } + pix1.Red = ~pix0.Red; + pix1.Green = ~pix0.Green; + pix1.Blue = ~pix0.Blue; + pix1.Reserved = 0; + + data1 = calloc(maxcount, 2); + if (data1 == NULL) { + printf("Unable to allocate memory"); + return (-1); + } + data2 = data1 + maxcount; + + ofs = 0; + while (size > 0) { + count = min(size, maxcount); + + status = pciio->Mem.Read(pciio, EfiPciIoWidthUint32, + EFI_PCI_IO_PASS_THROUGH_BAR, addr + ofs, count >> 2, + data1); + if (EFI_ERROR(status)) { + printf("Error reading frame buffer (before)"); + goto fail; + } + status = uga->Blt(uga, &pix1, EfiUgaBltBufferToVideo, + 0, 0, 0, line, 1, 1, 0); + if (EFI_ERROR(status)) { + printf("UGA BLT operation failed (modify)"); + goto fail; + } + status = pciio->Mem.Read(pciio, EfiPciIoWidthUint32, + EFI_PCI_IO_PASS_THROUGH_BAR, addr + ofs, count >> 2, + data2); + if (EFI_ERROR(status)) { + printf("Error reading frame buffer (after)"); + goto fail; + } + status = uga->Blt(uga, &pix0, EfiUgaBltBufferToVideo, + 0, 0, 0, line, 1, 1, 0); + if (EFI_ERROR(status)) { + printf("UGA BLT operation failed (restore)"); + goto fail; + } + for (idx = 0; idx < count; idx++) { + if (data1[idx] != data2[idx]) { + free(data1); + return (ofs + (idx & ~3)); + } + } + ofs += count; + size -= count; + } + printf("No change detected in frame buffer"); + + fail: + printf(" -- error %lu\n", EFI_ERROR_CODE(status)); + free(data1); + return (-1); +} + +static EFI_PCI_IO_PROTOCOL * +efifb_uga_get_pciio(void) +{ + EFI_PCI_IO_PROTOCOL *pciio; + EFI_HANDLE *buf, *hp; + EFI_STATUS status; + UINTN bufsz; + + /* Get all handles that support the UGA protocol. */ + bufsz = 0; + status = BS->LocateHandle(ByProtocol, &uga_guid, NULL, &bufsz, NULL); + if (status != EFI_BUFFER_TOO_SMALL) + return (NULL); + buf = malloc(bufsz); + status = BS->LocateHandle(ByProtocol, &uga_guid, NULL, &bufsz, buf); + if (status != EFI_SUCCESS) { + free(buf); + return (NULL); + } + bufsz /= sizeof(EFI_HANDLE); + + /* Get the PCI I/O interface of the first handle that supports it. */ + pciio = NULL; + for (hp = buf; hp < buf + bufsz; hp++) { + status = BS->HandleProtocol(*hp, &pciio_guid, (void **)&pciio); + if (status == EFI_SUCCESS) { + free(buf); + return (pciio); + } + } + free(buf); + return (NULL); +} + +static EFI_STATUS +efifb_uga_locate_framebuffer(EFI_PCI_IO_PROTOCOL *pciio, uint64_t *addrp, + uint64_t *sizep) +{ + uint8_t *resattr; + uint64_t addr, size; + EFI_STATUS status; + u_int bar; + + if (pciio == NULL) + return (EFI_DEVICE_ERROR); + + /* Attempt to get the frame buffer address (imprecise). */ + *addrp = 0; + *sizep = 0; + for (bar = 0; bar < 6; bar++) { + status = pciio->GetBarAttributes(pciio, bar, NULL, + (void **)&resattr); + if (status != EFI_SUCCESS) + continue; + /* XXX magic offsets and constants. */ + if (resattr[0] == 0x87 && resattr[3] == 0) { + /* 32-bit address space descriptor (MEMIO) */ + addr = le32dec(resattr + 10); + size = le32dec(resattr + 22); + } else if (resattr[0] == 0x8a && resattr[3] == 0) { + /* 64-bit address space descriptor (MEMIO) */ + addr = le64dec(resattr + 14); + size = le64dec(resattr + 38); + } else { + addr = 0; + size = 0; + } + BS->FreePool(resattr); + if (addr == 0 || size == 0) + continue; + + /* We assume the largest BAR is the frame buffer. */ + if (size > *sizep) { + *addrp = addr; + *sizep = size; + } + } + return ((*addrp == 0 || *sizep == 0) ? EFI_DEVICE_ERROR : 0); +} + +static int +efifb_from_uga(struct efi_fb *efifb, EFI_UGA_DRAW_PROTOCOL *uga) +{ + EFI_PCI_IO_PROTOCOL *pciio; + char *ev, *p; + EFI_STATUS status; + ssize_t offset; + uint64_t fbaddr; + uint32_t horiz, vert, stride; + uint32_t np, depth, refresh; + + status = uga->GetMode(uga, &horiz, &vert, &depth, &refresh); + if (EFI_ERROR(status)) + return (1); + efifb->fb_height = vert; + efifb->fb_width = horiz; + /* Paranoia... */ + if (efifb->fb_height == 0 || efifb->fb_width == 0) + return (1); + + /* The color masks are fixed AFAICT. */ + efifb_mask_from_pixfmt(efifb, PixelBlueGreenRedReserved8BitPerColor, + NULL); + + /* pciio can be NULL on return! */ + pciio = efifb_uga_get_pciio(); + + /* Try to find the frame buffer. */ + status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr, + &efifb->fb_size); + if (EFI_ERROR(status)) { + efifb->fb_addr = 0; + efifb->fb_size = 0; + } + + /* + * There's no reliable way to detect the frame buffer or the + * offset within the frame buffer of the visible region, nor + * the stride. Our only option is to look at the system and + * fill in the blanks based on that. Luckily, UGA was mostly + * only used on Apple hardware. + */ + offset = -1; + ev = getenv("smbios.system.maker"); + if (ev != NULL && !strcmp(ev, "Apple Inc.")) { + ev = getenv("smbios.system.product"); + if (ev != NULL && !strcmp(ev, "iMac7,1")) { + /* These are the expected values we should have. */ + horiz = 1680; + vert = 1050; + fbaddr = 0xc0000000; + /* These are the missing bits. */ + offset = 0x10000; + stride = 1728; + } else if (ev != NULL && !strcmp(ev, "MacBook3,1")) { + /* These are the expected values we should have. */ + horiz = 1280; + vert = 800; + fbaddr = 0xc0000000; + /* These are the missing bits. */ + offset = 0x0; + stride = 2048; + } + } + + /* + * If this is hardware we know, make sure that it looks familiar + * before we accept our hardcoded values. + */ + if (offset >= 0 && efifb->fb_width == horiz && + efifb->fb_height == vert && efifb->fb_addr == fbaddr) { + efifb->fb_addr += offset; + efifb->fb_size -= offset; + efifb->fb_stride = stride; + return (0); + } else if (offset >= 0) { + printf("Hardware make/model known, but graphics not " + "as expected.\n"); + printf("Console may not work!\n"); + } + + /* + * The stride is equal or larger to the width. Often it's the + * next larger power of two. We'll start with that... + */ + efifb->fb_stride = efifb->fb_width; + do { + np = efifb->fb_stride & (efifb->fb_stride - 1); + if (np) { + efifb->fb_stride |= (np - 1); + efifb->fb_stride++; + } + } while (np); + + ev = getenv("hw.efifb.address"); + if (ev == NULL) { + if (efifb->fb_addr == 0) { + printf("Please set hw.efifb.address and " + "hw.efifb.stride.\n"); + return (1); + } + + /* + * The visible part of the frame buffer may not start at + * offset 0, so try to detect it. Note that we may not + * always be able to read from the frame buffer, which + * means that we may not be able to detect anything. In + * that case, we would take a long time scanning for a + * pixel change in the frame buffer, which would have it + * appear that we're hanging, so we limit the scan to + * 1/256th of the frame buffer. This number is mostly + * based on PR 202730 and the fact that on a MacBoook, + * where we can't read from the frame buffer the offset + * of the visible region is 0. In short: we want to scan + * enough to handle all adapters that have an offset + * larger than 0 and we want to scan as little as we can + * to not appear to hang when we can't read from the + * frame buffer. + */ + offset = efifb_uga_find_pixel(uga, 0, pciio, efifb->fb_addr, + efifb->fb_size >> 8); + if (offset == -1) { + printf("Unable to reliably detect frame buffer.\n"); + } else if (offset > 0) { + efifb->fb_addr += offset; + efifb->fb_size -= offset; + } + } else { + offset = 0; + efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4; + efifb->fb_addr = strtoul(ev, &p, 0); + if (*p != '\0') + return (1); + } + + ev = getenv("hw.efifb.stride"); + if (ev == NULL) { + if (pciio != NULL && offset != -1) { + /* Determine the stride. */ + offset = efifb_uga_find_pixel(uga, 1, pciio, + efifb->fb_addr, horiz * 8); + if (offset != -1) + efifb->fb_stride = offset >> 2; + } else { + printf("Unable to reliably detect the stride.\n"); + } + } else { + efifb->fb_stride = strtoul(ev, &p, 0); + if (*p != '\0') + return (1); + } + + /* + * We finalized on the stride, so recalculate the size of the + * frame buffer. + */ + efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4; + return (0); +} + +int +efi_find_framebuffer(struct efi_fb *efifb) +{ + EFI_GRAPHICS_OUTPUT *gop; + EFI_UGA_DRAW_PROTOCOL *uga; + EFI_STATUS status; + + status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); + if (status == EFI_SUCCESS) + return (efifb_from_gop(efifb, gop->Mode, gop->Mode->Info)); + + status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); + if (status == EFI_SUCCESS) + return (efifb_from_uga(efifb, uga)); + + return (1); +} + +static void +print_efifb(int mode, struct efi_fb *efifb, int verbose) +{ + u_int depth; + + if (mode >= 0) + printf("mode %d: ", mode); + depth = efifb_color_depth(efifb); + printf("%ux%ux%u, stride=%u", efifb->fb_width, efifb->fb_height, + depth, efifb->fb_stride); + if (verbose) { + printf("\n frame buffer: address=%jx, size=%jx", + (uintmax_t)efifb->fb_addr, (uintmax_t)efifb->fb_size); + printf("\n color mask: R=%08x, G=%08x, B=%08x\n", + efifb->fb_mask_red, efifb->fb_mask_green, + efifb->fb_mask_blue); + } +} + +COMMAND_SET(gop, "gop", "graphics output protocol", command_gop); + +static int +command_gop(int argc, char *argv[]) +{ + struct efi_fb efifb; + EFI_GRAPHICS_OUTPUT *gop; + EFI_STATUS status; + u_int mode; + + status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); + if (EFI_ERROR(status)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "%s: Graphics Output Protocol not present (error=%lu)", + argv[0], EFI_ERROR_CODE(status)); + return (CMD_ERROR); + } + + if (argc < 2) + goto usage; + + if (!strcmp(argv[1], "set")) { + char *cp; + + if (argc != 3) + goto usage; + mode = strtol(argv[2], &cp, 0); + if (cp[0] != '\0') { + sprintf(command_errbuf, "mode is an integer"); + return (CMD_ERROR); + } + status = gop->SetMode(gop, mode); + if (EFI_ERROR(status)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "%s: Unable to set mode to %u (error=%lu)", + argv[0], mode, EFI_ERROR_CODE(status)); + return (CMD_ERROR); + } + } else if (!strcmp(argv[1], "get")) { + if (argc != 2) + goto usage; + efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info); + print_efifb(gop->Mode->Mode, &efifb, 1); + printf("\n"); + } else if (!strcmp(argv[1], "list")) { + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; + UINTN infosz; + + if (argc != 2) + goto usage; + pager_open(); + 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); + print_efifb(mode, &efifb, 0); + if (pager_output("\n")) + break; + } + pager_close(); + } + return (CMD_OK); + + usage: + snprintf(command_errbuf, sizeof(command_errbuf), + "usage: %s [list | get | set ]", argv[0]); + return (CMD_ERROR); +} + +COMMAND_SET(uga, "uga", "universal graphics adapter", command_uga); + +static int +command_uga(int argc, char *argv[]) +{ + struct efi_fb efifb; + EFI_UGA_DRAW_PROTOCOL *uga; + EFI_STATUS status; + + status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga); + if (EFI_ERROR(status)) { + snprintf(command_errbuf, sizeof(command_errbuf), + "%s: UGA Protocol not present (error=%lu)", + argv[0], EFI_ERROR_CODE(status)); + return (CMD_ERROR); + } + + if (argc != 1) + goto usage; + + if (efifb_from_uga(&efifb, uga) != CMD_OK) { + snprintf(command_errbuf, sizeof(command_errbuf), + "%s: Unable to get UGA information", argv[0]); + return (CMD_ERROR); + } + + print_efifb(-1, &efifb, 1); + printf("\n"); + return (CMD_OK); + + usage: + snprintf(command_errbuf, sizeof(command_errbuf), "usage: %s", argv[0]); + return (CMD_ERROR); +} Copied: head/sys/boot/efi/loader/framebuffer.h (from r324994, head/sys/boot/efi/loader/arch/amd64/framebuffer.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/efi/loader/framebuffer.h Wed Oct 25 18:55:04 2017 (r324995, copy of r324994, head/sys/boot/efi/loader/arch/amd64/framebuffer.h) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Benno Rice under sponsorship from + * the FreeBSD Foundation. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _EFIFB_H_ +#define _EFIFB_H_ + +int efi_find_framebuffer(struct efi_fb *efifb); + +#endif /* _EFIFB_H_ */ From owner-svn-src-head@freebsd.org Wed Oct 25 19:21:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2733DE52552; Wed, 25 Oct 2017 19:21: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 mx1.freebsd.org (Postfix) with ESMTPS id E95567F210; Wed, 25 Oct 2017 19:21:49 +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 v9PJLnVN020977; Wed, 25 Oct 2017 19:21:49 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PJLnKl020976; Wed, 25 Oct 2017 19:21:49 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201710251921.v9PJLnKl020976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 25 Oct 2017 19:21:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324996 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 324996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 19:21:50 -0000 Author: kp Date: Wed Oct 25 19:21:48 2017 New Revision: 324996 URL: https://svnweb.freebsd.org/changeset/base/324996 Log: Evaluate packet size after the firewall had its chance in the ip6 fast path Defer the packet size check until after the firewall has had a look at it. This means that the firewall now has the opportunity to (re-)fragment an oversized packet. This mirrors what the slow path does. Reviewed by: ae MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12779 Modified: head/sys/netinet6/ip6_fastfwd.c Modified: head/sys/netinet6/ip6_fastfwd.c ============================================================================== --- head/sys/netinet6/ip6_fastfwd.c Wed Oct 25 18:55:04 2017 (r324995) +++ head/sys/netinet6/ip6_fastfwd.c Wed Oct 25 19:21:48 2017 (r324996) @@ -194,7 +194,17 @@ passin: in6_ifstat_inc(rcvif, ifs6_in_noroute); goto dropin; } + /* + * Outgoing packet firewall processing. + */ + 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) + goto dropout; + + /* * We used slow path processing for packets with scoped addresses. * So, scope checks aren't needed here. */ @@ -205,14 +215,6 @@ passin: goto dropout; } - /* - * Outgoing packet firewall processing. - */ - 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) - goto dropout; /* * If packet filter sets the M_FASTFWD_OURS flag, this means * that new destination or next hop is our local address. From owner-svn-src-head@freebsd.org Wed Oct 25 20:34:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE385E5398B; Wed, 25 Oct 2017 20:34:59 +0000 (UTC) (envelope-from bdrewery@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 9511C8127B; Wed, 25 Oct 2017 20:34:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id AA2D02140; Wed, 25 Oct 2017 20:34:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id DB0AF8843; Wed, 25 Oct 2017 20:34:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id W10JvGLN8raf; Wed, 25 Oct 2017 20:34:51 +0000 (UTC) Subject: Re: svn commit: r322951 - head DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 0C4AC883E To: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201708271615.v7RGFcKs033967@repo.freebsd.org> From: Bryan Drewery Organization: FreeBSD Message-ID: Date: Wed, 25 Oct 2017 13:34:13 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201708271615.v7RGFcKs033967@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="DKVnu4BXb8RDK218J3V7GFpknPTOCTeqg" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 20:34:59 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DKVnu4BXb8RDK218J3V7GFpknPTOCTeqg Content-Type: multipart/mixed; boundary="8sNx7tkgrhsgclvLjSLV2VNRENClxaTRg"; protected-headers="v1" From: Bryan Drewery To: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r322951 - head References: <201708271615.v7RGFcKs033967@repo.freebsd.org> In-Reply-To: <201708271615.v7RGFcKs033967@repo.freebsd.org> --8sNx7tkgrhsgclvLjSLV2VNRENClxaTRg Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 8/27/17 9:15 AM, Ngie Cooper wrote: > Author: ngie > Date: Sun Aug 27 16:15:37 2017 > New Revision: 322951 > URL: https://svnweb.freebsd.org/changeset/base/322951 >=20 > Log: > Respect MK_TCSH with build-tools and native-xtools > =20 > This helps reduce the WORLDTMP footprint slightly. > =20 > Based on a patch I submitted 5 years ago to GNATS. > =20 > PR: 174051 > MFC after: 2 weeks > Relnotes: yes (anyone who cross-builds with MK_TCSH=3Dyes will run in= to > build failures if the host doesn't have tcsh(1)) I don't understand what you're saying here. If I build with MK_TCSH=3Dyes= and the host does not have tcsh, a failure occurs AFTER or BEFORE this change? Neither case makes sense to me. What is the failure? The change here is to build-tools which just calls 'make build-tools' in bin/csh which just builds 'gethost'. > # make build-tools > grep 'ERR_' /root/git/freebsd/contrib/tcsh/sh.err.c | grep '^#define' >= > sh.err.h > cc -E -O2 -pipe -I. -I/root/git/freebsd/bin/csh -I/root/git/freebsd/con= trib/tcsh -D_PATH_TCSHELL=3D'"/bin/csh"' -g -std=3Dgnu99 -fstack-protecto= r-strong -Wsystem-headers -Werror -Wno-pointer-sign -Wno-empty-body -Wno-= string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno= -unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-co= nversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-swi= tch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -fcolor= -diagnostics -Qunused-arguments /root/git/freebsd/contrib/tcsh/tc.const.c= /root/git/freebsd/contrib/tcsh/sh.char.h /root/git/freebsd/bin/csh/confi= g.h /root/git/freebsd/contrib/tcsh/config_f.h /root/git/freebsd/contrib/t= csh/sh.types.h sh.err.h -D_h_tc_const | grep 'Char STR' | sed -e 's/Cha= r \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | sort >> tc.const.h > Building /usr/obj/root/git/freebsd/bin/csh/gethost If the host does not have tcsh and MK_TCSH is set to yes and fails, then we're missing building tcsh as a build tool (in bootstrap-tools). I don't know where it is used though. This is the only place I see using csh in the build: > tools/test/malloc/Makefile: @csh -x -c "time ./malloc 500000 = 2000 8192" > tools/test/malloc/Makefile: @csh -x -c "time ./malloc 50000000 = 2000 8192" > tools/test/malloc/Makefile: @csh -x -c "time ./malloc 500000 1= 4000 8192" > tools/test/malloc/Makefile: @csh -x -c "time ./malloc 20000000 2= 0000 2048" > Reminded by: Fabian Keil This patch is overall fine but it saves 25KB in OBJDIR and ~1 second in build time. Based on the reminder and the Relnotes, it seems like whatever was intended to be fixed may not have been. >=20 > Modified: > head/Makefile.inc1 >=20 > Modified: head/Makefile.inc1 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/Makefile.inc1 Sun Aug 27 13:02:51 2017 (r322950) > +++ head/Makefile.inc1 Sun Aug 27 16:15:37 2017 (r322951) > @@ -1984,8 +1984,12 @@ _gcc_tools=3D gnu/usr.bin/cc/cc_tools > _rescue=3Drescue/rescue > .endif > =20 > +.if ${MK_TCSH} !=3D "no" > +_tcsh=3Dbin/csh > +.endif > + > .for _tool in \ > - bin/csh \ > + ${_tcsh} \ > bin/sh \ > ${LOCAL_TOOL_DIRS} \ > lib/ncurses/ncurses \ > @@ -2143,7 +2147,7 @@ native-xtools: .PHONY > bin/cat \ > bin/chmod \ > bin/cp \ > - bin/csh \ > + ${_tcsh} \ > bin/echo \ > bin/expr \ > bin/hostname \ >=20 --=20 Regards, Bryan Drewery --8sNx7tkgrhsgclvLjSLV2VNRENClxaTRg-- --DKVnu4BXb8RDK218J3V7GFpknPTOCTeqg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEzBAEBCgAdFiEE+Rc8ssOq6npcih8JNddxu25Gl88FAlnw9VgACgkQNddxu25G l88UOgf/ZFivMA4tGhBqeO4yxN/nwFHerjfP7uD4G9bZNhOcDy84MObqFoAo0QBa SlSI8Fq8jszxSS4tc1NvoN64TmcyDEvvR9H8GjUcAt1xLtJis902RcrFlL5F0WSN m22ynVNJd4BB/sKgD8/qBI4HpFAEKBLWHJtfVc7FLZ+6bLtPOUtQHAUD47qEw31J KJE0I23b9d0cMoG51689TejMh0lp3OEDwPhLAqdoVojkbcCnjM4SyBkBIHrZvTXP pC+JxbMmOADS4hQeqYIROeWukCvtzd/ca1ObN8laE2Q6zSiTiG+ix3iDwgeZuaLU bIxGVrXBZDJZ0Dd+dwLkQOpl1ac/Mw== =DAuU -----END PGP SIGNATURE----- --DKVnu4BXb8RDK218J3V7GFpknPTOCTeqg-- From owner-svn-src-head@freebsd.org Wed Oct 25 21:45:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01F0CE54EC3; Wed, 25 Oct 2017 21:45:57 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C352A832FA; Wed, 25 Oct 2017 21:45:56 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9PLjtW2079495; Wed, 25 Oct 2017 21:45:55 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PLjtQ3079494; Wed, 25 Oct 2017 21:45:55 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201710252145.v9PLjtQ3079494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 25 Oct 2017 21:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324998 - head/lib/clang X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/lib/clang X-SVN-Commit-Revision: 324998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 21:45:57 -0000 Author: bdrewery Date: Wed Oct 25 21:45:55 2017 New Revision: 324998 URL: https://svnweb.freebsd.org/changeset/base/324998 Log: Prefix {TARGET,BUILD}_TRIPLE with LLVM_ to avoid Makefile.inc1 collision. The Makefile.inc1 TARGET_TRIPLE is for specifying which -target is used during the build of world. MFC after: 2 weeks Reviewed by: dim, imp Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12792 Modified: head/lib/clang/llvm.build.mk Modified: head/lib/clang/llvm.build.mk ============================================================================== --- head/lib/clang/llvm.build.mk Wed Oct 25 19:27:12 2017 (r324997) +++ head/lib/clang/llvm.build.mk Wed Oct 25 21:45:55 2017 (r324998) @@ -33,11 +33,11 @@ TARGET_ABI= VENDOR= unknown OS_VERSION= freebsd12.0 -TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI} -BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION} +LLVM_TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION}${TARGET_ABI} +LLVM_BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/:C/arm64/aarch64/}-${VENDOR}-${OS_VERSION} -CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" -CFLAGS+= -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" +CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${LLVM_TARGET_TRIPLE}\" +CFLAGS+= -DLLVM_HOST_TRIPLE=\"${LLVM_BUILD_TRIPLE}\" CFLAGS+= -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" CFLAGS+= -ffunction-sections From owner-svn-src-head@freebsd.org Wed Oct 25 21:46:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76B33E54F29; Wed, 25 Oct 2017 21:46:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 436F78344D; Wed, 25 Oct 2017 21:46:31 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9PLkUsK079560; Wed, 25 Oct 2017 21:46:30 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PLkUVa079559; Wed, 25 Oct 2017 21:46:30 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201710252146.v9PLkUVa079559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 25 Oct 2017 21:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324999 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 324999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 21:46:31 -0000 Author: bdrewery Date: Wed Oct 25 21:46:30 2017 New Revision: 324999 URL: https://svnweb.freebsd.org/changeset/base/324999 Log: META_MODE: Follow-up r319593: Don't use host headers in a fresh new build. Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Oct 25 21:45:55 2017 (r324998) +++ head/Makefile.inc1 Wed Oct 25 21:46:30 2017 (r324999) @@ -671,7 +671,7 @@ META_MODE_BAD_ABI_VERS+= 1200031 OBJDIR_HOST_OSRELDATE!= \ awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ ${OBJTREE}${.CURDIR}/host-osreldate.h -.else +.elif exists(${WORLDTMP}/usr/include/osreldate.h) OBJDIR_HOST_OSRELDATE= 0 .endif .export OBJDIR_HOST_OSRELDATE @@ -680,6 +680,7 @@ OBJDIR_HOST_OSRELDATE= 0 # Note that this logic is the opposite of normal BOOTSTRAP handling. We want # to compare the WORLDTMP's OSRELDATE to the host's OSRELDATE. If the WORLDTMP # is older than the ABI-breakage OSRELDATE of the HOST then we rebuild. +.if defined(OBJDIR_HOST_OSRELDATE) .for _ver in ${META_MODE_BAD_ABI_VERS} .if ${OSRELDATE} >= ${_ver} && ${OBJDIR_HOST_OSRELDATE} < ${_ver} _meta_mode_need_rebuild= ${_ver} @@ -689,8 +690,9 @@ _meta_mode_need_rebuild= ${_ver} .info META_MODE: Rebuilding host tools due to ABI breakage in __FreeBSD_version ${_meta_mode_need_rebuild}. NO_META_IGNORE_HOST_HEADERS= 1 .export NO_META_IGNORE_HOST_HEADERS -.endif -.endif +.endif # defined(_meta_mode_need_rebuild) +.endif # defined(OBJDIR_HOST_OSRELDATE) +.endif # ${MK_META_MODE} == "yes" && defined(NO_CLEAN) ... # This is only used for META_MODE+filemon to track what the oldest # __FreeBSD_version is in WORLDTMP. This purposely does NOT have # a make dependency on /usr/include/osreldate.h as the file should From owner-svn-src-head@freebsd.org Wed Oct 25 21:46:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CE0D4E54F4A; Wed, 25 Oct 2017 21:46:34 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9DF5A83453; Wed, 25 Oct 2017 21:46:34 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9PLkXUk079606; Wed, 25 Oct 2017 21:46:33 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PLkXTt079605; Wed, 25 Oct 2017 21:46:33 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201710252146.v9PLkXTt079605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 25 Oct 2017 21:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325000 - head/tools/tools/nanobsd X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/tools/tools/nanobsd X-SVN-Commit-Revision: 325000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 21:46:34 -0000 Author: bdrewery Date: Wed Oct 25 21:46:33 2017 New Revision: 325000 URL: https://svnweb.freebsd.org/changeset/base/325000 Log: native-xtools: Override proper NXBDESTDIR. The new native-xtools uses 'make toolchain' so overriding DESTDIR as a make argument may interfere with WORLDTMP handling. The target also does a 'mkdir -p ${NXBDESTDIR}/usr', so we should be modifying that rather than DESTDIR. Note this causes the native-xtools binaries to be installed in NANO_WORLDDIR/usr NANO_WORLDDIR/bin rather than NANO_WORLDDIR/nxb-bin/usr and NANO_WORLDDIR/nxb-bin/bin. This was the case before this change as well. MFC after: 2 weeks Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D12782 Modified: head/tools/tools/nanobsd/defaults.sh Modified: head/tools/tools/nanobsd/defaults.sh ============================================================================== --- head/tools/tools/nanobsd/defaults.sh Wed Oct 25 21:46:30 2017 (r324999) +++ head/tools/tools/nanobsd/defaults.sh Wed Oct 25 21:46:33 2017 (r325000) @@ -438,7 +438,7 @@ native_xtools ( ) ( nano_make_install_env set -o xtrace cd "${NANO_SRC}" - ${NANO_MAKE} native-xtools DESTDIR="${NANO_WORLDDIR}" + ${NANO_MAKE} native-xtools NXBDESTDIR="${NANO_WORLDDIR}" ) > ${NANO_LOG}/_.native_xtools 2>&1 ) From owner-svn-src-head@freebsd.org Wed Oct 25 21:46:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D6525E54F6D; Wed, 25 Oct 2017 21:46:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B32B28348E; Wed, 25 Oct 2017 21:46:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9PLkaOO079653; Wed, 25 Oct 2017 21:46:36 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PLkab0079652; Wed, 25 Oct 2017 21:46:36 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201710252146.v9PLkab0079652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 25 Oct 2017 21:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325001 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 325001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 21:46:38 -0000 Author: bdrewery Date: Wed Oct 25 21:46:36 2017 New Revision: 325001 URL: https://svnweb.freebsd.org/changeset/base/325001 Log: Fix native-xtools build to use a proper sysroot. This takes longer but should reliably produce working binaries. The old version linked against system libraries and headers which would be a problem if building a native-xtools against a newer source than the host system. With a proper sysroot made first this is not a problem. This also allows: - NXBDIRS to be built in parallel - NXBDIRS to be installed to NXBDESTDIR in parallel - SYSTEM_COMPILER logic to work again. Note that because this change is adding a sysroot phase the compiler may be built up to twice now. The first is the "cross-compiler" even though it is for the native architecture, but it is still built to ensure the latest compiler is used to generate the binaries, unless SYSTEM_COMPILER allows /usr/bin/cc to be used. Then the target compiler is built which is actually a cross-compiler since it runs on native host but generates TARGET.TARGET_ARCH binaries. Note this also changes the path used for the OBJDIR. It used to use /usr/obj/target.target_arch/nxb/ for objects and /usr/obj/target.target_arch/nxb-bin for installed files, but now uses /usr/obj/nxb/target.target_arch/ for objects and /usr/obj/nxb/target.target_arch//nxb-bin for installed files. - NXBDESTDIR can be specified for where to install or queried with `make -f Makefile.inc1 TARGET=... TARGET_ARCH=... -V NXBDESTDIR` This could potentially be improved to reuse an existing sysroot. The problem is with building the SUBDIR_OVERRIDE list it needs to use a different OBJDIR since it is building all statically. We don't want to pollute the existing 'buildworld' OBJDIR and cause confusion on the next build. Using a separate OBJDIR for the 'everything' phase mostly works except for some things like linking in INTERNALLIBS that exist in the other OBJDIR. MFC after: 1 month Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Oct 25 21:46:33 2017 (r325000) +++ head/Makefile.inc1 Wed Oct 25 21:46:36 2017 (r325001) @@ -637,6 +637,8 @@ XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -s .endif .elif ${WANT_COMPILER_TYPE} == clang || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang) +MACHINE_ABI?= unknown +MACHINE_TRIPLE?=${MACHINE_ARCH:C/amd64/x86_64/}-${MACHINE_ABI}-freebsd12.0 TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0 XCFLAGS+= -target ${TARGET_TRIPLE} @@ -2111,47 +2113,20 @@ cross-tools: .MAKE .PHONY ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor -NXBDESTDIR= ${OBJTREE}/nxb-bin -NXBENV= MAKEOBJDIRPREFIX=${OBJTREE}/nxb \ - TOOLS_PREFIX= \ - INSTALL="sh ${.CURDIR}/tools/install.sh" \ - PATH=${PATH}:${OBJTREE}/gperf_for_gcc/usr/bin -NXBMAKE= ${NXBENV} ${MAKE} \ - LLVM_TBLGEN=${NXBDESTDIR}/usr/bin/llvm-tblgen \ - CLANG_TBLGEN=${NXBDESTDIR}/usr/bin/clang-tblgen \ - MACHINE=${TARGET} MACHINE_ARCH=${TARGET_ARCH} \ - MK_GDB=no MK_TESTS=no \ - SSP_CFLAGS= \ - MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes \ - -DNO_PIC MK_PROFILE=no -DNO_SHARED \ - -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \ - MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \ - MK_LLDB=no MK_DEBUG_FILES=no - +# # native-xtools is the current target for qemu-user cross builds of ports # via poudriere and the imgact_binmisc kernel module. -# For non-clang enabled targets that are still using the in tree gcc -# we must build a gperf binary for one instance of its Makefiles. On -# clang-enabled systems, the gperf binary is obsolete. -native-xtools: .PHONY -.if ${MK_GCC_BOOTSTRAP} != "no" - mkdir -p ${OBJTREE}/gperf_for_gcc/usr/bin - ${_+_}@${ECHODIR} "===> ${_gperf} (obj,all,install)"; \ - cd ${.CURDIR}/${_gperf}; \ - if [ -z "${NO_OBJ}" ]; then ${NXBMAKE} DIRPRFX=${_gperf}/ obj; fi; \ - ${NXBMAKE} DIRPRFX=${_gperf}/ all; \ - ${NXBMAKE} DIRPRFX=${_gperf}/ DESTDIR=${OBJTREE}/gperf_for_gcc install -.endif - mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr - mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ - -p ${NXBDESTDIR}/usr >/dev/null - mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ - -p ${NXBDESTDIR}/usr/include >/dev/null -.if ${MK_DEBUG_FILES} != "no" - mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ - -p ${NXBDESTDIR}/usr/lib >/dev/null -.endif -.for _tool in \ +# This target merely builds a toolchan/sysroot, then builds the tools it wants +# with the options it wants in a special MAKEOBJDIRPREFIX, using the toolchain +# already built. It then installs the static tools to NXBDESTDIR for Poudriere +# to pickup. +# +NXBOBJDIR= ${MAKEOBJDIRPREFIX}/nxb/${TARGET}.${TARGET_ARCH} +NXBDESTDIR= ${NXBOBJDIR}${.CURDIR}/nxb-bin + +# This is the list of tools to be built/installed as static and where +# appropriate to build for the given TARGET.TARGET_ARCH. +NXBDIRS+= \ bin/cat \ bin/chmod \ bin/cp \ @@ -2169,24 +2144,18 @@ native-xtools: .PHONY bin/rmdir \ bin/sh \ bin/sleep \ - ${_clang_tblgen} \ - usr.bin/ar \ - ${_binutils} \ - ${_elftctools} \ - ${_gcc} \ - ${_gcc_tools} \ - ${_clang_libs} \ - ${_clang} \ - ${_lld} \ sbin/md5 \ sbin/sysctl \ - usr.bin/diff \ + usr.bin/addr2line \ + usr.bin/ar \ usr.bin/awk \ usr.bin/basename \ usr.bin/bmake \ usr.bin/bzip2 \ usr.bin/cmp \ + usr.bin/diff \ usr.bin/dirname \ + usr.bin/elfcopy \ usr.bin/env \ usr.bin/fetch \ usr.bin/find \ @@ -2196,14 +2165,16 @@ native-xtools: .PHONY usr.bin/lex \ usr.bin/limits \ usr.bin/lorder \ - ${_libopenbsd} \ - ${_makewhatis} \ + usr.bin/mandoc \ usr.bin/mktemp \ usr.bin/mt \ + usr.bin/nm \ usr.bin/patch \ usr.bin/readelf \ usr.bin/sed \ + usr.bin/size \ usr.bin/sort \ + usr.bin/strings \ usr.bin/tar \ usr.bin/touch \ usr.bin/tr \ @@ -2215,12 +2186,81 @@ native-xtools: .PHONY usr.bin/xz \ usr.bin/yacc \ usr.sbin/chown - ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ - cd ${.CURDIR}/${_tool}; \ - if [ -z "${NO_OBJ}" ]; then ${NXBMAKE} DIRPRFX=${_tool}/ obj; fi; \ - ${NXBMAKE} DIRPRFX=${_tool}/ all; \ - ${NXBMAKE} DIRPRFX=${_tool}/ DESTDIR=${NXBDESTDIR} install -.endfor + +.if ${MK_CLANG} != "no" +NXBDIRS+= lib/clang +SUBDIR_DEPEND_usr.bin/clang= lib/clang +NXBDIRS+= usr.bin/clang +.elif ${MK_GCC} != "no" +NXBDIRS+= gnu/usr.bin/cc +.endif +.if ${MK_BINUTILS} != "no" +NXBDIRS+= gnu/usr.bin/binutils +.endif + +NXBMAKEENV+= \ + MAKEOBJDIRPREFIX=${NXBOBJDIR:Q} + +NXBMAKEARGS+= \ + OBJTREE=${NXBOBJDIR:Q} \ + -DNO_SHARED \ + -DNO_CPU_CFLAGS \ + -DNO_PIC \ + SSP_CFLAGS= \ + MK_CLANG_EXTRAS=no \ + MK_CLANG_FULL=no \ + MK_CTF=no \ + MK_DEBUG_FILES=no \ + MK_GDB=no \ + MK_HTML=no \ + MK_LLDB=no \ + MK_MAN=no \ + MK_MAN_UTILS=yes \ + MK_OFED=no \ + MK_OPENSSH=no \ + MK_PROFILE=no \ + MK_SENDMAIL=no \ + MK_SVNLITE=no \ + MK_TESTS=no \ + MK_WARNS=no \ + MK_ZFS=no + + +# For 'toolchain' we want to produce native binaries that themselves generate +# native binaries. +NXBTMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS:N-DNO_PIC:N-DNO_SHARED} \ + TARGET=${MACHINE} TARGET_ARCH=${MACHINE_ARCH} +# For 'everything' we want to produce native binaries (hence -target to +# be MACHINE) that themselves generate TARGET.TARGET_ARCH binaries. +# TARGET/TARGET_ARCH are still passed along from user. +NXBMAKE= ${NXBMAKEENV} ${MAKE} ${NXBMAKEARGS} \ + TARGET_TRIPLE=${MACHINE_TRIPLE:Q} +native-xtools: .PHONY + # Build the bootstrap/host/cross tools that produce native binaries + ${_+_}cd ${.CURDIR}; ${NXBTMAKE} kernel-toolchain + # Populate includes/libraries sysroot that produce native binaries. + # This is split out from 'toolchain' above mostly so that target LLVM + # libraries have a proper LLVM_DEFAULT_TARGET_TRIPLE without + # polluting the cross-compiler build. The LLVM/GCC libs are skipped + # here to avoid the problem but are kept in 'toolchain' so that + # needed build tools are built. + ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _includes MK_CLANG=no MK_GCC=no + ${_+_}cd ${.CURDIR}; ${NXBTMAKE} _libraries MK_CLANG=no MK_GCC=no +.if !defined(NO_OBJ) + ${_+_}cd ${.CURDIR}; ${NXBMAKE} SUBDIR_OVERRIDE="${NXBDIRS:M*}" _obj +.endif + ${_+_}cd ${.CURDIR}; ${NXBMAKE} SUBDIR_OVERRIDE="${NXBDIRS:M*}" \ + everything + mkdir -p ${NXBDESTDIR}/bin ${NXBDESTDIR}/sbin ${NXBDESTDIR}/usr + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ + -p ${NXBDESTDIR}/usr >/dev/null + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ + -p ${NXBDESTDIR}/usr/include >/dev/null + ${_+_}cd ${.CURDIR}; ${NXBMAKE} -f Makefile.inc1 \ + DESTDIR=${NXBDESTDIR} \ + SUBDIR_OVERRIDE="${NXBDIRS:M*}" \ + -DNO_ROOT \ + install # # hierarchy - ensure that all the needed directories are present From owner-svn-src-head@freebsd.org Wed Oct 25 21:46:41 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 333CAE54F89; Wed, 25 Oct 2017 21:46:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3707834EF; Wed, 25 Oct 2017 21:46:40 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9PLkdIJ079699; Wed, 25 Oct 2017 21:46:39 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PLkdrg079698; Wed, 25 Oct 2017 21:46:39 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201710252146.v9PLkdrg079698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 25 Oct 2017 21:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325002 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 325002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 21:46:41 -0000 Author: bdrewery Date: Wed Oct 25 21:46:39 2017 New Revision: 325002 URL: https://svnweb.freebsd.org/changeset/base/325002 Log: Cleanup pieces missed in r315057 which made mandoc mandatory Sponsored by: Dell EMC Isilon Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Oct 25 21:46:36 2017 (r325001) +++ head/Makefile.inc1 Wed Oct 25 21:46:39 2017 (r325002) @@ -1849,7 +1849,6 @@ _vtfontcvt= usr.bin/vtfontcvt .endif .if ${BOOTSTRAPPING} < 1000033 -_libopenbsd= lib/libopenbsd _m4= usr.bin/m4 _lex= usr.bin/lex @@ -1935,9 +1934,6 @@ _kerberos5_bootstrap_tools= \ .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} .endif -# r283777 makewhatis(1) replaced with mandoc version which builds a database. -_libopenbsd?= lib/libopenbsd -_makewhatis= usr.bin/mandoc ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd bootstrap-tools: .PHONY @@ -1954,8 +1950,8 @@ bootstrap-tools: .PHONY ${_cat} \ ${_kbdcontrol} \ usr.bin/lorder \ - ${_libopenbsd} \ - ${_makewhatis} \ + lib/libopenbsd \ + usr.bin/mandoc \ usr.bin/rpcgen \ ${_yacc} \ ${_m4} \ From owner-svn-src-head@freebsd.org Wed Oct 25 23:24:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40636E56770; Wed, 25 Oct 2017 23:24:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id 0FABC1823; Wed, 25 Oct 2017 23:24:30 +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 v9PNOU5f020975; Wed, 25 Oct 2017 23:24:30 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9PNOUXq020974; Wed, 25 Oct 2017 23:24:30 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710252324.v9PNOUXq020974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 25 Oct 2017 23:24:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325004 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 325004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Oct 2017 23:24:31 -0000 Author: imp Date: Wed Oct 25 23:24:30 2017 New Revision: 325004 URL: https://svnweb.freebsd.org/changeset/base/325004 Log: Fix typo and bump .Dd date. Noticed by: Richard Tector Sponsored by: Netflix Modified: head/share/man/man4/ipmi.4 Modified: head/share/man/man4/ipmi.4 ============================================================================== --- head/share/man/man4/ipmi.4 Wed Oct 25 22:25:32 2017 (r325003) +++ head/share/man/man4/ipmi.4 Wed Oct 25 23:24:30 2017 (r325004) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2007 +.Dd October 25, 2017 .Dt IPMI 4 .Os .Sh NAME @@ -98,7 +98,7 @@ driver implements the power cycling option to to implement power cycling of the system. The motherboard's BMC must support the chassis device and the optional power cycle subcomand of the chassis control command as described in section 28.3 -if the IPMI standard. +of the IPMI standard. The length of time the system is off will be at least one second, but may be longer if the power cycle interval has been set (see section 28.9). .Sh IOCTLS From owner-svn-src-head@freebsd.org Thu Oct 26 02:24:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F28DE31442; Thu, 26 Oct 2017 02:24:16 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f177.google.com (mail-io0-f177.google.com [209.85.223.177]) (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 3006666959; Thu, 26 Oct 2017 02:24:15 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f177.google.com with SMTP id n137so3116360iod.6; Wed, 25 Oct 2017 19: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; bh=rv/fTyCO56DUcoViHJBSX69iy1VfSQIJNsJFKdftfuo=; b=XtOFVp3wTvs1R/ob1m5d6vGnB5bFFeGsdsIQdHldUgJA6KmzXGrfCfNTXYIM0U2fA6 kIDg2InWRokhbGiNs3rLf+Y7CqgCeWNEURM6FihAylBN3ZW+Wjkin0uCMQhJcAR404YP zfenolBweUQyKfF9hPTxaYrufiQ1u7/Mo9uSvzL5P5FPqcAmgyzLMPfhZKPqvHBcsdCm 2tsX0Hz0jdtDEdyk3WhQTT4UwC5LkoLh500AgKaUbib/KvB8dYbWrnUe4EqSWSjz9NIG u9JS1srKccdHbDxxmacG+YteKycrsO8lIEUCfRsR7b22/i/kgfLpwQZG1DxS6/l5P1EW 80SQ== X-Gm-Message-State: AMCzsaXDGgdoeeLoQPfFXBaZM2L6Cqz+xkhCjhy5EKbr8+sU6JQ94AtW aB55Mf6B2CGwqqgCNStqAcRuqXVp X-Google-Smtp-Source: ABhQp+QlhpwaUM32DhjABRCA8Jipbj7gUt2SXFtD5gWqtgi6vsyMqmPRFqryhx1JCdtlOUOkB0oF6w== X-Received: by 10.107.56.130 with SMTP id f124mr3611916ioa.33.1508984220198; Wed, 25 Oct 2017 19:17:00 -0700 (PDT) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com. [209.85.214.43]) by smtp.gmail.com with ESMTPSA id q202sm1835388iod.85.2017.10.25.19.16.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 19:16:59 -0700 (PDT) Received: by mail-it0-f43.google.com with SMTP id l196so3299082itl.4; Wed, 25 Oct 2017 19:16:59 -0700 (PDT) X-Received: by 10.36.53.15 with SMTP id k15mr443227ita.75.1508984219732; Wed, 25 Oct 2017 19:16:59 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.164.130 with HTTP; Wed, 25 Oct 2017 19:16:59 -0700 (PDT) In-Reply-To: <201710232312.v9NNC1B0011025@repo.freebsd.org> References: <201710232312.v9NNC1B0011025@repo.freebsd.org> From: Conrad Meyer Date: Wed, 25 Oct 2017 19:16:59 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r324941 - in head: lib/libc/sys sys/kern To: Alan Somers Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, John Baldwin Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 02:24:16 -0000 Hi Alan, Coverity reports a mismatch between the loop quoted in the context below and the dynamic array size nent. (The mismatch predates your change, due to the invariant nent <= aio_listio_max and aiol_zone sized in terms of aio_listio_max.) CID is 1382114. On Mon, Oct 23, 2017 at 4:12 PM, Alan Somers wrote: > Author: asomers > Date: Mon Oct 23 23:12:01 2017 > New Revision: 324941 > URL: https://svnweb.freebsd.org/changeset/base/324941 > > Log: > Remove artificial restriction on lio_listio's operation count > ... > Modified: head/sys/kern/vfs_aio.c > ============================================================================== > --- head/sys/kern/vfs_aio.c Mon Oct 23 23:05:29 2017 (r324940) > +++ head/sys/kern/vfs_aio.c Mon Oct 23 23:12:01 2017 (r324941) >... > @@ -2812,7 +2809,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs > } else > tsp = NULL; > > - ujoblist = uma_zalloc(aiol_zone, M_WAITOK); > + ujoblist = malloc(uap->nent * sizeof(ujoblist[0]), M_AIOS, M_WAITOK); > ujoblist32 = (uint32_t *)ujoblist; > error = copyin(uap->aiocbp, ujoblist32, uap->nent * > sizeof(ujoblist32[0])); > if (error == 0) { > for (i = uap->nent; i > 0; i--) Probably, this should be: for (i = uap->nent - 1; i > 0; i--) > ujoblist[i] = PTRIN(ujoblist32[i]); > > error = kern_aio_suspend(td, uap->nent, ujoblist, tsp); > } > - uma_zfree(aiol_zone, ujoblist); > + free(ujoblist, M_AIOS); > return (error); > } I think this loop was wrong when it was introduced in r185878, but have not investigated that thoroughly. Best, Conrad From owner-svn-src-head@freebsd.org Thu Oct 26 09:29:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ABFCE43678; Thu, 26 Oct 2017 09:29:36 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3760D72B35; Thu, 26 Oct 2017 09:29:36 +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 v9Q9TZ8Q068074; Thu, 26 Oct 2017 09:29:35 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9Q9TZgO068073; Thu, 26 Oct 2017 09:29:35 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710260929.v9Q9TZgO068073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 26 Oct 2017 09:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325007 - head/sys/geom/mountver X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/geom/mountver X-SVN-Commit-Revision: 325007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 09:29:36 -0000 Author: trasz Date: Thu Oct 26 09:29:35 2017 New Revision: 325007 URL: https://svnweb.freebsd.org/changeset/base/325007 Log: Make gmountver(8) use G_PF_ACCEPT_UNMAPPED. MFC after: 2 weeks Modified: head/sys/geom/mountver/g_mountver.c Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Thu Oct 26 03:38:40 2017 (r325006) +++ head/sys/geom/mountver/g_mountver.c Thu Oct 26 09:29:35 2017 (r325007) @@ -271,6 +271,14 @@ g_mountver_create(struct gctl_req *req, struct g_class newpp->mediasize = pp->mediasize; newpp->sectorsize = pp->sectorsize; + if ((pp->flags & G_PF_ACCEPT_UNMAPPED) != 0) { + G_MOUNTVER_DEBUG(0, "Unmapped supported for %s.", gp->name); + newpp->flags |= G_PF_ACCEPT_UNMAPPED; + } else { + G_MOUNTVER_DEBUG(0, "Unmapped unsupported for %s.", gp->name); + newpp->flags &= ~G_PF_ACCEPT_UNMAPPED; + } + cp = g_new_consumer(gp); error = g_attach(cp, pp); if (error != 0) { From owner-svn-src-head@freebsd.org Thu Oct 26 10:11:37 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D65FE44784; Thu, 26 Oct 2017 10:11:37 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 580AB73EA0; Thu, 26 Oct 2017 10:11:37 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9QABa6Y085473; Thu, 26 Oct 2017 10:11:36 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QABZDk085463; Thu, 26 Oct 2017 10:11:35 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201710261011.v9QABZDk085463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Thu, 26 Oct 2017 10:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325008 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: truckman X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 325008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 10:11:37 -0000 Author: truckman Date: Thu Oct 26 10:11:35 2017 New Revision: 325008 URL: https://svnweb.freebsd.org/changeset/base/325008 Log: Fix Dummynet AQM packet marking function ecn_mark() and fq_codel / fq_pie schedulers packet classification functions in layer2 (bridge mode). Dummynet AQM packet marking function ecn_mark() and fq_codel/fq_pie schedulers packet classification functions (fq_codel_classify_flow() and fq_pie_classify_flow()) assume mbuf is pointing at L3 (IP) packet. However, this assumption is incorrect if ipfw/dummynet is used to manage layer2 traffic (bridge mode) since mbuf will point at L2 frame. This patch solves this problem by identifying the source of the frame/packet (L2 or L3) and adding ETHER_HDR_LEN offset when converting an mbuf pointer to ip pointer if the traffic is from layer2. More specifically, in dummynet packet tagging function, tag_mbuf(), iphdr_off is set to ETHER_HDR_LEN if the traffic is from layer2 and set to zero otherwise. Whenever an access to IP header is required, mtodo(m, dn_tag_get(m)->iphdr_off) is used instead of mtod(m, struct ip *) to correctly convert mbuf pointer to ip pointer in both L2 and L3 traffic. Submitted by: lstewart MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D12506 Modified: head/sys/netpfil/ipfw/dn_sched_fifo.c head/sys/netpfil/ipfw/dn_sched_fq_codel.c head/sys/netpfil/ipfw/dn_sched_fq_pie.c head/sys/netpfil/ipfw/dn_sched_prio.c head/sys/netpfil/ipfw/dn_sched_qfq.c head/sys/netpfil/ipfw/dn_sched_rr.c head/sys/netpfil/ipfw/dn_sched_wf2q.c head/sys/netpfil/ipfw/ip_dn_io.c head/sys/netpfil/ipfw/ip_dn_private.h Modified: head/sys/netpfil/ipfw/dn_sched_fifo.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_fifo.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/dn_sched_fifo.c Thu Oct 26 10:11:35 2017 (r325008) @@ -33,13 +33,16 @@ #include #include #include +#include #include #include +#include #include /* IFNAMSIZ */ #include #include /* ipfw_rule_ref */ #include /* flow_id */ #include +#include #include #include #ifdef NEW_AQM Modified: head/sys/netpfil/ipfw/dn_sched_fq_codel.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_fq_codel.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/dn_sched_fq_codel.c Thu Oct 26 10:11:35 2017 (r325008) @@ -218,13 +218,14 @@ fq_codel_classify_flow(struct mbuf *m, uint16_t fcount uint8_t tuple[41]; uint16_t hash=0; + ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off); //#ifdef INET6 struct ip6_hdr *ip6; int isip6; - isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0; + isip6 = (ip->ip_v == 6); if(isip6) { - ip6 = mtod(m, struct ip6_hdr *); + ip6 = (struct ip6_hdr *)ip; *((uint8_t *) &tuple[0]) = ip6->ip6_nxt; *((uint32_t *) &tuple[1]) = si->perturbation; memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16); @@ -253,7 +254,6 @@ fq_codel_classify_flow(struct mbuf *m, uint16_t fcount //#endif /* IPv4 */ - ip = mtod(m, struct ip *); *((uint8_t *) &tuple[0]) = ip->ip_p; *((uint32_t *) &tuple[1]) = si->perturbation; *((uint32_t *) &tuple[5]) = ip->ip_src.s_addr; Modified: head/sys/netpfil/ipfw/dn_sched_fq_pie.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_fq_pie.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/dn_sched_fq_pie.c Thu Oct 26 10:11:35 2017 (r325008) @@ -792,13 +792,14 @@ fq_pie_classify_flow(struct mbuf *m, uint16_t fcount, uint8_t tuple[41]; uint16_t hash=0; + ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off); //#ifdef INET6 struct ip6_hdr *ip6; int isip6; - isip6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0; + isip6 = (ip->ip_v == 6); if(isip6) { - ip6 = mtod(m, struct ip6_hdr *); + ip6 = (struct ip6_hdr *)ip; *((uint8_t *) &tuple[0]) = ip6->ip6_nxt; *((uint32_t *) &tuple[1]) = si->perturbation; memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16); @@ -826,7 +827,6 @@ fq_pie_classify_flow(struct mbuf *m, uint16_t fcount, //#endif /* IPv4 */ - ip = mtod(m, struct ip *); *((uint8_t *) &tuple[0]) = ip->ip_p; *((uint32_t *) &tuple[1]) = si->perturbation; *((uint32_t *) &tuple[5]) = ip->ip_src.s_addr; Modified: head/sys/netpfil/ipfw/dn_sched_prio.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_prio.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/dn_sched_prio.c Thu Oct 26 10:11:35 2017 (r325008) @@ -32,13 +32,16 @@ #include #include #include +#include #include #include +#include #include /* IFNAMSIZ */ #include #include /* ipfw_rule_ref */ #include /* flow_id */ #include +#include #include #include #ifdef NEW_AQM Modified: head/sys/netpfil/ipfw/dn_sched_qfq.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_qfq.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/dn_sched_qfq.c Thu Oct 26 10:11:35 2017 (r325008) @@ -33,13 +33,16 @@ #include #include #include +#include #include #include +#include #include /* IFNAMSIZ */ #include #include /* ipfw_rule_ref */ #include /* flow_id */ #include +#include #include #include #ifdef NEW_AQM Modified: head/sys/netpfil/ipfw/dn_sched_rr.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_rr.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/dn_sched_rr.c Thu Oct 26 10:11:35 2017 (r325008) @@ -33,13 +33,16 @@ #include #include #include +#include #include #include +#include #include /* IFNAMSIZ */ #include #include /* ipfw_rule_ref */ #include /* flow_id */ #include +#include #include #include #ifdef NEW_AQM Modified: head/sys/netpfil/ipfw/dn_sched_wf2q.c ============================================================================== --- head/sys/netpfil/ipfw/dn_sched_wf2q.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/dn_sched_wf2q.c Thu Oct 26 10:11:35 2017 (r325008) @@ -34,13 +34,16 @@ #include #include #include +#include #include #include +#include #include /* IFNAMSIZ */ #include #include /* ipfw_rule_ref */ #include /* flow_id */ #include +#include #include #include #ifdef NEW_AQM Modified: head/sys/netpfil/ipfw/ip_dn_io.c ============================================================================== --- head/sys/netpfil/ipfw/ip_dn_io.c Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/ip_dn_io.c Thu Oct 26 10:11:35 2017 (r325008) @@ -237,27 +237,10 @@ SYSEND static void dummynet_send(struct mbuf *); /* - * Packets processed by dummynet have an mbuf tag associated with - * them that carries their dummynet state. - * Outside dummynet, only the 'rule' field is relevant, and it must - * be at the beginning of the structure. - */ -struct dn_pkt_tag { - struct ipfw_rule_ref rule; /* matching rule */ - - /* second part, dummynet specific */ - int dn_dir; /* action when packet comes out.*/ - /* see ip_fw_private.h */ - uint64_t output_time; /* when the pkt is due for delivery*/ - struct ifnet *ifp; /* interface, for ip_output */ - struct _ip6dn_args ip6opt; /* XXX ipv6 options */ -}; - -/* * Return the mbuf tag holding the dummynet state (it should * be the first one on the list). */ -static struct dn_pkt_tag * +struct dn_pkt_tag * dn_tag_get(struct mbuf *m) { struct m_tag *mtag = m_tag_first(m); @@ -448,7 +431,7 @@ int ecn_mark(struct mbuf* m) { struct ip *ip; - ip = mtod(m, struct ip *); + ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off); switch (ip->ip_v) { case IPVERSION: @@ -472,7 +455,7 @@ ecn_mark(struct mbuf* m) #ifdef INET6 case (IPV6_VERSION >> 4): { - struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *); + struct ip6_hdr *ip6 = (struct ip6_hdr *)ip; u_int32_t flowlabel; flowlabel = ntohl(ip6->ip6_flow); @@ -859,6 +842,7 @@ tag_mbuf(struct mbuf *m, int dir, struct ip_fw_args *f dt->ifp = fwa->oif; /* dt->output tame is updated as we move through */ dt->output_time = dn_cfg.curr_time; + dt->iphdr_off = (dir & PROTO_LAYER2) ? ETHER_HDR_LEN : 0; return 0; } Modified: head/sys/netpfil/ipfw/ip_dn_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_dn_private.h Thu Oct 26 09:29:35 2017 (r325007) +++ head/sys/netpfil/ipfw/ip_dn_private.h Thu Oct 26 10:11:35 2017 (r325008) @@ -367,6 +367,24 @@ enum { DN_QHT_IS_Q = 0x0100, /* in flowset, qht is a single queue */ }; +/* + * Packets processed by dummynet have an mbuf tag associated with + * them that carries their dummynet state. + * Outside dummynet, only the 'rule' field is relevant, and it must + * be at the beginning of the structure. + */ +struct dn_pkt_tag { + struct ipfw_rule_ref rule; /* matching rule */ + + /* second part, dummynet specific */ + int dn_dir; /* action when packet comes out.*/ + /* see ip_fw_private.h */ + uint64_t output_time; /* when the pkt is due for delivery*/ + struct ifnet *ifp; /* interface, for ip_output */ + struct _ip6dn_args ip6opt; /* XXX ipv6 options */ + uint16_t iphdr_off; /* IP header offset for mtodo() */ +}; + extern struct dn_parms dn_cfg; //VNET_DECLARE(struct dn_parms, _base_dn_cfg); //#define dn_cfg VNET(_base_dn_cfg) @@ -374,6 +392,7 @@ extern struct dn_parms dn_cfg; int dummynet_io(struct mbuf **, int , struct ip_fw_args *); void dummynet_task(void *context, int pending); void dn_reschedule(void); +struct dn_pkt_tag * dn_tag_get(struct mbuf *m); struct dn_queue *ipdn_q_find(struct dn_fsk *, struct dn_sch_inst *, struct ipfw_flow_id *); From owner-svn-src-head@freebsd.org Thu Oct 26 10:18:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6EFBE44ADA; Thu, 26 Oct 2017 10:18:32 +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 mx1.freebsd.org (Postfix) with ESMTPS id B64067435C; Thu, 26 Oct 2017 10:18:32 +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 v9QAIVK4088780; Thu, 26 Oct 2017 10:18:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QAIVsT088779; Thu, 26 Oct 2017 10:18:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201710261018.v9QAIVsT088779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 26 Oct 2017 10:18:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325009 - head/sys/geom/mountver X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/geom/mountver X-SVN-Commit-Revision: 325009 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 10:18:33 -0000 Author: trasz Date: Thu Oct 26 10:18:31 2017 New Revision: 325009 URL: https://svnweb.freebsd.org/changeset/base/325009 Log: Make gmountver(8) use direct dispatch. MFC after: 2 weeks Modified: head/sys/geom/mountver/g_mountver.c Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Thu Oct 26 10:11:35 2017 (r325008) +++ head/sys/geom/mountver/g_mountver.c Thu Oct 26 10:18:31 2017 (r325009) @@ -257,7 +257,7 @@ g_mountver_create(struct gctl_req *req, struct g_class } gp = g_new_geomf(mp, "%s", name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); - mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF); + mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_RECURSE); TAILQ_INIT(&sc->sc_queue); sc->sc_provider_name = strdup(pp->name, M_GEOM); gp->softc = sc; @@ -270,6 +270,7 @@ g_mountver_create(struct gctl_req *req, struct g_class newpp = g_new_providerf(gp, "%s", gp->name); newpp->mediasize = pp->mediasize; newpp->sectorsize = pp->sectorsize; + newpp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE; if ((pp->flags & G_PF_ACCEPT_UNMAPPED) != 0) { G_MOUNTVER_DEBUG(0, "Unmapped supported for %s.", gp->name); @@ -280,6 +281,7 @@ g_mountver_create(struct gctl_req *req, struct g_class } cp = g_new_consumer(gp); + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); if (error != 0) { gctl_error(req, "Cannot attach to provider %s.", pp->name); From owner-svn-src-head@freebsd.org Thu Oct 26 13:23:14 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52A39E49868; Thu, 26 Oct 2017 13:23:14 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 215967DF81; Thu, 26 Oct 2017 13:23:14 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9QDNDXu067293; Thu, 26 Oct 2017 13:23:13 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QDNDsP067292; Thu, 26 Oct 2017 13:23:13 GMT (envelope-from des@FreeBSD.org) Message-Id: <201710261323.v9QDNDsP067292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org using -f From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= Date: Thu, 26 Oct 2017 13:23:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325010 - head/lib/libpam/modules/pam_unix X-SVN-Group: head X-SVN-Commit-Author: des X-SVN-Commit-Paths: head/lib/libpam/modules/pam_unix X-SVN-Commit-Revision: 325010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 13:23:14 -0000 Author: des Date: Thu Oct 26 13:23:13 2017 New Revision: 325010 URL: https://svnweb.freebsd.org/changeset/base/325010 Log: If the user-provided password exceeds the maximum password length, don't bother passing it to crypt(). It won't succeed and may allow an attacker to confirm that the user exists. Reported by: jkim@ MFC after: 1 week Security: CVE-2016-6210 Modified: head/lib/libpam/modules/pam_unix/pam_unix.c Modified: head/lib/libpam/modules/pam_unix/pam_unix.c ============================================================================== --- head/lib/libpam/modules/pam_unix/pam_unix.c Thu Oct 26 10:18:31 2017 (r325009) +++ head/lib/libpam/modules/pam_unix/pam_unix.c Thu Oct 26 13:23:13 2017 (r325010) @@ -111,6 +111,7 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __un if (!(flags & PAM_DISALLOW_NULL_AUTHTOK) && openpam_get_option(pamh, PAM_OPT_NULLOK)) return (PAM_SUCCESS); + PAM_LOG("Password is empty, using fake password"); realpw = "*"; } lc = login_getpwclass(pwd); @@ -125,6 +126,10 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags __un if (retval != PAM_SUCCESS) return (retval); PAM_LOG("Got password"); + if (strnlen(pass, _PASSWORD_LEN + 1) > _PASSWORD_LEN) { + PAM_LOG("Password is too long, using fake password"); + realpw = "*"; + } if (strcmp(crypt(pass, realpw), realpw) == 0) return (PAM_SUCCESS); From owner-svn-src-head@freebsd.org Thu Oct 26 15:28:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82D5FE4C3E7; Thu, 26 Oct 2017 15:28:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E95B81FAC; Thu, 26 Oct 2017 15:28:19 +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 v9QFSIeX017945; Thu, 26 Oct 2017 15:28:18 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QFSIDX017941; Thu, 26 Oct 2017 15:28:18 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201710261528.v9QFSIDX017941@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 26 Oct 2017 15:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325011 - in head: cddl/usr.sbin/zfsd lib/libdevdctl X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: cddl/usr.sbin/zfsd lib/libdevdctl X-SVN-Commit-Revision: 325011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 15:28:19 -0000 Author: asomers Date: Thu Oct 26 15:28:18 2017 New Revision: 325011 URL: https://svnweb.freebsd.org/changeset/base/325011 Log: zfsd should be able to online an L2ARC that disappears and returns Previously, this didn't work because L2ARC devices' labels don't contain pool GUIDs. Modify zfsd so that the pool GUID won't be required: lib/libdevdctl/guid.h Change INVALID_GUID from a uint64_t constant to a function that returns an invalid Guid object. Remove the void constructor. Nothing uses it, and it violates RAII. cddl/usr.sbin/zfsd/case_file.h cddl/usr.sbin/zfsd/case_file.cc Allow CaseFile::Find to match a CaseFile based on Vdev GUID alone. In CaseFile::ReEvaluate, attempt to online devices even if the newly arrived device has no pool GUID. cddl/usr.sbin/zfsd/vdev_iterator.cc Iterate through a pool's cache devices as well as its regular devices. Reported by: avg Reviewed by: avg MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D12791 Modified: head/cddl/usr.sbin/zfsd/case_file.cc head/cddl/usr.sbin/zfsd/case_file.h head/cddl/usr.sbin/zfsd/vdev_iterator.cc head/lib/libdevdctl/guid.h Modified: head/cddl/usr.sbin/zfsd/case_file.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/case_file.cc Thu Oct 26 13:23:13 2017 (r325010) +++ head/cddl/usr.sbin/zfsd/case_file.cc Thu Oct 26 15:28:18 2017 (r325011) @@ -102,7 +102,8 @@ CaseFile::Find(Guid poolGUID, Guid vdevGUID) for (CaseFileList::iterator curCase = s_activeCases.begin(); curCase != s_activeCases.end(); curCase++) { - if ((*curCase)->PoolGUID() != poolGUID + if (((*curCase)->PoolGUID() != poolGUID + && Guid::InvalidGuid() != poolGUID) || (*curCase)->VdevGUID() != vdevGUID) continue; @@ -268,7 +269,8 @@ CaseFile::ReEvaluate(const string &devPath, const stri } if (vdev != NULL - && vdev->PoolGUID() == m_poolGUID + && ( vdev->PoolGUID() == m_poolGUID + || vdev->PoolGUID() == Guid::InvalidGuid()) && vdev->GUID() == m_vdevGUID) { zpool_vdev_online(pool, vdev->GUIDString().c_str(), Modified: head/cddl/usr.sbin/zfsd/case_file.h ============================================================================== --- head/cddl/usr.sbin/zfsd/case_file.h Thu Oct 26 13:23:13 2017 (r325010) +++ head/cddl/usr.sbin/zfsd/case_file.h Thu Oct 26 15:28:18 2017 (r325011) @@ -89,6 +89,8 @@ class CaseFile (public) * \brief Find a CaseFile object by a vdev's pool/vdev GUID tuple. * * \param poolGUID Pool GUID for the vdev of the CaseFile to find. + * If InvalidGuid, then only match the vdev GUID + * instead of both pool and vdev GUIDs. * \param vdevGUID Vdev GUID for the vdev of the CaseFile to find. * * \return If found, a pointer to a valid CaseFile object. Modified: head/cddl/usr.sbin/zfsd/vdev_iterator.cc ============================================================================== --- head/cddl/usr.sbin/zfsd/vdev_iterator.cc Thu Oct 26 13:23:13 2017 (r325010) +++ head/cddl/usr.sbin/zfsd/vdev_iterator.cc Thu Oct 26 15:28:18 2017 (r325011) @@ -76,7 +76,9 @@ void VdevIterator::Reset() { nvlist_t *rootVdev; + nvlist **cache_child; int result; + uint_t cache_children; result = nvlist_lookup_nvlist(m_poolConfig, ZPOOL_CONFIG_VDEV_TREE, @@ -85,6 +87,13 @@ VdevIterator::Reset() throw ZfsdException(m_poolConfig, "Unable to extract " "ZPOOL_CONFIG_VDEV_TREE from pool."); m_vdevQueue.assign(1, rootVdev); + result = nvlist_lookup_nvlist_array(rootVdev, + ZPOOL_CONFIG_L2CACHE, + &cache_child, + &cache_children); + if (result == 0) + for (uint_t c = 0; c < cache_children; c++) + m_vdevQueue.push_back(cache_child[c]); } nvlist_t * Modified: head/lib/libdevdctl/guid.h ============================================================================== --- head/lib/libdevdctl/guid.h Thu Oct 26 13:23:13 2017 (r325010) +++ head/lib/libdevdctl/guid.h Thu Oct 26 15:28:18 2017 (r325011) @@ -62,9 +62,9 @@ class Guid { public: /* Constructors */ - Guid(); Guid(uint64_t guid); Guid(const std::string &guid); + static Guid InvalidGuid(); /* Assignment */ Guid& operator=(const Guid& rhs); @@ -80,23 +80,24 @@ class Guid operator uint64_t() const; operator bool() const; - static const uint64_t INVALID_GUID = 0; protected: + static const uint64_t INVALID_GUID = 0; + /* The integer value of the GUID. */ uint64_t m_GUID; }; //- Guid Inline Public Methods ------------------------------------------------ inline -Guid::Guid() - : m_GUID(INVALID_GUID) +Guid::Guid(uint64_t guid) + : m_GUID(guid) { } -inline -Guid::Guid(uint64_t guid) - : m_GUID(guid) +inline Guid +Guid::InvalidGuid() { + return (Guid(INVALID_GUID)); } inline Guid& From owner-svn-src-head@freebsd.org Thu Oct 26 15:45:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B44D0E4CBCD for ; Thu, 26 Oct 2017 15:45:31 +0000 (UTC) (envelope-from ant0inegaillardafrz19iThu@bonheuradultere.com) Received: from mail.bonheuradultere.com (mail.bonheuradultere.com [91.143.92.2]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "My Work", Issuer "My Work" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4026982B7D for ; Thu, 26 Oct 2017 15:45:30 +0000 (UTC) (envelope-from ant0inegaillardafrz19iThu@bonheuradultere.com) Received: from bonheuradultere.com (unknown [7.45.220.119]) by mail.bonheuradultere.com (Postfix) with ESMTP id BE59B94F2D for ; Thu, 26 Oct 2017 13:39:05 +0300 (EEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.bonheuradultere.com BE59B94F2D Mime-Version: 1.0 Received: by 245.241.241.244 with HTTP; Thursday, 26 October 2017 06:38:35 -0300 (DST) From: =?utf-8?q?Ant0i_J?= To: svn-src-head@freebsd.org Subject: =?utf-8?q?_I_love_it_and_ready_to_experiment__Wed_Twenty_second_of_August?= =?utf-8?q?_?= Message-ID: <20171026103835.22193.89495@wipmail> X-Priority: 3 (Normal) X-Mailer: Microsoft Outlook 12.0 Importance: Normal Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Thu, 26 Oct 2017 15:45:31 -0000 X-List-Received-Date: Thu, 26 Oct 2017 15:45:31 -0000 SGkgZXZlcnlib2R5ICEKCkkgZG8gbm90IGRvIHRoaW5ncyBoYWxmd2F5LiBGb3IgbWUsIGl0IGlz IGVzc2VudGlhbCB0byBnbyBmYXN0IGFuZCBkbyBncmVhdC4KV2hlbiBJIHJlZ2lzdGVyZWQgb24g LWhvdHlnaXJsLmNvbS0sIEkgZGlkIG5vdCB0aGluayBpdCB3b3VsZCBnbyBzbyBmYXN0IQoKLWhv dHlnaXJsLmNvbS0gKHJlbW92ZSB0aGUgZHJhd2luZ3MgYnkgY29weWluZyB0aGUgbGluaykKwqAK CgpXZSBpbnZpdGUgYW55b25lIHdobyBubyBsb25nZXIgd2lzaGVzIHRvIHJlY2VpdmUgZS1tYWls IGZyb20gdXMgdG8gdXNlIHRoZSBmb2xsb3dpbmcgbGluazogLWhvdHlnaXJsLmNvbS9kZXNpbnNj cmlwdGlvbi5odG1sLQoKCgoKCgoKCgoKCgoKCgoKCgo+Pj4+Tm8sIG5vLCB3ZSBuZWVkIHRoaXMg dG8gYmUgbGVnaXQuICBUaGlzIHNob3VsZCBiZSB0cmVhdGVkIGFzIGEgY29udHJhY3RlZCBmZWF0 dXJlIGJ5IHBhc3Npb25hdGUgY3VzdG9tZXJzIGFuZCBoYW5kbGVkIGJ5IFVibnQuICAgV2UgbmVl ZCBVYm50IHRvIGFjY2VwdCB0aGUgbW9uZXkgYW5kIHRoZW4gcGF5IHRoZSBwcm9ncmFtbWVyIG92 ZXJ0aW1lIChzaW5jZSB0aGV5IGFwcGFyZW50bHkgZG9uJ3Qgc2VlIHRoZSBmZWF0dXJlIGltcG9y dGFudCBlbm91Z2ggdG8gc3BlbmQgbm9ybWFsIHRpbWUgb24pIHRvIGFkZCB0aGUgZmVhdHVyZSBw ZXJtYW5lbnRseSBzbyB0aGF0IGl0IHdpbGwgYmUgdXBkYXRlZCBhbmQgcHJlc2VudCBpbiBhbGwg ZnV0dXJlIGZpcm13YXJlIHVwZGF0ZXMuICBBbmQgd2hlbiBmaXJtd2FyZSB1cGRhdGVzIGFyZSBk b25lIHNldHRpbmdzIHNob3VsZCByZW1haW4gYXMgdGhleSBkbyB3aXRoIG90aGVyIGZlYXR1cmVz Lgo+Pj5Ud2VudHkgeWVhcnMgYWdvLCB0aGUgcGFyYW5vaWEgdGhhdCBjb25zdW1lZCBjdWx0cyBs aWtlIEhlYXZlbiBHYXRlIGV4aXN0ZWQgb24gdGhlIG1hcmdpbnMgb2YgQW1lcmljYW4gc29jaWV0 eS4gTm93IGl0IG1vdmVkIHRvd2FyZCB0aGUgY2VudGVyIG9mIHRoZSBuYXRpb24gcG9saXRpY2Fs IGxpZmUuCj4+RWx2aXMgaW1wcmVzc2l2ZSB2b2NhbCByYW5nZSBhbmQgaGlzIHRlY2huaWNhbCBh YmlsaXR5IG1hZGUgaGlzIHZvaWNlIGFuIGluc3RydW1lbnQgdGhhdCBldmVuIG9wZXJhIHNpbmdl cnMgaGF2ZSBsaW5lZCB1cCB0byBwYXkgdHJpYnV0ZSB0by4KPk11c2ljIHRvdXJpc20gaXMgYmVj b21pbmcgYW4gaW5jcmVhc2luZ2x5IGJpZyBidXNpbmVzcy4gQXMgeW91IGV4cGVjdCwgRWx2aXMg aXMgYXQgdGhlIGZvcmVmcm9udCBvZiB0aGF0IGluZHVzdHJ5Lgo+VWJudCB0ZWFtIHNlZW0gbm90 IHRvIGNhcmUgdG8gYmUgZmFpciB0aGV5IGRvIGhhdmUgbXVjaCBiaWdnZXIgaXNzdWVzIHJpZ2h0 IG5vdyBidXQgbm90IGFsbG93aW5nIGEgb3B0aW9uIHRoYXQgYWxyZWFkeSBpbiBpdHMgY29yZSBJ IGRvbid0IHVuZGVyc3RhbmQgYmVmb3JlIHRoZXkgc2FpZCBpdCBuZWVkZWQgYSBrZXJuYWwgdXBn cmFkZSBhbmQgZGlkIG5vdCB3YW50IHRvIGRlYWwgd2l0aCBpdCA1LjYuMyBoYXMgYSBuZXcga2Vy bmFsIHNvIG1heWJlIDUuNyBmaXJtd2FyZSB3aWxsIGdldCBpdD8/IEFpcm9zIDcgc2VlbXMgdG8g YmUgdGhlIG5ldyB0aGluZyB0aG91Z2ggCiBJbiB0aGlzIGNhc2UsIHRoZSBjbGllbnQgYW5kIHNl cnZlciB3ZXJlIHVuYWJsZSB0byBhZ3JlZSBvbiB0aGUga2V5IGV4Y2hhbmdlIGFsZ29yaXRobS4g VGhlIHNlcnZlciBvZmZlcmVkIG9ubHkgYSBzaW5nbGUgbWV0aG9kIGRpZmZpZS1oZWxsbWFuLWdy b3VwMS1zaGExLiBPcGVuU1NIIHN1cHBvcnRzIHRoaXMgbWV0aG9kLCBidXQgZG9lcyBub3QgZW5h YmxlIGl0IGJ5IGRlZmF1bHQgYmVjYXVzZSBpcyB3ZWFrIGFuZCB3aXRoaW4gdGhlb3JldGljYWwg cmFuZ2Ugb2YgdGhlIHNvLWNhbGxlZCBMb2dqYW0gYXR0YWNrLgpUaGUgYmVzdCByZXNvbHV0aW9u IGZvciB0aGVzZSBmYWlsdXJlcyBpcyB0byB1cGdyYWRlIHRoZSBzb2Z0d2FyZSBhdCB0aGUgb3Ro ZXIgZW5kLiBPcGVuU1NIIG9ubHkgZGlzYWJsZXMgYWxnb3JpdGhtcyB0aGF0IHdlIGFjdGl2ZWx5 IHJlY29tbWVuZCBhZ2FpbnN0IHVzaW5nIGJlY2F1c2UgdGhleSBhcmUga25vd24gdG8gYmUgd2Vh ay4gSW4gc29tZSBjYXNlcywgdGhpcyBtaWdodCBub3QgYmUgaW1tZWRpYXRlbHkgcG9zc2libGUg c28geW91IG1heSBuZWVkIA== From owner-svn-src-head@freebsd.org Thu Oct 26 16:02:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72B38E4D29A; Thu, 26 Oct 2017 16:02:40 +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 mx1.freebsd.org (Postfix) with ESMTPS id 274568341F; Thu, 26 Oct 2017 16:02:40 +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 v9QG2dSX034121; Thu, 26 Oct 2017 16:02:39 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QG2d9N034120; Thu, 26 Oct 2017 16:02:39 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710261602.v9QG2d9N034120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Oct 2017 16:02:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325012 - in head/sys/boot/arm: at91 ixp425 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys/boot/arm: at91 ixp425 X-SVN-Commit-Revision: 325012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 16:02:40 -0000 Author: imp Date: Thu Oct 26 16:02:38 2017 New Revision: 325012 URL: https://svnweb.freebsd.org/changeset/base/325012 Log: Remove now-empty directories Deleted: head/sys/boot/arm/at91/ head/sys/boot/arm/ixp425/ From owner-svn-src-head@freebsd.org Thu Oct 26 16:36:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73B7FE4DC9B; Thu, 26 Oct 2017 16:36:28 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4138F66A; Thu, 26 Oct 2017 16:36:28 +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 v9QGaRYf046721; Thu, 26 Oct 2017 16:36:27 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QGaROi046720; Thu, 26 Oct 2017 16:36:27 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710261636.v9QGaROi046720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Oct 2017 16:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325014 - head/sys/arm/include X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/arm/include X-SVN-Commit-Revision: 325014 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 16:36:28 -0000 Author: imp Date: Thu Oct 26 16:36:27 2017 New Revision: 325014 URL: https://svnweb.freebsd.org/changeset/base/325014 Log: Add a 'place holder' arm struct efi_fb until a real one comes along. This allows the arm efi boot loader to compile again. Sponsored by: Netflix Modified: head/sys/arm/include/metadata.h Modified: head/sys/arm/include/metadata.h ============================================================================== --- head/sys/arm/include/metadata.h Thu Oct 26 16:20:47 2017 (r325013) +++ head/sys/arm/include/metadata.h Thu Oct 26 16:36:27 2017 (r325014) @@ -39,4 +39,19 @@ struct efi_map_header { uint32_t descriptor_version; }; +/* + * Placeholder for now + */ +struct efi_fb { + uint64_t fb_addr; + uint64_t fb_size; + uint32_t fb_height; + uint32_t fb_width; + uint32_t fb_stride; + uint32_t fb_mask_red; + uint32_t fb_mask_green; + uint32_t fb_mask_blue; + uint32_t fb_mask_reserved; +}; + #endif /* !_MACHINE_METADATA_H_ */ From owner-svn-src-head@freebsd.org Thu Oct 26 17:18:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D5CCCE4EC1A; Thu, 26 Oct 2017 17:18:25 +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 4B8D52163; Thu, 26 Oct 2017 17:18:24 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([77.179.173.241]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MIdYi-1e9xeS2v4y-002GkP; Thu, 26 Oct 2017 19:18:16 +0200 Date: Thu, 26 Oct 2017 19:18:02 +0200 From: "O. Hartmann" To: Alan Somers Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r325011 - in head: cddl/usr.sbin/zfsd lib/libdevdctl Message-ID: <20171026191802.3d13f342@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201710261528.v9QFSIDX017941@repo.freebsd.org> References: <201710261528.v9QFSIDX017941@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/fmn.CyBi2jMOTbw.9pdX8y2"; protocol="application/pgp-signature" X-Provags-ID: V03:K0:pCRAMfbwTLAlLMqHK5ysMkoMzDUhlVvAc2ezJINGb+I2nLAjreG 3w328Ho7RxYmoNjL/wzTwVFjKzkoWINOQzGXhDegUePlScAL9BXBamKZ+2q/bbiV+E8gUix qoXBCi3vrLvJQFMnpmP8AwYjuBVj+9InmeJQgy3uonnIO3sVFlUEgvWUBUXS5+S3LpjEboF xEH4XoX+5LDnaqBUTFmzg== X-UI-Out-Filterresults: notjunk:1;V01:K0:HrecSDeuQsc=:QcfitdV88i+5BJ3qSIekqR I1/eK3mATCSRlxoA193xZaD0odOMW4pk27EOH+kf03wzTMyHQeYw2pM2xfGUII3wl7NF6msjE Hz1iyilR8VUgboO5ThF6yu2wCiSv6qc2uxl1aHp9k0NeXMki497f1dnYGjKJHwnjlOq1EzVol yIm72QjRdQ87YEc9fmxzpCtBMYzI7ObWjcH174x2nyiGqEg7ga37k5IMz2BX0s+eicRhKFfpr SJdi5vWGKpVT4mPvlwd/ZrstREN0yCcHsvhnc+rB6rxWbtFDHwWP/sdO5J95SOOcDM52BhTyY 3N6cdtkilFppoiyiSi8brQbnBYoEm2hX7Kqm+fP00SxnDNWfAWcVNVF0atSCOtTUv0I/ynfUG 4OGYN78ikqJdu35fDBZtJuSaM8EGbv3mkUNaCnHX0vfhMq7Eb2kww+drDpFx7WTOMKun6YfiS TURj9aW9EKFD4N8Eho1kOhdnH7DGVp7u/IjdzXU9f9x3RGlQnZF0/+LP2u0DVnHygODQctzIk L0BKc5iKx8U4r3S+ai6kEnbZQ4F0AErEA3U0628QjqYdBIjwD7hv4nNbfquAp8rUBgVfT/Kqh 0lFGwmEOUWQ5rFG1Xvz1Z222i9ROkXjbEe8Vvz+xavoNM415yJ3BL3se29ph5ZPKt0cBCA0He yZP7fL1Aj70Fb8GsWAkiRrh2at1PxGDUtbXvwF+5qgf1YgBasXqUZ2QsSz+pCxiE6F2m1q3+m CyXl1lXayeJobydRL6FenhOvaZqdCNnk8lnuHGe48EcEaXEmWuMyvGtvaUzhuy2TvudRd7kzR CbqMGsrK91HnKn4GcT43BiR7vC3cQ== X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 17:18:26 -0000 --Sig_/fmn.CyBi2jMOTbw.9pdX8y2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am Thu, 26 Oct 2017 15:28:18 +0000 (UTC) Alan Somers schrieb: > Author: asomers > Date: Thu Oct 26 15:28:18 2017 > New Revision: 325011 > URL: https://svnweb.freebsd.org/changeset/base/325011 >=20 > Log: > zfsd should be able to online an L2ARC that disappears and returns > =20 > Previously, this didn't work because L2ARC devices' labels don't contain > pool GUIDs. Modify zfsd so that the pool GUID won't be required: > =20 > lib/libdevdctl/guid.h > Change INVALID_GUID from a uint64_t constant to a function that > returns an invalid Guid object. Remove the void constructor. > Nothing uses it, and it violates RAII. > =20 > cddl/usr.sbin/zfsd/case_file.h > cddl/usr.sbin/zfsd/case_file.cc > Allow CaseFile::Find to match a CaseFile based on Vdev GUID alone. > In CaseFile::ReEvaluate, attempt to online devices even if the newly > arrived device has no pool GUID. > =20 > cddl/usr.sbin/zfsd/vdev_iterator.cc > Iterate through a pool's cache devices as well as its regular > devices. > =20 > Reported by: avg > Reviewed by: avg > MFC after: 3 weeks > Sponsored by: Spectra Logic Corp > Differential Revision: https://reviews.freebsd.org/D12791 >=20 > Modified: > head/cddl/usr.sbin/zfsd/case_file.cc > head/cddl/usr.sbin/zfsd/case_file.h > head/cddl/usr.sbin/zfsd/vdev_iterator.cc > head/lib/libdevdctl/guid.h >=20 > Modified: head/cddl/usr.sbin/zfsd/case_file.cc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/cddl/usr.sbin/zfsd/case_file.cc Thu Oct 26 13:23:13 2017 > (r325010) +++ head/cddl/usr.sbin/zfsd/case_file.cc Thu Oct 26 15:28:18 > 2017 (r325011) @@ -102,7 +102,8 @@ CaseFile::Find(Guid poolGUID, Guid vde= vGUID) > for (CaseFileList::iterator curCase =3D s_activeCases.begin(); > curCase !=3D s_activeCases.end(); curCase++) { > =20 > - if ((*curCase)->PoolGUID() !=3D poolGUID > + if (((*curCase)->PoolGUID() !=3D poolGUID > + && Guid::InvalidGuid() !=3D poolGUID) > || (*curCase)->VdevGUID() !=3D vdevGUID) > continue; > =20 > @@ -268,7 +269,8 @@ CaseFile::ReEvaluate(const string &devPath, const stri > } > =20 > if (vdev !=3D NULL > - && vdev->PoolGUID() =3D=3D m_poolGUID > + && ( vdev->PoolGUID() =3D=3D m_poolGUID > + || vdev->PoolGUID() =3D=3D Guid::InvalidGuid()) > && vdev->GUID() =3D=3D m_vdevGUID) { > =20 > zpool_vdev_online(pool, vdev->GUIDString().c_str(), >=20 > Modified: head/cddl/usr.sbin/zfsd/case_file.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/cddl/usr.sbin/zfsd/case_file.h Thu Oct 26 13:23:13 2017 (r325010) > +++ head/cddl/usr.sbin/zfsd/case_file.h Thu Oct 26 15:28:18 2017 (r325011) > @@ -89,6 +89,8 @@ class CaseFile (public) > * \brief Find a CaseFile object by a vdev's pool/vdev GUID tuple. > * > * \param poolGUID Pool GUID for the vdev of the CaseFile to find. > + * If InvalidGuid, then only match the vdev GUID > + * instead of both pool and vdev GUIDs. > * \param vdevGUID Vdev GUID for the vdev of the CaseFile to find. > * > * \return If found, a pointer to a valid CaseFile object. >=20 > Modified: head/cddl/usr.sbin/zfsd/vdev_iterator.cc > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/cddl/usr.sbin/zfsd/vdev_iterator.cc Thu Oct 26 13:23:13 2017 > (r325010) +++ head/cddl/usr.sbin/zfsd/vdev_iterator.cc Thu Oct 26 15:28:18 > 2017 (r325011) @@ -76,7 +76,9 @@ void > VdevIterator::Reset() > { > nvlist_t *rootVdev; > + nvlist **cache_child; > int result; > + uint_t cache_children; > =20 > result =3D nvlist_lookup_nvlist(m_poolConfig, > ZPOOL_CONFIG_VDEV_TREE, > @@ -85,6 +87,13 @@ VdevIterator::Reset() > throw ZfsdException(m_poolConfig, "Unable to extract " > "ZPOOL_CONFIG_VDEV_TREE from pool."); > m_vdevQueue.assign(1, rootVdev); > + result =3D nvlist_lookup_nvlist_array(rootVdev, > + ZPOOL_CONFIG_L2CACHE, > + &cache_child, > + &cache_children); > + if (result =3D=3D 0) > + for (uint_t c =3D 0; c < cache_children; c++) > + m_vdevQueue.push_back(cache_child[c]); > } > =20 > nvlist_t * >=20 > Modified: head/lib/libdevdctl/guid.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/lib/libdevdctl/guid.h Thu Oct 26 13:23:13 2017 (r325010) > +++ head/lib/libdevdctl/guid.h Thu Oct 26 15:28:18 2017 (r325011) > @@ -62,9 +62,9 @@ class Guid > { > public: > /* Constructors */ > - Guid(); > Guid(uint64_t guid); > Guid(const std::string &guid); > + static Guid InvalidGuid(); > =20 > /* Assignment */ > Guid& operator=3D(const Guid& rhs); > @@ -80,23 +80,24 @@ class Guid > operator uint64_t() const; > operator bool() const; > =20 > - static const uint64_t INVALID_GUID =3D 0; > protected: > + static const uint64_t INVALID_GUID =3D 0; > + > /* The integer value of the GUID. */ > uint64_t m_GUID; > }; > =20 > //- Guid Inline Public Methods -----------------------------------------= ------- > inline > -Guid::Guid() > - : m_GUID(INVALID_GUID) > +Guid::Guid(uint64_t guid) > + : m_GUID(guid) > { > } > =20 > -inline > -Guid::Guid(uint64_t guid) > - : m_GUID(guid) > +inline Guid > +Guid::InvalidGuid() > { > + return (Guid(INVALID_GUID)); > } > =20 > inline Guid& > _______________________________________________ > 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" Building world and kernel on revision 325014 fails with=20 [...] =3D=3D=3D> gnu/usr.bin/binutils/ld (all) --- all_subdir_lib --- --- lrint_test --- (cd /usr/src/lib/msun/tests && DEPENDFILE=3D.depend.lrint_test NO_SUBDIR= =3D1 make -f /usr/src/lib/msun/tests/Makefile _RECURSING_PROGS=3Dt PROG=3Dlrint_test= ) --- all_subdir_cddl --- --- all_subdir_cddl/usr.sbin/zfsd --- --- vdev.o --- /usr/src/cddl/usr.sbin/zfsd/vdev.cc:81:7: error: constructor for 'Vdev' mus= t explicitly initialize the member 'm_poolGUID' which does not have a default constructo= r Vdev::Vdev() and this pacth seems to be the culprit. Kind regards, Oliver --=20 O. Hartmann Ich widerspreche der Nutzung oder =C3=9Cbermittlung meiner Daten f=C3=BCr Werbezwecke oder f=C3=BCr die Markt- oder Meinungsforschung (=C2=A7 28 Abs.= 4 BDSG). --Sig_/fmn.CyBi2jMOTbw.9pdX8y2 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iLUEARMKAB0WIQQZVZMzAtwC2T/86TrS528fyFhYlAUCWfIYygAKCRDS528fyFhY lEsxAf9B4z69n/pPobqUgNynscdBeD+4fI7dtL33Yat9Wh9Vpy0FGDp7Oitaho3Z RYplJRJ9xrW06mCpJ+KcpW1WnM96Af93uHdC8qVVaetnk8mCn2oROEj7T2lCgkSS WKvygjgozvSBSrBv9PSEuCvt4JJrulzlI1VD1mpPT/UAtjOyHaUW =uS/l -----END PGP SIGNATURE----- --Sig_/fmn.CyBi2jMOTbw.9pdX8y2-- From owner-svn-src-head@freebsd.org Thu Oct 26 17:56:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38B55E4FB6C; Thu, 26 Oct 2017 17:56:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 082A33C04; Thu, 26 Oct 2017 17:56:34 +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 v9QHuYP3080450; Thu, 26 Oct 2017 17:56:34 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QHuYm6080449; Thu, 26 Oct 2017 17:56:34 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201710261756.v9QHuYm6080449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 26 Oct 2017 17:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325016 - head/lib/libdevdctl X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libdevdctl X-SVN-Commit-Revision: 325016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 17:56:35 -0000 Author: asomers Date: Thu Oct 26 17:56:34 2017 New Revision: 325016 URL: https://svnweb.freebsd.org/changeset/base/325016 Log: Partially revert r325011: restore Guid's default constructor Reported by: ohartmann MFC after: 3 weeks X-MFC-With: 325011 Sponsored by: Spectra Logic Corp Modified: head/lib/libdevdctl/guid.h Modified: head/lib/libdevdctl/guid.h ============================================================================== --- head/lib/libdevdctl/guid.h Thu Oct 26 17:45:01 2017 (r325015) +++ head/lib/libdevdctl/guid.h Thu Oct 26 17:56:34 2017 (r325016) @@ -62,7 +62,11 @@ class Guid { public: /* Constructors */ + /* Default constructor: an Invalid guid */ + Guid(); + /* Construct a guid from a provided integer */ Guid(uint64_t guid); + /* Construct a guid from a string in base 8, 10, or 16 */ Guid(const std::string &guid); static Guid InvalidGuid(); @@ -88,6 +92,12 @@ class Guid }; //- Guid Inline Public Methods ------------------------------------------------ +inline +Guid::Guid() + : m_GUID(INVALID_GUID) +{ +} + inline Guid::Guid(uint64_t guid) : m_GUID(guid) From owner-svn-src-head@freebsd.org Thu Oct 26 18:32:05 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6300E507AD; Thu, 26 Oct 2017 18:32:05 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2B7B644E6; Thu, 26 Oct 2017 18:32:05 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9QIW4Js097215; Thu, 26 Oct 2017 18:32:04 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QIW4RX097214; Thu, 26 Oct 2017 18:32:04 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201710261832.v9QIW4RX097214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Thu, 26 Oct 2017 18:32:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325017 - head/sys/contrib/libnv X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/sys/contrib/libnv X-SVN-Commit-Revision: 325017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 18:32:06 -0000 Author: jilles Date: Thu Oct 26 18:32:04 2017 New Revision: 325017 URL: https://svnweb.freebsd.org/changeset/base/325017 Log: libnv: Fix strict-aliasing violation with cookie In rS323851, some casts were adjusted in calls to nvlist_next() and nvlist_get_pararr() in order to make scan-build happy. I think these changes just confused scan-build into not reporting the strict-aliasing violation. For example, nvlist_xdescriptors() is causing nvlist_next() to write to its local variable nvp of type nvpair_t * using the lvalue *cookiep of type void *, which is not allowed. Given the APIs of nvlist_next(), nvlist_get_parent() and nvlist_get_pararr(), one possible fix is to create a local void *cookie in nvlist_xdescriptors() and other places, and to convert the value to nvpair_t * when necessary. This patch implements that fix. Reviewed by: oshogbo MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12760 Modified: head/sys/contrib/libnv/nvlist.c Modified: head/sys/contrib/libnv/nvlist.c ============================================================================== --- head/sys/contrib/libnv/nvlist.c Thu Oct 26 17:56:34 2017 (r325016) +++ head/sys/contrib/libnv/nvlist.c Thu Oct 26 18:32:04 2017 (r325017) @@ -707,15 +707,17 @@ out: static int * nvlist_xdescriptors(const nvlist_t *nvl, int *descs) { + void *cookie; nvpair_t *nvp; int type; NVLIST_ASSERT(nvl); PJDLOG_ASSERT(nvl->nvl_error == 0); - nvp = NULL; + cookie = NULL; do { - while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) { + while (nvlist_next(nvl, &type, &cookie) != NULL) { + nvp = cookie; switch (type) { case NV_TYPE_DESCRIPTOR: *descs = nvpair_get_descriptor(nvp); @@ -737,7 +739,7 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs) } case NV_TYPE_NVLIST: nvl = nvpair_get_nvlist(nvp); - nvp = NULL; + cookie = NULL; break; case NV_TYPE_NVLIST_ARRAY: { @@ -749,12 +751,12 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs) PJDLOG_ASSERT(nitems > 0); nvl = value[0]; - nvp = NULL; + cookie = NULL; break; } } } - } while ((nvl = nvlist_get_pararr(nvl, (void *)&nvp)) != NULL); + } while ((nvl = nvlist_get_pararr(nvl, &cookie)) != NULL); return (descs); } @@ -784,6 +786,7 @@ size_t nvlist_ndescriptors(const nvlist_t *nvl) { #ifndef _KERNEL + void *cookie; nvpair_t *nvp; size_t ndescs; int type; @@ -792,16 +795,17 @@ nvlist_ndescriptors(const nvlist_t *nvl) PJDLOG_ASSERT(nvl->nvl_error == 0); ndescs = 0; - nvp = NULL; + cookie = NULL; do { - while (nvlist_next(nvl, &type, (void *)&nvp) != NULL) { + while (nvlist_next(nvl, &type, &cookie) != NULL) { + nvp = cookie; switch (type) { case NV_TYPE_DESCRIPTOR: ndescs++; break; case NV_TYPE_NVLIST: nvl = nvpair_get_nvlist(nvp); - nvp = NULL; + cookie = NULL; break; case NV_TYPE_NVLIST_ARRAY: { @@ -813,7 +817,7 @@ nvlist_ndescriptors(const nvlist_t *nvl) PJDLOG_ASSERT(nitems > 0); nvl = value[0]; - nvp = NULL; + cookie = NULL; break; } case NV_TYPE_DESCRIPTOR_ARRAY: @@ -827,7 +831,7 @@ nvlist_ndescriptors(const nvlist_t *nvl) } } } - } while ((nvl = nvlist_get_pararr(nvl, (void *)&nvp)) != NULL); + } while ((nvl = nvlist_get_pararr(nvl, &cookie)) != NULL); return (ndescs); #else From owner-svn-src-head@freebsd.org Thu Oct 26 19:45:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34E9FE51CA5; Thu, 26 Oct 2017 19:45:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 040E866E1A; Thu, 26 Oct 2017 19:45:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9QJjFUM030110; Thu, 26 Oct 2017 19:45:15 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QJjFaW030109; Thu, 26 Oct 2017 19:45:15 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201710261945.v9QJjFaW030109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 26 Oct 2017 19:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325018 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 325018 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 19:45:16 -0000 Author: asomers Date: Thu Oct 26 19:45:15 2017 New Revision: 325018 URL: https://svnweb.freebsd.org/changeset/base/325018 Log: Fix aio_suspend in 32-bit emulation An off-by-one error has been present since the system call was first present in 185878. It additionally became a memory corruption bug after change 324941. The failure is actually revealed by our existing AIO tests. However, apparently nobody's been running those in 32-bit emulation mode. Reported by: Coverity, cem CID: 1382114 MFC after: 18 days X-MFC-With: 324941 Sponsored by: Spectra Logic Corp Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Thu Oct 26 18:32:04 2017 (r325017) +++ head/sys/kern/vfs_aio.c Thu Oct 26 19:45:15 2017 (r325018) @@ -2814,7 +2814,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs error = copyin(uap->aiocbp, ujoblist32, uap->nent * sizeof(ujoblist32[0])); if (error == 0) { - for (i = uap->nent; i > 0; i--) + for (i = uap->nent - 1; i >= 0; i--) ujoblist[i] = PTRIN(ujoblist32[i]); error = kern_aio_suspend(td, uap->nent, ujoblist, tsp); From owner-svn-src-head@freebsd.org Thu Oct 26 20:33:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AADC7E52ADF; Thu, 26 Oct 2017 20:33:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 9198568948; Thu, 26 Oct 2017 20:33:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v9QKO0P0006539 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 26 Oct 2017 13:24:01 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v9QKO09O006538; Thu, 26 Oct 2017 13:24:00 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 26 Oct 2017 13:24:00 -0700 From: Gleb Smirnoff To: Edward Tomasz Napierala Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r325009 - head/sys/geom/mountver Message-ID: <20171026202400.GF1100@FreeBSD.org> References: <201710261018.v9QAIVsT088779@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201710261018.v9QAIVsT088779@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 20:33:11 -0000 Hi Edward, On Thu, Oct 26, 2017 at 10:18:31AM +0000, Edward Tomasz Napierala wrote: E> Log: E> Make gmountver(8) use direct dispatch. E> E> MFC after: 2 weeks E> E> Modified: E> head/sys/geom/mountver/g_mountver.c E> E> Modified: head/sys/geom/mountver/g_mountver.c E> ============================================================================== E> --- head/sys/geom/mountver/g_mountver.c Thu Oct 26 10:11:35 2017 (r325008) E> +++ head/sys/geom/mountver/g_mountver.c Thu Oct 26 10:18:31 2017 (r325009) E> @@ -257,7 +257,7 @@ g_mountver_create(struct gctl_req *req, struct g_class E> } E> gp = g_new_geomf(mp, "%s", name); E> sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); E> - mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF); E> + mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_RECURSE); MTX_RECURSE is a flag not a type, should be: mtx_init(&sc->sc_mtx, "gmountver", NULL, MTX_DEF | MTX_RECURSE); -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Thu Oct 26 20:44:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0A24E52D91; Thu, 26 Oct 2017 20:44:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id 8ADAB692D1; Thu, 26 Oct 2017 20:44:43 +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 v9QKigpC055661; Thu, 26 Oct 2017 20:44:42 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QKigHZ055658; Thu, 26 Oct 2017 20:44:42 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201710262044.v9QKigHZ055658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 26 Oct 2017 20:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325019 - in head: share/man/man9 sys/contrib/libnv sys/sys X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head: share/man/man9 sys/contrib/libnv sys/sys X-SVN-Commit-Revision: 325019 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 20:44:43 -0000 Author: oshogbo Date: Thu Oct 26 20:44:42 2017 New Revision: 325019 URL: https://svnweb.freebsd.org/changeset/base/325019 Log: Introduce cnvlist_name() and cnvlist_type() functions. Those function can be used when we are iterating over nvlist to reduce amount of extra variables we need to declare. MFC after: 1 month Modified: head/share/man/man9/cnv.9 head/sys/contrib/libnv/cnvlist.c head/sys/sys/cnv.h Modified: head/share/man/man9/cnv.9 ============================================================================== --- head/share/man/man9/cnv.9 Thu Oct 26 19:45:15 2017 (r325018) +++ head/share/man/man9/cnv.9 Thu Oct 26 20:44:42 2017 (r325019) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 27, 2016 +.Dd October 26, 2017 .Dt CNV 9 .Os .Sh NAME @@ -37,6 +37,11 @@ .Lb libnv .Sh SYNOPSIS .In sys/cnv.h +.Ft const char * +.Fn cnvlist_name "void *cookiep" +.Ft int +.Fn cnvlist_type "void *cookiep" +.\" .Ft bool .Fn cnvlist_get_bool "void *cookiep" .Ft uint64_t @@ -121,6 +126,16 @@ The concept of cookies is explained in and .Fn nvlist_get_pararr from +.Xr nv 9 . +.Pp +The +.Fn cnvlist_name +function returns the name of an element associated with the given cookie. +.Pp +The +.Fn cnvlist_type +function returns the type of an element associated with the given cookie. +Types which can be returned are described in .Xr nv 9 . .Pp The Modified: head/sys/contrib/libnv/cnvlist.c ============================================================================== --- head/sys/contrib/libnv/cnvlist.c Thu Oct 26 19:45:15 2017 (r325018) +++ head/sys/contrib/libnv/cnvlist.c Thu Oct 26 20:44:42 2017 (r325019) @@ -53,6 +53,20 @@ __FBSDID("$FreeBSD$"); #include "nvlist_impl.h" #include "nvpair_impl.h" +const char * +cnvlist_name(void *cookiep) +{ + + return (nvpair_name(cookiep)); +} + +int +cnvlist_type(void *cookiep) +{ + + return (nvpair_type(cookiep)); +} + #define CNVLIST_GET(ftype, type, NVTYPE) \ ftype \ cnvlist_get_##type(void *cookiep) \ Modified: head/sys/sys/cnv.h ============================================================================== --- head/sys/sys/cnv.h Thu Oct 26 19:45:15 2017 (r325018) +++ head/sys/sys/cnv.h Thu Oct 26 20:44:42 2017 (r325019) @@ -48,6 +48,12 @@ typedef struct nvlist nvlist_t; __BEGIN_DECLS /* + * Functions which returns information about the given cookie. + */ +const char *cnvlist_name(void *cookiep); +int cnvlist_type(void *cookiep); + +/* * The cnvlist_get functions returns value associated with the given cookie. * If it returns a pointer, the pointer represents internal buffer and should * not be freed by the caller. From owner-svn-src-head@freebsd.org Thu Oct 26 20:53:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A87DFE52FD2; Thu, 26 Oct 2017 20:53:57 +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 mx1.freebsd.org (Postfix) with ESMTPS id 7607A69740; Thu, 26 Oct 2017 20:53:57 +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 v9QKru2K059707; Thu, 26 Oct 2017 20:53:56 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QKruXf059706; Thu, 26 Oct 2017 20:53:56 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201710262053.v9QKruXf059706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 26 Oct 2017 20:53:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325020 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 325020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 20:53:57 -0000 Author: kp Date: Thu Oct 26 20:53:56 2017 New Revision: 325020 URL: https://svnweb.freebsd.org/changeset/base/325020 Log: pf tests: destroy jails before destroying interfaces When cleaning up we must destroy the jails before we destroy the interfaces. Otherwise we might try to destroy interfaces that belong to a jail, which won't work and fail to completely clean up. Modified: head/tests/sys/netpfil/pf/utils.subr Modified: head/tests/sys/netpfil/pf/utils.subr ============================================================================== --- head/tests/sys/netpfil/pf/utils.subr Thu Oct 26 20:44:42 2017 (r325019) +++ head/tests/sys/netpfil/pf/utils.subr Thu Oct 26 20:53:56 2017 (r325020) @@ -51,17 +51,17 @@ pft_set_rules() pft_cleanup() { - if [ -f created_interfaces.lst ]; then - for ifname in `cat created_interfaces.lst` + if [ -f created_jails.lst ]; then + for jailname in `cat created_jails.lst` do - ifconfig ${ifname} destroy + jail -r ${jailname} done fi - if [ -f created_jails.lst ]; then - for jailname in `cat created_jails.lst` + if [ -f created_interfaces.lst ]; then + for ifname in `cat created_interfaces.lst` do - jail -r ${jailname} + ifconfig ${ifname} destroy done fi } From owner-svn-src-head@freebsd.org Thu Oct 26 20:54:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8942EE53046; Thu, 26 Oct 2017 20:54:53 +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 mx1.freebsd.org (Postfix) with ESMTPS id 652506989A; Thu, 26 Oct 2017 20:54:53 +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 v9QKsq7P059787; Thu, 26 Oct 2017 20:54:52 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QKsqCY059785; Thu, 26 Oct 2017 20:54:52 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201710262054.v9QKsqCY059785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 26 Oct 2017 20:54:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325021 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 325021 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 20:54:53 -0000 Author: kp Date: Thu Oct 26 20:54:52 2017 New Revision: 325021 URL: https://svnweb.freebsd.org/changeset/base/325021 Log: pf tests: Fragmentation (v6) test Test fragmentation handling (i.e. scrub fragment reassemble) code for IPv6. Two simple tests: Ping a host (jail) and test forwarding of fragmented packets. Added: head/tests/sys/netpfil/pf/fragmentation.sh (contents, props changed) Modified: head/tests/sys/netpfil/pf/Makefile Modified: head/tests/sys/netpfil/pf/Makefile ============================================================================== --- head/tests/sys/netpfil/pf/Makefile Thu Oct 26 20:53:56 2017 (r325020) +++ head/tests/sys/netpfil/pf/Makefile Thu Oct 26 20:54:52 2017 (r325021) @@ -6,6 +6,7 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil/pf ATF_TESTS_SH+= pass_block \ forward \ + fragmentation \ set_tos ${PACKAGE}FILES+= utils.subr \ Added: head/tests/sys/netpfil/pf/fragmentation.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/fragmentation.sh Thu Oct 26 20:54:52 2017 (r325021) @@ -0,0 +1,74 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPv6 fragmentation test' + atf_set require.user root + atf_set require.progs scapy +} + +v6_body() +{ + pft_init + + epair_send=$(pft_mkepair) + epair_link=$(pft_mkepair) + + pft_mkjail alcatraz ${epair_send}b ${epair_link}a + pft_mkjail singsing ${epair_link}b + + ifconfig ${epair_send}a inet6 2001:db8:42::1/64 no_dad up + + jexec alcatraz ifconfig ${epair_send}b inet6 2001:db8:42::2/64 no_dad up + jexec alcatraz ifconfig ${epair_link}a inet6 2001:db8:43::2/64 no_dad up + jexec alcatraz sysctl net.inet6.ip6.forwarding=1 + + jexec singsing ifconfig ${epair_link}b inet6 2001:db8:43::3/64 no_dad up + jexec singsing route add -6 2001:db8:42::/64 2001:db8:43::2 + route add -6 2001:db8:43::/64 2001:db8:42::2 + + jexec alcatraz ifconfig ${epair_send}b inet6 -ifdisabled + jexec alcatraz ifconfig ${epair_link}a inet6 -ifdisabled + jexec singsing ifconfig ${epair_link}b inet6 -ifdisabled + ifconfig ${epair_send}a inet6 -ifdisabled + + jexec alcatraz pfctl -e + pft_set_rules alcatraz \ + "scrub fragment reassemble" \ + "block in" \ + "pass in inet6 proto icmp6 icmp6-type { neighbrsol, neighbradv }" \ + "pass in inet6 proto icmp6 icmp6-type { echoreq, echorep }" + + # Host test + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8:42::2 + + atf_check -s exit:0 -o ignore \ + ping6 -c 1 -s 4500 2001:db8:42::2 + + atf_check -s exit:0 -o ignore\ + ping6 -c 1 -b 70000 -s 65000 2001:db8:42::2 + + # Forwarding test + atf_check -s exit:0 -o ignore \ + ping6 -c 1 2001:db8:43::3 + + atf_check -s exit:0 -o ignore \ + ping6 -c 1 -s 4500 2001:db8:43::3 + + atf_check -s exit:0 -o ignore\ + ping6 -c 1 -b 70000 -s 65000 2001:db8:43::3 +} + +v6_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v6" +} From owner-svn-src-head@freebsd.org Thu Oct 26 20:55:35 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D34DE530AE; Thu, 26 Oct 2017 20:55:35 +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 mx1.freebsd.org (Postfix) with ESMTPS id E0C85699F5; Thu, 26 Oct 2017 20:55:34 +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 v9QKtYTq059881; Thu, 26 Oct 2017 20:55:34 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QKtYlX059880; Thu, 26 Oct 2017 20:55:34 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201710262055.v9QKtYlX059880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 26 Oct 2017 20:55:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325022 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 325022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 20:55:35 -0000 Author: kp Date: Thu Oct 26 20:55:33 2017 New Revision: 325022 URL: https://svnweb.freebsd.org/changeset/base/325022 Log: pf tests: Remove temporary files Remove the created_jails.lst and created_interfaces.lst files in the cleanup code. Modified: head/tests/sys/netpfil/pf/utils.subr Modified: head/tests/sys/netpfil/pf/utils.subr ============================================================================== --- head/tests/sys/netpfil/pf/utils.subr Thu Oct 26 20:54:52 2017 (r325021) +++ head/tests/sys/netpfil/pf/utils.subr Thu Oct 26 20:55:33 2017 (r325022) @@ -56,6 +56,7 @@ pft_cleanup() do jail -r ${jailname} done + rm created_jails.lst fi if [ -f created_interfaces.lst ]; then @@ -63,5 +64,6 @@ pft_cleanup() do ifconfig ${ifname} destroy done + rm created_interfaces.lst fi } From owner-svn-src-head@freebsd.org Thu Oct 26 22:52:53 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00115E54C6F; Thu, 26 Oct 2017 22:52:52 +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 mx1.freebsd.org (Postfix) with ESMTPS id CFA566CC05; Thu, 26 Oct 2017 22:52:52 +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 v9QMqphw009362; Thu, 26 Oct 2017 22:52:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QMqpvL009359; Thu, 26 Oct 2017 22:52:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710262252.v9QMqpvL009359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Oct 2017 22:52:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325024 - in head/sys: dev/ipmi sys X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: dev/ipmi sys X-SVN-Commit-Revision: 325024 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 22:52:53 -0000 Author: imp Date: Thu Oct 26 22:52:51 2017 New Revision: 325024 URL: https://svnweb.freebsd.org/changeset/base/325024 Log: Various IPMI watchdog timer improvements o Make hw.ipmi.on a tuneable o Changes to keep shutdown from hanging indefinitately after the wd would normally have been disabled. o Add support for setting pretimeout (which fires an interrupt some time before the actual watchdog expires) o Allow refinement of the actions to take when the watchdog expires o Allow special startup timeout to keep us from hanging in boot before watchdogd is started, but after we've loaded the kernel. Obtained From: Netflix OCA Firmware Modified: head/sys/dev/ipmi/ipmi.c head/sys/dev/ipmi/ipmivars.h head/sys/sys/ipmi.h Modified: head/sys/dev/ipmi/ipmi.c ============================================================================== --- head/sys/dev/ipmi/ipmi.c Thu Oct 26 22:19:28 2017 (r325023) +++ head/sys/dev/ipmi/ipmi.c Thu Oct 26 22:52:51 2017 (r325024) @@ -81,10 +81,28 @@ static void ipmi_dtor(void *arg); int ipmi_attached = 0; static int on = 1; +static bool wd_in_shutdown = false; +static int wd_timer_actions = IPMI_SET_WD_ACTION_POWER_CYCLE; +static int wd_shutdown_countdown = 420; /* sec */ +static int wd_startup_countdown = 420; /* sec */ +static int wd_pretimeout_countdown = 120; /* sec */ + static SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD, 0, "IPMI driver parameters"); -SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RW, +SYSCTL_INT(_hw_ipmi, OID_AUTO, on, CTLFLAG_RWTUN, &on, 0, ""); +SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_timer_actions, CTLFLAG_RW, + &wd_timer_actions, 0, + "IPMI watchdog timer actions (including pre-timeout interrupt)"); +SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_shutdown_countdown, CTLFLAG_RW, + &wd_shutdown_countdown, 0, + "IPMI watchdog countdown for shutdown (seconds)"); +SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_startup_countdown, CTLFLAG_RDTUN, + &wd_startup_countdown, 0, + "IPMI watchdog countdown initialized during startup (seconds)"); +SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_pretimeout_countdown, CTLFLAG_RW, + &wd_pretimeout_countdown, 0, + "IPMI watchdog pre-timeout countdown (seconds)"); static struct cdevsw ipmi_cdevsw = { .d_version = D_VERSION, @@ -631,8 +649,8 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int if (sec) { req->ir_request[0] = IPMI_SET_WD_TIMER_DONT_STOP | IPMI_SET_WD_TIMER_SMS_OS; - req->ir_request[1] = IPMI_SET_WD_ACTION_RESET; - req->ir_request[2] = 0; + req->ir_request[1] = (wd_timer_actions & 0xff); + req->ir_request[2] = (wd_pretimeout_countdown & 0xff); req->ir_request[3] = 0; /* Timer use */ req->ir_request[4] = (sec * 10) & 0xff; req->ir_request[5] = (sec * 10) >> 8; @@ -657,21 +675,40 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error) unsigned int timeout; int e; - if (dumping) + /* Ignore requests while disabled. */ + if (!on) return; + /* + * To prevent infinite hangs, we don't let anyone pat or change + * the watchdog when we're shutting down. (See ipmi_shutdown_event().) + * However, we do want to keep patting the watchdog while we are doing + * a coredump. + */ + if (wd_in_shutdown) { + if (dumping && sc->ipmi_watchdog_active) + ipmi_reset_watchdog(sc); + return; + } + cmd &= WD_INTERVAL; if (cmd > 0 && cmd <= 63) { timeout = ((uint64_t)1 << cmd) / 1000000000; if (timeout == 0) timeout = 1; - if (timeout != sc->ipmi_watchdog_active) { + if (timeout != sc->ipmi_watchdog_active || + wd_timer_actions != sc->ipmi_watchdog_actions || + wd_pretimeout_countdown != sc->ipmi_watchdog_pretimeout) { e = ipmi_set_watchdog(sc, timeout); if (e == 0) { sc->ipmi_watchdog_active = timeout; + sc->ipmi_watchdog_actions = wd_timer_actions; + sc->ipmi_watchdog_pretimeout = wd_pretimeout_countdown; } else { (void)ipmi_set_watchdog(sc, 0); sc->ipmi_watchdog_active = 0; + sc->ipmi_watchdog_actions = 0; + sc->ipmi_watchdog_pretimeout = 0; } } if (sc->ipmi_watchdog_active != 0) { @@ -681,9 +718,14 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error) } else { (void)ipmi_set_watchdog(sc, 0); sc->ipmi_watchdog_active = 0; + sc->ipmi_watchdog_actions = 0; + sc->ipmi_watchdog_pretimeout = 0; } } } else if (atomic_readandclear_int(&sc->ipmi_watchdog_active) != 0) { + sc->ipmi_watchdog_actions = 0; + sc->ipmi_watchdog_pretimeout = 0; + e = ipmi_set_watchdog(sc, 0); if (e != 0 && cmd == 0) *error = EOPNOTSUPP; @@ -691,6 +733,40 @@ ipmi_wd_event(void *arg, unsigned int cmd, int *error) } static void +ipmi_shutdown_event(void *arg, unsigned int cmd, int *error) +{ + struct ipmi_softc *sc = arg; + + /* Ignore event if disabled. */ + if (!on) + return; + + /* + * Positive wd_shutdown_countdown value will re-arm watchdog; + * Zero value in wd_shutdown_countdown will disable watchdog; + * Negative value in wd_shutdown_countdown will keep existing state; + * + * Revert to using a power cycle to ensure that the watchdog will + * do something useful here. Having the watchdog send an NMI + * instead is useless during shutdown, and might be ignored if an + * NMI already triggered. + */ + + wd_in_shutdown = true; + if (wd_shutdown_countdown == 0) { + /* disable watchdog */ + ipmi_set_watchdog(sc, 0); + sc->ipmi_watchdog_active = 0; + } else if (wd_shutdown_countdown > 0) { + /* set desired action and time, and, reset watchdog */ + wd_timer_actions = IPMI_SET_WD_ACTION_POWER_CYCLE; + ipmi_set_watchdog(sc, wd_shutdown_countdown); + sc->ipmi_watchdog_active = wd_shutdown_countdown; + ipmi_reset_watchdog(sc); + } +} + +static void ipmi_power_cycle(void *arg, int howto) { struct ipmi_softc *sc = arg; @@ -823,7 +899,10 @@ ipmi_startup(void *arg) device_printf(dev, "Attached watchdog\n"); /* register the watchdog event handler */ sc->ipmi_watchdog_tag = EVENTHANDLER_REGISTER( - watchdog_list, ipmi_wd_event, sc, 0); + watchdog_list, ipmi_wd_event, sc, 0); + sc->ipmi_shutdown_tag = EVENTHANDLER_REGISTER( + shutdown_pre_sync, ipmi_shutdown_event, + sc, 0); } } @@ -836,6 +915,23 @@ ipmi_startup(void *arg) sc->ipmi_cdev->si_drv1 = sc; /* + * Set initial watchdog state. If desired, set an initial + * watchdog on startup. Or, if the watchdog device is + * disabled, clear any existing watchdog. + */ + if (on && wd_startup_countdown > 0) { + wd_timer_actions = IPMI_SET_WD_ACTION_POWER_CYCLE; + if (ipmi_set_watchdog(sc, wd_startup_countdown) == 0 && + ipmi_reset_watchdog(sc) == 0) { + sc->ipmi_watchdog_active = wd_startup_countdown; + sc->ipmi_watchdog_actions = wd_timer_actions; + sc->ipmi_watchdog_pretimeout = wd_pretimeout_countdown; + } else + (void)ipmi_set_watchdog(sc, 0); + ipmi_reset_watchdog(sc); + } else if (!on) + (void)ipmi_set_watchdog(sc, 0); + /* * Power cycle the system off using IPMI. We use last - 1 since we don't * handle all the other kinds of reboots. We'll let others handle them. * We only try to do this if the BMC supports the Chassis device. @@ -892,6 +988,9 @@ ipmi_detach(device_t dev) destroy_dev(sc->ipmi_cdev); /* Detach from watchdog handling and turn off watchdog. */ + if (sc->ipmi_shutdown_tag) + EVENTHANDLER_DEREGISTER(shutdown_pre_sync, + sc->ipmi_shutdown_tag); if (sc->ipmi_watchdog_tag) { EVENTHANDLER_DEREGISTER(watchdog_list, sc->ipmi_watchdog_tag); ipmi_set_watchdog(sc, 0); Modified: head/sys/dev/ipmi/ipmivars.h ============================================================================== --- head/sys/dev/ipmi/ipmivars.h Thu Oct 26 22:19:28 2017 (r325023) +++ head/sys/dev/ipmi/ipmivars.h Thu Oct 26 22:52:51 2017 (r325024) @@ -109,7 +109,10 @@ struct ipmi_softc { int ipmi_driver_requests_polled; eventhandler_tag ipmi_power_cycle_tag; eventhandler_tag ipmi_watchdog_tag; + eventhandler_tag ipmi_shutdown_tag; int ipmi_watchdog_active; + int ipmi_watchdog_actions; + int ipmi_watchdog_pretimeout; struct intr_config_hook ipmi_ich; struct mtx ipmi_requests_lock; struct cv ipmi_request_added; Modified: head/sys/sys/ipmi.h ============================================================================== --- head/sys/sys/ipmi.h Thu Oct 26 22:19:28 2017 (r325023) +++ head/sys/sys/ipmi.h Thu Oct 26 22:52:51 2017 (r325024) @@ -89,7 +89,14 @@ #define IPMI_SET_WD_TIMER_SMS_OS 0x04 #define IPMI_SET_WD_TIMER_DONT_STOP 0x40 +#define IPMI_SET_WD_ACTION_NONE 0x00 #define IPMI_SET_WD_ACTION_RESET 0x01 +#define IPMI_SET_WD_ACTION_POWER_DOWN 0x02 +#define IPMI_SET_WD_ACTION_POWER_CYCLE 0x03 +#define IPMI_SET_WD_PREACTION_NONE (0x00 << 4) +#define IPMI_SET_WD_PREACTION_SMI (0x01 << 4) +#define IPMI_SET_WD_PREACTION_NMI (0x02 << 4) +#define IPMI_SET_WD_PREACTION_MI (0x03 << 4) struct ipmi_msg { unsigned char netfn; From owner-svn-src-head@freebsd.org Thu Oct 26 22:53:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D249E54C9F; Thu, 26 Oct 2017 22:53: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 mx1.freebsd.org (Postfix) with ESMTPS id 892EF6CC4A; Thu, 26 Oct 2017 22:53:05 +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 v9QMr2Fq009422; Thu, 26 Oct 2017 22:53:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QMr2Vw009421; Thu, 26 Oct 2017 22:53:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710262253.v9QMr2Vw009421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Oct 2017 22:53:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325025 - head/sys/dev/ipmi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/ipmi X-SVN-Commit-Revision: 325025 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 22:53:06 -0000 Author: imp Date: Thu Oct 26 22:53:02 2017 New Revision: 325025 URL: https://svnweb.freebsd.org/changeset/base/325025 Log: Make time we wait for a power cycle tunable. hw.ipmi.cycle_time is the time to wait for the power down phase of the ipmi power cycle before falling back to either reboot or halt. Sponsored by: Netflix Modified: head/sys/dev/ipmi/ipmi.c Modified: head/sys/dev/ipmi/ipmi.c ============================================================================== --- head/sys/dev/ipmi/ipmi.c Thu Oct 26 22:52:51 2017 (r325024) +++ head/sys/dev/ipmi/ipmi.c Thu Oct 26 22:53:02 2017 (r325025) @@ -86,6 +86,7 @@ static int wd_timer_actions = IPMI_SET_WD_ACTION_POWER static int wd_shutdown_countdown = 420; /* sec */ static int wd_startup_countdown = 420; /* sec */ static int wd_pretimeout_countdown = 120; /* sec */ +static int cycle_wait = 10; /* sec */ static SYSCTL_NODE(_hw, OID_AUTO, ipmi, CTLFLAG_RD, 0, "IPMI driver parameters"); @@ -103,6 +104,9 @@ SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_startup_countdown, C SYSCTL_INT(_hw_ipmi, OID_AUTO, wd_pretimeout_countdown, CTLFLAG_RW, &wd_pretimeout_countdown, 0, "IPMI watchdog pre-timeout countdown (seconds)"); +SYSCTL_INT(_hw_ipmi, OID_AUTO, cyle_wait, CTLFLAG_RWTUN, + &cycle_wait, 0, + "IPMI power cycle on reboot delay time (seconds)"); static struct cdevsw ipmi_cdevsw = { .d_version = D_VERSION, @@ -797,11 +801,11 @@ ipmi_power_cycle(void *arg, int howto) } /* - * BMCs are notoriously slow, give it up to 10s to effect the power + * BMCs are notoriously slow, give it cyle_wait seconds for the power * down leg of the power cycle. If that fails, fallback to the next * hanlder in the shutdown_final chain and/or the platform failsafe. */ - DELAY(10 * 1000 * 1000); + DELAY(cycle_wait * 1000 * 1000); device_printf(sc->ipmi_dev, "Power cycling via IPMI timed out\n"); } From owner-svn-src-head@freebsd.org Thu Oct 26 22:53:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD235E54D51; Thu, 26 Oct 2017 22:53: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 mx1.freebsd.org (Postfix) with ESMTPS id 76A236CE89; Thu, 26 Oct 2017 22:53: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 v9QMroMc009496; Thu, 26 Oct 2017 22:53:50 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QMrovZ009495; Thu, 26 Oct 2017 22:53:50 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710262253.v9QMrovZ009495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Oct 2017 22:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325026 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 325026 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 22:53:52 -0000 Author: imp Date: Thu Oct 26 22:53:49 2017 New Revision: 325026 URL: https://svnweb.freebsd.org/changeset/base/325026 Log: Always send STANDBY IMMEDIATE when shutting down To save SMART data and for a drive to understand that it's been nicely shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to use a local CCB on the stack. When we're panicing, used xpt_polled_action rather than cam_periph_runccb so that we can SEND IMMEDIATE after we've shutdown the scheduler. Sponsored by: Netflix Reviewed by: scottl@, gallatin@ Differential Revision: https://reviews.freebsd.org/D12799 Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Oct 26 22:53:02 2017 (r325025) +++ head/sys/cam/ata/ata_da.c Thu Oct 26 22:53:49 2017 (r325026) @@ -3466,7 +3466,7 @@ adaspindown(uint8_t cmd, int flags) { struct cam_periph *periph; struct ada_softc *softc; - union ccb *ccb; + struct ccb_ataio local_ccb; int error; CAM_PERIPH_FOREACH(periph, &adadriver) { @@ -3486,8 +3486,11 @@ adaspindown(uint8_t cmd, int flags) if (bootverbose) xpt_print(periph->path, "spin-down\n"); - ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); - cam_fill_ataio(&ccb->ataio, + memset(&local_ccb, 0, sizeof(local_ccb)); + xpt_setup_ccb(&local_ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + local_ccb.ccb_h.ccb_state = ADA_CCB_DUMP; + + cam_fill_ataio(&local_ccb, 0, adadone, CAM_DIR_NONE | flags, @@ -3495,14 +3498,35 @@ adaspindown(uint8_t cmd, int flags) NULL, 0, ada_default_timeout*1000); - ata_28bit_cmd(&ccb->ataio, cmd, 0, 0, 0); + ata_28bit_cmd(&local_ccb, cmd, 0, 0, 0); - error = cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, - /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, - softc->disk->d_devstat); + if (!SCHEDULER_STOPPED()) { + /* + * Not panicing, can just do the normal runccb + * XXX should make cam_periph_runccb work while + * XXX panicing... later + */ + error = cam_periph_runccb((union ccb *)&local_ccb, adaerror, + /*cam_flags*/0, /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, + softc->disk->d_devstat); + } else { + /* + * Panicing, so we have to do this by hand: do + * xpt_polled_action to run the request through the SIM, + * extract the error, and if the queue was frozen, + * unfreeze it. cam_periph_runccb takes care of these + * details, but xpt_polled_action doesn't. + */ + xpt_polled_action((union ccb *)&local_ccb); + error = adaerror((union ccb *)&local_ccb, 0, + SF_NO_RECOVERY | SF_NO_RETRY); + if ((local_ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(local_ccb.ccb_h.path, + /*relsim_flags*/0, /*reduction*/0, + /*timeout*/0, /*getcount_only*/0); + } if (error != 0) xpt_print(periph->path, "Spin-down disk failed\n"); - xpt_release_ccb(ccb); cam_periph_unlock(periph); } } @@ -3512,8 +3536,14 @@ adashutdown(void *arg, int howto) { adaflush(); - if (ada_spindown_shutdown != 0 && - (howto & (RB_HALT | RB_POWEROFF | RB_POWERCYCLE)) != 0) + + /* + * STANDBY IMMEDIATE flushes any volatile data to the drive so + * do this always to ensure we flush a cosnsistent state to + * the drive. adaspindown will ensure that we don't send this + * to a drive that doesn't support it. + */ + if (ada_spindown_shutdown != 0) adaspindown(ATA_STANDBY_IMMEDIATE, 0); } @@ -3522,6 +3552,10 @@ adasuspend(void *arg) { adaflush(); + /* + * SLEEP also fushes any volatile data, like STANDBY IMEDIATE, + * so we don't need to send it as well. + */ if (ada_spindown_suspend != 0) adaspindown(ATA_SLEEP, CAM_DEV_QFREEZE); } From owner-svn-src-head@freebsd.org Thu Oct 26 22:53:59 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D578DE54D76; Thu, 26 Oct 2017 22:53:58 +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 mx1.freebsd.org (Postfix) with ESMTPS id 58DD76CEBF; Thu, 26 Oct 2017 22:53:56 +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 v9QMrtbX009548; Thu, 26 Oct 2017 22:53:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9QMrth0009547; Thu, 26 Oct 2017 22:53:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710262253.v9QMrth0009547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Oct 2017 22:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325027 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 325027 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 22:53:59 -0000 Author: imp Date: Thu Oct 26 22:53:55 2017 New Revision: 325027 URL: https://svnweb.freebsd.org/changeset/base/325027 Log: We should be call adaerror() instead of cam_periph_error() always. Sponsored by: Netflix Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Thu Oct 26 22:53:49 2017 (r325026) +++ head/sys/cam/ata/ata_da.c Thu Oct 26 22:53:55 2017 (r325027) @@ -1080,8 +1080,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical } xpt_polled_action(&ccb); - error = cam_periph_error(&ccb, - 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); + error = adaerror(&ccb, + 0, SF_NO_RECOVERY | SF_NO_RETRY); if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); @@ -1116,8 +1116,8 @@ adadump(void *arg, void *virtual, vm_offset_t physical ata_28bit_cmd(&ccb.ataio, ATA_FLUSHCACHE, 0, 0, 0); xpt_polled_action(&ccb); - error = cam_periph_error(&ccb, - 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); + error = adaerror(&ccb, + 0, SF_NO_RECOVERY | SF_NO_RETRY); if ((ccb.ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(ccb.ccb_h.path, /*relsim_flags*/0, /*reduction*/0, /*timeout*/0, /*getcount_only*/0); From owner-svn-src-head@freebsd.org Thu Oct 26 23:04:26 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F23C3E5518C; Thu, 26 Oct 2017 23:04:26 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com [IPv6:2a00:1450:4010:c07::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 741CA6D779; Thu, 26 Oct 2017 23:04:26 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x236.google.com with SMTP id 75so5478128lfx.1; Thu, 26 Oct 2017 16:04:26 -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=pN50OAiAlEkkPETO8KEOv2eVANtB/3pWAqB9BvEN+4U=; b=fMfK5b8+/FRxiWrIxUdxxJxsUqanEsqK3vxu4KfnJnlVgjKHhnXP30zBSyVmC2Cemw DFwp1zoUxRUFQ5MRTLJZdcpYQTdFAxCY4+8DRVkLED9iDTAUecXzkCK1PoGiHSGQvEN0 vg/+R0C8n4iA/G1v3E62rwDT9TzT19PpfG8gYve1f3AbycRMBVINeBFojgoAwXOQE+kr W47JJDUAySorKbf4Zi+Sk2RwvO7+QsaRS+4Vwsq3uU7mXpotwFXfJtePVG17GKCk7i4j xOHenGFMzbiguXo57iHNGi/j8fom7QnCmBbnC2lffqxUtU1admAkqVv4BKxT1D+mGEzS cioQ== 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=pN50OAiAlEkkPETO8KEOv2eVANtB/3pWAqB9BvEN+4U=; b=T7NEfl4/YZR+o9cL55JzBmYrJot5+1Y8I17c78jH46z9g9EuazU3QmE1jegwOD95gj k6ZineY1cQX8LlwPQH8YbzsFQBbYpulXY/OoPWiBNJ3eqDWsasJb4JVl4bvt6l4+o/qv cuBOudSlNeadpm/6+SSyOhl/PMWtqzyEsFvPqU2AlnYk61YLYfF1pP7QONJ0g1O78lRQ UcwoxMb6Li5JPtjRVe6m7CGEayoYwzIGXp1bd6lhfOer4ZDSYDW/vAHtv10oPa/BhAzh 9rrNqccXdFJQBglciFBlEQdC9df7d64o8MPc51xkKYlLic3NS9m78lKdt5rLU+NXREeu uEHQ== X-Gm-Message-State: AMCzsaVOEFmcgou/Pzc3XfdsFkYj0hfDMIudW91xuPKNlxTgoRif7vIn BPst5Y/l3A2auAqqhyxBugxf/cf+tfQMsmGb/i0= X-Google-Smtp-Source: ABhQp+R26777PlJGWGfm+UumdiMrhMAbX3MkQAxPFY6bX6Yoi66HUWsHtUiLbaAM9LjlnfUx3SH4NNIXhJBbWgY2ks4= X-Received: by 10.46.20.11 with SMTP id u11mr10477414ljd.38.1509059064224; Thu, 26 Oct 2017 16:04:24 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.93.24 with HTTP; Thu, 26 Oct 2017 16:04:23 -0700 (PDT) In-Reply-To: <201710262253.v9QMrovZ009495@repo.freebsd.org> References: <201710262253.v9QMrovZ009495@repo.freebsd.org> From: Alan Somers Date: Thu, 26 Oct 2017 17:04:23 -0600 X-Google-Sender-Auth: 9cQX5WLCQ_CDU09r9-CSfuQRyKU Message-ID: Subject: Re: svn commit: r325026 - head/sys/cam/ata To: Warner Losh 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 23:04:27 -0000 On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh wrote: > Author: imp > Date: Thu Oct 26 22:53:49 2017 > New Revision: 325026 > URL: https://svnweb.freebsd.org/changeset/base/325026 > > Log: > Always send STANDBY IMMEDIATE when shutting down > > To save SMART data and for a drive to understand that it's been nicely > shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to > use a local CCB on the stack. When we're panicing, used > xpt_polled_action rather than cam_periph_runccb so that we can SEND > IMMEDIATE after we've shutdown the scheduler. > > Sponsored by: Netflix > Reviewed by: scottl@, gallatin@ > Differential Revision: https://reviews.freebsd.org/D12799 > > Modified: > head/sys/cam/ata/ata_da.c Will this put the drive into a standby state just prior to a warm reboot? That could cause lengthy delays on the new boot while the drives spin up. That behavior caused a problem when the mpr driver did it to a JBOD full of 96 SATA drives. On the new boot, each drive spun up one at a time while they were being probed. Eventually the system paniced because run_interrupt_driven_hooks timed out. With mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0. -Alan From owner-svn-src-head@freebsd.org Thu Oct 26 23:35:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7C5EE55AC5 for ; Thu, 26 Oct 2017 23:35:16 +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 8A0EF6E3E0 for ; Thu, 26 Oct 2017 23:35:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22f.google.com with SMTP id 134so9026346ioo.0 for ; Thu, 26 Oct 2017 16:35: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=AIe16rq9OT4BNVLKjqd/T/USNZ+4lIqPvC1Jn6L2Tjc=; b=ON9gDyp+NEvEvdtqATne8zf+WICqa4RkqxsRn7/HoJO3+VljEyGGSMN1m9N2ufDJcS 1ixODnq4tnY6CQvaIXvwo57lMceKxFWwySbrugDc5qnBfqzsEXJ80ZVVj9ZHkWj1CfC9 kweVgAiwWBK5TDxPnZjZEl33Ab8hs7nEDdgp8FwL2iMowmnc9ly9NGCMTfHJB1TmNl4e qb2p8Gxr0N1cypDVcGK5Gfma16N8ua+VdGu73uwz6Psp5qQeAPpMoNhxBLKOuJzF/+5g h4BUPQkZerVhSG6E1xTURkpxbJ8hLT1zmVgRTs5K9veHd0zfkzqub5/5MY6rCSOcwOHp Ky5w== 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=AIe16rq9OT4BNVLKjqd/T/USNZ+4lIqPvC1Jn6L2Tjc=; b=c6mOiUo5RmwVWQbWQ3jV3LEak9UpLKkQLT9lxy4akuOg1yWDeVQKyb+HunmfFDsPLJ ssGzQFI7x0TxYUayELSCHcN2WiR9p0NDTvTvE2+Gqkvk0l1HC/AJhmbuvJCjBzmgZAPQ fYInODGmRHkmWpie29Gzy9rHb8vvrB0c9LnyqjYTYHiW+C0xTuHPwRVOr8AxoTvNUqJT ODKgAt9JmzpmKgec4bGrRA8xh40NPkOl+CrlVNvHgI4hrVUYf0vNIxRgDryCB3Iv+fyQ 8yWrikVyjv0YzHh6V9xYCNvloCW21XY4jijmUyqwvT1m360EC3vdMLRS+eZy5X7fOn0i w/1Q== X-Gm-Message-State: AMCzsaURyOHToMwOAdJG98VPjyZMsWBFIZgTLGog/4A+xX2nrNaNtHdN sZW5AyQDc/e3rt9kr3Eg7cBw1SmQfPqA+/c2GAWPCg== X-Google-Smtp-Source: ABhQp+SY+EjB/XVZjVjsnRHVHPse/UL0a5ZzjZupe5zwy3kGb1Wcps2ZS87Fihq2iz3Ub5UfMyK6+ifBZCkNaEJW0Xk= X-Received: by 10.36.94.129 with SMTP id h123mr856189itb.64.1509060915741; Thu, 26 Oct 2017 16:35:15 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Thu, 26 Oct 2017 16:35:15 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:68f3:90da:7630:94a5] In-Reply-To: References: <201710262253.v9QMrovZ009495@repo.freebsd.org> From: Warner Losh Date: Thu, 26 Oct 2017 17:35:15 -0600 X-Google-Sender-Auth: c6lfQFSKhMLnV-jKmFtJ1eSnmMU Message-ID: Subject: Re: svn commit: r325026 - head/sys/cam/ata To: Alan Somers Cc: Warner Losh , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 23:35:16 -0000 On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers wrote: > On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh wrote: > > Author: imp > > Date: Thu Oct 26 22:53:49 2017 > > New Revision: 325026 > > URL: https://svnweb.freebsd.org/changeset/base/325026 > > > > Log: > > Always send STANDBY IMMEDIATE when shutting down > > > > To save SMART data and for a drive to understand that it's been nicely > > shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to > > use a local CCB on the stack. When we're panicing, used > > xpt_polled_action rather than cam_periph_runccb so that we can SEND > > IMMEDIATE after we've shutdown the scheduler. > > > > Sponsored by: Netflix > > Reviewed by: scottl@, gallatin@ > > Differential Revision: https://reviews.freebsd.org/D12799 > > > > Modified: > > head/sys/cam/ata/ata_da.c > > Will this put the drive into a standby state just prior to a warm > reboot? That could cause lengthy delays on the new boot while the > drives spin up. That behavior caused a problem when the mpr driver > did it to a JBOD full of 96 SATA drives. On the new boot, each drive > spun up one at a time while they were being probed. Eventually the > system paniced because run_interrupt_driven_hooks timed out. With > mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0. > That's a good question. The standard is silent about what, exactly, the Standby state means. We already allow this to be disabled, and this commit doesn't change that. It looks like IDLE IMMEDIATE also forces SMART media non volatile to be flushed out. What do you suggest? Warner From owner-svn-src-head@freebsd.org Fri Oct 27 02:27:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7553E5946D for ; Fri, 27 Oct 2017 02:27:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (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 7B50872CC6 for ; Fri, 27 Oct 2017 02:27:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x232.google.com with SMTP id n137so9659896iod.6 for ; Thu, 26 Oct 2017 19:27:23 -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=5A/zArWkcoyc5lO3mVaaxETHcHp4N0Km2sZe50S7r/U=; b=F7xZdIFWV+dxZwBS38/8gVljP1IoliKnBzFNGG2jSQr9npbAD/RsVrb4NfDig7Sjx+ GW6eqaSeBdxRPYkyA454v7YDrI/EQkzgkQxeir2PknCGlM7wD4GJkK5r51D/jJh51CfX sDTQuN4RQp9NTEFAN1/jUnOQTQofpitl4VqaZrMSA8S5cC+ehpmq/BO1WUwhLurMbkCc x+AR0X0gg5+6FNElUCCyV1TjXwtFeXWc/GqPo3aaw+0juIh3ZyfG64YNb2Geg81c5HDf 7J6AKFGKgAZvpRRoGuJCZImw1/eSORoy6h9zmMGxONpmM64AUjNz6OYL4mOUAadOg1Uw qATQ== 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=5A/zArWkcoyc5lO3mVaaxETHcHp4N0Km2sZe50S7r/U=; b=BoBGabKljWMKgfKwOfUnQlHmWfHUytMX1kU2LN9NClLXDbxw76kRx9kVn3bdGOqDgr 3RZry7268hqVHVitIc63Lst9C5AyAlQr0K+gKGp1nxJKnMijZW6bwTZ5iOxgD7iOlGJU JNm5x5PcdH42GYonOj2seaU2uRSnoEkxH1uUwq3K0eHkLLaGdg6uDuOofVRwhXRyep+w 0AUwNvaJJPcPZ3EdLoAxfKhWDIjWyRQOsqTxM+vzU5T4it4PxsPILOFz2eol7LZYQ4Bp pC++wVf+OTZePew/vd66aJGSz1TzhPSpbPdF5KEsYceLxn7yO64ZXhc+H1YviwcooEPY zpdA== X-Gm-Message-State: AMCzsaVlBZRwkts6k5x0/ucAOSDuQXxZNfAacc7SQvv6h8KfoF1UB40Z 9+VsTGCJV7SWoq+AKpO4Rar3ISv2Dt9KC4jGOYro9A== X-Google-Smtp-Source: ABhQp+TZr0IKK6gHF1s91p1ENIMbP2BxCuJKepKblC0Nl+3JQ109J0cg9dklVAmi/sQQGerJuRKOS98Q/PcVLamDWWQ= X-Received: by 10.36.184.5 with SMTP id m5mr1388046ite.69.1509071242870; Thu, 26 Oct 2017 19:27:22 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Thu, 26 Oct 2017 19:27:22 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:68f3:90da:7630:94a5] In-Reply-To: References: <201710262253.v9QMrovZ009495@repo.freebsd.org> From: Warner Losh Date: Thu, 26 Oct 2017 20:27:22 -0600 X-Google-Sender-Auth: oCv8gFfkDYP9n-6k1fof6AEM694 Message-ID: Subject: Re: svn commit: r325026 - head/sys/cam/ata To: Alan Somers Cc: Warner Losh , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 02:27:23 -0000 On Thu, Oct 26, 2017 at 5:35 PM, Warner Losh wrote: > > > On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers wrote: > >> On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh wrote: >> > Author: imp >> > Date: Thu Oct 26 22:53:49 2017 >> > New Revision: 325026 >> > URL: https://svnweb.freebsd.org/changeset/base/325026 >> > >> > Log: >> > Always send STANDBY IMMEDIATE when shutting down >> > >> > To save SMART data and for a drive to understand that it's been nicely >> > shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to >> > use a local CCB on the stack. When we're panicing, used >> > xpt_polled_action rather than cam_periph_runccb so that we can SEND >> > IMMEDIATE after we've shutdown the scheduler. >> > >> > Sponsored by: Netflix >> > Reviewed by: scottl@, gallatin@ >> > Differential Revision: https://reviews.freebsd.org/D12799 >> > >> > Modified: >> > head/sys/cam/ata/ata_da.c >> >> Will this put the drive into a standby state just prior to a warm >> reboot? That could cause lengthy delays on the new boot while the >> drives spin up. That behavior caused a problem when the mpr driver >> did it to a JBOD full of 96 SATA drives. On the new boot, each drive >> spun up one at a time while they were being probed. Eventually the >> system paniced because run_interrupt_driven_hooks timed out. With >> mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0. >> > > That's a good question. The standard is silent about what, exactly, the > Standby state means. We already allow this to be disabled, and this commit > doesn't change that. It looks like IDLE IMMEDIATE also forces SMART media > non volatile to be flushed out. > > What do you suggest? > I see two paths forward. We need to flush the NV SMART data at reboot time. SSDs that we use, at least, consider it an unclean shutdown if you don't Idle the drive on reboot because part of that process does a COMINIT/COMRESET and if the drive is in the Active state, it ticks up the counter (and with at least one vendor can lose NV SMART data). So, path forward #1 is that we do STANDBY IMMEDIATE for SSDs in the RB_REBOOT case or all drives in the other cases. For HDD and RB_REBOOT we do only a IDLE IMMEDIATE which shouldn't spin the drives down. This seems to bake in what we know about storage devices and is easiest for the user. If we get it right, it's easier for the user. If we get it wrong, the user can disable all spin downs. Path forward #2 is to just make what we send a sysctl. This is unsatisfying and error-prone, but gives the most flexibility. I don't like this. I'd be curious if there's another viable path forward I'm not seeing that you might know. FWIW, we don't connect HDDs to our AHCI ports (they are all on MPT/MPS/MPR HBAs), so we've not seen any issues in the 6 or so months we've had this in the tree. Warner From owner-svn-src-head@freebsd.org Fri Oct 27 03:16:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F434E5A189; Fri, 27 Oct 2017 03:16:20 +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 mx1.freebsd.org (Postfix) with ESMTPS id 59F277430D; Fri, 27 Oct 2017 03:16:20 +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 v9R3GJn5017187; Fri, 27 Oct 2017 03:16:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9R3GJ3Y017184; Fri, 27 Oct 2017 03:16:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201710270316.v9R3GJ3Y017184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 27 Oct 2017 03:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325028 - in head: sys/kern sys/sys tests/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: sys/kern sys/sys tests/sys/kern X-SVN-Commit-Revision: 325028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 03:16:20 -0000 Author: jhb Date: Fri Oct 27 03:16:19 2017 New Revision: 325028 URL: https://svnweb.freebsd.org/changeset/base/325028 Log: Discard the correct thread event reported for a ptrace stop. When multiple threads wish to report a tracing event to a debugger, both threads call ptracestop() and one thread will win the race to be the reporting thread (p->p_xthread). The debugger uses PT_LWPINFO with the process ID to determine which thread / LWP is reporting an event and the details of that event. This event is cleared as a side effect of the subsequent ptrace event that resumed the process (PT_CONTINUE, PT_STEP, etc.). However, ptrace() was clearing the event identified by the LWP ID passed to the resume request even if that wasn't the 'p_xthread'. This could result in clearing an event that had not yet been observed by the debugger and leaving the existing event for 'p_thread' pending so that it was reported a second time. Specifically, if the debugger stopped due to a software breakpoint in one thread, but then switched to another thread that was used to resume (e.g. if the user switched to a different thread and issued a step), the resume request (PT_STEP) cleared a pending event (if any) for the thread being stepped. However, the process immediately stopped and the first thread reported it's breakpoint event a second time. The debugger decremented the PC for "both" breakpoint events which resulted in the PC now pointing into the middle of an instruction (on x86) and a SIGILL fault when the process was resumed a second time. To fix, always clear the pending event for 'p_xthread' when resuming a process. ptrace() still honors the requested LWP ID when enabling single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE). Reported by: GDB testsuite (gdb.threads/continue-pending-status.exp) Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12794 Modified: head/sys/kern/sys_process.c head/sys/sys/param.h head/tests/sys/kern/ptrace_test.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Thu Oct 26 22:53:55 2017 (r325027) +++ head/sys/kern/sys_process.c Fri Oct 27 03:16:19 2017 (r325028) @@ -1129,6 +1129,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } sendsig: + /* + * Clear the pending event for the thread that just + * reported its event (p_xthread). This may not be + * the thread passed to PT_CONTINUE, PT_STEP, etc. if + * the debugger is resuming a different thread. + */ + td2 = p->p_xthread; if (proctree_locked) { sx_xunlock(&proctree_lock); proctree_locked = 0; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Oct 26 22:53:55 2017 (r325027) +++ head/sys/sys/param.h Fri Oct 27 03:16:19 2017 (r325028) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200051 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200052 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Thu Oct 26 22:53:55 2017 (r325027) +++ head/tests/sys/kern/ptrace_test.c Fri Oct 27 03:16:19 2017 (r325028) @@ -3463,6 +3463,174 @@ ATF_TC_BODY(ptrace__PT_STEP_with_signal, tc) ATF_REQUIRE(errno == ECHILD); } +#if defined(__amd64__) || defined(__i386__) +/* + * Only x86 both define breakpoint() and have a PC after breakpoint so + * that restarting doesn't retrigger the breakpoint. + */ +static void * +continue_thread(void *arg) +{ + breakpoint(); + return (NULL); +} + +static __dead2 void +continue_thread_main(void) +{ + pthread_t threads[2]; + + CHILD_REQUIRE(pthread_create(&threads[0], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_create(&threads[1], NULL, continue_thread, + NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[0], NULL) == 0); + CHILD_REQUIRE(pthread_join(threads[1], NULL) == 0); + exit(1); +} + +/* + * Ensure that PT_CONTINUE clears the status of the thread that + * triggered the stop even if a different thread's LWP was passed to + * PT_CONTINUE. + */ +ATF_TC_WITHOUT_HEAD(ptrace__PT_CONTINUE_different_thread); +ATF_TC_BODY(ptrace__PT_CONTINUE_different_thread, tc) +{ + struct ptrace_lwpinfo pl; + pid_t fpid, wpid; + lwpid_t lwps[2]; + bool hit_break[2]; + int i, j, status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + continue_thread_main(); + } + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + ATF_REQUIRE(ptrace(PT_LWP_EVENTS, wpid, NULL, 1) == 0); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One of the new threads should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + lwps[0] = pl.pl_lwpid; + + /* + * Suspend this thread to ensure both threads are alive before + * hitting the breakpoint. + */ + ATF_REQUIRE(ptrace(PT_SUSPEND, lwps[0], NULL, 0) != -1); + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* Second thread should report it's birth. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_BORN | PL_FLAG_SCX)) == + (PL_FLAG_BORN | PL_FLAG_SCX)); + ATF_REQUIRE(pl.pl_lwpid != lwps[0]); + lwps[1] = pl.pl_lwpid; + + /* Resume both threads waiting for breakpoint events. */ + hit_break[0] = hit_break[1] = false; + ATF_REQUIRE(ptrace(PT_RESUME, lwps[0], NULL, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + + /* One thread should report a breakpoint. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + hit_break[i] = true; + + /* + * Resume both threads but pass the other thread's LWPID to + * PT_CONTINUE. + */ + ATF_REQUIRE(ptrace(PT_CONTINUE, lwps[i ^ 1], (caddr_t)1, 0) == 0); + + /* + * Will now get two thread exit events and one more breakpoint + * event. + */ + for (j = 0; j < 3; j++) { + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + + if (pl.pl_lwpid == lwps[0]) + i = 0; + else + i = 1; + + ATF_REQUIRE_MSG(lwps[i] != 0, "event for exited thread"); + if (pl.pl_flags & PL_FLAG_EXITED) { + ATF_REQUIRE_MSG(hit_break[i], + "exited thread did not report breakpoint"); + lwps[i] = 0; + } else { + ATF_REQUIRE((pl.pl_flags & PL_FLAG_SI) != 0); + ATF_REQUIRE(pl.pl_siginfo.si_signo == SIGTRAP && + pl.pl_siginfo.si_code == TRAP_BRKPT); + ATF_REQUIRE_MSG(!hit_break[i], + "double breakpoint event"); + hit_break[i] = true; + } + + ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); + } + + /* Both threads should have exited. */ + ATF_REQUIRE(lwps[0] == 0); + ATF_REQUIRE(lwps[1] == 0); + + /* The last event should be for the child process's exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} +#endif + ATF_TP_ADD_TCS(tp) { @@ -3515,6 +3683,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__event_mask_sigkill_discard); ATF_TP_ADD_TC(tp, ptrace__PT_ATTACH_with_SBDRY_thread); ATF_TP_ADD_TC(tp, ptrace__PT_STEP_with_signal); +#if defined(__amd64__) || defined(__i386__) + ATF_TP_ADD_TC(tp, ptrace__PT_CONTINUE_different_thread); +#endif return (atf_no_error()); } From owner-svn-src-head@freebsd.org Fri Oct 27 04:47:45 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4A8C4E5BCA3; Fri, 27 Oct 2017 04:47:45 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1951376BEF; Fri, 27 Oct 2017 04:47:45 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9R4lig5054336; Fri, 27 Oct 2017 04:47:44 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9R4liOC054334; Fri, 27 Oct 2017 04:47:44 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201710270447.v9R4liOC054334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 27 Oct 2017 04:47:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325030 - head/lib/libc/stdio X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/lib/libc/stdio X-SVN-Commit-Revision: 325030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 04:47:45 -0000 Author: cy Date: Fri Oct 27 04:47:44 2017 New Revision: 325030 URL: https://svnweb.freebsd.org/changeset/base/325030 Log: Remove redundant sys/cdefs.h include. MFC after: 1 week Modified: head/lib/libc/stdio/gets.c Modified: head/lib/libc/stdio/gets.c ============================================================================== --- head/lib/libc/stdio/gets.c Fri Oct 27 04:38:42 2017 (r325029) +++ head/lib/libc/stdio/gets.c Fri Oct 27 04:47:44 2017 (r325030) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include #include -#include #include "un-namespace.h" #include "libc_private.h" #include "local.h" From owner-svn-src-head@freebsd.org Fri Oct 27 04:51:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9421FE5BDD1; Fri, 27 Oct 2017 04:51:06 +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 mx1.freebsd.org (Postfix) with ESMTPS id 626D876E04; Fri, 27 Oct 2017 04:51:06 +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 v9R4p5fG054506; Fri, 27 Oct 2017 04:51:05 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9R4p5DJ054505; Fri, 27 Oct 2017 04:51:05 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201710270451.v9R4p5DJ054505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 27 Oct 2017 04:51:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325031 - head/lib/libc/stdio X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/lib/libc/stdio X-SVN-Commit-Revision: 325031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 04:51:06 -0000 Author: cy Date: Fri Oct 27 04:51:05 2017 New Revision: 325031 URL: https://svnweb.freebsd.org/changeset/base/325031 Log: Ensure all incude statements are kept together by moving the sys/cdefs.h include appropriately. MFC after: 1 week X-MFC with: r325030 Modified: head/lib/libc/stdio/gets.c Modified: head/lib/libc/stdio/gets.c ============================================================================== --- head/lib/libc/stdio/gets.c Fri Oct 27 04:47:44 2017 (r325030) +++ head/lib/libc/stdio/gets.c Fri Oct 27 04:51:05 2017 (r325031) @@ -33,9 +33,9 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gets.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include __FBSDID("$FreeBSD$"); +#include #include "namespace.h" #include #include From owner-svn-src-head@freebsd.org Fri Oct 27 05:04:31 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55C8DE5C1AC; Fri, 27 Oct 2017 05:04:31 +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 mx1.freebsd.org (Postfix) with ESMTPS id 231A57759B; Fri, 27 Oct 2017 05:04:31 +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 v9R54UKV062466; Fri, 27 Oct 2017 05:04:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9R54Ubn062465; Fri, 27 Oct 2017 05:04:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201710270504.v9R54Ubn062465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 27 Oct 2017 05:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325032 - head/lib/libc/stdio X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/lib/libc/stdio X-SVN-Commit-Revision: 325032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 05:04:31 -0000 Author: cy Date: Fri Oct 27 05:04:29 2017 New Revision: 325032 URL: https://svnweb.freebsd.org/changeset/base/325032 Log: Revert r325031. This breaks the build due to __FBSDID. Pointy hat to: cy Modified: head/lib/libc/stdio/gets.c Modified: head/lib/libc/stdio/gets.c ============================================================================== --- head/lib/libc/stdio/gets.c Fri Oct 27 04:51:05 2017 (r325031) +++ head/lib/libc/stdio/gets.c Fri Oct 27 05:04:29 2017 (r325032) @@ -33,9 +33,9 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gets.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ +#include __FBSDID("$FreeBSD$"); -#include #include "namespace.h" #include #include From owner-svn-src-head@freebsd.org Fri Oct 27 06:34:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 664A8E5D57F; Fri, 27 Oct 2017 06:34:01 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::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 EA5CE7DAC5; Fri, 27 Oct 2017 06:34:00 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x235.google.com with SMTP id p75so1433275wmg.3; Thu, 26 Oct 2017 23:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pyi22pvWZxbj87Xzpa/v84QOKxQooDYId0CSXH1Ctis=; b=Y2/NVtMA0SbygiXYxIZxpWJ6vLIp0d8RaP8JfCBf2sJ4kLtHvTJSyjWjoDYshZ76Cj W7TxbFnow0oNzIGtU/+nSytrrS8avgvVcgVOLplAm7urJjzxTDs1JDAZLKF1n15dD3YG 0P69+tq7Us0TbugxXG6Cz9B5sgAu+v6AlWAWi3l/VXeQilcQILG6e6MKIn09Y+4AXUA+ oMbQuwrOjv6NK1pDHCisA5aclJACReUxTOqVn0nGh39nwORVYHU4oisi4tYdSTeqaBed ScOKDQdJF/QUhtyJ4Ja+PKXfSxAb07AyV3+8gJXPHRtoWDb1bmTYvYR0bxNI/C1qXjd2 GHPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pyi22pvWZxbj87Xzpa/v84QOKxQooDYId0CSXH1Ctis=; b=fQbAsIY7QElKL2hxX/VDv+CcblG0KYJ/hNPMZiJ/ImHevSMWuJvtIdPoC5DB+oNm8u HxQ3D9sJaqpP0yfsEFAyt/SNzFMXoYa3Cu5u7m8DzRJNgmZUnJXhZiKMcoQW4o6t8Uby F8jN2+KrySTDhBsllIocQ12SrmtsRj8Dyl4uVcg6rPsl1fr6Xjvy+oxp1VBYnNMIv8PG WwjddsGZfOT6gWvfg/+PKWBGEE2xRRbCcOHRPAEd6pWUUXXnQTIBWztj8rkbckfL4FzP 6+0VQAVeCOst0KquETqZeMF+3ZwXCr0vKAAPEfSKTMuMDrHVZvTHtdu4o9y+xgmn6qOX IUbg== X-Gm-Message-State: AMCzsaVj/jIgXRbhaOwXzV2d3NblbPfaIetpOi13zaNUd/9cW/3zz7CG 2NDBjTD4SSQaL8s1kp67XjT5lPQvvaw= X-Google-Smtp-Source: ABhQp+R9278ZQsfkQP2RQWpRIhr4OLOqsPFPbCfqnYBOTIYlmpO4gf9iMArzqUtpKNB58Z5brQ7Nqw== X-Received: by 10.80.133.203 with SMTP id q11mr30158373edh.50.1509086038997; Thu, 26 Oct 2017 23:33:58 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id p45sm5245888edc.30.2017.10.26.23.33.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 23:33:58 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> Message-ID: <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> Date: Fri, 27 Oct 2017 08:33:58 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201710232131.v9NLV4Rb068825@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 06:34:01 -0000 On 23.10.2017 23:31, Dimitry Andric wrote: > Author: dim > Date: Mon Oct 23 21:31:04 2017 > New Revision: 324938 > URL: https://svnweb.freebsd.org/changeset/base/324938 > > Log: > After jemalloc was updated to version 5.0.0 in r319971, i386 executables > linked with AddressSanitizer (even those linked on earlier versions of > FreeBSD, or with external versions of clang) started failing with errors > similar to: > > ==14688==AddressSanitizer CHECK failed: > /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36 > "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0) > > This is because AddressSanitizer expects all the TLS data in the program > to be aligned to at least 8 bytes. > > Before the jemalloc 5.0.0 update, all the TLS data in the i386 version > of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this > grow to 2404 bytes (not a multiple of 8). This is due to added caching > data in jemalloc's internal struct tsd_s. > > To fix AddressSanitizer, ensure this struct is aligned to at least 16 > bytes, which can be done unconditionally for all architectures. (An > earlier version of the fix aligned the struct to 8 bytes, but only for > ILP32 architectures. This was deemed unnecessarily complicated.) > > PR: 221337 > X-MFC-With: r319971 > This causes a regression on armv7 for /rescue/sh. At least malloc_slow is != 0, but I don't known what's exactly happen. Any idea? ------------------------------------------------------------------- /usr/local/bin/gdb801 --args /usr/obj/usr/src/rescue/rescue/rescue sh GNU gdb (GDB) 8.0.1 [GDB v8.0.1 for FreeBSD] Reading symbols from /usr/obj/usr/src/rescue/rescue/rescue...done. (gdb) r Starting program: /usr/obj/usr/src/rescue/rescue/rescue sh : /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:241: Failed assertion: "!malloc_slow && tsd_tcache_enabled_get(tsd) && tsd_reentrancy_level_get(tsd) == 0" Program received signal SIGABRT, Aborted. thr_kill () at thr_kill.S:3 3 RSYSCALL(thr_kill) (gdb) bt #0 thr_kill () at thr_kill.S:3 #1 0x00823ac8 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52 #2 0x00823a4c in abort () at /usr/src/lib/libc/stdlib/abort.c:65 #3 0x007c49cc in tsd_assert_fast (tsd=0x20c82010) at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:240 #4 0x007c3e3c in tsd_fast (tsd=0x20c82010) at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:248 #5 0x007c4c40 in tsd_fetch_impl (init=true, minimal=false) at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:266 #6 0x007c47e0 in tsd_fetch () at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:290 #7 0x007c4774 in __je_malloc_tsd_boot0 () at jemalloc_tsd.c:256 #8 0x00821370 in malloc_init_hard () at jemalloc_jemalloc.c:1473 #9 0x00817d24 in malloc_init () at jemalloc_jemalloc.c:220 #10 0x00814dbc in imalloc (sopts=0xbfbfec70, dopts=0xbfbfec54) at jemalloc_jemalloc.c:1931 #11 0x00814ca8 in __malloc (size=12) at jemalloc_jemalloc.c:1981 #12 0x0019454c in callback_register (func=0x19b290 , arg=0x0) at /usr/src/sbin/ifconfig/ifconfig.c:705 #13 0x0019b274 in vlan_ctor () at /usr/src/sbin/ifconfig/ifvlan.c:227 #14 0x00008318 in handle_static_init (argc=, argv=, env=) at /usr/src/lib/csu/common/ignore_init.c:85 #15 __start (argc=2, argv=0xbfbfed00, env=0xbfbfed0c, ps_strings=, obj=0x0, cleanup=) at /usr/src/lib/csu/arm/crt1.c:108 #16 0x00008180 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) Quit > Modified: > head/contrib/jemalloc/include/jemalloc/internal/tsd.h > > Modified: head/contrib/jemalloc/include/jemalloc/internal/tsd.h > ============================================================================== > --- head/contrib/jemalloc/include/jemalloc/internal/tsd.h Mon Oct 23 20:50:08 2017 (r324937) > +++ head/contrib/jemalloc/include/jemalloc/internal/tsd.h Mon Oct 23 21:31:04 2017 (r324938) > @@ -120,7 +120,8 @@ struct tsd_s { > t use_a_getter_or_setter_instead_##n; > MALLOC_TSD > #undef O > -}; > +/* AddressSanitizer requires TLS data to be aligned to at least 8 bytes. */ > +} JEMALLOC_ALIGNED(16); > > /* > * Wrapper around tsd_t that makes it possible to avoid implicit conversion > From owner-svn-src-head@freebsd.org Fri Oct 27 07:53:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1CFFE3A22D; Fri, 27 Oct 2017 07:53:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48A417FD8D; Fri, 27 Oct 2017 07:53:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::61b5:f744:558d:eba6] (unknown [IPv6:2001:470:7a58:0:61b5:f744:558d:eba6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 08F54F955; Fri, 27 Oct 2017 09:53:24 +0200 (CEST) From: Dimitry Andric Message-Id: <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_FE439175-2139-41D4-B599-5BD0953053AC"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal Date: Fri, 27 Oct 2017 09:53:24 +0200 In-Reply-To: <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: mmel@freebsd.org References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 07:53:39 -0000 --Apple-Mail=_FE439175-2139-41D4-B599-5BD0953053AC Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 27 Oct 2017, at 08:33, Michal Meloun wrote: > > On 23.10.2017 23:31, Dimitry Andric wrote: >> Author: dim >> Date: Mon Oct 23 21:31:04 2017 >> New Revision: 324938 >> URL: https://svnweb.freebsd.org/changeset/base/324938 >> >> Log: >> After jemalloc was updated to version 5.0.0 in r319971, i386 executables >> linked with AddressSanitizer (even those linked on earlier versions of >> FreeBSD, or with external versions of clang) started failing with errors >> similar to: >> >> ==14688==AddressSanitizer CHECK failed: >> /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36 >> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0) >> >> This is because AddressSanitizer expects all the TLS data in the program >> to be aligned to at least 8 bytes. >> >> Before the jemalloc 5.0.0 update, all the TLS data in the i386 version >> of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this >> grow to 2404 bytes (not a multiple of 8). This is due to added caching >> data in jemalloc's internal struct tsd_s. >> >> To fix AddressSanitizer, ensure this struct is aligned to at least 16 >> bytes, which can be done unconditionally for all architectures. (An >> earlier version of the fix aligned the struct to 8 bytes, but only for >> ILP32 architectures. This was deemed unnecessarily complicated.) >> >> PR: 221337 >> X-MFC-With: r319971 >> > This causes a regression on armv7 for /rescue/sh. At least malloc_slow > is != 0, but I don't known what's exactly happen. Any idea? > > ------------------------------------------------------------------- > /usr/local/bin/gdb801 --args /usr/obj/usr/src/rescue/rescue/rescue sh > GNU gdb (GDB) 8.0.1 [GDB v8.0.1 for FreeBSD] > Reading symbols from /usr/obj/usr/src/rescue/rescue/rescue...done. > (gdb) r > Starting program: /usr/obj/usr/src/rescue/rescue/rescue sh > : > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:241: Failed > assertion: "!malloc_slow && tsd_tcache_enabled_get(tsd) && > tsd_reentrancy_level_get(tsd) == 0" > > Program received signal SIGABRT, Aborted. > thr_kill () at thr_kill.S:3 > 3 RSYSCALL(thr_kill) > (gdb) bt > #0 thr_kill () at thr_kill.S:3 > #1 0x00823ac8 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52 > #2 0x00823a4c in abort () at /usr/src/lib/libc/stdlib/abort.c:65 > #3 0x007c49cc in tsd_assert_fast (tsd=0x20c82010) at > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:240 > #4 0x007c3e3c in tsd_fast (tsd=0x20c82010) at > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:248 > #5 0x007c4c40 in tsd_fetch_impl (init=true, minimal=false) at > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:266 > #6 0x007c47e0 in tsd_fetch () at > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:290 > #7 0x007c4774 in __je_malloc_tsd_boot0 () at jemalloc_tsd.c:256 > #8 0x00821370 in malloc_init_hard () at jemalloc_jemalloc.c:1473 > #9 0x00817d24 in malloc_init () at jemalloc_jemalloc.c:220 > #10 0x00814dbc in imalloc (sopts=0xbfbfec70, dopts=0xbfbfec54) at > jemalloc_jemalloc.c:1931 > #11 0x00814ca8 in __malloc (size=12) at jemalloc_jemalloc.c:1981 > #12 0x0019454c in callback_register (func=0x19b290 , arg=0x0) > at /usr/src/sbin/ifconfig/ifconfig.c:705 > #13 0x0019b274 in vlan_ctor () at /usr/src/sbin/ifconfig/ifvlan.c:227 > #14 0x00008318 in handle_static_init (argc=, > argv=, env=) > at /usr/src/lib/csu/common/ignore_init.c:85 > #15 __start (argc=2, argv=0xbfbfed00, env=0xbfbfed0c, > ps_strings=, obj=0x0, cleanup=) > at /usr/src/lib/csu/arm/crt1.c:108 > #16 0x00008180 in ?? () > Backtrace stopped: previous frame identical to this frame (corrupt stack?) Hmm I don't see how adding some padding at the end of struct tsd_s could cause this. Is it possible to figure out which of the three tested values is wrong? -Dimitry --Apple-Mail=_FE439175-2139-41D4-B599-5BD0953053AC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWfLl9AAKCRCwXqMKLiCW o1wEAJ9zuPZJeBVLwDJQ7PKBovBPaQZN4ACePCMMFz862rOUJCHCFKn/AxKWW2M= =BDxh -----END PGP SIGNATURE----- --Apple-Mail=_FE439175-2139-41D4-B599-5BD0953053AC-- From owner-svn-src-head@freebsd.org Fri Oct 27 10:43:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41ADBE3FE53; Fri, 27 Oct 2017 10:43:00 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 C66E78461F; Fri, 27 Oct 2017 10:42:59 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x232.google.com with SMTP id r68so2885100wmr.3; Fri, 27 Oct 2017 03:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=TLzSHjB8kpOpUfetb/AaAEebN2FZBI0y3JxMUMNjp3o=; b=mzbQXUuG4riYp/bYEFled9DoZDPGW2w+J5IXUfURCpurJMk5e94p2oV333ws3C2p3P AsgsMa49Wsch/ydKygNKXSRwrHvlmXYRWnyYsiue+id3QnDd0GoOahitt5PdaTY1/BbV ibFiaV7CU+Ux+GpqmruNjvz3OCRTHQof67ocMaKy9D436+7fAZJi5ATQnxL35bUJQ3ip jMMan3qpTTWJfeDlxq+QzQThwZ/wT8jm9qJFRt0SLaDjdQzHbm8XI7YqSkxAshZganQG OatrjHr4FiRDciSe3nGATnqzQ8zGxFCfXHZmjx1laC6NyjVzpe7rr1S7yNUjBlBUI1mu Eogg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=TLzSHjB8kpOpUfetb/AaAEebN2FZBI0y3JxMUMNjp3o=; b=qRgFZC5Jvo2mSccnS7kyyFuo2sfysz0LGyjomUcPbSszVuhr7BrFvSaxdr5unOft2S FnZ5AagfmGrQlxqpJqp4e6qRMK4FquoQH3j1h7WFpcIueEGWngNpJE94FlRN+QfIcgio e7/F08+LhgCF6q98FD40lKNVREs6niHu0cesvVNMuNCXW7SLht83zCTp26O93OsHBlLK SjViXy8PDmpzyWio9xe8dRjwWHpeu7xH4QGoYmDGvVOB/GsCkopiwXuRnmrBJDOzwkP3 0MCKVDklbh6jor+GhItP9OL5r+nSBfTZ7ym186Ktw2OLFEVkmdIYTCL0Bi4INpYbPfwv K2Cw== X-Gm-Message-State: AMCzsaUGMLBVWP0bzasyXDt2aXuLeZJT6pjI+sEZyO+ubFmGacEEklZ6 1bytJLmcHipE/BCAPg/a6jB8J2RvDP0= X-Google-Smtp-Source: ABhQp+Rym5gGlg4xe2wzsvZFMgnswuLHMj8ELOvIZeBFRNpp3Z8H8dMZkrZ3ko5znFIARm4c/m9PUw== X-Received: by 10.80.145.109 with SMTP id f42mr18529eda.215.1509100977804; Fri, 27 Oct 2017 03:42:57 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id 23sm4701325edx.8.2017.10.27.03.42.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 03:42:57 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> Message-ID: Date: Fri, 27 Oct 2017 12:42:58 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 10:43:00 -0000 On 27.10.2017 9:53, Dimitry Andric wrote: > On 27 Oct 2017, at 08:33, Michal Meloun wrote: >> >> On 23.10.2017 23:31, Dimitry Andric wrote: >>> Author: dim >>> Date: Mon Oct 23 21:31:04 2017 >>> New Revision: 324938 >>> URL: https://svnweb.freebsd.org/changeset/base/324938 >>> >>> Log: >>> After jemalloc was updated to version 5.0.0 in r319971, i386 executables >>> linked with AddressSanitizer (even those linked on earlier versions of >>> FreeBSD, or with external versions of clang) started failing with errors >>> similar to: >>> >>> ==14688==AddressSanitizer CHECK failed: >>> /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36 >>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0) >>> >>> This is because AddressSanitizer expects all the TLS data in the program >>> to be aligned to at least 8 bytes. >>> >>> Before the jemalloc 5.0.0 update, all the TLS data in the i386 version >>> of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this >>> grow to 2404 bytes (not a multiple of 8). This is due to added caching >>> data in jemalloc's internal struct tsd_s. >>> >>> To fix AddressSanitizer, ensure this struct is aligned to at least 16 >>> bytes, which can be done unconditionally for all architectures. (An >>> earlier version of the fix aligned the struct to 8 bytes, but only for >>> ILP32 architectures. This was deemed unnecessarily complicated.) >>> >>> PR: 221337 >>> X-MFC-With: r319971 >>> >> This causes a regression on armv7 for /rescue/sh. At least malloc_slow >> is != 0, but I don't known what's exactly happen. Any idea? >> >> ------------------------------------------------------------------- >> /usr/local/bin/gdb801 --args /usr/obj/usr/src/rescue/rescue/rescue sh >> GNU gdb (GDB) 8.0.1 [GDB v8.0.1 for FreeBSD] >> Reading symbols from /usr/obj/usr/src/rescue/rescue/rescue...done. >> (gdb) r >> Starting program: /usr/obj/usr/src/rescue/rescue/rescue sh >> : >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:241: Failed >> assertion: "!malloc_slow && tsd_tcache_enabled_get(tsd) && >> tsd_reentrancy_level_get(tsd) == 0" >> >> Program received signal SIGABRT, Aborted. >> thr_kill () at thr_kill.S:3 >> 3 RSYSCALL(thr_kill) >> (gdb) bt >> #0 thr_kill () at thr_kill.S:3 >> #1 0x00823ac8 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52 >> #2 0x00823a4c in abort () at /usr/src/lib/libc/stdlib/abort.c:65 >> #3 0x007c49cc in tsd_assert_fast (tsd=0x20c82010) at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:240 >> #4 0x007c3e3c in tsd_fast (tsd=0x20c82010) at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:248 >> #5 0x007c4c40 in tsd_fetch_impl (init=true, minimal=false) at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:266 >> #6 0x007c47e0 in tsd_fetch () at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:290 >> #7 0x007c4774 in __je_malloc_tsd_boot0 () at jemalloc_tsd.c:256 >> #8 0x00821370 in malloc_init_hard () at jemalloc_jemalloc.c:1473 >> #9 0x00817d24 in malloc_init () at jemalloc_jemalloc.c:220 >> #10 0x00814dbc in imalloc (sopts=0xbfbfec70, dopts=0xbfbfec54) at >> jemalloc_jemalloc.c:1931 >> #11 0x00814ca8 in __malloc (size=12) at jemalloc_jemalloc.c:1981 >> #12 0x0019454c in callback_register (func=0x19b290 , arg=0x0) >> at /usr/src/sbin/ifconfig/ifconfig.c:705 >> #13 0x0019b274 in vlan_ctor () at /usr/src/sbin/ifconfig/ifvlan.c:227 >> #14 0x00008318 in handle_static_init (argc=, >> argv=, env=) >> at /usr/src/lib/csu/common/ignore_init.c:85 >> #15 __start (argc=2, argv=0xbfbfed00, env=0xbfbfed0c, >> ps_strings=, obj=0x0, cleanup=) >> at /usr/src/lib/csu/arm/crt1.c:108 >> #16 0x00008180 in ?? () >> Backtrace stopped: previous frame identical to this frame (corrupt stack?) > > Hmm I don't see how adding some padding at the end of struct tsd_s could > cause this. Is it possible to figure out which of the three tested > values is wrong? I can confirm that rescue compiled without JEMALLOC_ALIGNED() works. tsd_assert_fast: tsd: address 0x20c83010 tsd_assert_fast: malloc_slow: 0x1 (address 0xaa4122) tsd_assert_fast: tsd_tcache_enabled_get:() 0x0 tsd_assert_fast: tsd_reentrancy_level_get(): 0x0 But it looks like real culprit of this issue is that this code (from tsd.c) ------------------------------------------------------- #elif (defined(JEMALLOC_TLS)) __thread tsd_t JEMALLOC_TLS_MODEL tsd_tls = TSD_INITIALIZER; pthread_key_t tsd_tsd; bool tsd_booted = false; ------------------------------------------------------- doesn't initialize tsd_tls, it's zeroed. I'm not sure if this can be caused by crunch or by static linking. I cannot find any other failing program, seems like only rescue is broken... Michal From owner-svn-src-head@freebsd.org Fri Oct 27 12:37:24 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF83DE43D41; Fri, 27 Oct 2017 12:37:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 749996391F; Fri, 27 Oct 2017 12:37:24 +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 v9RCbNki048470; Fri, 27 Oct 2017 12:37:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RCbMqM048460; Fri, 27 Oct 2017 12:37:22 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201710271237.v9RCbMqM048460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 27 Oct 2017 12:37:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325035 - in head/cddl: contrib/opensolaris/cmd/zdb contrib/opensolaris/cmd/ztest contrib/opensolaris/lib/libcmdutils contrib/opensolaris/lib/libzfs/common contrib/opensolaris/lib/libzp... X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/cddl: contrib/opensolaris/cmd/zdb contrib/opensolaris/cmd/ztest contrib/opensolaris/lib/libcmdutils contrib/opensolaris/lib/libzfs/common contrib/opensolaris/lib/libzpool/common contrib/openso... X-SVN-Commit-Revision: 325035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 12:37:24 -0000 Author: avg Date: Fri Oct 27 12:37:22 2017 New Revision: 325035 URL: https://svnweb.freebsd.org/changeset/base/325035 Log: MFV r325013,r325034: 640 number_to_scaled_string is duplicated in several commands illumos/illumos-gate@0a0551200ecbcd4f1b17560acaeeb7b6c8b0090e https://github.com/illumos/illumos-gate/commit/0a0551200ecbcd4f1b17560acaeeb7b6c8b0090e https://www.illumos.org/issues/640 du(1), df(1m), ls(1), and swap(1m) all include a copy (it appears literally copied) of the 'number_to_scaled_string' function in their source. This should be moved to a shared library and all 4 commands should use this instead. FreeBSD note: of all libcmdutils functionality ZFS (and other illumos contrib code) currently uses only nicenum() function (which is similar to humanize_number but has some formatting differences). For this reason I decided to not port the whole library. As a result, nicenum.c from libcmdutils is compiled into libzfs and libzpool. This is a bit ugly, but works. If one day we are forced to create libillumos, then the file should be moved to that library. Reviewed by: Sebastian Wiedenroth Reviewed by: Robert Mustacchi Reviewed by: Yuri Pankov Approved by: Dan McDonald Author: Jason King MFC after: 2 weeks Added: head/cddl/contrib/opensolaris/lib/libcmdutils/ - copied from r325013, vendor/illumos/dist/lib/libcmdutils/ head/cddl/contrib/opensolaris/lib/libcmdutils/libcmdutils.h - copied, changed from r325034, vendor/illumos/dist/lib/libcmdutils/libcmdutils.h Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/cddl/contrib/opensolaris/lib/libzpool/common/util.c head/cddl/lib/libzfs/Makefile head/cddl/lib/libzpool/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/zdb/Makefile Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zdb/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Fri Oct 27 12:37:22 2017 (r325035) @@ -63,6 +63,7 @@ #include #include #include +#include #undef verify #include @@ -276,12 +277,12 @@ dump_history_offsets(objset_t *os, uint64_t object, vo } static void -zdb_nicenum(uint64_t num, char *buf) +zdb_nicenum(uint64_t num, char *buf, size_t buflen) { if (dump_opt['P']) - (void) sprintf(buf, "%llu", (longlong_t)num); + (void) snprintf(buf, buflen, "%llu", (longlong_t)num); else - nicenum(num, buf); + nicenum(num, buf, sizeof (buf)); } const char histo_stars[] = "****************************************"; @@ -458,12 +459,17 @@ dump_bpobj(objset_t *os, uint64_t object, void *data, bpobj_phys_t *bpop = data; char bytes[32], comp[32], uncomp[32]; + /* make sure the output won't get truncated */ + CTASSERT(sizeof (bytes) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (comp) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (uncomp) >= NN_NUMBUF_SZ); + if (bpop == NULL) return; - zdb_nicenum(bpop->bpo_bytes, bytes); - zdb_nicenum(bpop->bpo_comp, comp); - zdb_nicenum(bpop->bpo_uncomp, uncomp); + zdb_nicenum(bpop->bpo_bytes, bytes, sizeof (bytes)); + zdb_nicenum(bpop->bpo_comp, comp, sizeof (comp)); + zdb_nicenum(bpop->bpo_uncomp, uncomp, sizeof (uncomp)); (void) printf("\t\tnum_blkptrs = %llu\n", (u_longlong_t)bpop->bpo_num_blkptrs); @@ -756,8 +762,11 @@ dump_metaslab_stats(metaslab_t *msp) avl_tree_t *t = &msp->ms_size_tree; int free_pct = range_tree_space(rt) * 100 / msp->ms_size; - zdb_nicenum(metaslab_block_maxsize(msp), maxbuf); + /* max sure nicenum has enough space */ + CTASSERT(sizeof (maxbuf) >= NN_NUMBUF_SZ); + zdb_nicenum(metaslab_block_maxsize(msp), maxbuf, sizeof (maxbuf)); + (void) printf("\t %25s %10lu %7s %6s %4s %4d%%\n", "segments", avl_numnodes(t), "maxsize", maxbuf, "freepct", free_pct); @@ -773,7 +782,8 @@ dump_metaslab(metaslab_t *msp) space_map_t *sm = msp->ms_sm; char freebuf[32]; - zdb_nicenum(msp->ms_size - space_map_allocated(sm), freebuf); + zdb_nicenum(msp->ms_size - space_map_allocated(sm), freebuf, + sizeof (freebuf)); (void) printf( "\tmetaslab %6llu offset %12llx spacemap %6llu free %5s\n", @@ -1356,6 +1366,9 @@ dump_dsl_dir(objset_t *os, uint64_t object, void *data time_t crtime; char nice[32]; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (nice) >= NN_NUMBUF_SZ); + if (dd == NULL) return; @@ -1371,15 +1384,15 @@ dump_dsl_dir(objset_t *os, uint64_t object, void *data (u_longlong_t)dd->dd_origin_obj); (void) printf("\t\tchild_dir_zapobj = %llu\n", (u_longlong_t)dd->dd_child_dir_zapobj); - zdb_nicenum(dd->dd_used_bytes, nice); + zdb_nicenum(dd->dd_used_bytes, nice, sizeof (nice)); (void) printf("\t\tused_bytes = %s\n", nice); - zdb_nicenum(dd->dd_compressed_bytes, nice); + zdb_nicenum(dd->dd_compressed_bytes, nice, sizeof (nice)); (void) printf("\t\tcompressed_bytes = %s\n", nice); - zdb_nicenum(dd->dd_uncompressed_bytes, nice); + zdb_nicenum(dd->dd_uncompressed_bytes, nice, sizeof (nice)); (void) printf("\t\tuncompressed_bytes = %s\n", nice); - zdb_nicenum(dd->dd_quota, nice); + zdb_nicenum(dd->dd_quota, nice, sizeof (nice)); (void) printf("\t\tquota = %s\n", nice); - zdb_nicenum(dd->dd_reserved, nice); + zdb_nicenum(dd->dd_reserved, nice, sizeof (nice)); (void) printf("\t\treserved = %s\n", nice); (void) printf("\t\tprops_zapobj = %llu\n", (u_longlong_t)dd->dd_props_zapobj); @@ -1389,7 +1402,8 @@ dump_dsl_dir(objset_t *os, uint64_t object, void *data (u_longlong_t)dd->dd_flags); #define DO(which) \ - zdb_nicenum(dd->dd_used_breakdown[DD_USED_ ## which], nice); \ + zdb_nicenum(dd->dd_used_breakdown[DD_USED_ ## which], nice, \ + sizeof (nice)); \ (void) printf("\t\tused_breakdown[" #which "] = %s\n", nice) DO(HEAD); DO(SNAP); @@ -1408,15 +1422,22 @@ dump_dsl_dataset(objset_t *os, uint64_t object, void * char used[32], compressed[32], uncompressed[32], unique[32]; char blkbuf[BP_SPRINTF_LEN]; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (used) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (compressed) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (uncompressed) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (unique) >= NN_NUMBUF_SZ); + if (ds == NULL) return; ASSERT(size == sizeof (*ds)); crtime = ds->ds_creation_time; - zdb_nicenum(ds->ds_referenced_bytes, used); - zdb_nicenum(ds->ds_compressed_bytes, compressed); - zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed); - zdb_nicenum(ds->ds_unique_bytes, unique); + zdb_nicenum(ds->ds_referenced_bytes, used, sizeof (used)); + zdb_nicenum(ds->ds_compressed_bytes, compressed, sizeof (compressed)); + zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed, + sizeof (uncompressed)); + zdb_nicenum(ds->ds_unique_bytes, unique, sizeof (unique)); snprintf_blkptr(blkbuf, sizeof (blkbuf), &ds->ds_bp); (void) printf("\t\tdir_obj = %llu\n", @@ -1475,12 +1496,15 @@ dump_bptree(objset_t *os, uint64_t obj, char *name) bptree_phys_t *bt; dmu_buf_t *db; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (bytes) >= NN_NUMBUF_SZ); + if (dump_opt['d'] < 3) return; VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); bt = db->db_data; - zdb_nicenum(bt->bt_bytes, bytes); + zdb_nicenum(bt->bt_bytes, bytes, sizeof (bytes)); (void) printf("\n %s: %llu datasets, %s\n", name, (unsigned long long)(bt->bt_end - bt->bt_begin), bytes); dmu_buf_rele(db, FTAG); @@ -1512,13 +1536,18 @@ dump_full_bpobj(bpobj_t *bpo, char *name, int indent) char comp[32]; char uncomp[32]; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (bytes) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (comp) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (uncomp) >= NN_NUMBUF_SZ); + if (dump_opt['d'] < 3) return; - zdb_nicenum(bpo->bpo_phys->bpo_bytes, bytes); + zdb_nicenum(bpo->bpo_phys->bpo_bytes, bytes, sizeof (bytes)); if (bpo->bpo_havesubobj && bpo->bpo_phys->bpo_subobjs != 0) { - zdb_nicenum(bpo->bpo_phys->bpo_comp, comp); - zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp); + zdb_nicenum(bpo->bpo_phys->bpo_comp, comp, sizeof (comp)); + zdb_nicenum(bpo->bpo_phys->bpo_uncomp, uncomp, sizeof (uncomp)); (void) printf(" %*s: object %llu, %llu local blkptrs, " "%llu subobjs in object %llu, %s (%s/%s comp)\n", indent * 8, name, @@ -1572,6 +1601,11 @@ dump_deadlist(dsl_deadlist_t *dl) char comp[32]; char uncomp[32]; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (bytes) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (comp) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (uncomp) >= NN_NUMBUF_SZ); + if (dump_opt['d'] < 3) return; @@ -1580,9 +1614,9 @@ dump_deadlist(dsl_deadlist_t *dl) return; } - zdb_nicenum(dl->dl_phys->dl_used, bytes); - zdb_nicenum(dl->dl_phys->dl_comp, comp); - zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp); + zdb_nicenum(dl->dl_phys->dl_used, bytes, sizeof (bytes)); + zdb_nicenum(dl->dl_phys->dl_comp, comp, sizeof (comp)); + zdb_nicenum(dl->dl_phys->dl_uncomp, uncomp, sizeof (uncomp)); (void) printf("\n Deadlist: %s (%s/%s comp)\n", bytes, comp, uncomp); @@ -1883,6 +1917,13 @@ dump_object(objset_t *os, uint64_t object, int verbosi char aux[50]; int error; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (iblk) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (dblk) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (lsize) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (asize) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (bonus_size) >= NN_NUMBUF_SZ); + if (*print_header) { (void) printf("\n%10s %3s %5s %5s %5s %5s %6s %s\n", "Object", "lvl", "iblk", "dblk", "dsize", "lsize", @@ -1903,11 +1944,11 @@ dump_object(objset_t *os, uint64_t object, int verbosi } dmu_object_info_from_dnode(dn, &doi); - zdb_nicenum(doi.doi_metadata_block_size, iblk); - zdb_nicenum(doi.doi_data_block_size, dblk); - zdb_nicenum(doi.doi_max_offset, lsize); - zdb_nicenum(doi.doi_physical_blocks_512 << 9, asize); - zdb_nicenum(doi.doi_bonus_size, bonus_size); + zdb_nicenum(doi.doi_metadata_block_size, iblk, sizeof (iblk)); + zdb_nicenum(doi.doi_data_block_size, dblk, sizeof (dblk)); + zdb_nicenum(doi.doi_max_offset, lsize, sizeof (lsize)); + zdb_nicenum(doi.doi_physical_blocks_512 << 9, asize, sizeof (asize)); + zdb_nicenum(doi.doi_bonus_size, bonus_size, sizeof (bonus_size)); (void) sprintf(fill, "%6.2f", 100.0 * doi.doi_fill_count * doi.doi_data_block_size / (object == 0 ? DNODES_PER_BLOCK : 1) / doi.doi_max_offset); @@ -1970,6 +2011,8 @@ dump_object(objset_t *os, uint64_t object, int verbosi for (;;) { char segsize[32]; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (segsize) >= NN_NUMBUF_SZ); error = dnode_next_offset(dn, 0, &start, minlvl, blkfill, 0); if (error) @@ -1977,7 +2020,7 @@ dump_object(objset_t *os, uint64_t object, int verbosi end = start; error = dnode_next_offset(dn, DNODE_FIND_HOLE, &end, minlvl, blkfill, 0); - zdb_nicenum(end - start, segsize); + zdb_nicenum(end - start, segsize, sizeof (segsize)); (void) printf("\t\tsegment [%016llx, %016llx)" " size %5s\n", (u_longlong_t)start, (u_longlong_t)end, segsize); @@ -2008,6 +2051,9 @@ dump_dir(objset_t *os) int print_header = 1; int i, error; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (numbuf) >= NN_NUMBUF_SZ); + dsl_pool_config_enter(dmu_objset_pool(os), FTAG); dmu_objset_fast_stat(os, &dds); dsl_pool_config_exit(dmu_objset_pool(os), FTAG); @@ -2026,7 +2072,7 @@ dump_dir(objset_t *os) ASSERT3U(usedobjs, ==, BP_GET_FILL(os->os_rootbp)); - zdb_nicenum(refdbytes, numbuf); + zdb_nicenum(refdbytes, numbuf, sizeof (numbuf)); if (verbosity >= 4) { (void) snprintf(blkbuf, sizeof (blkbuf), ", rootbp "); @@ -2673,6 +2719,9 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr int sec_remaining = (zcb->zcb_totalasize - bytes) / 1024 / kb_per_sec; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (buf) >= NN_NUMBUF_SZ); + zfs_nicenum(bytes, buf, sizeof (buf)); (void) fprintf(stderr, "\r%5s completed (%4dMB/s) " @@ -3022,6 +3071,14 @@ dump_block_stats(spa_t *spa) char avg[32], gang[32]; char *typename; + /* make sure nicenum has enough space */ + CTASSERT(sizeof (csize) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (lsize) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (psize) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (asize) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (avg) >= NN_NUMBUF_SZ); + CTASSERT(sizeof (gang) >= NN_NUMBUF_SZ); + if (t < DMU_OT_NUMTYPES) typename = dmu_ot[t].ot_name; else @@ -3055,12 +3112,17 @@ dump_block_stats(spa_t *spa) zcb.zcb_type[ZB_TOTAL][t].zb_asize) continue; - zdb_nicenum(zb->zb_count, csize); - zdb_nicenum(zb->zb_lsize, lsize); - zdb_nicenum(zb->zb_psize, psize); - zdb_nicenum(zb->zb_asize, asize); - zdb_nicenum(zb->zb_asize / zb->zb_count, avg); - zdb_nicenum(zb->zb_gangs, gang); + zdb_nicenum(zb->zb_count, csize, + sizeof (csize)); + zdb_nicenum(zb->zb_lsize, lsize, + sizeof (lsize)); + zdb_nicenum(zb->zb_psize, psize, + sizeof (psize)); + zdb_nicenum(zb->zb_asize, asize, + sizeof (asize)); + zdb_nicenum(zb->zb_asize / zb->zb_count, avg, + sizeof (avg)); + zdb_nicenum(zb->zb_gangs, gang, sizeof (gang)); (void) printf("%6s\t%5s\t%5s\t%5s\t%5s" "\t%5.2f\t%6.2f\t", Modified: head/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/contrib/opensolaris/cmd/ztest/ztest.c Fri Oct 27 12:37:22 2017 (r325035) @@ -25,6 +25,7 @@ * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2017 Joyent, Inc. */ /* @@ -125,6 +126,7 @@ #include #include #include +#include static int ztest_fd_data = -1; static int ztest_fd_rand = -1; @@ -556,12 +558,13 @@ usage(boolean_t requested) { const ztest_shared_opts_t *zo = &ztest_opts_defaults; - char nice_vdev_size[10]; - char nice_gang_bang[10]; + char nice_vdev_size[NN_NUMBUF_SZ]; + char nice_gang_bang[NN_NUMBUF_SZ]; FILE *fp = requested ? stdout : stderr; - nicenum(zo->zo_vdev_size, nice_vdev_size); - nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang); + nicenum(zo->zo_vdev_size, nice_vdev_size, sizeof (nice_vdev_size)); + nicenum(zo->zo_metaslab_gang_bang, nice_gang_bang, + sizeof (nice_gang_bang)); (void) fprintf(fp, "Usage: %s\n" "\t[-v vdevs (default: %llu)]\n" @@ -3158,10 +3161,10 @@ ztest_vdev_LUN_growth(ztest_ds_t *zd, uint64_t id) old_class_space, new_class_space); if (ztest_opts.zo_verbose >= 5) { - char oldnumbuf[6], newnumbuf[6]; + char oldnumbuf[NN_NUMBUF_SZ], newnumbuf[NN_NUMBUF_SZ]; - nicenum(old_class_space, oldnumbuf); - nicenum(new_class_space, newnumbuf); + nicenum(old_class_space, oldnumbuf, sizeof (oldnumbuf)); + nicenum(new_class_space, newnumbuf, sizeof (newnumbuf)); (void) printf("%s grew from %s to %s\n", spa->spa_name, oldnumbuf, newnumbuf); } @@ -6204,7 +6207,7 @@ main(int argc, char **argv) ztest_info_t *zi; ztest_shared_callstate_t *zc; char timebuf[100]; - char numbuf[6]; + char numbuf[NN_NUMBUF_SZ]; spa_t *spa; char *cmd; boolean_t hasalt; @@ -6341,7 +6344,7 @@ main(int argc, char **argv) now = MIN(now, zs->zs_proc_stop); print_time(zs->zs_proc_stop - now, timebuf); - nicenum(zs->zs_space, numbuf); + nicenum(zs->zs_space, numbuf, sizeof (numbuf)); (void) printf("Pass %3d, %8s, %3llu ENOSPC, " "%4.1f%% of %5s used, %3.0f%% done, %8s to go\n", Copied and modified: head/cddl/contrib/opensolaris/lib/libcmdutils/libcmdutils.h (from r325034, vendor/illumos/dist/lib/libcmdutils/libcmdutils.h) ============================================================================== --- vendor/illumos/dist/lib/libcmdutils/libcmdutils.h Fri Oct 27 11:26:36 2017 (r325034, copy source) +++ head/cddl/contrib/opensolaris/lib/libcmdutils/libcmdutils.h Fri Oct 27 12:37:22 2017 (r325035) @@ -36,10 +36,12 @@ #ifndef _LIBCMDUTILS_H #define _LIBCMDUTILS_H +#ifdef illumos #if !defined(_LP64) && \ !((_FILE_OFFSET_BITS == 64) || defined(_LARGEFILE64_SOURCE)) #error "libcmdutils.h can only be used in a largefile compilation environment" #endif +#endif /* * This is a private header file. Applications should not directly include @@ -56,7 +58,9 @@ #include #include #include +#ifdef illumos #include +#endif #include #include #include Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c Fri Oct 27 12:37:22 2017 (r325035) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -579,42 +580,7 @@ zfs_strdup(libzfs_handle_t *hdl, const char *str) void zfs_nicenum(uint64_t num, char *buf, size_t buflen) { - uint64_t n = num; - int index = 0; - char u; - - while (n >= 1024) { - n /= 1024; - index++; - } - - u = " KMGTPE"[index]; - - if (index == 0) { - (void) snprintf(buf, buflen, "%llu", n); - } else if ((num & ((1ULL << 10 * index) - 1)) == 0) { - /* - * If this is an even multiple of the base, always display - * without any decimal precision. - */ - (void) snprintf(buf, buflen, "%llu%c", n, u); - } else { - /* - * We want to choose a precision that reflects the best choice - * for fitting in 5 characters. This can get rather tricky when - * we have numbers that are very close to an order of magnitude. - * For example, when displaying 10239 (which is really 9.999K), - * we want only a single place of precision for 10.0K. We could - * develop some complex heuristics for this, but it's much - * easier just to try each combination in turn. - */ - int i; - for (i = 2; i >= 0; i--) { - if (snprintf(buf, buflen, "%.*f%c", i, - (double)num / (1ULL << 10 * index), u) <= 5) - break; - } - } + nicenum(num, buf, buflen); } void Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Fri Oct 27 12:37:22 2017 (r325035) @@ -581,7 +581,7 @@ extern void kernel_init(int); extern void kernel_fini(void); struct spa; -extern void nicenum(uint64_t num, char *buf); +extern void nicenum(uint64_t num, char *buf, size_t); extern void show_pool_stats(struct spa *); extern int set_global_var(char *arg); Modified: head/cddl/contrib/opensolaris/lib/libzpool/common/util.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzpool/common/util.c Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/contrib/opensolaris/lib/libzpool/common/util.c Fri Oct 27 12:37:22 2017 (r325035) @@ -38,33 +38,6 @@ * Routines needed by more than one client of libzpool. */ -void -nicenum(uint64_t num, char *buf) -{ - uint64_t n = num; - int index = 0; - char u; - - while (n >= 1024) { - n = (n + (1024 / 2)) / 1024; /* Round up or down */ - index++; - } - - u = " KMGTPE"[index]; - - if (index == 0) { - (void) sprintf(buf, "%llu", (u_longlong_t)n); - } else if (n < 10 && (num & (num - 1)) != 0) { - (void) sprintf(buf, "%.2f%c", - (double)num / (1ULL << 10 * index), u); - } else if (n < 100 && (num & (num - 1)) != 0) { - (void) sprintf(buf, "%.1f%c", - (double)num / (1ULL << 10 * index), u); - } else { - (void) sprintf(buf, "%llu%c", (u_longlong_t)n, u); - } -} - static void show_vdev_stats(const char *desc, const char *ctype, nvlist_t *nv, int indent) { @@ -97,15 +70,17 @@ show_vdev_stats(const char *desc, const char *ctype, n sec = MAX(1, vs->vs_timestamp / NANOSEC); - nicenum(vs->vs_alloc, used); - nicenum(vs->vs_space - vs->vs_alloc, avail); - nicenum(vs->vs_ops[ZIO_TYPE_READ] / sec, rops); - nicenum(vs->vs_ops[ZIO_TYPE_WRITE] / sec, wops); - nicenum(vs->vs_bytes[ZIO_TYPE_READ] / sec, rbytes); - nicenum(vs->vs_bytes[ZIO_TYPE_WRITE] / sec, wbytes); - nicenum(vs->vs_read_errors, rerr); - nicenum(vs->vs_write_errors, werr); - nicenum(vs->vs_checksum_errors, cerr); + nicenum(vs->vs_alloc, used, sizeof (used)); + nicenum(vs->vs_space - vs->vs_alloc, avail, sizeof (avail)); + nicenum(vs->vs_ops[ZIO_TYPE_READ] / sec, rops, sizeof (rops)); + nicenum(vs->vs_ops[ZIO_TYPE_WRITE] / sec, wops, sizeof (wops)); + nicenum(vs->vs_bytes[ZIO_TYPE_READ] / sec, rbytes, + sizeof (rbytes)); + nicenum(vs->vs_bytes[ZIO_TYPE_WRITE] / sec, wbytes, + sizeof (wbytes)); + nicenum(vs->vs_read_errors, rerr, sizeof (rerr)); + nicenum(vs->vs_write_errors, werr, sizeof (werr)); + nicenum(vs->vs_checksum_errors, cerr, sizeof (cerr)); (void) printf("%*s%s%*s%*s%*s %5s %5s %5s %5s %5s %5s %5s\n", indent, "", Modified: head/cddl/lib/libzfs/Makefile ============================================================================== --- head/cddl/lib/libzfs/Makefile Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/lib/libzfs/Makefile Fri Oct 27 12:37:22 2017 (r325035) @@ -4,6 +4,7 @@ .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs .PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common +.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils/common LIB= zfs LIBADD= md pthread umem util uutil m avl bsdxml geom nvpair z zfs_core @@ -15,6 +16,8 @@ SRCS= deviceid.c \ zmount.c \ zone.c +SRCS+= nicenum.c + SRCS+= libzfs_changelist.c \ libzfs_compat.c \ libzfs_config.c \ @@ -54,5 +57,6 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libn CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs_core/common +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils .include Modified: head/cddl/lib/libzpool/Makefile ============================================================================== --- head/cddl/lib/libzpool/Makefile Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/lib/libzpool/Makefile Fri Oct 27 12:37:22 2017 (r325035) @@ -25,6 +25,8 @@ ATOMIC_SRCS= opensolaris_atomic.c .endif # UNICODE_SRCS .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/unicode +# LIBCMDUTILS_SRCS +.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils/common LIB= zpool @@ -34,10 +36,11 @@ LUA_SRCS= ${LUA_OBJS:C/.o$/.c/} KERNEL_SRCS= kernel.c taskq.c util.c LIST_SRCS= list.c UNICODE_SRCS= u8_textprep.c +LIBCMDUTILS_SRCS=nicenum.c SRCS= ${ZFS_COMMON_SRCS} ${ZFS_SHARED_SRCS} ${LUA_SRCS} \ ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ - ${UNICODE_SRCS} + ${UNICODE_SRCS} ${LIBCMDUTILS_SRCS} WARNS?= 0 CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris @@ -51,6 +54,7 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/comm CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils # XXX: pthread doesn't have mutex_owned() equivalent, so we need to look # into libthr private structures. That's sooo evil, but it's only for # ZFS debugging tools needs. Modified: head/cddl/usr.bin/ztest/Makefile ============================================================================== --- head/cddl/usr.bin/ztest/Makefile Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/usr.bin/ztest/Makefile Fri Oct 27 12:37:22 2017 (r325035) @@ -11,6 +11,7 @@ CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys Modified: head/cddl/usr.sbin/zdb/Makefile ============================================================================== --- head/cddl/usr.sbin/zdb/Makefile Fri Oct 27 11:26:36 2017 (r325034) +++ head/cddl/usr.sbin/zdb/Makefile Fri Oct 27 12:37:22 2017 (r325035) @@ -12,6 +12,7 @@ CSTD= c99 CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/lib/libumem +CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libcmdutils CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libuutil/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libzfs/common From owner-svn-src-head@freebsd.org Fri Oct 27 12:53:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2312E447C0; Fri, 27 Oct 2017 12:53:27 +0000 (UTC) (envelope-from melounmichal@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 4A8ED64884; Fri, 27 Oct 2017 12:53:27 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x22b.google.com with SMTP id r196so3633592wmf.2; Fri, 27 Oct 2017 05:53:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4ukqrf+666IVTkXwtVUslaCj8jSahrQjRm6G+P4Z/pw=; b=EQSvHjOnCt3ub3xJcIxqqob11MRkdghsMh1ItbDGtWMTq1qp3qRwwcovsziXzeNu7t N/5ONLilQqz+jJm41SFuHJXCslZoVXpu7nidZYv/cBa+MpcahvYFVE1Y11avlGfwqUvH EpseCdOsiXSfSnth89iKKnoBfWgqtB8at6pIT8uCeb70gftj+CQxxhp6bzd807BxuC8a LNAhqZMsWb10CgcBq6qAqABeCBE716Cxjq5q6Hn4S27nkVeF3Zwv/tKh4kzLOKFV5oU2 2Kfxy7cS89kEppDqcNwyJZwqnWAn/x/xwxo+PErDQiX7NBH006mDv0ousxEes6VZR2/M Ie/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=4ukqrf+666IVTkXwtVUslaCj8jSahrQjRm6G+P4Z/pw=; b=GTey6BU4N5uqWl61VIzqtFy5xBGsvA2r3CZTMa9RxnCVwLEvgEfw8/nw4eUqJXd0Mh SWC98rlsZP/PidwW+QacI0jZiuH+DJ8gNZ4ekUPsbPAHjZN0CtuFNqhazXZsRmJANpvu t9FjggUVEd6Y/xSs+pAYfK9RcKyow2PVJoh6d8o5lTK4/qCc9Y7gfaXSh0m1hecrDd+r esvk0PHHhP77uZbr7CX6CRXACiFZUfjJGxe7v3OLQx2sE25VO2Vsvqhhh5u5Qqq4jdhX 9W1aoPLl5RZLsD/w6mkqvnJht8svM50XWiarxBq4cABTleHiNiijqJ7eLPeZSQrCoVqN 19Eg== X-Gm-Message-State: AMCzsaUhiDYyZSHU63ns2juIyWVO5pNIfawJ6SWOuA8mUNnz7w/G/nUV EKd7jqlvcUGQwtdg0eC0b0szNKOoamk= X-Google-Smtp-Source: ABhQp+TpMLfzN/avzp86FB3WtQmWGQbbTxqQg94Ve5ZeZQSZhaRm+47ViRVj5euhqC2fAb2+yCtynQ== X-Received: by 10.80.175.165 with SMTP id h34mr508501edd.292.1509108805371; Fri, 27 Oct 2017 05:53:25 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id e25sm5004270edj.28.2017.10.27.05.53.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 05:53:24 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, kib@freebsd.org References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> Message-ID: <6eff6e66-4987-8753-105f-b6a5b8234ff3@freebsd.org> Date: Fri, 27 Oct 2017 14:53:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 12:53:27 -0000 Sorry for top posting That's pity, we have clear problem in rtld code :( See: ----------------------------------------------------- RESCUE WITHOUT JEMALLOC_ALIGNED(16); ----------------------------------------------------- Program Headers: TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 0x011bc R 0x8 Section Headers: 04 .tdata .tbss .init_array .fini_array .jcr .got Dump: 00a832b0 <__je_tsd_tls+0xa832b0>: a832b0: 00000005 GDB (gdb) b tsd_fetch_impl Breakpoint 1 at 0x7c4c08: tsd_fetch_impl. (6 locations) (gdb) r Starting program: /usr/src/rescue.noalign sh Breakpoint 1, tsd_fetch_impl (init=true, minimal=false) at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 261 tsd_t *tsd = tsd_get(init); (gdb) n 263 if (!init && tsd_get_allocates() && tsd == NULL) { (gdb) p tsd $1 = (tsd_t *) 0x20c83008 (gdb) p *tsd $2 = {state = 5 '\005', .... (gdb) p *((tsd_t *)0x00a832b0) $3 = {state = 5 '\005', ... ----------------------------------------------------- RESCUE WITH JEMALLOC_ALIGNED(16); ----------------------------------------------------- Program Headers: TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 0x011bc R 0x10 Section Headers: 04 .tdata .tbss .init_array .fini_array .jcr .got Dump: 00a832b0 <__je_tsd_tls+0xa832b0>: a832b0: 00000005 GDB (gdb) b tsd_fetch_impl Breakpoint 1 at 0x7c4c08: tsd_fetch_impl. (6 locations) (gdb) r Starting program: /usr/obj/usr/src/rescue/rescue/rescue sh Breakpoint 1, tsd_fetch_impl (init=true, minimal=false) at /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 261 tsd_t *tsd = tsd_get(init); (gdb) n 263 if (!init && tsd_get_allocates() && tsd == NULL) { (gdb) p tsd $1 = (tsd_t *) 0x20c83010 (gdb) p *tsd $2 = {state = 0 '\000', ... (gdb) p *((tsd_t *)0x00a832b0) $3 = {state = 5 '\005', ... !!!! BUT p *(tsd - 8 bytes) !!!!!!!!!! (gdb) p *((tsd_t *)0x20c83008) $4 = {state = 5 '\005', ... ----------------------------------------------------- So it's clear that: - both binaries are valid, .tdata section have valid data. - requested alignment is propagated to binary. - .tdata section is properly loaded to memory because p *((tsd_t *)0x00a832b0) is {state = 5 '\005' in both cases - a per thread copy of .tdata respect requested alignment but the original data was copied to unaligned address. because for aligned binary p *tsd is {state = 0 '\000', ... p *(tsd - 8 bytes) is {state = 5 '\005' I'm right? Kib, please, can you help us? On 27.10.2017 9:53, Dimitry Andric wrote: > On 27 Oct 2017, at 08:33, Michal Meloun wrote: >> >> On 23.10.2017 23:31, Dimitry Andric wrote: >>> Author: dim >>> Date: Mon Oct 23 21:31:04 2017 >>> New Revision: 324938 >>> URL: https://svnweb.freebsd.org/changeset/base/324938 >>> >>> Log: >>> After jemalloc was updated to version 5.0.0 in r319971, i386 executables >>> linked with AddressSanitizer (even those linked on earlier versions of >>> FreeBSD, or with external versions of clang) started failing with errors >>> similar to: >>> >>> ==14688==AddressSanitizer CHECK failed: >>> /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36 >>> "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0) >>> >>> This is because AddressSanitizer expects all the TLS data in the program >>> to be aligned to at least 8 bytes. >>> >>> Before the jemalloc 5.0.0 update, all the TLS data in the i386 version >>> of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this >>> grow to 2404 bytes (not a multiple of 8). This is due to added caching >>> data in jemalloc's internal struct tsd_s. >>> >>> To fix AddressSanitizer, ensure this struct is aligned to at least 16 >>> bytes, which can be done unconditionally for all architectures. (An >>> earlier version of the fix aligned the struct to 8 bytes, but only for >>> ILP32 architectures. This was deemed unnecessarily complicated.) >>> >>> PR: 221337 >>> X-MFC-With: r319971 >>> >> This causes a regression on armv7 for /rescue/sh. At least malloc_slow >> is != 0, but I don't known what's exactly happen. Any idea? >> >> ------------------------------------------------------------------- >> /usr/local/bin/gdb801 --args /usr/obj/usr/src/rescue/rescue/rescue sh >> GNU gdb (GDB) 8.0.1 [GDB v8.0.1 for FreeBSD] >> Reading symbols from /usr/obj/usr/src/rescue/rescue/rescue...done. >> (gdb) r >> Starting program: /usr/obj/usr/src/rescue/rescue/rescue sh >> : >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:241: Failed >> assertion: "!malloc_slow && tsd_tcache_enabled_get(tsd) && >> tsd_reentrancy_level_get(tsd) == 0" >> >> Program received signal SIGABRT, Aborted. >> thr_kill () at thr_kill.S:3 >> 3 RSYSCALL(thr_kill) >> (gdb) bt >> #0 thr_kill () at thr_kill.S:3 >> #1 0x00823ac8 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52 >> #2 0x00823a4c in abort () at /usr/src/lib/libc/stdlib/abort.c:65 >> #3 0x007c49cc in tsd_assert_fast (tsd=0x20c82010) at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:240 >> #4 0x007c3e3c in tsd_fast (tsd=0x20c82010) at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:248 >> #5 0x007c4c40 in tsd_fetch_impl (init=true, minimal=false) at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:266 >> #6 0x007c47e0 in tsd_fetch () at >> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:290 >> #7 0x007c4774 in __je_malloc_tsd_boot0 () at jemalloc_tsd.c:256 >> #8 0x00821370 in malloc_init_hard () at jemalloc_jemalloc.c:1473 >> #9 0x00817d24 in malloc_init () at jemalloc_jemalloc.c:220 >> #10 0x00814dbc in imalloc (sopts=0xbfbfec70, dopts=0xbfbfec54) at >> jemalloc_jemalloc.c:1931 >> #11 0x00814ca8 in __malloc (size=12) at jemalloc_jemalloc.c:1981 >> #12 0x0019454c in callback_register (func=0x19b290 , arg=0x0) >> at /usr/src/sbin/ifconfig/ifconfig.c:705 >> #13 0x0019b274 in vlan_ctor () at /usr/src/sbin/ifconfig/ifvlan.c:227 >> #14 0x00008318 in handle_static_init (argc=, >> argv=, env=) >> at /usr/src/lib/csu/common/ignore_init.c:85 >> #15 __start (argc=2, argv=0xbfbfed00, env=0xbfbfed0c, >> ps_strings=, obj=0x0, cleanup=) >> at /usr/src/lib/csu/arm/crt1.c:108 >> #16 0x00008180 in ?? () >> Backtrace stopped: previous frame identical to this frame (corrupt stack?) > > Hmm I don't see how adding some padding at the end of struct tsd_s could > cause this. Is it possible to figure out which of the three tested > values is wrong? > > -Dimitry > From owner-svn-src-head@freebsd.org Fri Oct 27 14:50:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59367E473B1; Fri, 27 Oct 2017 14:50:16 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::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 D0BEC68299; Fri, 27 Oct 2017 14:50:15 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x230.google.com with SMTP id l23so7682892lfk.10; Fri, 27 Oct 2017 07:50:15 -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=bHiVKdqgQm4PbM7sdQHATZcB2twobmmcrNtnylkXGM8=; b=ULSU6LpGu0zoaMdrOVO3P4lvZ3PW6O8Ig+tueG85eDxTJflP03+X2x/FdUZtGpYu/P bKjxAur9eEDCgZwwCQfhFbRpSrdQ2gKbNnuUO20r2rx3IZkUQS7ZBaqaSO6V4RhkXwAG cRLG84NxHwL5bjtP2iznBEPqzUUVNebVfdFRjFnwXaQorftZMwX9n/gvrPV0vZ+NeEcY UdCFnng2q4M3NfGPsuqxnQjjUV3bVwaJ7qdHwtZ9FLPap9AgE+gR/3tu6oalvR74B+2I m/Rwd2CkLMRXCUCikJ2DpMNu+M1TuhTa85OVRpi+Xy50dSMtDq8AKWlEgx9o0KNacQXY UI7Q== 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=bHiVKdqgQm4PbM7sdQHATZcB2twobmmcrNtnylkXGM8=; b=f/y61hgc3YDPerE7LTmyl3dFQQyQB0R5RitoR+emadCa2nwG2uYkcIGnoJ5o4KVAQQ R2W0qOSQt8m+CPi7SAuPVqd255xsOal56dNWnuouYmFzBdhgwLcFdKZv0pcUyOiwx3hp cTsAOxhRfZ1A8toOORBkSLMlCYDY3lZ9VK0dQxzs6t7aoZWKy0EUS3R1nqvijBAqOqVJ HO0QXixm7g6VyCT0ohgWrDUZeEbouy7D8cmarKoS0gR29BimSEYx+8I29xRJkQcf8vUH u0+SlYP/bS5N5sePu140eE70vqK1mFCMQGdT95h25lL474I28mz28g/6bYndRqmB2c1O 3FSQ== X-Gm-Message-State: AMCzsaVv8jZftRctygtaDACUbqWcWSdV/b8aAVehCG2LzWh1t2GStrIS TbiSABOeCP4VZmKBYKTYpcr3u5Jq62OH3Tk0VWQ= X-Google-Smtp-Source: ABhQp+TIPB8IgPK+K+TrrtNuyuaguQiNnUImooBU9kYJsDcVIVrk7kJnl1j3kss/ZsmSYv4qIixQ2m/LfugjYon/Vyc= X-Received: by 10.25.216.88 with SMTP id p85mr290310lfg.21.1509115813514; Fri, 27 Oct 2017 07:50:13 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.93.24 with HTTP; Fri, 27 Oct 2017 07:50:12 -0700 (PDT) In-Reply-To: References: <201710262253.v9QMrovZ009495@repo.freebsd.org> From: Alan Somers Date: Fri, 27 Oct 2017 08:50:12 -0600 X-Google-Sender-Auth: AExPZdPB9sEiWjsd1Pjlpraj0yw Message-ID: Subject: Re: svn commit: r325026 - head/sys/cam/ata To: Warner Losh Cc: Warner Losh , "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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 14:50:16 -0000 On Thu, Oct 26, 2017 at 8:27 PM, Warner Losh wrote: > > > On Thu, Oct 26, 2017 at 5:35 PM, Warner Losh wrote: >> >> >> >> On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers wrote: >>> >>> On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh wrote: >>> > Author: imp >>> > Date: Thu Oct 26 22:53:49 2017 >>> > New Revision: 325026 >>> > URL: https://svnweb.freebsd.org/changeset/base/325026 >>> > >>> > Log: >>> > Always send STANDBY IMMEDIATE when shutting down >>> > >>> > To save SMART data and for a drive to understand that it's been >>> > nicely >>> > shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to >>> > use a local CCB on the stack. When we're panicing, used >>> > xpt_polled_action rather than cam_periph_runccb so that we can SEND >>> > IMMEDIATE after we've shutdown the scheduler. >>> > >>> > Sponsored by: Netflix >>> > Reviewed by: scottl@, gallatin@ >>> > Differential Revision: https://reviews.freebsd.org/D12799 >>> > >>> > Modified: >>> > head/sys/cam/ata/ata_da.c >>> >>> Will this put the drive into a standby state just prior to a warm >>> reboot? That could cause lengthy delays on the new boot while the >>> drives spin up. That behavior caused a problem when the mpr driver >>> did it to a JBOD full of 96 SATA drives. On the new boot, each drive >>> spun up one at a time while they were being probed. Eventually the >>> system paniced because run_interrupt_driven_hooks timed out. With >>> mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0. >> >> >> That's a good question. The standard is silent about what, exactly, the >> Standby state means. We already allow this to be disabled, and this commit >> doesn't change that. It looks like IDLE IMMEDIATE also forces SMART media >> non volatile to be flushed out. >> >> What do you suggest? > > > I see two paths forward. We need to flush the NV SMART data at reboot time. > SSDs that we use, at least, consider it an unclean shutdown if you don't > Idle the drive on reboot because part of that process does a > COMINIT/COMRESET and if the drive is in the Active state, it ticks up the > counter (and with at least one vendor can lose NV SMART data). > > So, path forward #1 is that we do STANDBY IMMEDIATE for SSDs in the > RB_REBOOT case or all drives in the other cases. For HDD and RB_REBOOT we do > only a IDLE IMMEDIATE which shouldn't spin the drives down. This seems to > bake in what we know about storage devices and is easiest for the user. If > we get it right, it's easier for the user. If we get it wrong, the user can > disable all spin downs. > > Path forward #2 is to just make what we send a sysctl. This is unsatisfying > and error-prone, but gives the most flexibility. I don't like this. > > I'd be curious if there's another viable path forward I'm not seeing that > you might know. > > FWIW, we don't connect HDDs to our AHCI ports (they are all on MPT/MPS/MPR > HBAs), so we've not seen any issues in the 6 or so months we've had this in > the tree. > > Warner Is there some reason not to send IDLE IMMEDIATE to both SSDs and HDDs? From owner-svn-src-head@freebsd.org Fri Oct 27 14:57:16 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E92CE47641; Fri, 27 Oct 2017 14:57: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 mx1.freebsd.org (Postfix) with ESMTPS id EEC9768751; Fri, 27 Oct 2017 14:57: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 v9REvFt9006515; Fri, 27 Oct 2017 14:57:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9REvE1c006513; Fri, 27 Oct 2017 14:57:14 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201710271457.v9REvE1c006513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 27 Oct 2017 14:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325039 - head/sys/amd64/vmm/io X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/amd64/vmm/io X-SVN-Commit-Revision: 325039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 14:57:16 -0000 Author: jhb Date: Fri Oct 27 14:57:14 2017 New Revision: 325039 URL: https://svnweb.freebsd.org/changeset/base/325039 Log: Rework pass through changes in r305485 to be safer. Specifically, devices that do not support PCI-e FLR and were not gracefully shutdown by the guest OS could continue to issue DMA requests after the VM was terminated. The changes in r305485 meant that those DMA requests were completed against the host's memory which could result in random memory corruption. Instead, leave ppt devices that are not attached to a VM disabled in the IOMMU and only restore the devices to the host domain if the ppt(4) driver is detached from a device. As an added safety belt, disable busmastering for a pass-through device when before adding it to the host domain during ppt(4) detach. PR: 222937 Tested by: Harry Schmalzbauer Reviewed by: grehan MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D12661 Modified: head/sys/amd64/vmm/io/iommu.c head/sys/amd64/vmm/io/ppt.c Modified: head/sys/amd64/vmm/io/iommu.c ============================================================================== --- head/sys/amd64/vmm/io/iommu.c Fri Oct 27 14:24:35 2017 (r325038) +++ head/sys/amd64/vmm/io/iommu.c Fri Oct 27 14:57:14 2017 (r325039) @@ -174,6 +174,7 @@ iommu_init(void) { int error, bus, slot, func; vm_paddr_t maxaddr; + devclass_t dc; device_t dev; if (!iommu_enable) @@ -214,6 +215,7 @@ iommu_init(void) add_tag = EVENTHANDLER_REGISTER(pci_add_device, iommu_pci_add, NULL, 0); delete_tag = EVENTHANDLER_REGISTER(pci_delete_device, iommu_pci_delete, NULL, 0); + dc = devclass_find("ppt"); for (bus = 0; bus <= PCI_BUSMAX; bus++) { for (slot = 0; slot <= PCI_SLOTMAX; slot++) { for (func = 0; func <= PCI_FUNCMAX; func++) { @@ -221,7 +223,15 @@ iommu_init(void) if (dev == NULL) continue; - /* Everything belongs to the host domain. */ + /* Skip passthrough devices. */ + if (dc != NULL && + device_get_devclass(dev) == dc) + continue; + + /* + * Everything else belongs to the host + * domain. + */ iommu_add_device(host_domain, pci_get_rid(dev)); } Modified: head/sys/amd64/vmm/io/ppt.c ============================================================================== --- head/sys/amd64/vmm/io/ppt.c Fri Oct 27 14:24:35 2017 (r325038) +++ head/sys/amd64/vmm/io/ppt.c Fri Oct 27 14:57:14 2017 (r325039) @@ -154,6 +154,7 @@ ppt_attach(device_t dev) ppt = device_get_softc(dev); + iommu_remove_device(iommu_host_domain(), pci_get_rid(dev)); num_pptdevs++; TAILQ_INSERT_TAIL(&pptdev_list, ppt, next); ppt->dev = dev; @@ -175,6 +176,8 @@ ppt_detach(device_t dev) return (EBUSY); num_pptdevs--; TAILQ_REMOVE(&pptdev_list, ppt, next); + pci_disable_busmaster(dev); + iommu_add_device(iommu_host_domain(), pci_get_rid(dev)); return (0); } @@ -368,7 +371,6 @@ ppt_assign_device(struct vm *vm, int bus, int slot, in true); pci_restore_state(ppt->dev); ppt->vm = vm; - iommu_remove_device(iommu_host_domain(), pci_get_rid(ppt->dev)); iommu_add_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); return (0); } @@ -397,7 +399,6 @@ ppt_unassign_device(struct vm *vm, int bus, int slot, ppt_teardown_msi(ppt); ppt_teardown_msix(ppt); iommu_remove_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); - iommu_add_device(iommu_host_domain(), pci_get_rid(ppt->dev)); ppt->vm = NULL; return (0); } From owner-svn-src-head@freebsd.org Fri Oct 27 14:57:39 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CCAF5E476AE; Fri, 27 Oct 2017 14:57:39 +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 mx1.freebsd.org (Postfix) with ESMTPS id 98FE56889E; Fri, 27 Oct 2017 14:57:39 +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 v9REvcxD006596; Fri, 27 Oct 2017 14:57:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9REvcNr006595; Fri, 27 Oct 2017 14:57:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201710271457.v9REvcNr006595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 27 Oct 2017 14:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325040 - 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: 325040 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 14:57:39 -0000 Author: imp Date: Fri Oct 27 14:57:38 2017 New Revision: 325040 URL: https://svnweb.freebsd.org/changeset/base/325040 Log: nvd alias has caused some problems, revert it for the moment. 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 Fri Oct 27 14:57:14 2017 (r325039) +++ head/sys/cam/nvme/nvme_da.c Fri Oct 27 14:57:38 2017 (r325040) @@ -794,7 +794,7 @@ ndaregister(struct cam_periph *periph, void *arg) /* * Add alias for older nvd drives to ease transition. */ - disk_add_alias(disk, "nvd"); + /* disk_add_alias(disk, "nvd"); Have reports of this causing problems */ /* * Acquire a reference to the periph before we register with GEOM. From owner-svn-src-head@freebsd.org Fri Oct 27 15:05:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A0DAE47B8E; Fri, 27 Oct 2017 15:05:56 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com [IPv6:2a00:1450:4010:c07::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 0E2786940A; Fri, 27 Oct 2017 15:05:55 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x22b.google.com with SMTP id n69so7758232lfn.2; Fri, 27 Oct 2017 08:05:55 -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=fKmNi3OkWHTMZy+uNnF7xtFrIVmO6VAY3m5A85ayCsU=; b=lVCs5LOmz3ctvPVa8v7Naw3PrDpN9ponh/dxYGaex6RJB93KekOffFNTx1rk04J0Io g3ri/Z03yHD/r5WEzYpz+VkzqaSCee9Q0SNJTPrQLyopkaZ9rltaEUlAbre51Z6cpmXO KsgUJ0a4z4So2qh4n4Sv7fXn7ZSVHx6VZjWKFu88TAcl7hy/p0dsIA9t19/As2jzwDsy +W1MqmxKTypLDYyQ/kFXtq3gJtxczIv8H+7FC1BPPh4LvAwpbAXgfU8xs39sJDNVvuLR 0Qlwne90gL+kDPAxR13JOduinRDO4N/85i8tZi2yx3d05n4dfTL6u7Ja/y32II3mWHTJ zNzA== 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=fKmNi3OkWHTMZy+uNnF7xtFrIVmO6VAY3m5A85ayCsU=; b=BiTsXxHS4NkbRIRuMz8Ax5OvHfVX0zCKZEvzlJgLBUchKmHAMZR68qVR0+T2KhCm9+ XuYtA+zehP6kh9uUCd9onPOYuRneTlhRYQUfROMNGt/s7E99DzF7CyuPK6oWCWtY0ZZg PWmX9gai9M4AIuTG60C5XnozeOyLBqwm2LttHFUa3u4F+XrrUmyHUSBBdreSsaIskaKD eVVkQaUAIWc2lVfczQ2y2LVZ8DR6mSMhpVs2PwPhGhaITC0xhEvMvPphQETFhMnjHtvG vhhDeVZD7B3ayu4Ucz0hI4D/3qXQ2C2qNK+72tk5cIiB7jbLevWWoL/T3nGaV/01EXxU /dUw== X-Gm-Message-State: AMCzsaULqxaIWrjd4omRM3TQHJRoarilqyAwxNKvxV4qoxqFKqk6mTo1 PWV1XvEyMBfReLLUPjCyYF3B0Wat19fwYhQDe8c= X-Google-Smtp-Source: ABhQp+TIsHwSZNHjKyTpCGpD4OSPJ14cHAkQbDWhxOXNELIiu+MO+FQHONaVUd3AFNtu0Q4Y5s/OI8icSW5cwVFu4y4= X-Received: by 10.46.66.198 with SMTP id h67mr341550ljf.108.1509116753769; Fri, 27 Oct 2017 08:05:53 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.93.24 with HTTP; Fri, 27 Oct 2017 08:05:53 -0700 (PDT) In-Reply-To: <201710271457.v9REvcNr006595@repo.freebsd.org> References: <201710271457.v9REvcNr006595@repo.freebsd.org> From: Alan Somers Date: Fri, 27 Oct 2017 09:05:53 -0600 X-Google-Sender-Auth: mV9JuOXJeNhuTMM8lw-Lcy3NpE4 Message-ID: Subject: Re: svn commit: r325040 - head/sys/cam/nvme To: Warner Losh 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 15:05:56 -0000 On Fri, Oct 27, 2017 at 8:57 AM, Warner Losh wrote: > Author: imp > Date: Fri Oct 27 14:57:38 2017 > New Revision: 325040 > URL: https://svnweb.freebsd.org/changeset/base/325040 > > Log: > nvd alias has caused some problems, revert it for the moment. > > 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 Fri Oct 27 14:57:14 2017 (r325039) > +++ head/sys/cam/nvme/nvme_da.c Fri Oct 27 14:57:38 2017 (r325040) > @@ -794,7 +794,7 @@ ndaregister(struct cam_periph *periph, void *arg) > /* > * Add alias for older nvd drives to ease transition. > */ > - disk_add_alias(disk, "nvd"); > + /* disk_add_alias(disk, "nvd"); Have reports of this causing problems */ > > /* > * Acquire a reference to the periph before we register with GEOM. Is there a PR? If so, please link the PR from the comment. From owner-svn-src-head@freebsd.org Fri Oct 27 15:07:01 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBBC5E47C15 for ; Fri, 27 Oct 2017 15:07:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x235.google.com (mail-io0-x235.google.com [IPv6:2607:f8b0:4001:c06::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 8122F69589 for ; Fri, 27 Oct 2017 15:07:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x235.google.com with SMTP id m81so13329160ioi.13 for ; Fri, 27 Oct 2017 08:07:01 -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=fTSJr5qsVabFVwgTRT94i8lCL1f3nvfuLiTnVuAzuhE=; b=WQm9HhG/vc58zLHKm99g4mqk6RRbNn7Peqxs/3cuNlTnSC/j0pLX6GctvnfBEwlelo RlE3JHDDdj5oTuExMOEKmSWRpvDzbp6PPWabnfC2WRf8cZiDnfBMdiJzON4YtPGfKVLP TQdOrMJcLURkxTZTGl6iAMEjyhCaXTIX0di7t9UGykohBeE/vaRz2I1tptPYRLrnNtZu 7uWkU0S15n2uMEwNLq+3CC8AdSYXU4yvwBAcv8XYjHcK0pJjj9n5T3PqZ9Gu1qRN+1ht SjgeYJzh0oRRGe/vDXRbvue8+obGXPh25mUr8PPL/dp21TjeOnOvCWeESCnrm73ivwFt jZKQ== 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=fTSJr5qsVabFVwgTRT94i8lCL1f3nvfuLiTnVuAzuhE=; b=WRBjX1XM6saWMUA1bh54DegrP/PUHxvqxrcZ+wHoqM/b3yQUEnbSgPTWFxrctjxjMe n2A2nbdGXoWNAkv9br51QVyWOpInZNvfb/D3G7R24TW6N/Pw4H58dH40Fm1tEM3xzYIK UMOSfPKHUZb8KbI8Hv+W7C5COG63ZfcY6Guds0Q0PNnjGTRi9fRTAMy3OoJS14iARXyh MkvAiLKXTYCzhJNS2QyhIrMMF6c4b4yX9SIB3Si2JloUZ8L4L0/EaR2/Gj7WBS5OuHur 1d8HfDs+GeLgE1pVuAIftcLIbKUt+MHnxGC/aVW5mw8KeIdjvEh+hPTcSum2Mc4U5BKM lM1A== X-Gm-Message-State: AMCzsaWtQ4RXexcnO/nFVc8SEnU9hNkIfORAdwOSJnTbbAU1vPEkmXNl LsljndsvzXhWKQnnT82OXRn+o6AAIFIUNNZimWsfow== X-Google-Smtp-Source: ABhQp+TpBouF9uQV2hho0m/MVzBETPXvncD428hB6DGSp09oyTE3prGIF8p2mtFqtZHvJdHL7oj1xjon1cQXnClEAuI= X-Received: by 10.107.30.73 with SMTP id e70mr1003468ioe.130.1509116820549; Fri, 27 Oct 2017 08:07:00 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Fri, 27 Oct 2017 08:06:59 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:68f3:90da:7630:94a5] In-Reply-To: References: <201710262253.v9QMrovZ009495@repo.freebsd.org> From: Warner Losh Date: Fri, 27 Oct 2017 09:06:59 -0600 X-Google-Sender-Auth: H7OE58pkNjHV2utQh4-lWFsvy9U Message-ID: Subject: Re: svn commit: r325026 - head/sys/cam/ata To: Alan Somers Cc: Warner Losh , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 15:07:01 -0000 On Fri, Oct 27, 2017 at 8:50 AM, Alan Somers wrote: > On Thu, Oct 26, 2017 at 8:27 PM, Warner Losh wrote: > > > > > > On Thu, Oct 26, 2017 at 5:35 PM, Warner Losh wrote: > >> > >> > >> > >> On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers > wrote: > >>> > >>> On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh wrote: > >>> > Author: imp > >>> > Date: Thu Oct 26 22:53:49 2017 > >>> > New Revision: 325026 > >>> > URL: https://svnweb.freebsd.org/changeset/base/325026 > >>> > > >>> > Log: > >>> > Always send STANDBY IMMEDIATE when shutting down > >>> > > >>> > To save SMART data and for a drive to understand that it's been > >>> > nicely > >>> > shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown > to > >>> > use a local CCB on the stack. When we're panicing, used > >>> > xpt_polled_action rather than cam_periph_runccb so that we can SEND > >>> > IMMEDIATE after we've shutdown the scheduler. > >>> > > >>> > Sponsored by: Netflix > >>> > Reviewed by: scottl@, gallatin@ > >>> > Differential Revision: https://reviews.freebsd.org/D12799 > >>> > > >>> > Modified: > >>> > head/sys/cam/ata/ata_da.c > >>> > >>> Will this put the drive into a standby state just prior to a warm > >>> reboot? That could cause lengthy delays on the new boot while the > >>> drives spin up. That behavior caused a problem when the mpr driver > >>> did it to a JBOD full of 96 SATA drives. On the new boot, each drive > >>> spun up one at a time while they were being probed. Eventually the > >>> system paniced because run_interrupt_driven_hooks timed out. With > >>> mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0. > >> > >> > >> That's a good question. The standard is silent about what, exactly, the > >> Standby state means. We already allow this to be disabled, and this > commit > >> doesn't change that. It looks like IDLE IMMEDIATE also forces SMART > media > >> non volatile to be flushed out. > >> > >> What do you suggest? > > > > > > I see two paths forward. We need to flush the NV SMART data at reboot > time. > > SSDs that we use, at least, consider it an unclean shutdown if you don't > > Idle the drive on reboot because part of that process does a > > COMINIT/COMRESET and if the drive is in the Active state, it ticks up the > > counter (and with at least one vendor can lose NV SMART data). > > > > So, path forward #1 is that we do STANDBY IMMEDIATE for SSDs in the > > RB_REBOOT case or all drives in the other cases. For HDD and RB_REBOOT > we do > > only a IDLE IMMEDIATE which shouldn't spin the drives down. This seems to > > bake in what we know about storage devices and is easiest for the user. > If > > we get it right, it's easier for the user. If we get it wrong, the user > can > > disable all spin downs. > > > > Path forward #2 is to just make what we send a sysctl. This is > unsatisfying > > and error-prone, but gives the most flexibility. I don't like this. > > > > I'd be curious if there's another viable path forward I'm not seeing that > > you might know. > > > > FWIW, we don't connect HDDs to our AHCI ports (they are all on > MPT/MPS/MPR > > HBAs), so we've not seen any issues in the 6 or so months we've had this > in > > the tree. > > > > Warner > > Is there some reason not to send IDLE IMMEDIATE to both SSDs and HDDs? > On warm boot? Not that I can think of. Our drive vendor told us specifically that STANDBY IMMEDIATE was what we should use, so I'll have to do some research. The standard says that it should be fine though. I like that direction. For the other stuff, I think we should still send STANDBY IMMEDIATE. I'll work up a patch (the hardest part is the comment) and add you to the review later today. Warner From owner-svn-src-head@freebsd.org Fri Oct 27 15:08:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D6A4E47D1B; Fri, 27 Oct 2017 15:08:46 +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 301BF69759; Fri, 27 Oct 2017 15:08: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 v9RF8frH014278 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 27 Oct 2017 18:08:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v9RF8frH014278 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v9RF8fon014277; Fri, 27 Oct 2017 18:08:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 27 Oct 2017 18:08:41 +0300 From: Konstantin Belousov To: mmel@freebsd.org Cc: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, kib@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal Message-ID: <20171027150841.GH2566@kib.kiev.ua> References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> <6eff6e66-4987-8753-105f-b6a5b8234ff3@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6eff6e66-4987-8753-105f-b6a5b8234ff3@freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 15:08:46 -0000 On Fri, Oct 27, 2017 at 02:53:26PM +0200, Michal Meloun wrote: > Sorry for top posting > That's pity, we have clear problem in rtld code :( > See: > ----------------------------------------------------- > RESCUE WITHOUT JEMALLOC_ALIGNED(16); > ----------------------------------------------------- > Program Headers: > TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 0x011bc R 0x8 > Section Headers: > 04 .tdata .tbss .init_array .fini_array .jcr .got > Dump: > 00a832b0 <__je_tsd_tls+0xa832b0>: > a832b0: 00000005 > > GDB > (gdb) b tsd_fetch_impl > Breakpoint 1 at 0x7c4c08: tsd_fetch_impl. (6 locations) > (gdb) r > Starting program: /usr/src/rescue.noalign sh > > Breakpoint 1, tsd_fetch_impl (init=true, minimal=false) at > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 > 261 tsd_t *tsd = tsd_get(init); > (gdb) n > 263 if (!init && tsd_get_allocates() && tsd == NULL) { > > (gdb) p tsd > $1 = (tsd_t *) 0x20c83008 > > (gdb) p *tsd > $2 = {state = 5 '\005', .... > > (gdb) p *((tsd_t *)0x00a832b0) > $3 = {state = 5 '\005', ... > > > > ----------------------------------------------------- > RESCUE WITH JEMALLOC_ALIGNED(16); > ----------------------------------------------------- > Program Headers: > TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 0x011bc R 0x10 > Section Headers: > 04 .tdata .tbss .init_array .fini_array .jcr .got > Dump: > 00a832b0 <__je_tsd_tls+0xa832b0>: > a832b0: 00000005 > > GDB > (gdb) b tsd_fetch_impl > Breakpoint 1 at 0x7c4c08: tsd_fetch_impl. (6 locations) > (gdb) r > Starting program: /usr/obj/usr/src/rescue/rescue/rescue sh > Breakpoint 1, tsd_fetch_impl (init=true, minimal=false) at > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 > 261 tsd_t *tsd = tsd_get(init); > (gdb) n > 263 if (!init && tsd_get_allocates() && tsd == NULL) { > > (gdb) p tsd > $1 = (tsd_t *) 0x20c83010 > > (gdb) p *tsd > $2 = {state = 0 '\000', ... > > (gdb) p *((tsd_t *)0x00a832b0) > $3 = {state = 5 '\005', ... > > !!!! BUT p *(tsd - 8 bytes) !!!!!!!!!! > (gdb) p *((tsd_t *)0x20c83008) > $4 = {state = 5 '\005', ... > > ----------------------------------------------------- > So it's clear that: > > - both binaries are valid, .tdata section have valid data. > - requested alignment is propagated to binary. > - .tdata section is properly loaded to memory because > p *((tsd_t *)0x00a832b0) is {state = 5 '\005' > in both cases > > - a per thread copy of .tdata respect requested alignment > but the original data was copied to unaligned address. > because for aligned binary > p *tsd is {state = 0 '\000', ... > p *(tsd - 8 bytes) is {state = 5 '\005' > > I'm right? > Kib, please, can you help us? Does it happen for rescue binary ? Note that the binary is linked static, so the problem is in lib/libc/gen/tls.c and not in rtld. There, I do not see any real use of the phdr' p_align value. BTW, is rescue linked to libthr ? From owner-svn-src-head@freebsd.org Fri Oct 27 15:22:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B26ACE483B1; Fri, 27 Oct 2017 15:22:02 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 79C2F6A068; Fri, 27 Oct 2017 15:22:02 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id EA5075A9F12; Fri, 27 Oct 2017 15:21:54 +0000 (UTC) Date: Fri, 27 Oct 2017 15:21:54 +0000 From: Brooks Davis To: Konstantin Belousov Cc: mmel@freebsd.org, Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, kib@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal Message-ID: <20171027152154.GA31598@spindle.one-eyed-alien.net> References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> <6eff6e66-4987-8753-105f-b6a5b8234ff3@freebsd.org> <20171027150841.GH2566@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ibTvN161/egqYuK8" Content-Disposition: inline In-Reply-To: <20171027150841.GH2566@kib.kiev.ua> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 15:22:02 -0000 --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 27, 2017 at 06:08:41PM +0300, Konstantin Belousov wrote: > On Fri, Oct 27, 2017 at 02:53:26PM +0200, Michal Meloun wrote: > > Sorry for top posting > > That's pity, we have clear problem in rtld code :( > > See: > > ----------------------------------------------------- > > RESCUE WITHOUT JEMALLOC_ALIGNED(16); > > ----------------------------------------------------- > > Program Headers: > > TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 0x011bc R 0x8 > > Section Headers: > > 04 .tdata .tbss .init_array .fini_array .jcr .got > > Dump: > > 00a832b0 <__je_tsd_tls+0xa832b0>: > > a832b0: 00000005 > >=20 > > GDB > > (gdb) b tsd_fetch_impl > > Breakpoint 1 at 0x7c4c08: tsd_fetch_impl. (6 locations) > > (gdb) r > > Starting program: /usr/src/rescue.noalign sh > >=20 > > Breakpoint 1, tsd_fetch_impl (init=3Dtrue, minimal=3Dfalse) at > > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 > > 261 tsd_t *tsd =3D tsd_get(init); > > (gdb) n > > 263 if (!init && tsd_get_allocates() && tsd =3D=3D NULL) { > >=20 > > (gdb) p tsd > > $1 =3D (tsd_t *) 0x20c83008 > >=20 > > (gdb) p *tsd > > $2 =3D {state =3D 5 '\005', .... > >=20 > > (gdb) p *((tsd_t *)0x00a832b0) > > $3 =3D {state =3D 5 '\005', ... > >=20 > >=20 > >=20 > > ----------------------------------------------------- > > RESCUE WITH JEMALLOC_ALIGNED(16); > > ----------------------------------------------------- > > Program Headers: > > TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 0x011bc R 0x10 > > Section Headers: > > 04 .tdata .tbss .init_array .fini_array .jcr .got > > Dump: > > 00a832b0 <__je_tsd_tls+0xa832b0>: > > a832b0: 00000005 > >=20 > > GDB > > (gdb) b tsd_fetch_impl > > Breakpoint 1 at 0x7c4c08: tsd_fetch_impl. (6 locations) > > (gdb) r > > Starting program: /usr/obj/usr/src/rescue/rescue/rescue sh > > Breakpoint 1, tsd_fetch_impl (init=3Dtrue, minimal=3Dfalse) at > > /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 > > 261 tsd_t *tsd =3D tsd_get(init); > > (gdb) n > > 263 if (!init && tsd_get_allocates() && tsd =3D=3D NULL) { > >=20 > > (gdb) p tsd > > $1 =3D (tsd_t *) 0x20c83010 > >=20 > > (gdb) p *tsd > > $2 =3D {state =3D 0 '\000', ... > >=20 > > (gdb) p *((tsd_t *)0x00a832b0) > > $3 =3D {state =3D 5 '\005', ... > >=20 > > !!!! BUT p *(tsd - 8 bytes) !!!!!!!!!! > > (gdb) p *((tsd_t *)0x20c83008) > > $4 =3D {state =3D 5 '\005', ... > >=20 > > ----------------------------------------------------- > > So it's clear that: > >=20 > > - both binaries are valid, .tdata section have valid data. > > - requested alignment is propagated to binary. > > - .tdata section is properly loaded to memory because > > p *((tsd_t *)0x00a832b0) is {state =3D 5 '\005' > > in both cases > >=20 > > - a per thread copy of .tdata respect requested alignment > > but the original data was copied to unaligned address. > > because for aligned binary > > p *tsd is {state =3D 0 '\000', ... > > p *(tsd - 8 bytes) is {state =3D 5 '\005' > >=20 > > I'm right? > > Kib, please, can you help us? >=20 > Does it happen for rescue binary ? >=20 > Note that the binary is linked static, so the problem is in lib/libc/gen/= tls.c > and not in rtld. There, I do not see any real use of the phdr' p_align > value. >=20 > BTW, is rescue linked to libthr ? There isn't alignment support for TLS in static binaries. I've fixed this in CheriBSD and am planning to upstream the fixes at some point. The fix for variant I is in: https://github.com/CTSRD-CHERI/cheribsd/commit/3cfb124ebb9fdb545dad8436a04d= d58c05b33f4b -- Brooks --ibTvN161/egqYuK8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJZ808SAAoJEKzQXbSebgfA+9MIAIEYWbrBn0EtgniKuEX99BfB ojzlnG8wxeujn/Hm33lfcDVNUSfjILiZoZxwIGR9Y8ENCSyfmMGmdv9s4CQzM9Ci ihesHFajDjrrsOYCt4mm774gJtc8eDoHbN+NN46QXbdZSLX+s2qTROeLcN5SUGH/ GrQwH13Kjda1bfOoD0XyS+qqjBD3F6YPScIdxsf/zpwFcZJI85UqkwSeGKU9oXlT 3EhJCDk4q29pXMKLUTkK59oQvHVftKXi55NcZv7Fzu2f5D7ijFe+TQ9urxd5QRag yFcvMUipkVolsviweVNlLDhGWhYdNMWFHTgtDI4YQvRgPHbvRS7RtvkSVKpL9gA= =ggcJ -----END PGP SIGNATURE----- --ibTvN161/egqYuK8-- From owner-svn-src-head@freebsd.org Fri Oct 27 15:37:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41C0BE4950F for ; Fri, 27 Oct 2017 15:37:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) (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 0147A6B9C1 for ; Fri, 27 Oct 2017 15:37:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x243.google.com with SMTP id h70so13559221ioi.4 for ; Fri, 27 Oct 2017 08:37:29 -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=0O8rXskDNCcW9ILI7UihRlvqoW84ahFW1WkA2ShJEzQ=; b=zvhmd4PEUQcPnRDeenlXmFVqcss4OoEtlvXOtiwIaQaTn5uEvTmZ6uXiLVFDXhPzWt 87JA9pEhBO7ESqkfGpORQaS8Thj2Lz02zcw9kx9uX77aJIUTyXhC30FtLo0B2nkwHK2f /JylP0ZT24UOfLdOxXiwEAY3kOyjCN7n9vczlj7ug1U4hnLfNHtFq0xsgCsvys/ZQTKE tnBlHAcr6EwS6jtWzwVU1DZpYw0l+oq6NuC4+w5XboHRIcFd3h3HsPfCcjXTrbdRfNzl LL84nOMdWQUM18os1eW5tpEVjpRcnPGQseAk/YPj7K81oQlexGzcqzXrrPTAhs4CL5me 8d7g== 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=0O8rXskDNCcW9ILI7UihRlvqoW84ahFW1WkA2ShJEzQ=; b=fSO7yJ/GUEL4CDFAgHlyB+R4aV1nIwOsSYUj7k9Y6VAewjL9DM/4DMmilfY6JMpqjH d5LmuqKxMOg++g6NjZUR4wpzziYUygWTr6hmNlV8uwMv5gWnuVkElZF0JMzWMDOEmwQI gldBbV/NwtQ09seuix90j3f6D7VFqcvojfw/bBJAokV2ngi6vtODq3/KL6KGbPmg0sJR YTz7UTj7Rh6CTXuDhqL0MY3eWZYi7vyv2Sr6Pfv56ad3eO9MeAfwG7w9F6IBXeImarfY Bbq82PnfQJVUQo++SnmYSD5h+4b05v5DYEBbUoAAD5nip+NqAXuMdyaDdju2war7cCfx waJw== X-Gm-Message-State: AMCzsaUqBV5P+VfDj3SZiLPHhdSb+TzyIjYZvk0tKNE6UuOi9EPDoNao 22UzcUK8+5pTNSdW9oWud0jI1PfmaGaAKkVEDijd2w== X-Google-Smtp-Source: ABhQp+SCkUFuDsZUR8SAywXNIn1gvvSFoF4Zjim1Mm16m6pJ49rGr7GivxnRxGGrR768/LcDnrnw++lDSN8UJmBaPZg= X-Received: by 10.107.27.7 with SMTP id b7mr1081301iob.136.1509118649286; Fri, 27 Oct 2017 08:37:29 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Fri, 27 Oct 2017 08:37:27 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:68f3:90da:7630:94a5] In-Reply-To: References: <201710271457.v9REvcNr006595@repo.freebsd.org> From: Warner Losh Date: Fri, 27 Oct 2017 09:37:27 -0600 X-Google-Sender-Auth: y3m0zUpBmBERZxkChHvwsnJUyJ0 Message-ID: Subject: Re: svn commit: r325040 - head/sys/cam/nvme To: Alan Somers Cc: Warner Losh , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 15:37:30 -0000 On Fri, Oct 27, 2017 at 9:05 AM, Alan Somers wrote: > On Fri, Oct 27, 2017 at 8:57 AM, Warner Losh wrote: > > Author: imp > > Date: Fri Oct 27 14:57:38 2017 > > New Revision: 325040 > > URL: https://svnweb.freebsd.org/changeset/base/325040 > > > > Log: > > nvd alias has caused some problems, revert it for the moment. > > > > 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 Fri Oct 27 14:57:14 2017 (r325039) > > +++ head/sys/cam/nvme/nvme_da.c Fri Oct 27 14:57:38 2017 (r325040) > > @@ -794,7 +794,7 @@ ndaregister(struct cam_periph *periph, void *arg) > > /* > > * Add alias for older nvd drives to ease transition. > > */ > > - disk_add_alias(disk, "nvd"); > > + /* disk_add_alias(disk, "nvd"); Have reports of this causing > problems */ > > > > /* > > * Acquire a reference to the periph before we register with > GEOM. > > Is there a PR? If so, please link the PR from the comment. > No PR. We had a problem at Netflix with the multiple drives we have in a system, so we disabled it locally. I wasn't seeing it in !Netflix FreeBSD at the time, so I didn't upstream. I since discovered the problem on a raw FreeBSD kernel on my machines here, but haven't had time to investigate further. It could be multiple drives, or something else triggering it. I just don't know yet, so there's nothing concrete to point to. Warner From owner-svn-src-head@freebsd.org Fri Oct 27 15:52:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75C1FE4A630 for ; Fri, 27 Oct 2017 15:52:25 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1a.eu.mailhop.org (outbound1a.eu.mailhop.org [52.58.109.202]) (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 4272F6D386 for ; Fri, 27 Oct 2017 15:52:21 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: cd41a584-bb2e-11e7-a893-25625093991c X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.eu.mailhop.org (Halon) with ESMTPSA id cd41a584-bb2e-11e7-a893-25625093991c; Fri, 27 Oct 2017 15:52:15 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v9RFqAt7004509; Fri, 27 Oct 2017 09:52:10 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1509119530.56824.75.camel@freebsd.org> Subject: Re: svn commit: r325026 - head/sys/cam/ata From: Ian Lepore To: Warner Losh , Alan Somers Cc: Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Date: Fri, 27 Oct 2017 09:52:10 -0600 In-Reply-To: References: <201710262253.v9QMrovZ009495@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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 15:52:25 -0000 On Thu, 2017-10-26 at 20:27 -0600, Warner Losh wrote: > On Thu, Oct 26, 2017 at 5:35 PM, Warner Losh wrote: > > > > > > > > > On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers wrote: > > > > > > > > On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh wrote: > > > > > > > > Author: imp > > > > Date: Thu Oct 26 22:53:49 2017 > > > > New Revision: 325026 > > > > URL: https://svnweb.freebsd.org/changeset/base/325026 > > > > > > > > Log: > > > >   Always send STANDBY IMMEDIATE when shutting down > > > > > > > >   To save SMART data and for a drive to understand that it's been nicely > > > >   shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to > > > >   use a local CCB on the stack. When we're panicing, used > > > >   xpt_polled_action rather than cam_periph_runccb so that we can SEND > > > >   IMMEDIATE after we've shutdown the scheduler. > > > > > > > >   Sponsored by: Netflix > > > >   Reviewed by: scottl@, gallatin@ > > > >   Differential Revision: https://reviews.freebsd.org/D12799 > > > > > > > > Modified: > > > >   head/sys/cam/ata/ata_da.c > > > Will this put the drive into a standby state just prior to a warm > > > reboot?  That could cause lengthy delays on the new boot while the > > > drives spin up.  That behavior caused a problem when the mpr driver > > > did it to a JBOD full of 96 SATA drives.  On the new boot, each drive > > > spun up one at a time while they were being probed.  Eventually the > > > system paniced because run_interrupt_driven_hooks timed out.  With > > > mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0. > > > > > That's a good question. The standard is silent about what, exactly, the > > Standby state means. We already allow this to be disabled, and this commit > > doesn't change that. It looks like IDLE IMMEDIATE also forces SMART media > > non volatile to be flushed out. > > > > What do you suggest? > > > I see two paths forward. We need to flush the NV SMART data at reboot time. > SSDs that we use, at least, consider it an unclean shutdown if you don't > Idle the drive on reboot because part of that process does a > COMINIT/COMRESET and if the drive is in the Active state, it ticks up the > counter (and with at least one vendor can lose NV SMART data). > > So, path forward #1 is that we do STANDBY IMMEDIATE for SSDs in the > RB_REBOOT case or all drives in the other cases. For HDD and RB_REBOOT we > do only a IDLE IMMEDIATE which shouldn't spin the drives down. IDLE will actually spin drives up -- my 'spinup' script is just a series of 'camcontrol idle ada#' commands for all the backup drives that are usually in standby. If IDLE does the necessary flushing, then why not STANDBY in the power- down/cycle case and IDLE in all other cases, regardless of drive type?  The only point in using STANDBY at all would be to avoid spinning up drives just before powering them down. -- Ian > This seems > to bake in what we know about storage devices and is easiest for the user. > If we get it right, it's easier for the user. If we get it wrong, the user > can disable all spin downs. > > Path forward #2 is to just make what we send a sysctl. This is unsatisfying > and error-prone, but gives the most flexibility. I don't like this. > > I'd be curious if there's another viable path forward I'm not seeing that > you might know. > > FWIW, we don't connect HDDs to our AHCI ports (they are all on MPT/MPS/MPR > HBAs), so we've not seen any issues in the 6 or so months we've had this in > the tree. > > Warner From owner-svn-src-head@freebsd.org Fri Oct 27 15:55:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56CBEE4A97C for ; Fri, 27 Oct 2017 15:55:25 +0000 (UTC) (envelope-from wlosh@bsdimp.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 186F86D758 for ; Fri, 27 Oct 2017 15:55:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x231.google.com with SMTP id b186so13671511iof.8 for ; Fri, 27 Oct 2017 08:55:25 -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=pE+Pqb7W2dUNsbw4Mu/s91akfnY8zBuX003ZzHwMUTQ=; b=EcC46Uj2FNl3UoMZjxg3c3XdPrFzse10fMbzkjPpc6x8rtRHCBk3mQkcE/iKtPlYl/ 4AvDJiqhHYFJ8VrLbA9NTz50Tt2w+3vbeh90Gus070qjdJEwOLzu6SftO6kuo8Gd4wwC y+0GNUe9aKxLEwSvELm4s+gHe2SMmxRgJVW0oDBGqJy2z/swaHt5h2iMACTmGLj1Qtom KA3NuxjDbE7iQqylc5PMNGynePAFdE8Y0w+o2vANILuVr4Xb/Srmp/XVBVfrApuYEy7K Ha/d6wyJLY491A8o/Z8l0eXDM4LT3a5lRG+hc0eXfYIYPdweWP4WVXU7rxE1Z988sahR 7RZQ== 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=pE+Pqb7W2dUNsbw4Mu/s91akfnY8zBuX003ZzHwMUTQ=; b=VmgqbPn2yU8c9ZbDNbQtpA/idbF9YGa4xh5XbtWqkAJReLjLJ2Pz5JPqqma2dcAHIN JFvPEZJg3Yx/vKVGASQopNaT+7lcNUDlEI/EAV/hndE23bcCbg9w/gOUGdc/QmNMwJPj dL+EdI2fTnbAp1gy15C0H1cSPRiAjXGXF5YNmC4dln/LgLHlGbCfAKLilDZ2tyNi6/oj RKlhJxymj0KQKiHBWybfCzvKOomQbPOWflEdYWHFrLKv2BPpbNEtptkTz4b2/YhlMOLJ owgSk3nN2VCcrCSDh5XPA8nHk+622TctzrUVS1/et72pmD9ToGBVbZ6d7v+LE6q6i/+n TexQ== X-Gm-Message-State: AMCzsaWRyiZ3P3eXoMUb3wKik3lCI8DhW77ABpbBZESQbpyRdAK+DD9W /gZ7cUNYs5wTSFEe9aS2XjgMQzYJML67/B7EOC6fGDqH X-Google-Smtp-Source: ABhQp+TFVoESwgtSifRDrHLI5MTOrjNHKdwFIdfxneJLT6gOpufjuETwRvAVS4CP6OMTzR/kimvMkQovMTP22qSOs6M= X-Received: by 10.36.94.129 with SMTP id h123mr1162297itb.64.1509119724464; Fri, 27 Oct 2017 08:55:24 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Fri, 27 Oct 2017 08:55:23 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:68f3:90da:7630:94a5] In-Reply-To: <1509119530.56824.75.camel@freebsd.org> References: <201710262253.v9QMrovZ009495@repo.freebsd.org> <1509119530.56824.75.camel@freebsd.org> From: Warner Losh Date: Fri, 27 Oct 2017 09:55:23 -0600 X-Google-Sender-Auth: NBQL_P0rfdGi_78-cezJryXUYrc Message-ID: Subject: Re: svn commit: r325026 - head/sys/cam/ata To: Ian Lepore Cc: Alan Somers , Warner Losh , "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.23 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 15:55:25 -0000 On Fri, Oct 27, 2017 at 9:52 AM, Ian Lepore wrote: > On Thu, 2017-10-26 at 20:27 -0600, Warner Losh wrote: > > On Thu, Oct 26, 2017 at 5:35 PM, Warner Losh wrote: > > > > > > > > > > > > > > On Thu, Oct 26, 2017 at 5:04 PM, Alan Somers > wrote: > > > > > > > > > > > On Thu, Oct 26, 2017 at 4:53 PM, Warner Losh > wrote: > > > > > > > > > > Author: imp > > > > > Date: Thu Oct 26 22:53:49 2017 > > > > > New Revision: 325026 > > > > > URL: https://svnweb.freebsd.org/changeset/base/325026 > > > > > > > > > > Log: > > > > > Always send STANDBY IMMEDIATE when shutting down > > > > > > > > > > To save SMART data and for a drive to understand that it's been > nicely > > > > > shutdown, we need to send a STANDBY IMMEDIATE. Modify > adaspindown to > > > > > use a local CCB on the stack. When we're panicing, used > > > > > xpt_polled_action rather than cam_periph_runccb so that we can > SEND > > > > > IMMEDIATE after we've shutdown the scheduler. > > > > > > > > > > Sponsored by: Netflix > > > > > Reviewed by: scottl@, gallatin@ > > > > > Differential Revision: https://reviews.freebsd.org/D12799 > > > > > > > > > > Modified: > > > > > head/sys/cam/ata/ata_da.c > > > > Will this put the drive into a standby state just prior to a warm > > > > reboot? That could cause lengthy delays on the new boot while the > > > > drives spin up. That behavior caused a problem when the mpr driver > > > > did it to a JBOD full of 96 SATA drives. On the new boot, each drive > > > > spun up one at a time while they were being probed. Eventually the > > > > system paniced because run_interrupt_driven_hooks timed out. With > > > > mpr, I was able to fix the problem by setting hw.mpr.enable_ssu=0. > > > > > > > That's a good question. The standard is silent about what, exactly, the > > > Standby state means. We already allow this to be disabled, and this > commit > > > doesn't change that. It looks like IDLE IMMEDIATE also forces SMART > media > > > non volatile to be flushed out. > > > > > > What do you suggest? > > > > > I see two paths forward. We need to flush the NV SMART data at reboot > time. > > SSDs that we use, at least, consider it an unclean shutdown if you don't > > Idle the drive on reboot because part of that process does a > > COMINIT/COMRESET and if the drive is in the Active state, it ticks up the > > counter (and with at least one vendor can lose NV SMART data). > > > > So, path forward #1 is that we do STANDBY IMMEDIATE for SSDs in the > > RB_REBOOT case or all drives in the other cases. For HDD and RB_REBOOT we > > do only a IDLE IMMEDIATE which shouldn't spin the drives down. > > IDLE will actually spin drives up -- my 'spinup' script is just a > series of 'camcontrol idle ada#' commands for all the backup drives > that are usually in standby. > > If IDLE does the necessary flushing, then why not STANDBY in the power- > down/cycle case and IDLE in all other cases, regardless of drive type? > The only point in using STANDBY at all would be to avoid spinning up > drives just before powering them down. https://reviews.freebsd.org/D12811 does exactly this. Alan suggested something similar. Maybe you could "give it a spin" on that crazy system of yours we chatted about on IRC and see if that helps... Warner > > -- Ian > > > This seems > > to bake in what we know about storage devices and is easiest for the > user. > > If we get it right, it's easier for the user. If we get it wrong, the > user > > can disable all spin downs. > > > > Path forward #2 is to just make what we send a sysctl. This is > unsatisfying > > and error-prone, but gives the most flexibility. I don't like this. > > > > I'd be curious if there's another viable path forward I'm not seeing that > > you might know. > > > > FWIW, we don't connect HDDs to our AHCI ports (they are all on > MPT/MPS/MPR > > HBAs), so we've not seen any issues in the 6 or so months we've had this > in > > the tree. > > > > Warner > From owner-svn-src-head@freebsd.org Fri Oct 27 16:23:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD691E4B40E; Fri, 27 Oct 2017 16:23:46 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9CA7C6E9F5; Fri, 27 Oct 2017 16:23:46 +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 v9RGNjkr047723; Fri, 27 Oct 2017 16:23:45 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RGNjec047721; Fri, 27 Oct 2017 16:23:45 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201710271623.v9RGNjec047721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Oct 2017 16:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325042 - head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Commit-Revision: 325042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 16:23:46 -0000 Author: emaste Date: Fri Oct 27 16:23:45 2017 New Revision: 325042 URL: https://svnweb.freebsd.org/changeset/base/325042 Log: libdtrace: replace "DOODAD" with more descriptive string Previously some unimplemented libdtrace routines printed the function, file and line number, followed by "DOODAD." That is not particularly informative, so replace it with a message reporting the actual issue. Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Fri Oct 27 15:33:26 2017 (r325041) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Fri Oct 27 16:23:45 2017 (r325042) @@ -229,10 +229,12 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, for (j = 0; j < nrel; j++) { #if defined(__aarch64__) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): aarch64 not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #elif defined(__arm__) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): arm not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + dofr[j].dofr_offset; @@ -240,7 +242,8 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L R_386_PC32); #elif defined(__mips__) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): MIPS not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #elif defined(__powerpc__) /* * Add 4 bytes to hit the low half of this 64-bit @@ -252,7 +255,8 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L R_PPC_REL32); #elif defined(__riscv) /* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): RISC-V not implemented\n", + __FUNCTION__, __FILE__, __LINE__); #else #error unknown ISA #endif @@ -802,7 +806,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): aarch64 not implemented\n", __FUNCTION__, __FILE__, + __LINE__); return (0); } #elif defined(__arm__) @@ -811,7 +816,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): arm not implemented\n", __FUNCTION__, __FILE__, + __LINE__); return (0); } #elif defined(__mips__) @@ -820,7 +826,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): MIPS not implemented\n", __FUNCTION__, __FILE__, + __LINE__); return (0); } #elif defined(__powerpc__) @@ -910,7 +917,8 @@ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): RISC-V implementation required\n", __FUNCTION__, + __FILE__, __LINE__); return (0); } #elif defined(__sparc) Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Fri Oct 27 15:33:26 2017 (r325041) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Fri Oct 27 16:23:45 2017 (r325042) @@ -426,7 +426,8 @@ dt_proc_attach(dt_proc_t *dpr, int exec) static void dt_proc_waitrun(dt_proc_t *dpr) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + printf("%s:%s(%d): not implemented\n", __FUNCTION__, __FILE__, + __LINE__); #ifdef DOODAD struct ps_prochandle *P = dpr->dpr_proc; const lwpstatus_t *psp = &Pstatus(P)->pr_lwp; From owner-svn-src-head@freebsd.org Fri Oct 27 16:36:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D8EEE4B7DF; Fri, 27 Oct 2017 16:36:07 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E08866F01B; Fri, 27 Oct 2017 16:36:06 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9RGa6XR051979; Fri, 27 Oct 2017 16:36:06 GMT (envelope-from obrien@FreeBSD.org) Received: (from obrien@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RGa6pN051978; Fri, 27 Oct 2017 16:36:06 GMT (envelope-from obrien@FreeBSD.org) Message-Id: <201710271636.v9RGa6pN051978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: obrien set sender to obrien@FreeBSD.org using -f From: "David E. O'Brien" Date: Fri, 27 Oct 2017 16:36:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325043 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: obrien X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 325043 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 16:36:07 -0000 Author: obrien Date: Fri Oct 27 16:36:05 2017 New Revision: 325043 URL: https://svnweb.freebsd.org/changeset/base/325043 Log: Update comment to match r177997 & r178036 changes. Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Fri Oct 27 16:23:45 2017 (r325042) +++ head/sys/compat/linux/linux_file.c Fri Oct 27 16:36:05 2017 (r325043) @@ -139,7 +139,7 @@ linux_common_open(struct thread *td, int dirfd, char * goto done; /* - * XXX In between kern_open() and fget(), another process + * XXX In between kern_openat() and fget(), another process * having the same filedesc could use that fd without * checking below. */ From owner-svn-src-head@freebsd.org Fri Oct 27 16:39:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7ED1CE4B967; Fri, 27 Oct 2017 16:39:32 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::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 0F8D36F2D2; Fri, 27 Oct 2017 16:39:32 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x236.google.com with SMTP id r196so4609087wmf.2; Fri, 27 Oct 2017 09:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=EHd/ewZ+LXdF6awcA/aiLGdM0FJLxgFCNtQzd6LjDuI=; b=U/jPY0SkmHSDnLPdidUDRhXhJ3MsJDQoO2nPkOFsTAqzAkw6oLUsOKVpmGlAgmKyWr lJl8puYRim5I+u6hMhP19l8IFc1ACgvsAfaENj1LdGNdVOEK7MbpcdN9v+CwwWYVEDYw +1TeVh7tjMD1mbSczwbTFIzOcB68wlkyV4nmIc0r+iwr+dELUWNmHmK9VT3SGJT12nD/ zWB4pGQsTONz/PItCUoX66dTDUsqqx5IyhPZ/8piflw3e1jWn1+aCb9RuyVetyngmhCQ raNuyAPFNItnxK8TksaCBRxzxFjwjIB78M2ai93equteSL1mG8cBrJUhJv/UzPgvPanf PR7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EHd/ewZ+LXdF6awcA/aiLGdM0FJLxgFCNtQzd6LjDuI=; b=g/vABSVsbW11/O/4MdlDR6RNjHJAec2QLYwIwunxZEGiMcGloVr2zcf46isc/u5AsI mhtroYixzZhcdzmyN3e7dSpSzmU43/uZrce1qNuLyt2KqkEKY88vcNGhi4aGnhghy0wo c3OGEAlVWTZyeK0Evaq5xA3ofiEyYdb5EqD+Gj10leiw3LAmPLUSlOf6ugCOSFkfneUe +8vptQFnrJL8TrWeh5dOKiZ12q9n1aIM99IMv09g3zRPEtZusa/YSzzAv9Q9p2sl4VxD vW4o+dxVQozeG5IrZ/6P9b6+xUyBosDWw8on+dCPijytBbCZv6mr/SNahr82TtBQthQg kSrQ== X-Gm-Message-State: AMCzsaUrSPT4sBF/IjZHF7/epxO2YI6hyR5IzGPL2fom5y7/+4EAY5JP xW51arOHEAP7CjFfbZoCuILBtINDwwg= X-Google-Smtp-Source: ABhQp+QXxqb6LclwSkKrxuNAtxcZisZiTEn3I9X7Ou0m4sI3JJMDHrdjCsX8uGNMn30nwzkcLlONKA== X-Received: by 10.80.177.41 with SMTP id k38mr1381523edd.41.1509122369628; Fri, 27 Oct 2017 09:39:29 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id n20sm5750917edb.93.2017.10.27.09.39.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 09:39:29 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: meloun.michal@gmail.com Subject: Re: svn commit: r325042 - head/cddl/contrib/opensolaris/lib/libdtrace/common To: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201710271623.v9RGNjec047721@repo.freebsd.org> Message-ID: <5e94395e-9feb-0f17-db3b-43583c461242@gmail.com> Date: Fri, 27 Oct 2017 18:39:28 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <201710271623.v9RGNjec047721@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 16:39:32 -0000 On 27.10.2017 18:23, Ed Maste wrote: > Author: emaste > Date: Fri Oct 27 16:23:45 2017 > New Revision: 325042 > URL: https://svnweb.freebsd.org/changeset/base/325042 > > Log: > libdtrace: replace "DOODAD" with more descriptive string > > Previously some unimplemented libdtrace routines printed the function, > file and line number, followed by "DOODAD." That is not particularly > informative, so replace it with a message reporting the actual issue. > > Sponsored by: The FreeBSD Foundation > > Modified: > head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c > head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c > Imho, assert would be much more appropriate. So far, and for affected arches, if port uses USDT probes then dtrace produces broken object files and it ends with exit code 0. This causes runaway build processes (on arm, unprocessed probe is compiled as branch to itself) see: http://beefy8.nyi.freebsd.org/data/head-armv6-default/p452566_s324810/logs/errors/erlang-runtime20-20.1.log Michal > Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Fri Oct 27 15:33:26 2017 (r325041) > +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Fri Oct 27 16:23:45 2017 (r325042) > @@ -229,10 +229,12 @@ prepare_elf32(dtrace_hdl_t *dtp, const dof_hdr_t *dof, > for (j = 0; j < nrel; j++) { > #if defined(__aarch64__) > /* XXX */ > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): aarch64 not implemented\n", > + __FUNCTION__, __FILE__, __LINE__); > #elif defined(__arm__) > /* XXX */ > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): arm not implemented\n", > + __FUNCTION__, __FILE__, __LINE__); > #elif defined(__i386) || defined(__amd64) > rel->r_offset = s->dofs_offset + > dofr[j].dofr_offset; > @@ -240,7 +242,8 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L > R_386_PC32); > #elif defined(__mips__) > /* XXX */ > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): MIPS not implemented\n", > + __FUNCTION__, __FILE__, __LINE__); > #elif defined(__powerpc__) > /* > * Add 4 bytes to hit the low half of this 64-bit > @@ -252,7 +255,8 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__L > R_PPC_REL32); > #elif defined(__riscv) > /* XXX */ > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): RISC-V not implemented\n", > + __FUNCTION__, __FILE__, __LINE__); > #else > #error unknown ISA > #endif > @@ -802,7 +806,8 @@ static int > dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, > uint32_t *off) > { > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): aarch64 not implemented\n", __FUNCTION__, __FILE__, > + __LINE__); > return (0); > } > #elif defined(__arm__) > @@ -811,7 +816,8 @@ static int > dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, > uint32_t *off) > { > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): arm not implemented\n", __FUNCTION__, __FILE__, > + __LINE__); > return (0); > } > #elif defined(__mips__) > @@ -820,7 +826,8 @@ static int > dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, > uint32_t *off) > { > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): MIPS not implemented\n", __FUNCTION__, __FILE__, > + __LINE__); > return (0); > } > #elif defined(__powerpc__) > @@ -910,7 +917,8 @@ static int > dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, > uint32_t *off) > { > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): RISC-V implementation required\n", __FUNCTION__, > + __FILE__, __LINE__); > return (0); > } > #elif defined(__sparc) > > Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Fri Oct 27 15:33:26 2017 (r325041) > +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c Fri Oct 27 16:23:45 2017 (r325042) > @@ -426,7 +426,8 @@ dt_proc_attach(dt_proc_t *dpr, int exec) > static void > dt_proc_waitrun(dt_proc_t *dpr) > { > -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); > + printf("%s:%s(%d): not implemented\n", __FUNCTION__, __FILE__, > + __LINE__); > #ifdef DOODAD > struct ps_prochandle *P = dpr->dpr_proc; > const lwpstatus_t *psp = &Pstatus(P)->pr_lwp; > From owner-svn-src-head@freebsd.org Fri Oct 27 17:05:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78D7EE4C6C6; Fri, 27 Oct 2017 17:05:15 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4643170618; Fri, 27 Oct 2017 17:05:15 +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 v9RH5Euk064712; Fri, 27 Oct 2017 17:05:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RH5EuZ064711; Fri, 27 Oct 2017 17:05:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710271705.v9RH5EuZ064711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 27 Oct 2017 17:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325044 - head/sys/geom/mirror X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/geom/mirror X-SVN-Commit-Revision: 325044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 17:05:15 -0000 Author: markj Date: Fri Oct 27 17:05:14 2017 New Revision: 325044 URL: https://svnweb.freebsd.org/changeset/base/325044 Log: Fix a lock leak in g_mirror_destroy(). g_mirror_destroy() is supposed to unlock the softc before indicating success, but it wasn't doing so if the caller raced with another thread destroying the mirror. MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/sys/geom/mirror/g_mirror.c Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Fri Oct 27 16:36:05 2017 (r325043) +++ head/sys/geom/mirror/g_mirror.c Fri Oct 27 17:05:14 2017 (r325044) @@ -3088,8 +3088,10 @@ g_mirror_destroy(struct g_mirror_softc *sc, int how) } } - if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) + if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROY) != 0) { + sx_xunlock(&sc->sc_lock); return (0); + } sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DESTROY; sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DRAIN; G_MIRROR_DEBUG(4, "%s: Waking up %p.", __func__, sc); From owner-svn-src-head@freebsd.org Fri Oct 27 17:21:44 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5819E4CE26; Fri, 27 Oct 2017 17:21:44 +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 mx1.freebsd.org (Postfix) with ESMTPS id B409070F3B; Fri, 27 Oct 2017 17:21:44 +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 v9RHLhO6071881; Fri, 27 Oct 2017 17:21:43 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RHLhJT071880; Fri, 27 Oct 2017 17:21:43 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710271721.v9RHLhJT071880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 27 Oct 2017 17:21:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325045 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 325045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 17:21:45 -0000 Author: ian Date: Fri Oct 27 17:21:43 2017 New Revision: 325045 URL: https://svnweb.freebsd.org/changeset/base/325045 Log: Actually release resources in detach() rather than just returning EBUSY. This will enable use of 'devctl disable', allow creation of a module, etc. Modified: head/sys/dev/sdhci/fsl_sdhci.c Modified: head/sys/dev/sdhci/fsl_sdhci.c ============================================================================== --- head/sys/dev/sdhci/fsl_sdhci.c Fri Oct 27 17:05:14 2017 (r325044) +++ head/sys/dev/sdhci/fsl_sdhci.c Fri Oct 27 17:21:43 2017 (r325045) @@ -803,9 +803,26 @@ fsl_sdhci_get_platform_clock(device_t dev) static int fsl_sdhci_detach(device_t dev) { + struct fsl_sdhci_softc *sc = device_get_softc(dev); - /* sdhci_fdt_gpio_teardown(sc->gpio); */ - return (EBUSY); + if (sc->gpio != NULL) + sdhci_fdt_gpio_teardown(sc->gpio); + + callout_drain(&sc->r1bfix_callout); + + if (sc->intr_cookie != NULL) + bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); + if (sc->irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + 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); + } + + return (0); } static int @@ -918,13 +935,7 @@ fsl_sdhci_attach(device_t dev) return (0); fail: - if (sc->intr_cookie) - bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); - if (sc->irq_res) - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); - if (sc->mem_res) - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); - + fsl_sdhci_detach(dev); return (err); } @@ -932,7 +943,7 @@ static int fsl_sdhci_probe(device_t dev) { - if (!ofw_bus_status_okay(dev)) + if (!ofw_bus_status_okay(dev)) return (ENXIO); switch (ofw_bus_search_compatible(dev, compat_data)->ocd_data) { From owner-svn-src-head@freebsd.org Fri Oct 27 17:48:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C67A5E4D49C; Fri, 27 Oct 2017 17:48:46 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::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 469D5719C8; Fri, 27 Oct 2017 17:48:46 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x235.google.com with SMTP id b189so4869337wmd.4; Fri, 27 Oct 2017 10:48:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HCzH87EdiNHYw9MPluAfOpVwCnlNI4ZBWMd37ACgP8c=; b=SdcF8e/OUBkTouhAf161ASVOAnKqfxg13vQye9ooG72BZ1iYIG6KZSW9HFutieC2F8 loUNI3qSYKj6uw8Evfpr6xzhbsKdzibX4a2rqP4xaDrL7Ip95AmTtgcoxMTPMqmdrSzD qjtidg9R2j3/p/P7VYRETVKoX86cnliglhZMTBACDQ6RZJxQjsvJSL5ZcMMBtARKjDXz 79Y+S/HvfpL4pbD9alt/IjT9lU2C/o7HEnp/EJ+OEKJJqNyE0nNtTrLb9ZTW8JWfPd5d ibOOJHiE+4YiM8q56GjqeMF/yXDrZHU8vimVebbZivY2bLpSL2Xd/zWVCCogG1tur0+M bVgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=HCzH87EdiNHYw9MPluAfOpVwCnlNI4ZBWMd37ACgP8c=; b=oEpw1XeMGXojarj6B9p5i4JK4Q6k182lPqNDrzptkPR4HUKTY2XYpgy/DuaUkcvTXY fKAn3vpW4CiD5oteUmrJXfnyI0fL9MSslKNCtQgy9fuKgZY4DbdxU5Bj5a4IsDc3B9z0 9WVwwjsNAJi1kiWPE7Ja/9CDtAF3kbjtHIZIS9s4MpIaiq+CFnrfZn5ncy18EjbghOOi Vt+cZm7JRQc9FBSNDkc27SnqRQ5H+8zUoVvnSyH8yJ/SfQmIO5vqKGwRVSpGjjl2i7HX 5nczrFOl1Y/bnILcAa9kfIEhRulrma79tS4LKvKUQ6+qlYX9lBZ9io9Q4uFcdru3vJge S/Yw== X-Gm-Message-State: AMCzsaWQqF7QfzfuJlRX+I7OHwWMlxLTw5usUrY+oBDzP9BtFgimA+2p EDKlbPT69+RUHf3ymdburBLdgk7ulQ4= X-Google-Smtp-Source: ABhQp+SRjXh6xrEsTtQN0yfPi/EHFfuwp9UypVVuBB/6Ztn+wcNmQcab1sHNMpERpqerFgfFbwU/5g== X-Received: by 10.80.182.118 with SMTP id c51mr1654622ede.204.1509126524314; Fri, 27 Oct 2017 10:48:44 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id i6sm5792482edk.3.2017.10.27.10.48.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 10:48:43 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal To: Brooks Davis , Konstantin Belousov Cc: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, kib@freebsd.org References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> <6eff6e66-4987-8753-105f-b6a5b8234ff3@freebsd.org> <20171027150841.GH2566@kib.kiev.ua> <20171027152154.GA31598@spindle.one-eyed-alien.net> Message-ID: Date: Fri, 27 Oct 2017 19:48:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171027152154.GA31598@spindle.one-eyed-alien.net> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 17:48:46 -0000 On 27.10.2017 17:21, Brooks Davis wrote: > On Fri, Oct 27, 2017 at 06:08:41PM +0300, Konstantin Belousov > wrote: >> On Fri, Oct 27, 2017 at 02:53:26PM +0200, Michal Meloun wrote: >>> Sorry for top posting That's pity, we have clear problem in >>> rtld code :( See: >>> ----------------------------------------------------- RESCUE >>> WITHOUT JEMALLOC_ALIGNED(16); >>> ----------------------------------------------------- Program >>> Headers: TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 >>> 0x011bc R 0x8 Section Headers: 04 .tdata .tbss >>> .init_array .fini_array .jcr .got Dump: 00a832b0 >>> <__je_tsd_tls+0xa832b0>: a832b0: 00000005 >>> >>> GDB (gdb) b tsd_fetch_impl Breakpoint 1 at 0x7c4c08: >>> tsd_fetch_impl. (6 locations) (gdb) r Starting program: >>> /usr/src/rescue.noalign sh >>> >>> Breakpoint 1, tsd_fetch_impl (init=true, minimal=false) at >>> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 >>> 261 tsd_t *tsd = tsd_get(init); (gdb) n 263 >>> if (!init && tsd_get_allocates() && tsd == NULL) { >>> >>> (gdb) p tsd $1 = (tsd_t *) 0x20c83008 >>> >>> (gdb) p *tsd $2 = {state = 5 '\005', .... >>> >>> (gdb) p *((tsd_t *)0x00a832b0) $3 = {state = 5 '\005', ... >>> >>> >>> >>> ----------------------------------------------------- RESCUE >>> WITH JEMALLOC_ALIGNED(16); >>> ----------------------------------------------------- Program >>> Headers: TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 >>> 0x011bc R 0x10 Section Headers: 04 .tdata .tbss >>> .init_array .fini_array .jcr .got Dump: 00a832b0 >>> <__je_tsd_tls+0xa832b0>: a832b0: 00000005 >>> >>> GDB (gdb) b tsd_fetch_impl Breakpoint 1 at 0x7c4c08: >>> tsd_fetch_impl. (6 locations) (gdb) r Starting program: >>> /usr/obj/usr/src/rescue/rescue/rescue sh Breakpoint 1, >>> tsd_fetch_impl (init=true, minimal=false) at >>> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 >>> 261 tsd_t *tsd = tsd_get(init); (gdb) n 263 >>> if (!init && tsd_get_allocates() && tsd == NULL) { >>> >>> (gdb) p tsd $1 = (tsd_t *) 0x20c83010 >>> >>> (gdb) p *tsd $2 = {state = 0 '\000', ... >>> >>> (gdb) p *((tsd_t *)0x00a832b0) $3 = {state = 5 '\005', ... >>> >>> !!!! BUT p *(tsd - 8 bytes) !!!!!!!!!! (gdb) p *((tsd_t >>> *)0x20c83008) $4 = {state = 5 '\005', ... >>> >>> ----------------------------------------------------- So it's >>> clear that: >>> >>> - both binaries are valid, .tdata section have valid data. - >>> requested alignment is propagated to binary. - .tdata section >>> is properly loaded to memory because p *((tsd_t *)0x00a832b0) >>> is {state = 5 '\005' in both cases >>> >>> - a per thread copy of .tdata respect requested alignment but >>> the original data was copied to unaligned address. because for >>> aligned binary p *tsd is {state = 0 '\000', ... p *(tsd - 8 >>> bytes) is {state = 5 '\005' >>> >>> I'm right? Kib, please, can you help us? >> >> Does it happen for rescue binary ? >> >> Note that the binary is linked static, so the problem is in >> lib/libc/gen/tls.c and not in rtld. There, I do not see any real >> use of the phdr' p_align value. >> Ahh, right, good catch. >> BTW, is rescue linked to libthr ? Imho not. > > There isn't alignment support for TLS in static binaries. I've > fixed this in CheriBSD and am planning to upstream the fixes at > some point. The fix for variant I is in: > > https://github.com/CTSRD-CHERI/cheribsd/commit/3cfb124ebb9fdb545dad8436a04dd58c05b33f4b > > The real alignment have no effect for program itself, it's important only for AddressSanitizer. But there is something what's still missing me. The rescue binary is statically linked, so whole program have only one TLS section and full TLS layout is determined by linker. The problematic structure, tsd_tls, is first one in TLS section group: readelf -a /usr/obj/usr/src/rescue/rescue/rescue | grep TLS 518961: 0000000000000000 2880 TLS GLOBAL DEFAULT 9 __je_tsd_tls and objdump -d -j .tdata /usr/obj/usr/src/rescue/rescue/rescue 00a832b0 <__je_tsd_tls+0xa832b0>: a832b0: 00000005 but disassembled code expect it at TLS ptr + 0x8 (for code without JEMALLOC_ALIGNED) or at TLS ptr + 0x10 (for code with JEMALLOC_ALIGNED) [without JEMALLOC_ALIGNED] 7c4d90: e59f0014 ldr r0, [pc, #20] ; 7c4dac 7c4d94: e58d0004 str r0, [sp, #4] 7c4d98: eb031d14 bl 88c1f0 <__aeabi_read_tp> 7c4d9c: e59dc004 ldr ip, [sp, #4] 7c4da0: e080000c add r0, r0, ip 7c4da4: e1a0d00b mov sp, fp 7c4da8: e8bd8800 pop {fp, pc} 7c4dac: 00000008 .word 0x00000008 [0x10 for code with JEMALLOC_ALIGNED] so someone other allocates at least one byte from start of TLS and linker is aware about this. But again, .data is first member of TLS and tsd_tls is first of .tdata and the 0x5 is value of first member of tsd_tls structure (.state = tsd_state_uninitialized). So who consumes the first bytes in TLS ???? Michal From owner-svn-src-head@freebsd.org Fri Oct 27 18:22:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3E69E4DFE4; Fri, 27 Oct 2017 18:22:28 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::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 8BA6672B4C; Fri, 27 Oct 2017 18:22:28 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id r196so5057088wmf.2; Fri, 27 Oct 2017 11:22:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=694EYRfM9ugfrs5+PVwsnUjBo590OKqHL4Lv8C9F0kY=; b=gmyCle3oUlW7p7W3fMKmCRNzLYkVAAvujmiuJ6P+R1G1O/jjRN9Jt06xNhIxskYKuF uHAz0BmFXz7t2kRdUtYkz7g2lbumSF7ta36PqV9ctu51sRsGm/Z7mW2MU/0np/oiWCI7 CaEhy+s3RvoS4J1EB3/ew6tFiqfYupmsl7qcO/7a7PaNkSGeNCieKYIa2u0yMGLxwxV+ XKHkHevv9nIxBxsQYMmmOnUdDA/UQVOSNJsctARcdjyvXoKESYbBtmI8VcRY3S4V1nX+ WOHYyx/Svtppq8QqTpPzSdpwriLdS2WhhvwykqptM7PhdJAEJMCu4i+mzIncOypOH90Z V5AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=694EYRfM9ugfrs5+PVwsnUjBo590OKqHL4Lv8C9F0kY=; b=CmMFUpvK5FpJ7McckhBKaquGLPK7PCe8gczRdGcT5Nzzaro2Q+nfjVsLnLxnuY9G+N SzIK03Zm2GDZZtRkgxsOl5XNJXc5Cr8dAeGPGRSQPdaL4rcRXQARab4jYX8alTrCffaj n0XFYhHAmyM/duxhKK31gOZnOFMkRcPjQCCNpq3FgMWtkF/Tf3U3Zo3eUkhuxconPIHq 2PflWKfH2fr87LCteZZCU0haF0cGtpooB5UqWLlzXFxKP50J7zaSMKJrEAMRx9XvBv9b OOO52xgb0+5g2elf/WuOkMf90NHg0FllwG1h1qakxRsZRzN+Wc5YsfcJniBLMsuX1zoG WHMg== X-Gm-Message-State: AMCzsaXpBUxOz5F4kVr6g0yCS7+nYbHmfh8mBZStxE/8PZwnkTe2xtle wAYD8iaBG4ZdWe9l0YvB2Q82LTqES5o= X-Google-Smtp-Source: ABhQp+RspASLALiA988lygnA52s5rMT676wZHaORIYAVOX/6q0D/R95Mg34UWy8YMeuAIL72PGGObA== X-Received: by 10.80.141.79 with SMTP id t15mr1742426edt.70.1509128546624; Fri, 27 Oct 2017 11:22:26 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id o60sm5599319eda.48.2017.10.27.11.22.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 11:22:26 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal To: Brooks Davis , Konstantin Belousov Cc: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, kib@freebsd.org References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> <6eff6e66-4987-8753-105f-b6a5b8234ff3@freebsd.org> <20171027150841.GH2566@kib.kiev.ua> <20171027152154.GA31598@spindle.one-eyed-alien.net> Message-ID: <9b85bde5-c450-94c7-a31e-f2eb7f6ab9ee@freebsd.org> Date: Fri, 27 Oct 2017 20:22:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171027152154.GA31598@spindle.one-eyed-alien.net> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 18:22:29 -0000 On Fri, Oct 27, 2017 at 19:48:43 +0200, Michal Meloun wrote: > On 27.10.2017 17:21, Brooks Davis wrote: >> On Fri, Oct 27, 2017 at 06:08:41PM +0300, Konstantin Belousov >> wrote: >>> On Fri, Oct 27, 2017 at 02:53:26PM +0200, Michal Meloun wrote: >>>> Sorry for top posting That's pity, we have clear problem in >>>> rtld code :( See: >>>> ----------------------------------------------------- RESCUE >>>> WITHOUT JEMALLOC_ALIGNED(16); >>>> ----------------------------------------------------- Program >>>> Headers: TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 >>>> 0x011bc R 0x8 Section Headers: 04 .tdata .tbss >>>> .init_array .fini_array .jcr .got Dump: 00a832b0 >>>> <__je_tsd_tls+0xa832b0>: a832b0: 00000005 >>>> >>>> GDB (gdb) b tsd_fetch_impl Breakpoint 1 at 0x7c4c08: >>>> tsd_fetch_impl. (6 locations) (gdb) r Starting program: >>>> /usr/src/rescue.noalign sh >>>> >>>> Breakpoint 1, tsd_fetch_impl (init=true, minimal=false) at >>>> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 >>>> 261 tsd_t *tsd = tsd_get(init); (gdb) n 263 >>>> if (!init && tsd_get_allocates() && tsd == NULL) { >>>> >>>> (gdb) p tsd $1 = (tsd_t *) 0x20c83008 >>>> >>>> (gdb) p *tsd $2 = {state = 5 '\005', .... >>>> >>>> (gdb) p *((tsd_t *)0x00a832b0) $3 = {state = 5 '\005', ... >>>> >>>> >>>> >>>> ----------------------------------------------------- RESCUE >>>> WITH JEMALLOC_ALIGNED(16); >>>> ----------------------------------------------------- Program >>>> Headers: TLS 0xa732b0 0x00a832b0 0x00a832b0 0x00b40 >>>> 0x011bc R 0x10 Section Headers: 04 .tdata .tbss >>>> .init_array .fini_array .jcr .got Dump: 00a832b0 >>>> <__je_tsd_tls+0xa832b0>: a832b0: 00000005 >>>> >>>> GDB (gdb) b tsd_fetch_impl Breakpoint 1 at 0x7c4c08: >>>> tsd_fetch_impl. (6 locations) (gdb) r Starting program: >>>> /usr/obj/usr/src/rescue/rescue/rescue sh Breakpoint 1, >>>> tsd_fetch_impl (init=true, minimal=false) at >>>> /usr/src/contrib/jemalloc/include/jemalloc/internal/tsd.h:261 >>>> 261 tsd_t *tsd = tsd_get(init); (gdb) n 263 >>>> if (!init && tsd_get_allocates() && tsd == NULL) { >>>> >>>> (gdb) p tsd $1 = (tsd_t *) 0x20c83010 >>>> >>>> (gdb) p *tsd $2 = {state = 0 '\000', ... >>>> >>>> (gdb) p *((tsd_t *)0x00a832b0) $3 = {state = 5 '\005', ... >>>> >>>> !!!! BUT p *(tsd - 8 bytes) !!!!!!!!!! (gdb) p *((tsd_t >>>> *)0x20c83008) $4 = {state = 5 '\005', ... >>>> >>>> ----------------------------------------------------- So it's >>>> clear that: >>>> >>>> - both binaries are valid, .tdata section have valid data. - >>>> requested alignment is propagated to binary. - .tdata section >>>> is properly loaded to memory because p *((tsd_t *)0x00a832b0) >>>> is {state = 5 '\005' in both cases >>>> >>>> - a per thread copy of .tdata respect requested alignment but >>>> the original data was copied to unaligned address. because for >>>> aligned binary p *tsd is {state = 0 '\000', ... p *(tsd - 8 >>>> bytes) is {state = 5 '\005' >>>> >>>> I'm right? Kib, please, can you help us? >>> >>> Does it happen for rescue binary ? >>> >>> Note that the binary is linked static, so the problem is in >>> lib/libc/gen/tls.c and not in rtld. There, I do not see any real >>> use of the phdr' p_align value. >>> > Ahh, right, good catch. >>> BTW, is rescue linked to libthr ? > Imho not. My bad, rescue *is* linked with libthr. And after looking to libthr/arch/arm/pthread_md.h, I'm confused much much more... >> >> There isn't alignment support for TLS in static binaries. I've >> fixed this in CheriBSD and am planning to upstream the fixes at >> some point. The fix for variant I is in: >> >> https://github.com/CTSRD-CHERI/cheribsd/commit/3cfb124ebb9fdb545dad8436a04dd58c05b33f4b >> >> > The real alignment have no effect for program itself, it's important > only for AddressSanitizer. > > But there is something what's still missing me. > The rescue binary is statically linked, so whole program have only one > TLS section and full TLS layout is determined by linker. > The problematic structure, tsd_tls, is first one in TLS section group: > > readelf -a /usr/obj/usr/src/rescue/rescue/rescue | grep TLS > 518961: 0000000000000000 2880 TLS GLOBAL DEFAULT 9 __je_tsd_tls > and > > objdump -d -j .tdata /usr/obj/usr/src/rescue/rescue/rescue > 00a832b0 <__je_tsd_tls+0xa832b0>: > a832b0: 00000005 > > but disassembled code expect it at TLS ptr + 0x8 (for code without > JEMALLOC_ALIGNED) or at TLS ptr + 0x10 (for code with JEMALLOC_ALIGNED) > > [without JEMALLOC_ALIGNED] > 7c4d90: e59f0014 ldr r0, [pc, #20] ; 7c4dac > > 7c4d94: e58d0004 str r0, [sp, #4] > 7c4d98: eb031d14 bl 88c1f0 <__aeabi_read_tp> > 7c4d9c: e59dc004 ldr ip, [sp, #4] > 7c4da0: e080000c add r0, r0, ip > 7c4da4: e1a0d00b mov sp, fp > 7c4da8: e8bd8800 pop {fp, pc} > 7c4dac: 00000008 .word 0x00000008 [0x10 for code > with JEMALLOC_ALIGNED] > > so someone other allocates at least one byte from start of TLS and > linker is aware about this. But again, .data is first member of TLS > and tsd_tls is first of .tdata and the 0x5 is value of first member of > tsd_tls structure (.state = tsd_state_uninitialized). > > So who consumes the first bytes in TLS ???? > > Michal From owner-svn-src-head@freebsd.org Fri Oct 27 18:34:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C805AE4E2B2; Fri, 27 Oct 2017 18:34:40 +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 3764D73116; Fri, 27 Oct 2017 18:34:40 +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 v9RIYYK4060196 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 27 Oct 2017 21:34:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v9RIYYK4060196 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v9RIYYaM060195; Fri, 27 Oct 2017 21:34:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 27 Oct 2017 21:34:34 +0300 From: Konstantin Belousov To: mmel@freebsd.org Cc: Brooks Davis , Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, kib@freebsd.org Subject: Re: svn commit: r324938 - head/contrib/jemalloc/include/jemalloc/internal Message-ID: <20171027183434.GK2566@kib.kiev.ua> References: <201710232131.v9NLV4Rb068825@repo.freebsd.org> <38db6f4e-72b8-6ffd-4529-f15ca32bad54@freebsd.org> <6FD27DFB-5039-4E33-B131-EF5391DD1630@FreeBSD.org> <6eff6e66-4987-8753-105f-b6a5b8234ff3@freebsd.org> <20171027150841.GH2566@kib.kiev.ua> <20171027152154.GA31598@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 18:34:40 -0000 On Fri, Oct 27, 2017 at 07:48:43PM +0200, Michal Meloun wrote: > But there is something what's still missing me. > The rescue binary is statically linked, so whole program have only one > TLS section and full TLS layout is determined by linker. > The problematic structure, tsd_tls, is first one in TLS section group: > > readelf -a /usr/obj/usr/src/rescue/rescue/rescue | grep TLS > 518961: 0000000000000000 2880 TLS GLOBAL DEFAULT 9 __je_tsd_tls > and > > objdump -d -j .tdata /usr/obj/usr/src/rescue/rescue/rescue > 00a832b0 <__je_tsd_tls+0xa832b0>: > a832b0: 00000005 > > but disassembled code expect it at TLS ptr + 0x8 (for code without > JEMALLOC_ALIGNED) or at TLS ptr + 0x10 (for code with JEMALLOC_ALIGNED) > > [without JEMALLOC_ALIGNED] > 7c4d90: e59f0014 ldr r0, [pc, #20] ; 7c4dac > > 7c4d94: e58d0004 str r0, [sp, #4] > 7c4d98: eb031d14 bl 88c1f0 <__aeabi_read_tp> > 7c4d9c: e59dc004 ldr ip, [sp, #4] > 7c4da0: e080000c add r0, r0, ip > 7c4da4: e1a0d00b mov sp, fp > 7c4da8: e8bd8800 pop {fp, pc} > 7c4dac: 00000008 .word 0x00000008 [0x10 for code > with JEMALLOC_ALIGNED] > > so someone other allocates at least one byte from start of TLS and > linker is aware about this. But again, .data is first member of TLS > and tsd_tls is first of .tdata and the 0x5 is value of first member of > tsd_tls structure (.state = tsd_state_uninitialized). > > So who consumes the first bytes in TLS ???? Hack the makefile to pass the -M option to linker, like -Wl,-M >/some/path/file.map. The file.map provides the data about sections assembly. From owner-svn-src-head@freebsd.org Fri Oct 27 19:27:06 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD4E9E4F1C5; Fri, 27 Oct 2017 19:27:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 88E33746C8; Fri, 27 Oct 2017 19:27:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9RJR5OP022879; Fri, 27 Oct 2017 19:27:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RJR5Pi022878; Fri, 27 Oct 2017 19:27:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201710271927.v9RJR5Pi022878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 27 Oct 2017 19:27:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325046 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 325046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 19:27:06 -0000 Author: tuexen Date: Fri Oct 27 19:27:05 2017 New Revision: 325046 URL: https://svnweb.freebsd.org/changeset/base/325046 Log: Fix parsing error when processing cmsg in SCTP send calls. Thei bug is related to a signed/unsigned mismatch. This should most likely fix the issue in sctp_sosend reported by Dmitry Vyukov on the freebsd-hackers mailing list and found by running syzkaller. Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Fri Oct 27 17:21:43 2017 (r325045) +++ head/sys/netinet/sctp_output.c Fri Oct 27 19:27:05 2017 (r325046) @@ -3465,32 +3465,35 @@ static int sctp_find_cmsg(int c_type, void *data, struct mbuf *control, size_t cpsize) { struct cmsghdr cmh; - int tlen, at, found; struct sctp_sndinfo sndinfo; struct sctp_prinfo prinfo; struct sctp_authinfo authinfo; + int tot_len, rem_len, cmsg_data_len, cmsg_data_off, off; + int found; - tlen = SCTP_BUF_LEN(control); - at = 0; - found = 0; /* * Independent of how many mbufs, find the c_type inside the control * structure and copy out the data. */ - while (at < tlen) { - if ((tlen - at) < (int)CMSG_ALIGN(sizeof(cmh))) { + found = 0; + tot_len = SCTP_BUF_LEN(control); + for (off = 0; off < tot_len; off += CMSG_ALIGN(cmh.cmsg_len)) { + rem_len = tot_len - off; + if (rem_len < (int)CMSG_ALIGN(sizeof(cmh))) { /* There is not enough room for one more. */ return (found); } - m_copydata(control, at, sizeof(cmh), (caddr_t)&cmh); + m_copydata(control, off, sizeof(cmh), (caddr_t)&cmh); if (cmh.cmsg_len < CMSG_ALIGN(sizeof(cmh))) { /* We dont't have a complete CMSG header. */ return (found); } - if (((int)cmh.cmsg_len + at) > tlen) { + if ((cmh.cmsg_len > INT_MAX) || ((int)cmh.cmsg_len > rem_len)) { /* We don't have the complete CMSG. */ return (found); } + cmsg_data_len = (int)cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh)); + cmsg_data_off = off + CMSG_ALIGN(sizeof(cmh)); if ((cmh.cmsg_level == IPPROTO_SCTP) && ((c_type == cmh.cmsg_type) || ((c_type == SCTP_SNDRCV) && @@ -3498,11 +3501,14 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co (cmh.cmsg_type == SCTP_PRINFO) || (cmh.cmsg_type == SCTP_AUTHINFO))))) { if (c_type == cmh.cmsg_type) { - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < cpsize) { + if (cpsize > INT_MAX) { return (found); } + if (cmsg_data_len < (int)cpsize) { + return (found); + } /* It is exactly what we want. Copy it out. */ - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), (int)cpsize, (caddr_t)data); + m_copydata(control, cmsg_data_off, (int)cpsize, (caddr_t)data); return (1); } else { struct sctp_sndrcvinfo *sndrcvinfo; @@ -3516,10 +3522,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co } switch (cmh.cmsg_type) { case SCTP_SNDINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_sndinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_sndinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_sndinfo), (caddr_t)&sndinfo); sndrcvinfo->sinfo_stream = sndinfo.snd_sid; sndrcvinfo->sinfo_flags = sndinfo.snd_flags; sndrcvinfo->sinfo_ppid = sndinfo.snd_ppid; @@ -3527,10 +3533,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co sndrcvinfo->sinfo_assoc_id = sndinfo.snd_assoc_id; break; case SCTP_PRINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_prinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_prinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_prinfo), (caddr_t)&prinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_prinfo), (caddr_t)&prinfo); if (prinfo.pr_policy != SCTP_PR_SCTP_NONE) { sndrcvinfo->sinfo_timetolive = prinfo.pr_value; } else { @@ -3539,10 +3545,10 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co sndrcvinfo->sinfo_flags |= prinfo.pr_policy; break; case SCTP_AUTHINFO: - if ((size_t)(cmh.cmsg_len - CMSG_ALIGN(sizeof(cmh))) < sizeof(struct sctp_authinfo)) { + if (cmsg_data_len < (int)sizeof(struct sctp_authinfo)) { return (found); } - m_copydata(control, at + CMSG_ALIGN(sizeof(cmh)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); + m_copydata(control, cmsg_data_off, sizeof(struct sctp_authinfo), (caddr_t)&authinfo); sndrcvinfo->sinfo_keynumber_valid = 1; sndrcvinfo->sinfo_keynumber = authinfo.auth_keynumber; break; @@ -3552,7 +3558,6 @@ sctp_find_cmsg(int c_type, void *data, struct mbuf *co found = 1; } } - at += CMSG_ALIGN(cmh.cmsg_len); } return (found); } From owner-svn-src-head@freebsd.org Fri Oct 27 20:21:10 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDBE3E4FFF8; Fri, 27 Oct 2017 20:21:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D2C676067; Fri, 27 Oct 2017 20:21:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9RKL91R046659; Fri, 27 Oct 2017 20:21:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RKL9nw046658; Fri, 27 Oct 2017 20:21:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201710272021.v9RKL9nw046658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 27 Oct 2017 20:21:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325047 - head/contrib/dma X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/dma X-SVN-Commit-Revision: 325047 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 20:21:10 -0000 Author: emaste Date: Fri Oct 27 20:21:09 2017 New Revision: 325047 URL: https://svnweb.freebsd.org/changeset/base/325047 Log: dma: fix use-after-free Sponsored by: The FreeBSD Foundation Modified: head/contrib/dma/dma.c Modified: head/contrib/dma/dma.c ============================================================================== --- head/contrib/dma/dma.c Fri Oct 27 19:27:05 2017 (r325046) +++ head/contrib/dma/dma.c Fri Oct 27 20:21:09 2017 (r325047) @@ -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-head@freebsd.org Fri Oct 27 21:22:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33AB2E5143C; Fri, 27 Oct 2017 21:22:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C4AD77C44; Fri, 27 Oct 2017 21:22:39 +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 v9RLMdxk072237; Fri, 27 Oct 2017 21:22:39 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RLMdvg072236; Fri, 27 Oct 2017 21:22:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201710272122.v9RLMdvg072236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 27 Oct 2017 21:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325048 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 325048 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 21:22:40 -0000 Author: gonzo Date: Fri Oct 27 21:22:38 2017 New Revision: 325048 URL: https://svnweb.freebsd.org/changeset/base/325048 Log: Fix MAC address detection regression introduced by r324184 To accomodate all variaties of Pi DTS files floating around we look for MAC address property either in DTS node for USB ethernet (if it exists) or at predefined path ".../usb/hub/ethernet". After r324184 smsc_fdt_find_eth_node started to return node with compatibility string "usb424,ec00" as an eth node. In imported GNU dts files this node still does not have MAC address related property, and therefor following check for "mac-address" and "local-mac-address" fails. To make this logic more robust do not just search for the node but also make sure it has required property, so if node with accepted compatibility string exists but doesn't have the property we fall back to looking for hardoded path mentioned above. Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Fri Oct 27 20:21:09 2017 (r325047) +++ head/sys/dev/usb/net/if_smsc.c Fri Oct 27 21:22:38 2017 (r325048) @@ -1637,6 +1637,37 @@ smsc_fdt_find_eth_node_by_path(phandle_t start) return (-1); } +/* + * Look through known names that can contain mac address + * return 0 if valid MAC address has been found + */ +static int +smsc_fdt_read_mac_property(phandle_t node, unsigned char *mac) +{ + int len; + + /* Check if there is property */ + if ((len = OF_getproplen(node, "local-mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "local-mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + + if ((len = OF_getproplen(node, "mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "mac-address", mac, + ETHER_ADDR_LEN); + return (0); + } + + return (ENXIO); +} + /** * Get MAC address from FDT blob. Firmware or loader should fill * mac-address or local-mac-address property. Returns 0 if MAC address @@ -1646,37 +1677,22 @@ static int smsc_fdt_find_mac(unsigned char *mac) { phandle_t node, root; - int len; root = OF_finddevice("/"); node = smsc_fdt_find_eth_node(root); + if (node != -1) { + if (smsc_fdt_read_mac_property(node, mac) == 0) + return (0); + } + /* * If it's not FreeBSD FDT blob for RPi, try more * generic .../usb/hub/ethernet */ - if (node == -1) - node = smsc_fdt_find_eth_node_by_path(root); + node = smsc_fdt_find_eth_node_by_path(root); - if (node != -1) { - /* Check if there is property */ - if ((len = OF_getproplen(node, "local-mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(node, "local-mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } - - if ((len = OF_getproplen(node, "mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(node, "mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } - } + if (node != -1) + return smsc_fdt_read_mac_property(node, mac); return (ENXIO); } From owner-svn-src-head@freebsd.org Fri Oct 27 21:48:03 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1E63E51A29; Fri, 27 Oct 2017 21:48:03 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AED197C85F; Fri, 27 Oct 2017 21:48:03 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9RLm2EW080562; Fri, 27 Oct 2017 21:48:02 GMT (envelope-from jlh@FreeBSD.org) Received: (from jlh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9RLm2uO080559; Fri, 27 Oct 2017 21:48:02 GMT (envelope-from jlh@FreeBSD.org) Message-Id: <201710272148.v9RLm2uO080559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jlh set sender to jlh@FreeBSD.org using -f From: Jeremie Le Hen Date: Fri, 27 Oct 2017 21:48:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325049 - in head: usr.bin/ruptime usr.bin/rwho usr.sbin/rwhod X-SVN-Group: head X-SVN-Commit-Author: jlh X-SVN-Commit-Paths: in head: usr.bin/ruptime usr.bin/rwho usr.sbin/rwhod X-SVN-Commit-Revision: 325049 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2017 21:48:04 -0000 Author: jlh Date: Fri Oct 27 21:48:02 2017 New Revision: 325049 URL: https://svnweb.freebsd.org/changeset/base/325049 Log: Update manpage date to when the deprecation notice was removed. Reported by: bcr Modified: head/usr.bin/ruptime/ruptime.1 head/usr.bin/rwho/rwho.1 head/usr.sbin/rwhod/rwhod.8 Modified: head/usr.bin/ruptime/ruptime.1 ============================================================================== --- head/usr.bin/ruptime/ruptime.1 Fri Oct 27 21:22:38 2017 (r325048) +++ head/usr.bin/ruptime/ruptime.1 Fri Oct 27 21:48:02 2017 (r325049) @@ -28,7 +28,7 @@ .\" @(#)ruptime.1 8.2 (Berkeley) 4/5/94 .\" $FreeBSD$ .\" -.Dd July 3, 2017 +.Dd August 8, 2017 .Dt RUPTIME 1 .Os .Sh NAME Modified: head/usr.bin/rwho/rwho.1 ============================================================================== --- head/usr.bin/rwho/rwho.1 Fri Oct 27 21:22:38 2017 (r325048) +++ head/usr.bin/rwho/rwho.1 Fri Oct 27 21:48:02 2017 (r325049) @@ -28,7 +28,7 @@ .\" @(#)rwho.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd July 3, 2017 +.Dd August 8, 2017 .Dt RWHO 1 .Os .Sh NAME Modified: head/usr.sbin/rwhod/rwhod.8 ============================================================================== --- head/usr.sbin/rwhod/rwhod.8 Fri Oct 27 21:22:38 2017 (r325048) +++ head/usr.sbin/rwhod/rwhod.8 Fri Oct 27 21:48:02 2017 (r325049) @@ -28,7 +28,7 @@ .\" @(#)rwhod.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd July 3, 2017 +.Dd August 8, 2017 .Dt RWHOD 8 .Os .Sh NAME From owner-svn-src-head@freebsd.org Sat Oct 28 02:06:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2905CE577C0; Sat, 28 Oct 2017 02:06:43 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) 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 EF4718399F; Sat, 28 Oct 2017 02:06:42 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg0-x22b.google.com with SMTP id 15so6530653pgc.12; Fri, 27 Oct 2017 19:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mdvpbxhnwFahvARkHB7bSkjbD/bg2PnxJRNVjbni/cM=; b=LcK1PezD2/ncoPyAFNhl67Dz13YVGDde1aVj2IJAMJLbbohc0R7blGNcgxyysnMsdj iPb7O/f5/PEqBO7y9B74NSXsn95UZJqRbxysHF0mQ7Xcg3kxtGRrYFwESc0auWXqsZ7W p1vHRDGunuyQPHOoeMpnxIs+jud79AvgHvXEieRYt2HGU7MiTF4X02KHkzHSdIA5LaC5 FP4NFM+lvlvr5kKCRv/ZPv3ByhIxgInjDeAy4ZRN7Pdj3AUB9e5l7DuViCX8CFvs7kMg 8B031CDZu6Tf6BzkeTzoOKTMftcaP/GcuMgtpJB3gQReMskN2A7yHZSuJdfa8f+rq38O 9hMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mdvpbxhnwFahvARkHB7bSkjbD/bg2PnxJRNVjbni/cM=; b=eQhni/OC7QWeCkOJHKR2sjPoKH9ft/yUdnyqWbTf8R+Ezx40Oz1BkBmlk3KXiZDV+y JVmZmb5G4xjyW6O6ZIfWHVVHRI0tJvfcTTlFUYZznUlZ0M4UQqIw54JuENdf24yVGJcZ kB+HZPs7JrTIyDZkEmMUZCBpsSZDPHxqlJK7K2vmVE0+qiL4+9/dNE54OoaaUeH571Y5 Y8/HXXPdRmA5lMawcSX58cU2bbrmX4cs3ObJCoGBj5zheQ4m8Vo4a5b+w4wHmNbJT7SI t2yQaN1aNWp3XTZsIbCUV9tH8X3t4k6pkfYNdTBYfrFF8sZgw9sYvb8yMIzEazLJFQsa O8HA== X-Gm-Message-State: AMCzsaXwV0nu7q5OL31MzTgiNhKt5vp4gajHakWyTsbIUVAI090ABryW ysp3fhOh33xJUneiPJzCDRZqjed+yxM= X-Google-Smtp-Source: ABhQp+QUBgAI4ZbyDwsxVLMOXH7ROeGXCEu16FYpNtaLOJrEZMhGIuN7LKHLRLmMEXjH5zS8Ws3UlQ== X-Received: by 10.101.88.203 with SMTP id e11mr1806303pgu.173.1509156401947; Fri, 27 Oct 2017 19:06:41 -0700 (PDT) Received: from ?IPv6:2607:fb90:817f:eb28:b5a7:ac38:1c59:528d? ([2607:fb90:817f:eb28:b5a7:ac38:1c59:528d]) by smtp.gmail.com with ESMTPSA id u46sm14172542pgn.80.2017.10.27.19.06.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 19:06:41 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r325016 - head/lib/libdevdctl From: Ngie Cooper X-Mailer: iPhone Mail (15A432) In-Reply-To: <201710261756.v9QHuYm6080449@repo.freebsd.org> Date: Fri, 27 Oct 2017 19:06:39 -0700 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <201710261756.v9QHuYm6080449@repo.freebsd.org> To: Alan Somers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 02:06:43 -0000 > On Oct 26, 2017, at 10:56, Alan Somers wrote: > > Author: asomers > Date: Thu Oct 26 17:56:34 2017 > New Revision: 325016 > URL: https://svnweb.freebsd.org/changeset/base/325016 > > Log: > Partially revert r325011: restore Guid's default constructor > > Reported by: ohartmann > MFC after: 3 weeks > X-MFC-With: 325011 > Sponsored by: Spectra Logic Corp > > Modified: > head/lib/libdevdctl/guid.h Or you could satisfy both signatures via optional parameters ;).. -Ngie From owner-svn-src-head@freebsd.org Sat Oct 28 02:51:29 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 203DDE596D1; Sat, 28 Oct 2017 02:51:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E234A62A; Sat, 28 Oct 2017 02:51:28 +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 v9S2pSOf008664; Sat, 28 Oct 2017 02:51:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9S2pSPl008663; Sat, 28 Oct 2017 02:51:28 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710280251.v9S2pSPl008663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Oct 2017 02:51:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325051 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 325051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 02:51:29 -0000 Author: markj Date: Sat Oct 28 02:51:27 2017 New Revision: 325051 URL: https://svnweb.freebsd.org/changeset/base/325051 Log: Remove a stale and incorrect comment. MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Sat Oct 28 02:48:37 2017 (r325050) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Oct 28 02:51:27 2017 (r325051) @@ -14127,11 +14127,7 @@ getdirtybuf(bp, lock, waitfor) BUF_UNLOCK(bp); if (waitfor != MNT_WAIT) return (NULL); - /* - * The lock argument must be bp->b_vp's mutex in - * this case. - */ -#ifdef DEBUG_VFS_LOCKS +#ifdef DEBUG_VFS_LOCKS if (bp->b_vp->v_type != VCHR) ASSERT_BO_WLOCKED(bp->b_bufobj); #endif From owner-svn-src-head@freebsd.org Sat Oct 28 02:48:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91534E59597; Sat, 28 Oct 2017 02:48:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5DCD8242; Sat, 28 Oct 2017 02:48:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9S2mbL0005629; Sat, 28 Oct 2017 02:48:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9S2mbHR005628; Sat, 28 Oct 2017 02:48:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201710280248.v9S2mbHR005628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 28 Oct 2017 02:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325050 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 325050 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 02:48:38 -0000 Author: markj Date: Sat Oct 28 02:48:37 2017 New Revision: 325050 URL: https://svnweb.freebsd.org/changeset/base/325050 Log: Remove workqueue items after updating the workqueue tail pointer. When QUEUE_MACRO_DEBUG_TRASH is configured, the queue linkage fields are trashed upon removal of the item, so be sure to only read them before removing the item. No functional change intended. MFC after: 1 week Sponsored by: Dell EMC Isilon Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Fri Oct 27 21:48:02 2017 (r325049) +++ head/sys/ufs/ffs/ffs_softdep.c Sat Oct 28 02:48:37 2017 (r325050) @@ -1535,10 +1535,10 @@ remove_from_worklist(wk) struct ufsmount *ump; ump = VFSTOUFS(wk->wk_mp); - WORKLIST_REMOVE(wk); if (ump->softdep_worklist_tail == wk) ump->softdep_worklist_tail = (struct worklist *)wk->wk_list.le_prev; + WORKLIST_REMOVE(wk); ump->softdep_on_worklist -= 1; } @@ -1836,11 +1836,11 @@ process_worklist_item(mp, target, flags) wake_worklist(wk); add_to_worklist(wk, WK_HEAD); } - LIST_REMOVE(&sentinel, wk_list); /* Sentinal could've become the tail from remove_from_worklist. */ if (ump->softdep_worklist_tail == &sentinel) ump->softdep_worklist_tail = (struct worklist *)sentinel.wk_list.le_prev; + LIST_REMOVE(&sentinel, wk_list); PRELE(curproc); return (matchcnt); } @@ -2894,7 +2894,6 @@ remove_from_journal(wk) if (ump->softdep_journal_tail == wk) ump->softdep_journal_tail = (struct worklist *)wk->wk_list.le_prev; - WORKLIST_REMOVE(wk); ump->softdep_on_journal -= 1; } From owner-svn-src-head@freebsd.org Sat Oct 28 16:50:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28B6AE47E3A; Sat, 28 Oct 2017 16:50:25 +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 mx1.freebsd.org (Postfix) with ESMTPS id EBFAA74A6F; Sat, 28 Oct 2017 16:50: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 v9SGoOQr052523; Sat, 28 Oct 2017 16:50:24 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SGoOcY052522; Sat, 28 Oct 2017 16:50:24 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710281650.v9SGoOcY052522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 28 Oct 2017 16:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325054 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 325054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 16:50:25 -0000 Author: ian Date: Sat Oct 28 16:50:23 2017 New Revision: 325054 URL: https://svnweb.freebsd.org/changeset/base/325054 Log: Increase the alignment of the rx/tx descriptor ring buffers to 64 bytes. 16 was the correct alignment for older hardware, but the imx7 requires 64-byte alignment, which is a fine value to use on all systems. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Modified: head/sys/dev/ffec/if_ffecreg.h Modified: head/sys/dev/ffec/if_ffecreg.h ============================================================================== --- head/sys/dev/ffec/if_ffecreg.h Sat Oct 28 07:06:57 2017 (r325053) +++ head/sys/dev/ffec/if_ffecreg.h Sat Oct 28 16:50:23 2017 (r325054) @@ -317,7 +317,7 @@ struct ffec_hwdesc * The hardware imposes alignment restrictions on various objects involved in * DMA transfers. These values are expressed in bytes (not bits). */ -#define FEC_DESC_RING_ALIGN 16 +#define FEC_DESC_RING_ALIGN 64 #define FEC_RXBUF_ALIGN 16 #define FEC_TXBUF_ALIGN 16 From owner-svn-src-head@freebsd.org Sat Oct 28 17:06:15 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 00654E482EF; Sat, 28 Oct 2017 17:06:15 +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 mx1.freebsd.org (Postfix) with ESMTPS id D0E99752BF; Sat, 28 Oct 2017 17:06: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 v9SH6EpA060985; Sat, 28 Oct 2017 17:06:14 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SH6DBU060983; Sat, 28 Oct 2017 17:06:13 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710281706.v9SH6DBU060983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 28 Oct 2017 17:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325055 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 325055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 17:06:15 -0000 Author: ian Date: Sat Oct 28 17:06:13 2017 New Revision: 325055 URL: https://svnweb.freebsd.org/changeset/base/325055 Log: Add FECFLAG_AVB variant flag to support new features on imx7. This flag is analogous to the Linux driver FEC_QUIRK_HAS_AVB. It indicates an FEC with support for Audio Video Bridging (AVB). This indicator is used for various other parts in the Linux driver (drivers/net/ethernet/freescale/fec_main.c). Use it to customize the receive/transmit buffer alignment. The receive buffer alignment increased to 64-bytes on the i.MX 6SoloX and i.MX 7Dual. There are no hard alignment restrictions for transmit buffers on these chips. Fix the ffec_softc::fectype type to provide enough storage for the feature flags. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Modified: head/sys/dev/ffec/if_ffec.c head/sys/dev/ffec/if_ffecreg.h Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Sat Oct 28 16:50:23 2017 (r325054) +++ head/sys/dev/ffec/if_ffec.c Sat Oct 28 17:06:13 2017 (r325055) @@ -97,7 +97,7 @@ enum { FECTYPE_NONE, FECTYPE_GENERIC, FECTYPE_IMX53, - FECTYPE_IMX6, + FECTYPE_IMX6, /* imx6 and imx7 */ FECTYPE_MVF, }; @@ -106,7 +106,8 @@ enum { * SoCs. These are ORed into the FECTYPE enum values. */ #define FECTYPE_MASK 0x0000ffff -#define FECFLAG_GBE (0x0001 << 16) +#define FECFLAG_GBE (1 << 16) +#define FECFLAG_AVB (1 << 17) /* * Table of supported FDT compat strings and their associated FECTYPE values. @@ -116,6 +117,7 @@ static struct ofw_compat_data compat_data[] = { {"fsl,imx53-fec", FECTYPE_IMX53}, {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, {"fsl,imx6ul-fec", FECTYPE_IMX6}, + {"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_AVB}, {"fsl,mvf600-fec", FECTYPE_MVF}, {"fsl,mvf-fec", FECTYPE_MVF}, {NULL, FECTYPE_NONE}, @@ -148,11 +150,13 @@ struct ffec_softc { void * intr_cookie; struct callout ffec_callout; mii_contype_t phy_conn_type; - uint8_t fectype; + uintptr_t fectype; boolean_t link_is_up; boolean_t is_attached; boolean_t is_detaching; int tx_watchdog_count; + int rxbuf_align; + int txbuf_align; bus_dma_tag_t rxdesc_tag; bus_dmamap_t rxdesc_map; @@ -754,7 +758,7 @@ ffec_setup_rxbuf(struct ffec_softc *sc, int idx, struc * have to ensure that the beginning of the buffer is aligned to the * hardware's requirements. */ - m_adj(m, roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN)); + m_adj(m, roundup(ETHER_ALIGN, sc->rxbuf_align)); error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, m, &seg, &nsegs, 0); @@ -1098,7 +1102,7 @@ ffec_init_locked(struct ffec_softc *sc) * when we support jumbo frames and receiving fragments of them into * separate buffers. */ - maxbuf = MCLBYTES - roundup(ETHER_ALIGN, FEC_RXBUF_ALIGN); + maxbuf = MCLBYTES - roundup(ETHER_ALIGN, sc->rxbuf_align); maxfl = min(maxbuf, 0x7ff); if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -1450,6 +1454,14 @@ ffec_attach(device_t dev) */ sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (sc->fectype & FECFLAG_AVB) { + sc->rxbuf_align = 64; + sc->txbuf_align = 1; + } else { + sc->rxbuf_align = 16; + sc->txbuf_align = 16; + } + /* * We have to be told what kind of electrical connection exists between * the MAC and PHY or we can't operate correctly. @@ -1525,7 +1537,7 @@ ffec_attach(device_t dev) error = bus_dma_tag_create( bus_get_dma_tag(dev), /* Parent tag. */ - FEC_TXBUF_ALIGN, 0, /* alignment, boundary */ + sc->txbuf_align, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ Modified: head/sys/dev/ffec/if_ffecreg.h ============================================================================== --- head/sys/dev/ffec/if_ffecreg.h Sat Oct 28 16:50:23 2017 (r325054) +++ head/sys/dev/ffec/if_ffecreg.h Sat Oct 28 17:06:13 2017 (r325055) @@ -318,7 +318,5 @@ struct ffec_hwdesc * DMA transfers. These values are expressed in bytes (not bits). */ #define FEC_DESC_RING_ALIGN 64 -#define FEC_RXBUF_ALIGN 16 -#define FEC_TXBUF_ALIGN 16 #endif /* IF_FFECREG_H */ From owner-svn-src-head@freebsd.org Sat Oct 28 17:30:51 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FE2BE48B92; Sat, 28 Oct 2017 17:30:51 +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 mx1.freebsd.org (Postfix) with ESMTPS id CC78675C50; Sat, 28 Oct 2017 17:30:50 +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 v9SHUnj4069108; Sat, 28 Oct 2017 17:30:49 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SHUnj4069107; Sat, 28 Oct 2017 17:30:49 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710281730.v9SHUnj4069107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 28 Oct 2017 17:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325056 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 325056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 17:30:51 -0000 Author: ian Date: Sat Oct 28 17:30:49 2017 New Revision: 325056 URL: https://svnweb.freebsd.org/changeset/base/325056 Log: Avoid AXI bus issues due to a MAC reset on imx6sx and imx7. When the FEC is connected to the AXI bus (indicated by AVB flag), a MAC reset while a bus transaction is pending can hang the bus. Instead of resetting, turn off the ENABLE bit, which allows the hardware to complete any in-progress transfers (appending a bad CRC to any partial packet) and release the AXI bus. This could probably be done unconditionally for all hardware variants, but that hasn't been tested. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Sat Oct 28 17:06:13 2017 (r325055) +++ head/sys/dev/ffec/if_ffec.c Sat Oct 28 17:30:49 2017 (r325056) @@ -1639,8 +1639,21 @@ ffec_attach(device_t dev) /* Try to get the MAC address from the hardware before resetting it. */ ffec_get_hwaddr(sc, eaddr); - /* Reset the hardware. Disables all interrupts. */ - WR4(sc, FEC_ECR_REG, FEC_ECR_RESET); + /* + * Reset the hardware. Disables all interrupts. + * + * When the FEC is connected to the AXI bus (indicated by AVB flag), a + * MAC reset while a bus transaction is pending can hang the bus. + * Instead of resetting, turn off the ENABLE bit, which allows the + * hardware to complete any in-progress transfers (appending a bad CRC + * to any partial packet) and release the AXI bus. This could probably + * be done unconditionally for all hardware variants, but that hasn't + * been tested. + */ + if (sc->fectype & FECFLAG_AVB) + WR4(sc, FEC_ECR_REG, 0); + else + WR4(sc, FEC_ECR_REG, FEC_ECR_RESET); /* Setup interrupt handler. */ error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, From owner-svn-src-head@freebsd.org Sat Oct 28 18:54:47 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B9AAE4AA44; Sat, 28 Oct 2017 18:54:47 +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 mx1.freebsd.org (Postfix) with ESMTPS id F39CA7CDE5; Sat, 28 Oct 2017 18:54:46 +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 v9SIskK1009010; Sat, 28 Oct 2017 18:54:46 GMT (envelope-from philip@FreeBSD.org) Received: (from philip@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SIsjoG009004; Sat, 28 Oct 2017 18:54:45 GMT (envelope-from philip@FreeBSD.org) Message-Id: <201710281854.v9SIsjoG009004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: philip set sender to philip@FreeBSD.org using -f From: Philip Paeps Date: Sat, 28 Oct 2017 18:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325059 - head/contrib/tzdata X-SVN-Group: head X-SVN-Commit-Author: philip X-SVN-Commit-Paths: head/contrib/tzdata X-SVN-Commit-Revision: 325059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 18:54:47 -0000 Author: philip Date: Sat Oct 28 18:54:45 2017 New Revision: 325059 URL: https://svnweb.freebsd.org/changeset/base/325059 Log: Import tzdata 2017c Changes: https://mm.icann.org/pipermail/tz-announce/2017-October/000047.html MFC after: 2 days Added: head/contrib/tzdata/calendars - copied unchanged from r325057, vendor/tzdata/dist/calendars head/contrib/tzdata/theory.html - copied unchanged from r325057, vendor/tzdata/dist/theory.html head/contrib/tzdata/zishrink.awk - copied unchanged from r325057, vendor/tzdata/dist/zishrink.awk Deleted: head/contrib/tzdata/Theory Modified: head/contrib/tzdata/CONTRIBUTING head/contrib/tzdata/LICENSE 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/backward head/contrib/tzdata/backzone head/contrib/tzdata/checklinks.awk head/contrib/tzdata/europe head/contrib/tzdata/leap-seconds.list head/contrib/tzdata/leapseconds head/contrib/tzdata/leapseconds.awk head/contrib/tzdata/northamerica head/contrib/tzdata/southamerica head/contrib/tzdata/version 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 Oct 28 17:45:42 2017 (r325058) +++ head/contrib/tzdata/CONTRIBUTING Sat Oct 28 18:54:45 2017 (r325059) @@ -5,20 +5,26 @@ change timekeeping rules erratically and sometimes wit warning, the data entries do not cover all of civil time before 1970, and undoubtedly errors remain in the code and data. Feel free to fill gaps or fix mistakes, and please email improvements -to tz@iana.org for use in the future. +to tz@iana.org for use in the future. In your email, please give +reliable sources that reviewers can check. +----- + +Developers can contribute technical changes to the source code and +data as follows. + To email small changes, please run a POSIX shell command like 'diff -u old/europe new/europe >myfix.patch', and attach myfix.patch to the email. -For more-elaborate changes, please read the Theory file and browse -the mailing list archives for -examples of patches that tend to work well. Ideally, additions to +For more-elaborate changes, please read the theory.html file and browse +the mailing list archives for +examples of patches that tend to work well. Additions to data should contain commentary citing reliable sources as -justification. +justification. Citations should use https: URLs if available. Please submit changes against either the latest release in - or the master branch of the development + or the master branch of the development repository. If you use Git the following workflow may be helpful: * Copy the development repository. Modified: head/contrib/tzdata/LICENSE ============================================================================== --- head/contrib/tzdata/LICENSE Sat Oct 28 17:45:42 2017 (r325058) +++ head/contrib/tzdata/LICENSE Sat Oct 28 18:54:45 2017 (r325059) @@ -1,4 +1,5 @@ -With a few exceptions, all files in the tz code and data (including -this one) are in the public domain. The exceptions are date.c, -newstrftime.3, and strftime.c, which contain material derived from BSD -and which use the BSD 3-clause license. +Unless specified below, all files in the tz code and data (including +this LICENSE file) are in the public domain. + +If the files date.c, newstrftime.3, and strftime.c are present, they +contain material derived from BSD and use the BSD 3-clause license. Modified: head/contrib/tzdata/Makefile ============================================================================== --- head/contrib/tzdata/Makefile Sat Oct 28 17:45:42 2017 (r325058) +++ head/contrib/tzdata/Makefile Sat Oct 28 18:54:45 2017 (r325059) @@ -49,6 +49,7 @@ TOPDIR= /usr/local # "Compiled" time zone information is placed in the "TZDIR" directory # (and subdirectories). # Use an absolute path name for TZDIR unless you're just testing the software. +# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty. TZDIR_BASENAME= zoneinfo TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) @@ -75,7 +76,7 @@ LIBDIR= $(TOPDIR)/lib # If you want only POSIX time, with time values interpreted as # seconds since the epoch (not counting leap seconds), use # REDO= posix_only -# below. If you want want only "right" time, with values interpreted +# below. If you want only "right" time, with values interpreted # as seconds since the epoch (counting leap seconds), use # REDO= right_only # below. If you want both sets of data available, with leap seconds not @@ -92,6 +93,24 @@ LIBDIR= $(TOPDIR)/lib REDO= posix_right +# To install data in text form that has all the information of the binary data, +# (optionally incorporating leap second information), use +# TZDATA_TEXT= tzdata.zi leapseconds +# To install text data without leap second information (e.g., because +# REDO='posix_only'), use +# TZDATA_TEXT= tzdata.zi +# To avoid installing text data, use +# TZDATA_TEXT= + +TZDATA_TEXT= leapseconds tzdata.zi + +# For backward-compatibility links for old zone names, use +# BACKWARD= backward pacificnew +# To omit these links, use +# BACKWARD= + +BACKWARD= backward pacificnew + # If you want out-of-scope and often-wrong data from the file 'backzone', use # PACKRATDATA= backzone # To omit this data, use @@ -99,6 +118,11 @@ REDO= posix_right PACKRATDATA= +# The name of a locale using the UTF-8 encoding, used during self-tests. +# The tests are skipped if the name does not appear to work on this system. + +UTF8_LOCALE= en_US.utf8 + # Since "." may not be in PATH... YEARISTYPE= ./yearistype @@ -106,50 +130,53 @@ YEARISTYPE= ./yearistype # Non-default libraries needed to link. LDLIBS= -# Add the following to the end of the "CFLAGS=" line as needed. +# Add the following to the end of the "CFLAGS=" line as needed to override +# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1". # -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c) +# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime +# formats that generate only the last two digits of year numbers +# -DEPOCH_LOCAL if the 'time' function returns local time not UT +# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater +# than what POSIX specifies, assuming local time is UT. +# For example, N is 252460800 on AmigaOS. # -DHAVE_DECL_ASCTIME_R=0 if does not declare asctime_r +# -DHAVE_DECL_ENVIRON if declares 'environ' # -DHAVE_DIRECT_H if mkdir needs (MS-Windows) -# -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS) -# -DHAVE_GETTEXT=1 if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris) -# -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares +# -DHAVE_GENERIC=0 if _Generic does not work +# -DHAVE_GETTEXT if 'gettext' works (e.g., GNU/Linux, FreeBSD, Solaris) +# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares # ctime_r and asctime_r incompatibly with the POSIX standard # (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined). -# -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h" +# -DHAVE_INTTYPES_H if you have a non-C99 compiler with # -DHAVE_LINK=0 if your system lacks a link function # -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function # -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz -# This defaults to 1 if a working localtime_rz seems to be available. # localtime_rz can make zdump significantly faster, but is nonstandard. # -DHAVE_POSIX_DECLS=0 if your system's include files do not declare # functions like 'link' or variables like 'tzname' required by POSIX -# -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h" -# -DHAVE_STRFTIME_L=1 if declares locale_t and strftime_l -# This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise. +# -DHAVE_SNPRINTF=0 if your system lacks the snprintf function +# -DHAVE_STDBOOL_H if you have a non-C99 compiler with +# -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_SYMLINK=0 if your system lacks the symlink function -# -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h" -# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h" +# -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 "unistd.h" (Microsoft C++ 7?) -# -DEPOCH_LOCAL=1 if the 'time' function returns local time not UT -# -DEPOCH_OFFSET=N if the 'time' function returns a value N greater -# than what POSIX specifies, assuming local time is UT. -# For example, N is 252460800 on AmigaOS. -# -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1 -# if you do not want run time warnings about formats that may cause -# year 2000 grief -# -Dssize_t=long on ancient hosts that lack ssize_t -# -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires; +# -DHAVE_UNISTD_H=0 if your compiler lacks a +# -Dlocale_t=XXX if your system uses XXX instead of locale_t +# -Dssize_t=long on hosts like MS-Windows that lack ssize_t +# -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. # -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t +# This is intended for internal use only; it mangles external names. # -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" # -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; # the default is system-supplied, typically "/usr/lib/locale" # -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified # DST transitions if the time zone files cannot be accessed -# -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems +# -DUNINIT_TRAP if reading uninitialized storage can cause problems # other than simply getting garbage data # -DUSE_LTZ=0 to build zdump with the system time zone library # Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. @@ -157,27 +184,28 @@ LDLIBS= # (or some other number) to set the maximum time zone abbreviation length # that zic will accept without a warning (the default is 6) # $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking -GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \ - -Wall -Wextra \ - -Wbad-function-cast -Wcast-align -Wdate-time \ - -Wdeclaration-after-statement \ - -Wdouble-promotion \ - -Wformat=2 -Winit-self -Wjump-misses-init \ - -Wlogical-op -Wmissing-prototypes -Wnested-externs \ - -Wold-style-definition -Woverlength-strings -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \ - -Wsuggest-attribute=format -Wsuggest-attribute=noreturn \ - -Wsuggest-attribute=pure -Wtrampolines \ - -Wundef -Wunused -Wwrite-strings \ - -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ - -Wno-type-limits -Wno-unused-parameter +# Select instrumentation via "make GCC_INSTRUMENT='whatever'". +GCC_INSTRUMENT = \ + -fsanitize=undefined -fsanitize-address-use-after-scope \ + -fsanitize-undefined-trap-on-error -fstack-protector +GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \ + $(GCC_INSTRUMENT) \ + -Wall -Wextra \ + -Walloc-size-larger-than=100000 -Warray-bounds=2 \ + -Wbad-function-cast -Wcast-align -Wdate-time \ + -Wdeclaration-after-statement -Wdouble-promotion \ + -Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \ + -Winit-self -Wjump-misses-init -Wlogical-op \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ + -Wold-style-definition -Woverlength-strings -Wpointer-arith \ + -Wshadow -Wshift-overflow=2 -Wstrict-prototypes -Wstringop-overflow=5 \ + -Wsuggest-attribute=const -Wsuggest-attribute=format \ + -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \ + -Wtrampolines -Wundef -Wuninitialized -Wunused \ + -Wvariadic-macros -Wvla -Wwrite-strings \ + -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ + -Wno-type-limits -Wno-unused-parameter # -# If you want to use System V compatibility code, add -# -DUSG_COMPAT -# to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight" -# variables to be kept up-to-date by the time conversion functions. Neither -# "timezone" nor "daylight" is described in X3J11's work. -# # If your system has a "GMT offset" field in its "struct tm"s # (or if you decide to add such a field in your system's "time.h" file), # add the name to a define such as @@ -189,6 +217,31 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict- # and define NO_TM_ZONE to suppress any guessing. These two fields are not # required by POSIX, but are widely available on GNU/Linux and BSD systems. # +# The next batch of options control support for external variables +# exported by tzcode. In practice these variables are less useful +# than TM_GMTOFF and TM_ZONE. However, most of them are standardized. +# # +# # To omit or support the external variable "tzname", add one of: +# # -DHAVE_TZNAME=0 +# # -DHAVE_TZNAME=1 +# # to the "CFLAGS=" line. "tzname" is required by POSIX 1988 and later. +# # If not defined, the code attempts to guess HAVE_TZNAME from other macros. +# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause +# # crashes when combined with some platforms' standard libraries, +# # presumably due to memory allocation issues. +# # +# # To omit or support the external variables "timezone" and "daylight", add +# # -DUSG_COMPAT=0 +# # -DUSG_COMPAT=1 +# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by +# # Unix Systems Group code and are required by POSIX 2008 (with XSI) and later. +# # If not defined, the code attempts to guess USG_COMPAT from other macros. +# # +# # To support the external variable "altzone", add +# # -DALTZONE +# # to the end of the "CFLAGS=" line; although "altzone" appeared in +# # System V Release 3.1 it has not been standardized. +# # If you want functions that were inspired by early versions of X3J11's work, # add # -DSTD_INSPIRED @@ -226,11 +279,6 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict- # -DALL_STATE # to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. # -# If you want an "altzone" variable (a la System V Release 3.1), add -# -DALTZONE -# to the end of the "CFLAGS=" line. -# This variable is not described in X3J11's work. -# # NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put # out by the National Institute of Standards and Technology # which claims to test C and Posix conformance. If you want to pass PCTS, add @@ -240,8 +288,8 @@ GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict- # If you want strict compliance with XPG4 as of 1994-04-09, add # -DXPG4_1994_04_09 # to the end of the "CFLAGS=" line. This causes "strftime" to always return -# 53 as a week number (rather than 52 or 53) for those days in January that -# before the first Monday in January when a "%V" format is used and January 1 +# 53 as a week number (rather than 52 or 53) for January days before +# January's first Monday when a "%V" format is used and January 1 # falls on a Friday, Saturday, or Sunday. CFLAGS= @@ -265,7 +313,7 @@ ZFLAGS= # How to use zic to install tz binary files. -ZIC_INSTALL= $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) +ZIC_INSTALL= $(ZIC) -d $(DESTDIR)$(TZDIR) $(LEAPSECONDS) # The name of a Posix-compliant 'awk' on your system. AWK= awk @@ -289,6 +337,7 @@ SGML_CATALOG_FILES= \ # The name, arguments and environment of a program to validate your web pages. # See for a validator, and # for a validation library. +# Set VALIDATE=':' if you do not have such a program. VALIDATE = nsgmls VALIDATE_FLAGS = -s -B -wall -wno-unused-param VALIDATE_ENV = \ @@ -355,7 +404,7 @@ AR= ar RANLIB= : TZCOBJS= zic.o -TZDOBJS= zdump.o localtime.o asctime.o +TZDOBJS= zdump.o localtime.o asctime.o strftime.o DATEOBJS= date.o localtime.o strftime.o asctime.o LIBSRCS= localtime.c asctime.c difftime.c LIBOBJS= localtime.o asctime.o difftime.o @@ -370,33 +419,35 @@ MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.t time2posix.3.txt \ tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ date.1.txt -COMMON= CONTRIBUTING LICENSE Makefile NEWS README Theory version +COMMON= calendars CONTRIBUTING LICENSE Makefile \ + NEWS README theory.html version WEB_PAGES= tz-art.htm tz-how-to.html tz-link.htm DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) PRIMARY_YDATA= africa antarctica asia australasia \ europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward +YDATA= $(PRIMARY_YDATA) etcetera $(BACKWARD) NDATA= systemv factory TDATA= $(YDATA) $(NDATA) ZONETABLES= zone1970.tab zone.tab -TABDATA= iso3166.tab leapseconds $(ZONETABLES) +TABDATA= iso3166.tab $(TZDATA_TEXT) $(ZONETABLES) LEAP_DEPS= leapseconds.awk leap-seconds.list -DATA= $(YDATA) $(NDATA) backzone $(TABDATA) \ - leap-seconds.list yearistype.sh -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk +TZDATA_ZI_DEPS= zishrink.awk $(TDATA) $(PACKRATDATA) +DATA= $(YDATA) $(NDATA) backzone iso3166.tab leap-seconds.list \ + leapseconds yearistype.sh $(ZONETABLES) +AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk zishrink.awk MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl TZS_YEAR= 2050 TZS= to$(TZS_YEAR).tzs TZS_NEW= to$(TZS_YEAR)new.tzs TZS_DEPS= $(PRIMARY_YDATA) asctime.c localtime.c \ private.h tzfile.h zdump.c zic.c -ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) +ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi # Consult these files when deciding whether to rebuild the 'version' file. # This list is not the same as the output of 'git ls-files', since # .gitignore is not distributed. VERSION_DEPS= \ - CONTRIBUTING LICENSE Makefile NEWS README Theory \ + calendars CONTRIBUTING LICENSE Makefile NEWS README \ africa antarctica asctime.c asia australasia \ backward backzone \ checklinks.awk checktab.awk \ @@ -405,7 +456,7 @@ VERSION_DEPS= \ leap-seconds.list leapseconds.awk localtime.c \ newctime.3 newstrftime.3 newtzset.3 northamerica \ pacificnew private.h \ - southamerica strftime.c systemv \ + southamerica strftime.c systemv theory.html \ time2posix.3 tz-art.htm tz-how-to.html tz-link.htm \ tzfile.5 tzfile.h tzselect.8 tzselect.ksh \ workman.sh yearistype.sh \ @@ -427,7 +478,7 @@ install: all $(DATA) $(REDO) $(MANS) $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ $(DESTDIR)$(MANDIR)/man8 $(ZIC_INSTALL) -l $(LOCALTIME) -p $(POSIXRULES) - cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/. + cp -f $(TABDATA) $(DESTDIR)$(TZDIR)/. cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. cp libtz.a $(DESTDIR)$(LIBDIR)/. $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a @@ -448,6 +499,11 @@ 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) + LC_ALL=C $(AWK) -f zishrink.awk $(TDATA) $(PACKRATDATA) >$@.out + mv $@.out $@ + version.h: version VERSION=`cat version` && printf '%s\n' \ 'static char const PKGVERSION[]="($(PACKAGE)) ";' \ @@ -473,6 +529,7 @@ leapseconds: $(LEAP_DEPS) # Arguments to pass to submakes of install_data. # They can be overridden by later submake arguments. INSTALLARGS = \ + BACKWARD=$(BACKWARD) \ DESTDIR=$(DESTDIR) \ LEAPSECONDS='$(LEAPSECONDS)' \ PACKRATDATA='$(PACKRATDATA)' \ @@ -481,10 +538,8 @@ INSTALLARGS = \ ZIC='$(ZIC)' # 'make install_data' installs one set of tz binary files. -# It can be tailored by setting LEAPSECONDS, PACKRATDATA, etc. -install_data: zic leapseconds yearistype $(PACKRATDATA) $(TDATA) - $(ZIC_INSTALL) $(TDATA) - $(AWK) '/^Rule/' $(TDATA) | $(ZIC_INSTALL) - $(PACKRATDATA) +install_data: zic leapseconds yearistype tzdata.zi + $(ZIC_INSTALL) tzdata.zi posix_only: $(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data @@ -521,14 +576,14 @@ posix_packrat: zones: $(REDO) -$(TZS_NEW): $(TDATA) zdump zic +$(TZS_NEW): tzdata.zi zdump zic mkdir -p tzs.dir - $(zic) -d tzs.dir $(TDATA) - $(AWK) '/^Link/{print $$1 "\t" $$2 "\t" $$3}' \ - $(TDATA) | LC_ALL=C sort >$@.out + $(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" \ - '/^Zone/{print wd "/tzs.dir/" $$2}' $(TDATA) \ + '/^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 @@ -564,24 +619,37 @@ tzselect: tzselect.ksh version chmod +x $@.out mv $@.out $@ -check: check_character_set check_white_space check_links check_sorted \ - check_tables check_tzs check_web +check: check_character_set check_white_space check_links \ + check_name_lengths check_sorted \ + check_tables check_web check_zishrink check_tzs check_character_set: $(ENCHILADA) - LC_ALL=en_US.utf8 && export LC_ALL && \ + test ! '$(UTF8_LOCALE)' || \ + ! printf 'A\304\200B\n' | \ + LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 || { \ + LC_ALL='$(UTF8_LOCALE)' && export LC_ALL && \ sharp='#' && \ ! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \ $(MISC) $(SOURCES) $(WEB_PAGES) \ - CONTRIBUTING LICENSE Makefile README version && \ + CONTRIBUTING LICENSE Makefile README \ + version tzdata.zi && \ ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ leapseconds yearistype.sh zone.tab && \ - ! grep -Env $(OK_LINE) $(ENCHILADA) + ! grep -Env $(OK_LINE) $(ENCHILADA); \ + } check_white_space: $(ENCHILADA) patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \ ! grep -En "$$pat" $(ENCHILADA) ! grep -n '[[:space:]]$$' $(ENCHILADA) +PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+ +FILE_NAME_COMPONENT_TOO_LONG = \ + $(PRECEDES_FILE_NAME)[^[:space:]]*[^/[:space:]]{15} + +check_name_lengths: $(TDATA) backzone + ! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' $(TDATA) backzone + CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab @@ -596,6 +664,7 @@ check_sorted: backward backzone iso3166.tab zone.tab z check_links: checklinks.awk $(TDATA) $(AWK) -f checklinks.awk $(TDATA) + $(AWK) -f checklinks.awk tzdata.zi check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) for tab in $(ZONETABLES); do \ @@ -606,14 +675,32 @@ check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABL check_tzs: $(TZS) $(TZS_NEW) diff -u $(TZS) $(TZS_NEW) -check_web: $(WEB_PAGES) - $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES) +# This checks only the HTML 4.01 strict page. +# To check the the other pages, use . +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) + for type in posix right; do \ + mkdir -p time_t.dir/$$type 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-shrunk tzdata.zi && \ + diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \ + done + rm -fr time_t.dir + clean_misc: rm -f core *.o *.out \ date tzselect version.h zdump zic yearistype libtz.a clean: clean_misc - rm -fr *.dir tzdb-*/ $(TZS_NEW) + rm -fr *.dir tzdata.zi tzdb-*/ $(TZS_NEW) maintainer-clean: clean @echo 'This command is intended for maintainers to use; it' @@ -667,6 +754,7 @@ set-timestamps.out: $(ENCHILADA) touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \ exit; \ done + touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS) touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version touch $@ @@ -678,7 +766,7 @@ check_public: $(MAKE) maintainer-clean $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL mkdir -p public.dir - for i in $(TDATA) ; do \ + for i in $(TDATA) tzdata.zi; do \ $(zic) -v -d public.dir $$i 2>&1 || exit; \ done $(zic) -v -d public.dir $(TDATA) @@ -772,8 +860,8 @@ typecheck: $(MAKE) clean ; \ done -zonenames: $(TDATA) - @$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA) +zonenames: tzdata.zi + @$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi asctime.o: private.h tzfile.h date.o: private.h @@ -789,6 +877,7 @@ zic.o: private.h tzfile.h version.h .PHONY: check check_character_set check_links .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: install install_data maintainer-clean names .PHONY: posix_only posix_packrat posix_right Modified: head/contrib/tzdata/NEWS ============================================================================== --- head/contrib/tzdata/NEWS Sat Oct 28 17:45:42 2017 (r325058) +++ head/contrib/tzdata/NEWS Sat Oct 28 18:54:45 2017 (r325059) @@ -1,5 +1,169 @@ News for the tz database +Release 2017c - 2017-10-20 14:49:34 -0700 + + Briefly: + Northern Cyprus switches from +03 to +02/+03 on 2017-10-29. + Fiji ends DST 2018-01-14, not 2018-01-21. + Namibia switches from +01/+02 to +02 on 2018-04-01. + Sudan switches from +03 to +02 on 2017-11-01. + Tonga likely switches from +13/+14 to +13 on 2017-11-05. + Turks & Caicos switches from -04 to -05/-04 on 2018-11-04. + A new file tzdata.zi now holds a small text copy of all data. + The zic input format has been regularized slightly. + + Changes to future time stamps + + Northern Cyprus has decided to resume EU rules starting + 2017-10-29, thus reinstituting winter time. + + Fiji ends DST 2018-01-14 instead of the 2018-01-21 previously + predicted. (Thanks to Dominic Fok.) Adjust future predictions + accordingly. + + Namibia will switch from +01 with DST to +02 all year on + 2017-09-03 at 02:00. This affects UT offsets starting 2018-04-01 + at 02:00. (Thanks to Steffen Thorsen.) + + Sudan will switch from +03 to +02 on 2017-11-01. (Thanks to Ahmed + Atyya and Yahia Abdalla.) South Sudan is not switching, so + Africa/Juba is no longer a link to Africa/Khartoum. + + Tonga has likely ended its experiment with DST, and will not + adjust its clocks on 2017-11-05. Although Tonga has not announced + whether it will continue to observe DST, the IATA is assuming that + it will not. (Thanks to David Wade.) + + Turks & Caicos will switch from -04 all year to -05 with US DST on + 2018-03-11 at 03:00. This affects UT offsets starting 2018-11-04 + at 02:00. (Thanks to Steffen Thorsen.) + + Changes to past time stamps + + Namibia switched from +02 to +01 on 1994-03-21, not 1994-04-03. + (Thanks to Arthur David Olson.) + + Detroit did not observe DST in 1967. + + Use railway time for Asia/Kolkata before 1941, by switching to + Madras local time (UT +052110) in 1870, then to IST (UT +0530) in + 1906. Also, treat 1941-2's +0630 as DST, like 1942-5. + + Europe/Dublin's 1946 and 1947 fallback transitions occurred at + 02:00 standard time, not 02:00 DST. (Thanks to Michael Deckers.) + + Pacific/Apia and Pacific/Pago_Pago switched from Antipodean to + American time in 1892, not 1879. (Thanks to Michael Deckers.) + + Adjust the 1867 transition in Alaska to better reflect the + historical record, by changing it to occur on 1867-10-18 at 15:30 + Sitka time rather than at the start of 1867-10-17 local time. + Although strictly speaking this is accurate only for Sitka, + the rest of Alaska's blanks need to be filled in somehow. + + Fix off-by-one errors in UT offsets for Adak and Nome before 1867. + (Thanks to Michael Deckers.) + + Add 7 s to the UT offset in Asia/Yangon before 1920. + + Changes to zone names + + Remove Canada/East-Saskatchewan from the 'backward' file, as it + exceeded the 14-character limit and was an unused misnomer anyway. + + Changes to build procedure + + To support applications that prefer to read time zone data in text + form, two zic input files tzdata.zi and leapseconds are now + installed by default. The commands 'zic tzdata.zi' and 'zic -L + leapseconds tzdata.zi' can reproduce the tzdata binary files + without and with leap seconds, respectively. To prevent these two + new files from being installed, use 'make TZDATA_TEXT=', and to + suppress leap seconds from the tzdata text installation, use 'make + TZDATA_TEXT=tzdata.zi'. + + 'make BACKWARD=' now suppresses backward-compatibility names + like 'US/Pacific' that are defined in the 'backward' and + 'pacificnew' files. + + 'make check' now works on systems that lack a UTF-8 locale, + or that lack the nsgmls program. Set UTF8_LOCALE to configure + the name of a UTF-8 locale, if you have one. + + Y2K runtime checks are no longer enabled by default. Add + -DDEPRECATE_TWO_DIGIT_YEARS to CFLAGS to enable them, instead of + adding -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU + to disable them. (New name suggested by Brian Inglis.) + + The build procedure for zdump now works on AIX 7.1. + (Problem reported by Kees Dekker.) + + Changes to code + + zic and the reference runtime now reject multiple leap seconds + within 28 days of each other, or leap seconds before the Epoch. + As a result, support for double leap seconds, which was + obsolescent and undocumented, has been removed. Double leap + seconds were an error in the C89 standard; they have never existed + in civil timekeeping. (Thanks to Robert Elz and Bradley White for + noticing glitches in the code that uncovered this problem.) + + zic now warns about use of the obsolescent and undocumented -y + option, and about use of the obsolescent TYPE field of Rule lines. + + zic now allows unambiguous abbreviations like "Sa" and "Su" for + weekdays; formerly it rejected them due to a bug. Conversely, zic + no longer considers non-prefixes to be abbreviations; for example, + it no longer accepts "lF" as an abbreviation for "lastFriday". + Also, zic warns about the undocumented usage with a "last-" + prefix, e.g., "last-Fri". + + Similarly, zic now accepts the unambiguous abbreviation "L" for + "Link" in ordinary context and for "Leap" in leap-second context. + Conversely, zic no longer accepts non-prefixes such as "La" as + abbreviations for words like "Leap". + + zic no longer accepts leap second lines in ordinary input, or + ordinary lines in leap second input. Formerly, zic sometimes + warned about this undocumented usage and handled it incorrectly. + + The new macro HAVE_TZNAME governs whether the tzname external + variable is exported, instead of USG_COMPAT. USG_COMPAT now + governs only the external variables "timezone" and "daylight". + This change is needed because the three variables are not in the + same category: although POSIX requires tzname, it specifies the + other two variables as optional. Also, USG_COMPAT is now 1 or 0: + if not defined, the code attempts to guess it from other macros. + + localtime.c and difftime.c no longer require stdio.h, and .c files + other than zic.c no longer require sys/wait.h. + + zdump.c no longer assumes snprintf. (Reported by Jonathan Leffler.) + + Calculation of time_t extrema works around a bug in GCC 4.8.4 + (Reported by Stan Shebs and Joseph Myers.) + + zic.c no longer mistranslates formats of line numbers in non-English + locales. (Problem reported by Benno Schulenberg.) + + Several minor changes have been made to the code to make it a + bit easier to port to MS-Windows and Solaris. (Thanks to Kees + Dekker for reporting the problems.) + + Changes to documentation and commentary + + The two new files 'theory.html' and 'calendars' contain the + contents of the removed file 'Theory'. The goal is to document + tzdb theory more accessibly. + + The zic man page now documents abbreviation rules. + + tz-link.htm now covers how to apply tzdata changes to clients. + (Thanks to Jorge Fábregas for the AIX link.) It also mentions MySQL. + + The leap-seconds.list URL has been updated to something that is + more reliable for tzdb. (Thanks to Tim Parenti and Brian Inglis.) + Release 2017b - 2017-03-17 07:30:38 -0700 Briefly: Haiti has resumed DST. @@ -15,7 +179,17 @@ Release 2017b - 2017-03-17 07:30:38 -0700 Use "MMT" to abbreviate Liberia's time zone before 1972, as "-004430" is one byte over the POSIX limit. (Problem reported by Derick Rethans.) + Changes to code + The reference localtime implementation now falls back on the + current US daylight-saving transition rules rather than the + 1987-2006 rules. This fallback occurs only when (1) the TZ + environment variable's value has a name like "AST4ADT" that asks + for daylight saving time but does not specify the rules, (2) there + is no file by that name, and (3) the TZDEFRULES file cannot be + loaded. (Thanks to Tom Lane.) + + Release 2017a - 2017-02-28 00:05:36 -0800 Briefly: Southern Chile moves from -04/-03 to -03, and Mongolia @@ -1981,7 +2155,7 @@ Release 2013e - 2013-09-19 23:50:04 -0700 The 'leapseconds' file is now generated automatically from a new file 'leap-seconds.list', which is a copy of - . + A new source file 'leapseconds.awk' implements this. The goal is simplification of the future maintenance of 'leapseconds'. @@ -2187,7 +2361,7 @@ Release 2013a - 2013-02-27 09:20:35 -0800 Many changes affect historical timestamps before 1940. These were deduced from: Milne J. Civil time. Geogr J. 1899 - Feb;13(2):173-94 . + Feb;13(2):173-94 . Changes affecting the code: Modified: head/contrib/tzdata/africa ============================================================================== --- head/contrib/tzdata/africa Sat Oct 28 17:45:42 2017 (r325058) +++ head/contrib/tzdata/africa Sat Oct 28 18:54:45 2017 (r325059) @@ -26,7 +26,7 @@ # # For data circa 1899, a common source is: # Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94. -# http://www.jstor.org/stable/1774359 +# https://www.jstor.org/stable/1774359 # # A reliable and entertaining source about time zones is # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997). @@ -218,7 +218,7 @@ Rule Egypt 2006 only - Sep 21 24:00 0 - # saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07. # From Jesper Nørgaard Welen (2007-08-15): [The following agree:] # http://www.nentjes.info/Bill/bill5.htm -# http://www.timeanddate.com/worldclock/city.html?n=53 +# https://www.timeanddate.com/worldclock/city.html?n=53 # From Steffen Thorsen (2007-09-04): The official information...: # http://www.sis.gov.eg/En/EgyptOnline/Miscellaneous/000002/0207000000000000001580.htm Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - @@ -256,8 +256,8 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # timeanddate[2] and another site I've found[3] also support that. # # [1] https://bugzilla.redhat.com/show_bug.cgi?id=492263 -# [2] http://www.timeanddate.com/worldclock/clockchange.html?n=53 -# [3] http://wwp.greenwichmeantime.com/time-zone/africa/egypt/ +# [2] https://www.timeanddate.com/worldclock/clockchange.html?n=53 +# [3] https://wwp.greenwichmeantime.com/time-zone/africa/egypt/ # From Arthur David Olson (2009-04-20): # In 2009 (and for the next several years), Ramadan ends before the fourth @@ -267,10 +267,10 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # From Steffen Thorsen (2009-08-11): # We have been able to confirm the August change with the Egyptian Cabinet # Information and Decision Support Center: -# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html +# https://www.timeanddate.com/news/time/egypt-dst-ends-2009.html # # The Middle East News Agency -# http://www.mena.org.eg/index.aspx +# https://www.mena.org.eg/index.aspx # also reports "Egypt starts winter time on August 21" # today in article numbered "71, 11/08/2009 12:25 GMT." # Only the title above is available without a subscription to their service, @@ -320,7 +320,7 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # Thursday of April.... Clocks will still be turned back for Ramadan, but # dates not yet announced.... # http://almogaz.com/news/weird-news/2015/04/05/1947105 ... -# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html +# https://www.timeanddate.com/news/time/egypt-starts-dst-2015.html # From Ahmed Nazmy (2015-04-20): # Egypt's ministers cabinet just announced ... that it will cancel DST at @@ -447,11 +447,11 @@ Zone Africa/Monrovia -0:43:08 - LMT 1882 # From Even Scharning (2012-11-10): # Libya set their time one hour back at 02:00 on Saturday November 10. -# http://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/ +# https://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/ # Here is an official source [in Arabic]: http://ls.ly/fb6Yc # # Steffen Thorsen forwarded a translation (2012-11-10) in -# http://mm.icann.org/pipermail/tz/2012-November/018451.html +# https://mm.icann.org/pipermail/tz/2012-November/018451.html # # From Tim Parenti (2012-11-11): # Treat the 2012-11-10 change as a zone change from UTC+2 to UTC+1. @@ -462,7 +462,7 @@ Zone Africa/Monrovia -0:43:08 - LMT 1882 # From Even Scharning (2013-10-25): # The scheduled end of DST in Libya on Friday, October 25, 2013 was # cancelled yesterday.... -# http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/ +# https://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/ # # From Paul Eggert (2013-10-25): # For now, assume they're reverting to the pre-2012 rules of permanent UT +02. @@ -515,7 +515,7 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 # basis.... # It seems that Mauritius observed daylight saving time from 1982-10-10 to # 1983-03-20 as well, but that was not successful.... -# http://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html +# https://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html # From Alex Krivenyshev (2008-06-25): # http://economicdevelopment.gov.mu/portal/site/Mainhomepage/menuitem.a42b24128104d9845dabddd154508a0c/?content_id=0a7cee8b5d69a110VgnVCM1000000a04a8c0RCRD @@ -583,7 +583,7 @@ Zone Africa/Tripoli 0:52:44 - LMT 1920 # http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints- # # Our wrap-up: -# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html +# https://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html # From Arthur David Olson (2009-07-11): # The "mauritius-dst-will-not-repeat" wrapup includes this: @@ -615,7 +615,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # be one hour ahead of GMT between 1 June and 27 September, according to # Communication Minister and Government Spokesman, Khalid Naciri...." # -# http://www.worldtimezone.net/dst_news/dst_news_morocco01.html +# http://www.worldtimezone.com/dst_news/dst_news_morocco01.html # http://en.afrik.com/news11892.html # From Alex Krivenyshev (2008-05-09): @@ -628,7 +628,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # From Patrice Scattolin (2008-05-09): # According to this article: -# http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html +# https://www.avmaroc.com/actualite/heure-dete-comment-a127896.html # (and republished here: ) # the changes occur at midnight: # @@ -650,7 +650,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # posted in English). # # The following Google query will generate many relevant hits: -# http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search +# https://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search # From Steffen Thorsen (2008-08-27): # Morocco will change the clocks back on the midnight between August 31 @@ -661,7 +661,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # http://www.menara.ma/fr/Actualites/Maroc/Societe/ci.retour_a_l_heure_gmt_a_partir_du_dimanche_31_aout_a_minuit_officiel_.default # # We have some further details posted here: -# http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html +# https://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html # From Steffen Thorsen (2009-03-17): # Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according @@ -671,7 +671,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # (French) # # Our summary: -# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html +# https://www.timeanddate.com/news/time/morocco-starts-dst-2009.html # From Alexander Krivenyshev (2009-03-17): # Here is a link to official document from Royaume du Maroc Premier Ministre, @@ -694,7 +694,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html # (French) # Our page: -# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html +# https://www.timeanddate.com/news/time/morocco-starts-dst-2010.html # From Dan Abitol (2011-03-30): # ...Rules for Africa/Casablanca are the following (24h format) @@ -711,7 +711,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # They said that the decision was already taken. # # More articles in the press -# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html +# https://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html # http://www.lematin.ma/Actualite/Express/Article.asp?id=148923 # http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim @@ -803,7 +803,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # 1433 (18 April 2012) and the decision of the Head of Government of # 16 N. 3-29-15 Chaaban 1435 (4 June 2015). # Source (french): -# http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/ +# https://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/ # # From Milamber (2015-06-09): # http://www.mmsp.gov.ma/fr/actualites.aspx?id=863 @@ -812,7 +812,7 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis # [The gov.ma announcement] would (probably) make the switch on 2015-07-19 go # from 03:00 to 04:00 rather than from 02:00 to 03:00, as in the patch.... # I think the patch is correct and the quoted text is wrong; the text in -# agrees +# agrees # with the patch. # From Paul Eggert (2015-06-08): @@ -937,10 +937,18 @@ Link Africa/Maputo Africa/Kigali # Rwanda Link Africa/Maputo Africa/Lubumbashi # E Dem. Rep. of Congo Link Africa/Maputo Africa/Lusaka # Zambia + # Namibia -# The 1994-04-03 transition is from Shanks & Pottenger. -# Shanks & Pottenger report no DST after 1998-04; go with IATA. +# From Arthur David Olson (2017-08-09): +# The text of the "Namibia Time Act, 1994" is available online at +# www.lac.org.na/laws/1994/811.pdf +# and includes this nugget: +# Notwithstanding the provisions of subsection (2) of section 1, the +# first winter period after the commencement of this Act shall +# commence at OOhOO on Monday 21 March 1994 and shall end at 02h00 on +# Sunday 4 September 1994. + # From Petronella Sibeene (2007-03-30): # http://allafrica.com/stories/200703300178.html # While the entire country changes its time, Katima Mulilo and other @@ -955,19 +963,30 @@ Link Africa/Maputo Africa/Lusaka # Zambia # observes Botswana time, we have no details about historical practice. # In the meantime people there can use Africa/Gaborone. # See: Immanuel S. The Namibian. 2017-02-23. -# http://www.namibian.com.na/51480/read/Time-change-divides-lawmakers +# https://www.namibian.com.na/51480/read/Time-change-divides-lawmakers +# From Steffen Thorsen (2017-08-09): +# Namibia is going to change their time zone to what is now their DST: +# https://www.newera.com.na/2017/02/23/namibias-winter-time-might-be-repealed/ +# This video is from the government decision: +# https://www.nbc.na/news/na-passes-namibia-time-bill-repealing-1994-namibia-time-act.8665 +# We have made the assumption so far that they will change their time zone at +# the same time they would normally start DST, the first Sunday in September: +# https://www.timeanddate.com/news/time/namibia-new-time-zone.html + # RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S -Rule Namibia 1994 max - Sep Sun>=1 2:00 1:00 S -Rule Namibia 1995 max - Apr Sun>=1 2:00 0 - +Rule Namibia 1994 only - Mar 21 0:00 0 - +Rule Namibia 1994 2016 - Sep Sun>=1 2:00 1:00 S +Rule Namibia 1995 2017 - Apr Sun>=1 2:00 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 1:30 - +0130 1903 Mar 2:00 - SAST 1942 Sep 20 2:00 2:00 1:00 SAST 1943 Mar 21 2:00 2:00 - SAST 1990 Mar 21 # independence - 2:00 - CAT 1994 Apr 3 - 1:00 Namibia WA%sT + 2:00 - CAT 1994 Mar 21 0:00 + 1:00 Namibia WA%sT 2017 Sep 3 2:00 + 2:00 - CAT # Niger # See Africa/Lagos. @@ -1054,14 +1073,24 @@ Link Africa/Johannesburg Africa/Mbabane # Swaziland # no information # Sudan -# + # From # Sudan News Agency (2000-01-13), # also reported by Michaël De Beukelaer-Dossche via Steffen Thorsen: # Clocks will be moved ahead for 60 minutes all over the Sudan as of noon # Saturday.... This was announced Thursday by Caretaker State Minister for # Manpower Abdul-Rahman Nur-Eddin. + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Oct 28 18:56:28 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F087BE4AAF3; Sat, 28 Oct 2017 18:56:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBE257CF38; Sat, 28 Oct 2017 18:56:28 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9SIuRBH009140; Sat, 28 Oct 2017 18:56:27 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SIuRIJ009139; Sat, 28 Oct 2017 18:56:27 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710281856.v9SIuRIJ009139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 28 Oct 2017 18:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325060 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 325060 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 18:56:29 -0000 Author: ian Date: Sat Oct 28 18:56:27 2017 New Revision: 325060 URL: https://svnweb.freebsd.org/changeset/base/325060 Log: Add a #define RESOURCE_SPEC_END. Similar to DEVMETHOD_END and KOBJMETHOD_END, this is to serve as the end marker in an array of resource_spec structures. Modified: head/sys/sys/bus.h Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Sat Oct 28 18:54:45 2017 (r325059) +++ head/sys/sys/bus.h Sat Oct 28 18:56:27 2017 (r325060) @@ -491,6 +491,7 @@ struct resource_spec { int rid; int flags; }; +#define RESOURCE_SPEC_END {-1, 0, 0} int bus_alloc_resources(device_t dev, struct resource_spec *rs, struct resource **res); From owner-svn-src-head@freebsd.org Sat Oct 28 19:08:07 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6C04E4AE44; Sat, 28 Oct 2017 19:08: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 mx1.freebsd.org (Postfix) with ESMTPS id 80D247D3DD; Sat, 28 Oct 2017 19:08: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 v9SJ864v013238; Sat, 28 Oct 2017 19:08:06 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SJ86GT013237; Sat, 28 Oct 2017 19:08:06 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710281908.v9SJ86GT013237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 28 Oct 2017 19:08:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325061 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 325061 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 19:08:07 -0000 Author: ian Date: Sat Oct 28 19:08:06 2017 New Revision: 325061 URL: https://svnweb.freebsd.org/changeset/base/325061 Log: Support up to 3 IRQs in the ffec driver. Newer hardware splits the interrupts onto 3 different irq lines, but the docs barely mention that there are multiple interrupts, and do not detail how they're split up. The code now supports 1-3 irqs, and uses the same interrupt service routine to handle all of them. I modified the submitted changes to use bus_alloc_resources() instead of using loops to allocate each irq separately. Thus, blame any bugs on me (I can't actually test on imx7 hardware). PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Sat Oct 28 18:56:27 2017 (r325060) +++ head/sys/dev/ffec/if_ffec.c Sat Oct 28 19:08:06 2017 (r325061) @@ -133,6 +133,8 @@ static struct ofw_compat_data compat_data[] = { #define WATCHDOG_TIMEOUT_SECS 5 +#define MAX_IRQ_COUNT 3 + struct ffec_bufmap { struct mbuf *mbuf; bus_dmamap_t map; @@ -145,9 +147,9 @@ struct ffec_softc { struct ifnet *ifp; int if_flags; struct mtx mtx; - struct resource *irq_res; + struct resource *irq_res[MAX_IRQ_COUNT]; struct resource *mem_res; - void * intr_cookie; + void * intr_cookie[MAX_IRQ_COUNT]; struct callout ffec_callout; mii_contype_t phy_conn_type; uintptr_t fectype; @@ -177,6 +179,13 @@ struct ffec_softc { int txcount; }; +static struct resource_spec irq_res_spec[MAX_IRQ_COUNT + 1] = { + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 1, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 2, RF_ACTIVE | RF_OPTIONAL }, + RESOURCE_SPEC_END +}; + #define FFEC_LOCK(sc) mtx_lock(&(sc)->mtx) #define FFEC_UNLOCK(sc) mtx_unlock(&(sc)->mtx) #define FFEC_LOCK_INIT(sc) mtx_init(&(sc)->mtx, \ @@ -1364,7 +1373,7 @@ ffec_detach(device_t dev) { struct ffec_softc *sc; bus_dmamap_t map; - int idx; + int idx, irq; /* * NB: This function can be called internally to unwind a failure to @@ -1415,15 +1424,17 @@ ffec_detach(device_t dev) bus_dmamap_destroy(sc->txdesc_tag, sc->txdesc_map); } if (sc->txdesc_tag != NULL) - bus_dma_tag_destroy(sc->txdesc_tag); + bus_dma_tag_destroy(sc->txdesc_tag); /* Release bus resources. */ - if (sc->intr_cookie) - bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); + for (irq = 0; irq < MAX_IRQ_COUNT; ++irq) { + if (sc->intr_cookie[irq] != NULL) { + bus_teardown_intr(dev, sc->irq_res[irq], + sc->intr_cookie[irq]); + } + } + bus_release_resources(dev, irq_res_spec, sc->irq_res); - if (sc->irq_res != NULL) - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); - if (sc->mem_res != NULL) bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); @@ -1439,7 +1450,7 @@ ffec_attach(device_t dev) struct mbuf *m; void *dummy; phandle_t ofw_node; - int error, phynum, rid; + int error, phynum, rid, irq; uint8_t eaddr[ETHER_ADDR_LEN]; uint32_t idx, mscr; @@ -1490,12 +1501,10 @@ ffec_attach(device_t dev) error = ENOMEM; goto out; } - rid = 0; - sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); - if (sc->irq_res == NULL) { - device_printf(dev, "could not allocate interrupt resources.\n"); - error = ENOMEM; + + error = bus_alloc_resources(dev, irq_res_spec, sc->irq_res); + if (error != 0) { + device_printf(dev, "could not allocate interrupt resources\n"); goto out; } @@ -1656,11 +1665,17 @@ ffec_attach(device_t dev) WR4(sc, FEC_ECR_REG, FEC_ECR_RESET); /* Setup interrupt handler. */ - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, ffec_intr, sc, &sc->intr_cookie); - if (error != 0) { - device_printf(dev, "could not setup interrupt handler.\n"); - goto out; + for (irq = 0; irq < MAX_IRQ_COUNT; ++irq) { + if (sc->irq_res[irq] != NULL) { + error = bus_setup_intr(dev, sc->irq_res[irq], + INTR_TYPE_NET | INTR_MPSAFE, NULL, ffec_intr, sc, + &sc->intr_cookie[irq]); + if (error != 0) { + device_printf(dev, + "could not setup interrupt handler.\n"); + goto out; + } + } } /* From owner-svn-src-head@freebsd.org Sat Oct 28 19:24:00 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC934E4B406; Sat, 28 Oct 2017 19:24:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id 6BDC67DC3D; Sat, 28 Oct 2017 19:24:00 +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 v9SJNxbA021369; Sat, 28 Oct 2017 19:23:59 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SJNvE5021346; Sat, 28 Oct 2017 19:23:57 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201710281923.v9SJNvE5021346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 28 Oct 2017 19:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325062 - in head/lib: . libcasper libcasper/libcasper libcasper/services libcasper/services/cap_dns libcasper/services/cap_dns/tests libcasper/services/cap_grp libcasper/services/cap_g... X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head/lib: . libcasper libcasper/libcasper libcasper/services libcasper/services/cap_dns libcasper/services/cap_dns/tests libcasper/services/cap_grp libcasper/services/cap_grp/tests libcasper/servic... X-SVN-Commit-Revision: 325062 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 19:24:00 -0000 Author: oshogbo Date: Sat Oct 28 19:23:57 2017 New Revision: 325062 URL: https://svnweb.freebsd.org/changeset/base/325062 Log: Introduce caspermocks. The idea behinds mocks is that we don't need to ifdef a lot of code in tools itself but those defines are hidden in the casper library. Right now the mocks are implemented as define/inlines functions. There was a very long discussion how this should be implemented. This approach has some advantages like we don't need to link to any additional libraries. Unfortunately there are also some disadvantages for example it is easy to get library out of sync between two versions of functions or that we need extra define to compile program with casper support. This isn't an ideal solution but it's good enough for now and should simplify capsicumizing programs. This also doesn't close us any other ways to do those mocks and this should evolve in time. Discussed with: pjd, emaste, ed, rwatson, bapt, cem, bdrewery Differential Revision: https://reviews.freebsd.org/D8753 Modified: head/lib/Makefile head/lib/libcasper/Makefile.inc head/lib/libcasper/libcasper/Makefile head/lib/libcasper/libcasper/libcasper.h head/lib/libcasper/services/Makefile head/lib/libcasper/services/cap_dns/Makefile head/lib/libcasper/services/cap_dns/cap_dns.h head/lib/libcasper/services/cap_dns/tests/Makefile head/lib/libcasper/services/cap_dns/tests/dns_test.c head/lib/libcasper/services/cap_grp/Makefile head/lib/libcasper/services/cap_grp/cap_grp.h head/lib/libcasper/services/cap_grp/tests/Makefile head/lib/libcasper/services/cap_grp/tests/grp_test.c head/lib/libcasper/services/cap_pwd/Makefile head/lib/libcasper/services/cap_pwd/cap_pwd.h head/lib/libcasper/services/cap_pwd/tests/Makefile head/lib/libcasper/services/cap_pwd/tests/pwd_test.c head/lib/libcasper/services/cap_random/Makefile head/lib/libcasper/services/cap_random/cap_random.h head/lib/libcasper/services/cap_sysctl/Makefile head/lib/libcasper/services/cap_sysctl/cap_sysctl.h head/lib/libcasper/services/cap_sysctl/tests/Makefile Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -35,6 +35,7 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ libcalendar \ libcam \ libcapsicum \ + libcasper \ libcompat \ libcrypt \ libdevctl \ @@ -127,7 +128,6 @@ SUBDIR.${MK_ATM}+= libngatm SUBDIR.${MK_BLACKLIST}+=libblacklist SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp SUBDIR.${MK_BSNMP}+= libbsnmp -SUBDIR.${MK_CASPER}+= libcasper .if !defined(COMPAT_32BIT) && !defined(COMPAT_SOFTFP) SUBDIR.${MK_CLANG}+= clang Modified: head/lib/libcasper/Makefile.inc ============================================================================== --- head/lib/libcasper/Makefile.inc Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/Makefile.inc Sat Oct 28 19:23:57 2017 (r325062) @@ -1,3 +1,9 @@ # $FreeBSD$ +.include + +.if ${MK_CASPER} != "no" +CFLAGS+=-DWITH_CASPER +.endif + .include "../Makefile.inc" Modified: head/lib/libcasper/libcasper/Makefile ============================================================================== --- head/lib/libcasper/libcasper/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/libcasper/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -1,16 +1,21 @@ # $FreeBSD$ +.include + PACKAGE=${LIB} -LIB= casper SHLIB_MAJOR= 0 SHLIBDIR?= /lib +.if ${MK_CASPER} != "no" +LIB= casper + SRCS= libcasper.c SRCS+= libcasper_impl.c SRCS+= libcasper_service.c SRCS+= service.c SRCS+= zygote.c +.endif INCS= libcasper.h INCS+= libcasper_service.h Modified: head/lib/libcasper/libcasper/libcasper.h ============================================================================== --- head/lib/libcasper/libcasper/libcasper.h Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/libcasper/libcasper.h Sat Oct 28 19:23:57 2017 (r325062) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2012-2013 The FreeBSD Foundation - * Copyright (c) 2015 Mariusz Zaborski + * Copyright (c) 2015-2017 Mariusz Zaborski * All rights reserved. * * This software was developed by Pawel Jakub Dawidek under sponsorship from @@ -33,8 +33,16 @@ #ifndef _LIBCASPER_H_ #define _LIBCASPER_H_ +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + #include +#include +#include +#include + #ifndef _NVLIST_T_DECLARED #define _NVLIST_T_DECLARED struct nvlist; @@ -44,72 +52,191 @@ typedef struct nvlist nvlist_t; #ifndef _CAP_CHANNEL_T_DECLARED #define _CAP_CHANNEL_T_DECLARED +#ifdef WITH_CASPER struct cap_channel; typedef struct cap_channel cap_channel_t; -#endif +#else +struct cap_channel { + int cch_fd; +}; +typedef struct cap_channel cap_channel_t; +#endif /* ! WITH_CASPER */ +#endif /* ! _CAP_CHANNEL_T_DECLARED */ /* * The functions opens unrestricted communication channel to Casper. */ +#ifdef WITH_CASPER cap_channel_t *cap_init(void); +#else +static inline cap_channel_t * +cap_init(void) +{ + cap_channel_t *chan; + chan = malloc(sizeof(*chan)); + if (chan != NULL) { + chan->cch_fd = -1; + } + return (chan); +} +#endif + /* * The functions to communicate with service. */ +#ifdef WITH_CASPER cap_channel_t *cap_service_open(const cap_channel_t *chan, const char *name); int cap_service_limit(const cap_channel_t *chan, const char * const *names, size_t nnames); +#else +#define cap_service_open(chan, name) (cap_init()) +#define cap_service_limit(chan, names, nnames) (0) +#endif /* * The function creates cap_channel_t based on the given socket. */ +#ifdef WITH_CASPER cap_channel_t *cap_wrap(int sock); +#else +static inline cap_channel_t * +cap_wrap(int sock) +{ + cap_channel_t *chan; + chan = cap_init(); + if (chan != NULL) { + chan->cch_fd = sock; + } + return (chan); +} +#endif + /* * The function returns communication socket and frees cap_channel_t. */ +#ifdef WITH_CASPER int cap_unwrap(cap_channel_t *chan); +#else +#define cap_unwrap(chan) (chan->cch_fd) +#endif /* * The function clones the given capability. */ +#ifdef WITH_CASPER cap_channel_t *cap_clone(const cap_channel_t *chan); +#else +static inline cap_channel_t * +cap_clone(const cap_channel_t *chan) +{ + cap_channel_t *newchan; + newchan = cap_init(); + if (newchan == NULL) { + return (NULL); + } + + if (chan->cch_fd == -1) { + newchan->cch_fd = -1; + } else { + newchan->cch_fd = dup(chan->cch_fd); + if (newchan->cch_fd < 0) { + free(newchan); + newchan = NULL; + } + } + + return (newchan); +} +#endif + /* * The function closes the given capability. */ +#ifdef WITH_CASPER void cap_close(cap_channel_t *chan); +#else +static inline void +cap_close(cap_channel_t *chan) +{ + if (chan->cch_fd >= 0) { + close(chan->cch_fd); + } + free(chan); +} +#endif + /* * The function returns socket descriptor associated with the given * cap_channel_t for use with select(2)/kqueue(2)/etc. */ +#ifdef WITH_CASPER int cap_sock(const cap_channel_t *chan); +#else +#define cap_sock(chan) (chan->cch_fd) +#endif /* * The function limits the given capability. * It always destroys 'limits' on return. */ +#ifdef WITH_CASPER int cap_limit_set(const cap_channel_t *chan, nvlist_t *limits); +#else +#define cap_limit_set(chan, limits) (0) +#endif /* * The function returns current limits of the given capability. */ +#ifdef WITH_CASPER int cap_limit_get(const cap_channel_t *chan, nvlist_t **limitsp); +#else +static inline int +cap_limit_get(const cap_channel_t *chan __unused, nvlist_t **limitsp) +{ + *limitsp = nvlist_create(0); + return (0); +} +#endif + /* * Function sends nvlist over the given capability. */ +#ifdef WITH_CASPER int cap_send_nvlist(const cap_channel_t *chan, const nvlist_t *nvl); +#else +#define cap_send_nvlist(chan, nvl) (0) +#endif + /* * Function receives nvlist over the given capability. */ +#ifdef WITH_CASPER nvlist_t *cap_recv_nvlist(const cap_channel_t *chan, int flags); +#else +#define cap_recv_nvlist(chan, flags) (0) +#endif + /* * Function sends the given nvlist, destroys it and receives new nvlist in * response over the given capability. */ +#ifdef WITH_CASPER nvlist_t *cap_xfer_nvlist(const cap_channel_t *chan, nvlist_t *nvl, int flags); +#else +static inline nvlist_t * +cap_xfer_nvlist(const cap_channel_t *chan __unused, nvlist_t *nvl, int flags) +{ + + nvlist_destroy(nvl); + return (nvlist_create(flags)); +} +#endif #endif /* !_LIBCASPER_H_ */ Modified: head/lib/libcasper/services/Makefile ============================================================================== --- head/lib/libcasper/services/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + SUBDIR= cap_dns SUBDIR+= cap_grp SUBDIR+= cap_pwd Modified: head/lib/libcasper/services/cap_dns/Makefile ============================================================================== --- head/lib/libcasper/services/cap_dns/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_dns/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -5,12 +5,15 @@ SHLIBDIR?= /lib/casper .include PACKAGE=libcasper -LIB= cap_dns SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper +.if ${MK_CASPER} != "no" +LIB= cap_dns + SRCS= cap_dns.c +.endif INCS= cap_dns.h Modified: head/lib/libcasper/services/cap_dns/cap_dns.h ============================================================================== --- head/lib/libcasper/services/cap_dns/cap_dns.h Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_dns/cap_dns.h Sat Oct 28 19:23:57 2017 (r325062) @@ -32,11 +32,16 @@ #ifndef _CAP_DNS_H_ #define _CAP_DNS_H_ +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + #include /* socklen_t */ struct addrinfo; struct hostent; +#ifdef WITH_CASPER struct hostent *cap_gethostbyname(cap_channel_t *chan, const char *name); struct hostent *cap_gethostbyname2(cap_channel_t *chan, const char *name, int type); @@ -53,5 +58,18 @@ int cap_dns_type_limit(cap_channel_t *chan, const char size_t ntypes); int cap_dns_family_limit(cap_channel_t *chan, const int *families, size_t nfamilies); +#else +#define cap_gethostbyname(chan, name) gethostbyname(name) +#define cap_gethostbyname2(chan, name, type) gethostbyname2(name, type) +#define cap_gethostbyaddr(chan, addr, len, type) gethostbyaddr(addr, len, type) + +#define cap_getaddrinfo(chan, hostname, servname, hints, res) \ + getaddrinfo(hostname, servname, hints, res) +#define cap_getnameinfo(chan, sa, salen, host, hostlen, serv, servlen, flags) \ + getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) + +#define cap_dns_type_limit(chan, types, ntypes) (0) +#define cap_dns_family_limit(chan, families, nfamilies) (0) +#endif #endif /* !_CAP_DNS_H_ */ Modified: head/lib/libcasper/services/cap_dns/tests/Makefile ============================================================================== --- head/lib/libcasper/services/cap_dns/tests/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_dns/tests/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -1,9 +1,13 @@ # $FreeBSD$ +.include + TAP_TESTS_C= dns_test +.if ${MK_CASPER} != "no" LIBADD+= casper LIBADD+= cap_dns +.endif LIBADD+= nv WARNS?= 3 Modified: head/lib/libcasper/services/cap_dns/tests/dns_test.c ============================================================================== --- head/lib/libcasper/services/cap_dns/tests/dns_test.c Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_dns/tests/dns_test.c Sat Oct 28 19:23:57 2017 (r325062) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include Modified: head/lib/libcasper/services/cap_grp/Makefile ============================================================================== --- head/lib/libcasper/services/cap_grp/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_grp/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -5,12 +5,15 @@ SHLIBDIR?= /lib/casper .include PACKAGE=libcasper -LIB= cap_grp SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper +.if ${MK_CASPER} != "no" +LIB= cap_grp + SRCS= cap_grp.c +.endif INCS= cap_grp.h Modified: head/lib/libcasper/services/cap_grp/cap_grp.h ============================================================================== --- head/lib/libcasper/services/cap_grp/cap_grp.h Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_grp/cap_grp.h Sat Oct 28 19:23:57 2017 (r325062) @@ -32,6 +32,11 @@ #ifndef _CAP_GRP_H_ #define _CAP_GRP_H_ +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + +#ifdef WITH_CASPER struct group *cap_getgrent(cap_channel_t *chan); struct group *cap_getgrnam(cap_channel_t *chan, const char *name); struct group *cap_getgrgid(cap_channel_t *chan, gid_t gid); @@ -53,5 +58,32 @@ int cap_grp_limit_fields(cap_channel_t *chan, const ch 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); +#else +#define cap_getgrent(chan) getgrent() +#define cap_getgrnam(chan, name) getgrnam(name) +#define cap_getgrgid(chan, gid) getgrgid(gid) + +#define cap_setgroupent(chan, stayopen) etgroupent(stayopen) +#define endgrent(chan) endgrent() +inline int +cap_setgrent(cap_channel_t *chan __unused) +{ + + setgrent(); + return(0); +} + +#define cap_getgrent_r(chan, grp, buffer, bufsize, result) \ + getgrent_r(grp, buffer, bufsize, result) +#define cap_getgrnam_r(chan, name, grp, buffer, bufsize, result) \ + getgrnam_r(name, grp, buffer, bufsize, result) +#define cap_getgrgid_r(chan, gid, grp, buffer, bufsize, result) \ + getgrgid_r(gid, grp, buffer, bufsize, result) + +#define cap_grp_limit_cmds(chan, cmds, ncmds) (0) +#define cap_grp_limit_fields(chan, fields, nfields) (0) +#define cap_grp_limit_groups(chan, names, nnames, gids, ngids) (0) + +#endif #endif /* !_CAP_GRP_H_ */ Modified: head/lib/libcasper/services/cap_grp/tests/Makefile ============================================================================== --- head/lib/libcasper/services/cap_grp/tests/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_grp/tests/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -1,9 +1,13 @@ # $FreeBSD$ +.include + TAP_TESTS_C= grp_test +.if ${MK_CASPER} != "no" LIBADD+= casper LIBADD+= cap_grp +.endif LIBADD+= nv WARNS?= 3 Modified: head/lib/libcasper/services/cap_grp/tests/grp_test.c ============================================================================== --- head/lib/libcasper/services/cap_grp/tests/grp_test.c Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_grp/tests/grp_test.c Sat Oct 28 19:23:57 2017 (r325062) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include Modified: head/lib/libcasper/services/cap_pwd/Makefile ============================================================================== --- head/lib/libcasper/services/cap_pwd/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_pwd/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -5,12 +5,15 @@ SHLIBDIR?= /lib/casper .include PACKAGE=libcasper -LIB= cap_pwd SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper +.if ${MK_CASPER} != "no" +LIB= cap_pwd + SRCS= cap_pwd.c +.endif INCS= cap_pwd.h Modified: head/lib/libcasper/services/cap_pwd/cap_pwd.h ============================================================================== --- head/lib/libcasper/services/cap_pwd/cap_pwd.h Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_pwd/cap_pwd.h Sat Oct 28 19:23:57 2017 (r325062) @@ -32,6 +32,11 @@ #ifndef _CAP_PWD_H_ #define _CAP_PWD_H_ +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + +#ifdef WITH_CASPER struct passwd *cap_getpwent(cap_channel_t *chan); struct passwd *cap_getpwnam(cap_channel_t *chan, const char *login); struct passwd *cap_getpwuid(cap_channel_t *chan, uid_t uid); @@ -53,5 +58,25 @@ int cap_pwd_limit_fields(cap_channel_t *chan, const ch size_t nfields); int cap_pwd_limit_users(cap_channel_t *chan, const char * const *names, size_t nnames, uid_t *uids, size_t nuids); +#else +#define cap_getpwent(chan) getpwent() +#define cap_getpwnam(chan, login) getpwnam(login) +#define cap_getpwuid(chan, uid) getpwuid(uid) + +#define cap_getpwent_r(chan, pwd, buffer, bufsize, result) \ + getpwent_r(pwd, buffer, bufsize, result) +#define cap_getpwnam_r(chan, name, pwd, buffer, bufsize, result) \ + getpwnam_r(name, pwd, buffer, bufsize, result) +#define cap_getpwuid_r(chan, uid, pwd, buffer, bufsize, result) \ + getpwuid_r(uid, pwd, buffer, bufsize, result) + +#define cap_setpassent(chan, stayopen) setpassent(stayopen) +#define cap_setpwent(chan) setpwent() +#define cap_endpwent(chan) endpwent() + +#define cap_pwd_limit_cmds(chan, cmds, ncmds) (0) +#define cap_pwd_limit_fields(chan, fields, nfields) (0) +#define cap_pwd_limit_users(chan, names, nnames, uids, nuids) (0) +#endif #endif /* !_CAP_PWD_H_ */ Modified: head/lib/libcasper/services/cap_pwd/tests/Makefile ============================================================================== --- head/lib/libcasper/services/cap_pwd/tests/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_pwd/tests/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -1,9 +1,13 @@ # $FreeBSD$ +.include + TAP_TESTS_C= pwd_test +.if ${MK_CASPER} != "no" LIBADD+= casper LIBADD+= cap_pwd +.endif LIBADD+= nv WARNS?= 3 Modified: head/lib/libcasper/services/cap_pwd/tests/pwd_test.c ============================================================================== --- head/lib/libcasper/services/cap_pwd/tests/pwd_test.c Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_pwd/tests/pwd_test.c Sat Oct 28 19:23:57 2017 (r325062) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include Modified: head/lib/libcasper/services/cap_random/Makefile ============================================================================== --- head/lib/libcasper/services/cap_random/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_random/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -1,13 +1,18 @@ # $FreeBSD$ +.include + PACKAGE=libcasper -LIB= cap_random SHLIB_MAJOR= 0 SHLIBDIR?= /lib/casper INCSDIR?= ${INCLUDEDIR}/casper +.if ${MK_CASPER} != "no" +LIB= cap_random + SRCS= cap_random.c +.endif INCS= cap_random.h Modified: head/lib/libcasper/services/cap_random/cap_random.h ============================================================================== --- head/lib/libcasper/services/cap_random/cap_random.h Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_random/cap_random.h Sat Oct 28 19:23:57 2017 (r325062) @@ -32,6 +32,20 @@ #ifndef _CAP_RANDOM_H_ #define _CAP_RANDOM_H_ +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + +#ifdef WITH_CASPER int cap_random_buf(cap_channel_t *chan, void *buf, size_t nbytes); +#else +inline int +cap_random_buf(cap_channel_t *chan, void *buf, size_t nbytes) +{ + + arc4random_buf(buf, nbytes); + return(0); +} +#endif #endif /* !_CAP_RANDOM_H_ */ Modified: head/lib/libcasper/services/cap_sysctl/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_sysctl/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -5,12 +5,15 @@ SHLIBDIR?= /lib/casper .include PACKAGE=libcasper -LIB= cap_sysctl SHLIB_MAJOR= 0 INCSDIR?= ${INCLUDEDIR}/casper +.if ${MK_CASPER} != "no" +LIB= cap_sysctl + SRCS= cap_sysctl.c +.endif INCS= cap_sysctl.h Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.h ============================================================================== --- head/lib/libcasper/services/cap_sysctl/cap_sysctl.h Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.h Sat Oct 28 19:23:57 2017 (r325062) @@ -32,12 +32,21 @@ #ifndef _CAP_SYSCTL_H_ #define _CAP_SYSCTL_H_ +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + #define CAP_SYSCTL_READ 0x01 #define CAP_SYSCTL_WRITE 0x02 #define CAP_SYSCTL_RDWR (CAP_SYSCTL_READ | CAP_SYSCTL_WRITE) #define CAP_SYSCTL_RECURSIVE 0x04 +#ifdef WITH_CASPER int cap_sysctlbyname(cap_channel_t *chan, const char *name, void *oldp, size_t *oldlenp, const void *newp, size_t newlen); +#else +#define cap_sysctlbyname(chan, name, oldp, oldlenp, newp, newlen) \ + sysctlbyname(name, oldp, oldlenp, newp, newlen) +#endif #endif /* !_CAP_SYSCTL_H_ */ Modified: head/lib/libcasper/services/cap_sysctl/tests/Makefile ============================================================================== --- head/lib/libcasper/services/cap_sysctl/tests/Makefile Sat Oct 28 19:08:06 2017 (r325061) +++ head/lib/libcasper/services/cap_sysctl/tests/Makefile Sat Oct 28 19:23:57 2017 (r325062) @@ -1,9 +1,13 @@ # $FreeBSD$ +.include + TAP_TESTS_C= sysctl_test +.if ${MK_CASPER} != "no" LIBADD+= casper LIBADD+= cap_sysctl +.endif LIBADD+= nv WARNS?= 3 From owner-svn-src-head@freebsd.org Sat Oct 28 19:34:09 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55999E4B7B5; Sat, 28 Oct 2017 19:34:09 +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 mx1.freebsd.org (Postfix) with ESMTPS id 3197A7E1AC; Sat, 28 Oct 2017 19:34:09 +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 v9SJY884025807; Sat, 28 Oct 2017 19:34:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SJY8H3025806; Sat, 28 Oct 2017 19:34:08 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710281934.v9SJY8H3025806@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 28 Oct 2017 19:34:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325063 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 325063 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 19:34:09 -0000 Author: ian Date: Sat Oct 28 19:34:08 2017 New Revision: 325063 URL: https://svnweb.freebsd.org/changeset/base/325063 Log: Use the 16-bit receive shift feature in ffec hardware that supports it. When available, enabling this feature causes the hardware to write data to the receive buffer starting at a 16-bit offset from the start address. This eliminates the need to copy the data after receiving to re-align the protocol headers to a 32-bit boundary. PR: 222634 Submitted by: sebastian.huber@embedded-brains.de Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Sat Oct 28 19:23:57 2017 (r325062) +++ head/sys/dev/ffec/if_ffec.c Sat Oct 28 19:34:08 2017 (r325063) @@ -108,6 +108,7 @@ enum { #define FECTYPE_MASK 0x0000ffff #define FECFLAG_GBE (1 << 16) #define FECFLAG_AVB (1 << 17) +#define FECFLAG_RACC (1 << 18) /* * Table of supported FDT compat strings and their associated FECTYPE values. @@ -115,10 +116,11 @@ enum { static struct ofw_compat_data compat_data[] = { {"fsl,imx51-fec", FECTYPE_GENERIC}, {"fsl,imx53-fec", FECTYPE_IMX53}, - {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_GBE}, - {"fsl,imx6ul-fec", FECTYPE_IMX6}, - {"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_GBE | FECFLAG_AVB}, - {"fsl,mvf600-fec", FECTYPE_MVF}, + {"fsl,imx6q-fec", FECTYPE_IMX6 | FECFLAG_RACC | FECFLAG_GBE }, + {"fsl,imx6ul-fec", FECTYPE_IMX6 | FECFLAG_RACC }, + {"fsl,imx7d-fec", FECTYPE_IMX6 | FECFLAG_RACC | FECFLAG_GBE | + FECFLAG_AVB }, + {"fsl,mvf600-fec", FECTYPE_MVF | FECFLAG_RACC }, {"fsl,mvf-fec", FECTYPE_MVF}, {NULL, FECTYPE_NONE}, }; @@ -760,14 +762,17 @@ ffec_setup_rxbuf(struct ffec_softc *sc, int idx, struc int error, nsegs; struct bus_dma_segment seg; - /* - * We need to leave at least ETHER_ALIGN bytes free at the beginning of - * the buffer to allow the data to be re-aligned after receiving it (by - * copying it backwards ETHER_ALIGN bytes in the same buffer). We also - * have to ensure that the beginning of the buffer is aligned to the - * hardware's requirements. - */ - m_adj(m, roundup(ETHER_ALIGN, sc->rxbuf_align)); + if ((sc->fectype & FECFLAG_RACC) == 0) { + /* + * The RACC[SHIFT16] feature is not available. So, we need to + * leave at least ETHER_ALIGN bytes free at the beginning of the + * buffer to allow the data to be re-aligned after receiving it + * (by copying it backwards ETHER_ALIGN bytes in the same + * buffer). We also have to ensure that the beginning of the + * buffer is aligned to the hardware's requirements. + */ + m_adj(m, roundup(ETHER_ALIGN, sc->rxbuf_align)); + } error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, m, &seg, &nsegs, 0); @@ -815,23 +820,6 @@ ffec_rxfinish_onebuf(struct ffec_softc *sc, int len) return; } - /* - * Unfortunately, the protocol headers need to be aligned on a 32-bit - * boundary for the upper layers. The hardware requires receive - * buffers to be 16-byte aligned. The ethernet header is 14 bytes, - * leaving the protocol header unaligned. We used m_adj() after - * allocating the buffer to leave empty space at the start of the - * buffer, now we'll use the alignment agnostic bcopy() routine to - * shuffle all the data backwards 2 bytes and adjust m_data. - * - * XXX imx6 hardware is able to do this 2-byte alignment by setting the - * SHIFT16 bit in the RACC register. Older hardware doesn't have that - * feature, but for them could we speed this up by copying just the - * protocol headers into their own small mbuf then chaining the cluster - * to it? That way we'd only need to copy like 64 bytes or whatever - * the biggest header is, instead of the whole 1530ish-byte frame. - */ - FFEC_UNLOCK(sc); bmap = &sc->rxbuf_map[sc->rx_idx]; @@ -844,10 +832,25 @@ ffec_rxfinish_onebuf(struct ffec_softc *sc, int len) m->m_pkthdr.len = len; m->m_pkthdr.rcvif = sc->ifp; - src = mtod(m, uint8_t*); - dst = src - ETHER_ALIGN; - bcopy(src, dst, len); - m->m_data = dst; + /* + * Align the protocol headers in the receive buffer on a 32-bit + * boundary. Newer hardware does the alignment for us. On hardware + * that doesn't support this feature, we have to copy-align the data. + * + * XXX for older hardware, could we speed this up by copying just the + * protocol headers into their own small mbuf then chaining the cluster + * to it? That way we'd only need to copy like 64 bytes or whatever the + * biggest header is, instead of the whole 1530ish-byte frame. + */ + + if (sc->fectype & FECFLAG_RACC) { + m->m_data = mtod(m, uint8_t *) + 2; + } else { + src = mtod(m, uint8_t*); + dst = src - ETHER_ALIGN; + bcopy(src, dst, len); + m->m_data = dst; + } sc->ifp->if_input(sc->ifp, m); FFEC_LOCK(sc); @@ -1220,6 +1223,14 @@ ffec_init_locked(struct ffec_softc *sc) WR4(sc, FEC_MIBC_REG, regval | FEC_MIBC_DIS); ffec_clear_stats(sc); WR4(sc, FEC_MIBC_REG, regval & ~FEC_MIBC_DIS); + + if (sc->fectype & FECFLAG_RACC) { + /* + * RACC - Receive Accelerator Function Configuration. + */ + regval = RD4(sc, FEC_RACC_REG); + WR4(sc, FEC_RACC_REG, regval | FEC_RACC_SHIFT16); + } /* * ECR - Ethernet control register. From owner-svn-src-head@freebsd.org Sat Oct 28 19:39:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E50ECE4B8F2; Sat, 28 Oct 2017 19:39:23 +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 mx1.freebsd.org (Postfix) with ESMTPS id C0EDE7E35F; Sat, 28 Oct 2017 19:39:23 +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 v9SJdMhd026071; Sat, 28 Oct 2017 19:39:22 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SJdMd9026070; Sat, 28 Oct 2017 19:39:22 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201710281939.v9SJdMd9026070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 28 Oct 2017 19:39:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325064 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 325064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 19:39:24 -0000 Author: oshogbo Date: Sat Oct 28 19:39:22 2017 New Revision: 325064 URL: https://svnweb.freebsd.org/changeset/base/325064 Log: Simplify ping sandbox. We don't need to check if casper is present, this is done in the library itself. Reviewed by: emaste, cem, ed Differential Revision: https://reviews.freebsd.org/D8754 Modified: head/sbin/ping/ping.c Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Sat Oct 28 19:34:08 2017 (r325063) +++ head/sbin/ping/ping.c Sat Oct 28 19:39:22 2017 (r325064) @@ -76,10 +76,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef WITH_CASPER #include #include -#endif #ifdef IPSEC #include @@ -204,15 +202,11 @@ static double tsumsq = 0.0; /* sum of all times square static volatile sig_atomic_t finish_up; static volatile sig_atomic_t siginfo_p; -#ifdef WITH_CASPER static cap_channel_t *capdns; -#endif static void fill(char *, char *); static u_short in_cksum(u_short *, int); -#ifdef WITH_CASPER static cap_channel_t *capdns_setup(void); -#endif static void check_status(void); static void finish(void) __dead2; static void pinger(void); @@ -563,21 +557,17 @@ main(int argc, char *const *argv) if (options & F_PINGFILLED) { fill((char *)datap, payload); } -#ifdef WITH_CASPER capdns = capdns_setup(); -#endif if (source) { bzero((char *)&sock_in, sizeof(sock_in)); sock_in.sin_family = AF_INET; if (inet_aton(source, &sock_in.sin_addr) != 0) { shostname = source; } else { -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyname2(capdns, source, AF_INET); else -#endif hp = gethostbyname2(source, AF_INET); if (!hp) errx(EX_NOHOST, "cannot resolve %s: %s", @@ -606,11 +596,9 @@ main(int argc, char *const *argv) if (inet_aton(target, &to->sin_addr) != 0) { hostname = target; } else { -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyname2(capdns, target, AF_INET); else -#endif hp = gethostbyname2(target, AF_INET); if (!hp) errx(EX_NOHOST, "cannot resolve %s: %s", @@ -624,7 +612,6 @@ main(int argc, char *const *argv) hostname = hnamebuf; } -#ifdef WITH_CASPER /* From now on we will use only reverse DNS lookups. */ if (capdns != NULL) { const char *types[1]; @@ -633,7 +620,6 @@ main(int argc, char *const *argv) if (cap_dns_type_limit(capdns, types, 1) < 0) err(1, "unable to limit access to system.dns service"); } -#endif if (connect(ssend, (struct sockaddr *)&whereto, sizeof(whereto)) != 0) err(1, "connect"); @@ -722,10 +708,8 @@ main(int argc, char *const *argv) if (options & F_NUMERIC) cansandbox = true; -#ifdef WITH_CASPER else if (capdns != NULL) cansandbox = true; -#endif else cansandbox = false; @@ -1707,11 +1691,9 @@ pr_addr(struct in_addr ina) if (options & F_NUMERIC) return inet_ntoa(ina); -#ifdef WITH_CASPER if (capdns != NULL) hp = cap_gethostbyaddr(capdns, (char *)&ina, 4, AF_INET); else -#endif hp = gethostbyaddr((char *)&ina, 4, AF_INET); if (hp == NULL) @@ -1791,7 +1773,6 @@ fill(char *bp, char *patp) } } -#ifdef WITH_CASPER static cap_channel_t * capdns_setup(void) { @@ -1817,7 +1798,6 @@ capdns_setup(void) return (capdnsloc); } -#endif /* WITH_CASPER */ #if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC) #define SECOPT " [-P policy]" From owner-svn-src-head@freebsd.org Sat Oct 28 20:03:30 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 52E84E4C543; Sat, 28 Oct 2017 20:03:30 +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 mx1.freebsd.org (Postfix) with ESMTPS id 2F2F77EF90; Sat, 28 Oct 2017 20:03:30 +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 v9SK3TGr038099; Sat, 28 Oct 2017 20:03:29 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SK3TNR038098; Sat, 28 Oct 2017 20:03:29 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201710282003.v9SK3TNR038098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 28 Oct 2017 20:03:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325065 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 325065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 20:03:30 -0000 Author: ian Date: Sat Oct 28 20:03:29 2017 New Revision: 325065 URL: https://svnweb.freebsd.org/changeset/base/325065 Log: Split the hardware type enum and the hw feature flags bits into separate fields in the softc; they're ORed together in the ofw_compat_data. I already caught myself doing 'sc->fectype == ' without masking out the feature bits in one place, and that's sure to happen again. Glomming them together is convenient for storing them in the ofw_compat_data array, but there's no reason to keep them together in the softc. Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Sat Oct 28 19:39:22 2017 (r325064) +++ head/sys/dev/ffec/if_ffec.c Sat Oct 28 20:03:29 2017 (r325065) @@ -103,12 +103,15 @@ enum { /* * Flags that describe general differences between the FEC hardware in various - * SoCs. These are ORed into the FECTYPE enum values. + * SoCs. These are ORed into the FECTYPE enum values in the ofw_compat_data, so + * the low 8 bits are reserved for the type enum. In the softc, the type and + * flags are put into separate members, so that you don't need to mask the flags + * out of the type to compare it. */ -#define FECTYPE_MASK 0x0000ffff -#define FECFLAG_GBE (1 << 16) -#define FECFLAG_AVB (1 << 17) -#define FECFLAG_RACC (1 << 18) +#define FECTYPE_MASK 0x000000ff +#define FECFLAG_GBE (1 << 8) +#define FECFLAG_AVB (1 << 9) +#define FECFLAG_RACC (1 << 10) /* * Table of supported FDT compat strings and their associated FECTYPE values. @@ -154,7 +157,8 @@ struct ffec_softc { void * intr_cookie[MAX_IRQ_COUNT]; struct callout ffec_callout; mii_contype_t phy_conn_type; - uintptr_t fectype; + uint32_t fecflags; + uint8_t fectype; boolean_t link_is_up; boolean_t is_attached; boolean_t is_detaching; @@ -261,7 +265,7 @@ ffec_miigasket_setup(struct ffec_softc *sc) * We only need the gasket for MII and RMII connections on certain SoCs. */ - switch (sc->fectype & FECTYPE_MASK) + switch (sc->fectype) { case FECTYPE_IMX53: break; @@ -762,7 +766,7 @@ ffec_setup_rxbuf(struct ffec_softc *sc, int idx, struc int error, nsegs; struct bus_dma_segment seg; - if ((sc->fectype & FECFLAG_RACC) == 0) { + if (!(sc->fecflags & FECFLAG_RACC)) { /* * The RACC[SHIFT16] feature is not available. So, we need to * leave at least ETHER_ALIGN bytes free at the beginning of the @@ -842,8 +846,7 @@ ffec_rxfinish_onebuf(struct ffec_softc *sc, int len) * to it? That way we'd only need to copy like 64 bytes or whatever the * biggest header is, instead of the whole 1530ish-byte frame. */ - - if (sc->fectype & FECFLAG_RACC) { + if (sc->fecflags & FECFLAG_RACC) { m->m_data = mtod(m, uint8_t *) + 2; } else { src = mtod(m, uint8_t*); @@ -1224,7 +1227,7 @@ ffec_init_locked(struct ffec_softc *sc) ffec_clear_stats(sc); WR4(sc, FEC_MIBC_REG, regval & ~FEC_MIBC_DIS); - if (sc->fectype & FECFLAG_RACC) { + if (sc->fecflags & FECFLAG_RACC) { /* * RACC - Receive Accelerator Function Configuration. */ @@ -1460,10 +1463,11 @@ ffec_attach(device_t dev) struct ifnet *ifp = NULL; struct mbuf *m; void *dummy; + uintptr_t typeflags; phandle_t ofw_node; + uint32_t idx, mscr; int error, phynum, rid, irq; uint8_t eaddr[ETHER_ADDR_LEN]; - uint32_t idx, mscr; sc = device_get_softc(dev); sc->dev = dev; @@ -1474,9 +1478,11 @@ ffec_attach(device_t dev) * There are differences in the implementation and features of the FEC * hardware on different SoCs, so figure out what type we are. */ - sc->fectype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + typeflags = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + sc->fectype = (uint8_t)(typeflags & FECTYPE_MASK); + sc->fecflags = (uint32_t)(typeflags & ~FECTYPE_MASK); - if (sc->fectype & FECFLAG_AVB) { + if (sc->fecflags & FECFLAG_AVB) { sc->rxbuf_align = 64; sc->txbuf_align = 1; } else { @@ -1670,7 +1676,7 @@ ffec_attach(device_t dev) * be done unconditionally for all hardware variants, but that hasn't * been tested. */ - if (sc->fectype & FECFLAG_AVB) + if (sc->fecflags & FECFLAG_AVB) WR4(sc, FEC_ECR_REG, 0); else WR4(sc, FEC_ECR_REG, FEC_ECR_RESET); @@ -1752,7 +1758,7 @@ ffec_attach(device_t dev) } error = mii_attach(dev, &sc->miibus, ifp, ffec_media_change, ffec_media_status, BMSR_DEFCAPMASK, phynum, MII_OFFSET_ANY, - (sc->fectype & FECTYPE_MVF) ? MIIF_FORCEANEG : 0); + (sc->fecflags & FECTYPE_MVF) ? MIIF_FORCEANEG : 0); if (error != 0) { device_printf(dev, "PHY attach failed\n"); goto out; From owner-svn-src-head@freebsd.org Sat Oct 28 20:09:36 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2577FE4C68B; Sat, 28 Oct 2017 20:09:36 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E72E37F219; Sat, 28 Oct 2017 20:09:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9SK9ZIQ038495; Sat, 28 Oct 2017 20:09:35 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SK9Zvx038494; Sat, 28 Oct 2017 20:09:35 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201710282009.v9SK9Zvx038494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 28 Oct 2017 20:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325066 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 325066 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 20:09:36 -0000 Author: pfg Date: Sat Oct 28 20:09:34 2017 New Revision: 325066 URL: https://svnweb.freebsd.org/changeset/base/325066 Log: Fix out-of-bounds read in libc/regex. The bug is an out-of-bounds read detected with address sanitizer that happens when 'sp' in p_b_coll_elems() includes NUL byte[s], e.g. if it's equal to "GS\x00". In that case len will be equal to 4, and the strncmp(cp->name, sp, len) call will succeed when cp->name is "GS" but the cp->name[len] == '\0' comparison will cause the read to go out-of-bounds. Checking the length using strlen() instead eliminates the issue. The bug was found in LLVM with oss-fuzz: https://reviews.llvm.org/D39380 MFC after: 1 week Obtained from: Vlad Tsyrklevich through posting on openbsd-tech Modified: head/lib/libc/regex/regcomp.c Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Sat Oct 28 20:03:29 2017 (r325065) +++ head/lib/libc/regex/regcomp.c Sat Oct 28 20:09:34 2017 (r325066) @@ -1059,7 +1059,7 @@ p_b_coll_elem(struct parse *p, } len = p->next - sp; for (cp = cnames; cp->name != NULL; cp++) - if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0') + if (strncmp(cp->name, sp, len) == 0 && strlen(cp->name) == len) return(cp->code); /* known name */ memset(&mbs, 0, sizeof(mbs)); if ((clen = mbrtowc(&wc, sp, len, &mbs)) == len) From owner-svn-src-head@freebsd.org Sat Oct 28 21:26:50 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE06AE4DC0A; Sat, 28 Oct 2017 21:26:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AB37C80D51; Sat, 28 Oct 2017 21:26:50 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9SLQnoW071929; Sat, 28 Oct 2017 21:26:49 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9SLQnuw071928; Sat, 28 Oct 2017 21:26:49 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201710282126.v9SLQnuw071928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 28 Oct 2017 21:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325067 - head/usr.sbin/bsnmpd/modules/snmp_hostres X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.sbin/bsnmpd/modules/snmp_hostres X-SVN-Commit-Revision: 325067 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 21:26:51 -0000 Author: pfg Date: Sat Oct 28 21:26:49 2017 New Revision: 325067 URL: https://svnweb.freebsd.org/changeset/base/325067 Log: bsnmpd: Only refresh devtree if devd event is a new or removed device. It makes sense to refresh the tree only when a device is inserted or removed, otherwise bsnmpd wastes lot of CPU. PR: 209368 MFC after: 1 week Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Sat Oct 28 20:09:34 2017 (r325066) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Sat Oct 28 21:26:49 2017 (r325067) @@ -479,7 +479,9 @@ again: } else { if (read_len == sizeof(buf)) goto again; - refresh_device_tbl(1); + /* Only refresh device table on a device add or remove event. */ + if (buf[0] == '+' || buf[0] == '-') + refresh_device_tbl(1); } } From owner-svn-src-head@freebsd.org Sat Oct 28 23:57:46 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3D3AE512C8; Sat, 28 Oct 2017 23:57:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) (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 C3309FAE; Sat, 28 Oct 2017 23:57:45 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f170.google.com with SMTP id 134so19901764ioo.0; Sat, 28 Oct 2017 16:57:45 -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=n15pe59ECFdvzPS6PwcuY0NV5Uda37QsEoswGSzuzuY=; b=puzCYIVtyL6D3T3HQQb+pa0xlaIpygNyTR86uo3oqJKGZ6Ucy3SOlCLJhEbOMCtYsL Vk0c6z0G77E8ctsPLZwYFGM/g8ADHS74KgmSUcAo1aJObASqZEl9TpsylZsnU4TAYFLC eLqHnxLwU5oC+Dfi4hSnbYaXsyVTznFnS50cgXzLn/hnko1uL46T68fC1t0bRY5+9hfu UociihDEq/wWsizIHE1FeXw76LEmmwSSmYkAqTQySFDZkpYTeOSEozqXKz5iDh6OJxMD PW94qv6fgJGYfp6NmCaGJmJX1sa/lyYfXAp1F+mb+IKy988F4qw/tbaTmNsF+8PBzNci nSYQ== X-Gm-Message-State: AMCzsaWYxSqd00EaCx07msD3n62+xTxjKy7nZ4RTP9x0kZ61unB4zhkA nXU59vJb0zSQ5Jq3jKrEj6LhNHxJ X-Google-Smtp-Source: ABhQp+SQt74KFykWs24+hdkkf93LYzyS6NZEGIcTiuZFtInYRXt6q0J3s13acQ9nrPskysopWNFDNA== X-Received: by 10.107.200.207 with SMTP id y198mr6015237iof.157.1509234567583; Sat, 28 Oct 2017 16:49:27 -0700 (PDT) Received: from mail-io0-f172.google.com (mail-io0-f172.google.com. [209.85.223.172]) by smtp.gmail.com with ESMTPSA id m39sm5289280ioo.44.2017.10.28.16.49.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Oct 2017 16:49:27 -0700 (PDT) Received: by mail-io0-f172.google.com with SMTP id 134so19885374ioo.0; Sat, 28 Oct 2017 16:49:27 -0700 (PDT) X-Received: by 10.107.16.13 with SMTP id y13mr5727086ioi.117.1509234567338; Sat, 28 Oct 2017 16:49:27 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.2.164.130 with HTTP; Sat, 28 Oct 2017 16:49:26 -0700 (PDT) In-Reply-To: <201710281923.v9SJNvE5021346@repo.freebsd.org> References: <201710281923.v9SJNvE5021346@repo.freebsd.org> From: Conrad Meyer Date: Sat, 28 Oct 2017 16:49:26 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r325062 - in head/lib: . libcasper libcasper/libcasper libcasper/services libcasper/services/cap_dns libcasper/services/cap_dns/tests libcasper/services/cap_grp libcasper/services/cap_g... To: Mariusz Zaborski 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Oct 2017 23:57:46 -0000 Hi, On Sat, Oct 28, 2017 at 12:23 PM, Mariusz Zaborski wr= ote: > Author: oshogbo > Date: Sat Oct 28 19:23:57 2017 > New Revision: 325062 > URL: https://svnweb.freebsd.org/changeset/base/325062 > > Log: > Introduce caspermocks. > > The idea behinds mocks is that we don't need to ifdef a lot of code in > tools itself but those defines are hidden in the casper library. > Right now the mocks are implemented as define/inlines functions. > There was a very long discussion how this should be implemented. > This approach has some advantages like we don't need to link to any add= itional > libraries. Unfortunately there are also some disadvantages for example = it is > easy to get library out of sync between two versions of functions or th= at we > need extra define to compile program with casper support. > This isn't an ideal solution but it's good enough for now and should si= mplify > capsicumizing programs. This also doesn't close us any other ways to do= those > mocks and this should evolve in time. > > Discussed with: pjd, emaste, ed, rwatson, bapt, cem, bdrewery > Differential Revision: https://reviews.freebsd.org/D8753 It's worth pointing out "discussed with" here very much does not mean "approved by" =E2=80=94 several of the people mentioned above raised concer= ns with this approach and only one person explicitly supported the change. Best, Conrad