From owner-svn-src-head@freebsd.org Sun Jun 7 00:07:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FCD0341ED9; Sun, 7 Jun 2020 00:07:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fcBz1L8lz4DMC; Sun, 7 Jun 2020 00:07:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28ED7A454; Sun, 7 Jun 2020 00:07:23 +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 05707N58096450; Sun, 7 Jun 2020 00:07:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05707Mfu096444; Sun, 7 Jun 2020 00:07:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202006070007.05707Mfu096444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 7 Jun 2020 00:07:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361880 - in head: . gnu/usr.bin gnu/usr.bin/binutils share/mk tools/build/mk tools/build/options X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: . gnu/usr.bin gnu/usr.bin/binutils share/mk tools/build/mk tools/build/options X-SVN-Commit-Revision: 361880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 00:07:23 -0000 Author: emaste Date: Sun Jun 7 00:07:21 2020 New Revision: 361880 URL: https://svnweb.freebsd.org/changeset/base/361880 Log: Retire BINUTILS and BINUTILS_BOOTSTRAP options As of r361857 all BINUTILS options are disabled by default - ports have been changed to depend on binutils if they require GNU as, and all base system assembly files have been switched to use Clang's integrated assembler. Relnotes: Yes Sponsored by: The FreeBSD Foundation Deleted: head/tools/build/options/WITHOUT_BINUTILS head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP head/tools/build/options/WITH_BINUTILS head/tools/build/options/WITH_BINUTILS_BOOTSTRAP Modified: head/Makefile.inc1 head/ObsoleteFiles.inc head/gnu/usr.bin/Makefile head/gnu/usr.bin/binutils/Makefile head/share/mk/src.opts.mk head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sat Jun 6 22:26:44 2020 (r361879) +++ head/Makefile.inc1 Sun Jun 7 00:07:21 2020 (r361880) @@ -300,7 +300,7 @@ TEST_SYSTEM_COMPILER_VARS= \ X_COMPILER_FREEBSD_VERSION TEST_SYSTEM_LINKER_VARS= \ USING_SYSTEM_LINKER MK_SYSTEM_LINKER \ - MK_LLD_BOOTSTRAP MK_BINUTILS_BOOTSTRAP \ + MK_LLD_BOOTSTRAP \ WANT_LINKER_TYPE WANT_LINKER_VERSION WANT_LINKER_VERSION_FILE \ WANT_LINKER_FREEBSD_VERSION WANT_LINKER_FREEBSD_VERSION_FILE \ LD LINKER_TYPE LINKER_FEATURES LINKER_VERSION \ @@ -2421,9 +2421,6 @@ _dtrace_tools= cddl/lib/libctf cddl/usr.bin/ctfconvert # If we're given an XAS, don't build binutils. .if ${XAS:M/*} == "" -.if ${MK_BINUTILS_BOOTSTRAP} != "no" -_binutils= gnu/usr.bin/binutils -.endif .if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no" _elftctools= lib/libelftc \ lib/libpe \ @@ -2467,7 +2464,6 @@ cross-tools: .MAKE .PHONY ${_clang_libs} \ ${_clang} \ ${_lld} \ - ${_binutils} \ ${_elftctools} \ ${_dtrace_tools} \ ${_btxld} \ @@ -2565,9 +2561,6 @@ SUBDIR_DEPEND_usr.bin/clang= lib/clang NXBDIRS+= lib/clang NXBDIRS+= usr.bin/clang .endif -.if ${MK_BINUTILS} != "no" -NXBDIRS+= gnu/usr.bin/binutils -.endif # XXX: native-xtools passes along ${NXBDIRS} in SUBDIR_OVERRIDE that needs # to be evaluated after NXBDIRS is set. .if make(install) && !empty(SUBDIR_OVERRIDE) @@ -3273,7 +3266,6 @@ _xb-build-tools: .PHONY XDEVDIRS= \ ${_clang_libs} \ ${_lld} \ - ${_binutils} \ ${_elftctools} \ usr.bin/ar \ ${_clang} Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Jun 6 22:26:44 2020 (r361879) +++ head/ObsoleteFiles.inc Sun Jun 7 00:07:21 2020 (r361880) @@ -36,6 +36,212 @@ # xargs -n1 | sort | uniq -d; # done +# 20200606: retire binutils build infrastructure +.if !defined(WITH_PORT_BASE_BINUTILS) +OLD_FILES+=usr/bin/as +OLD_FILES+=usr/bin/ld.bfd +OLD_FILES+=usr/share/man/man1/as.1.gz +OLD_FILES+=usr/share/man/man7/as.7.gz +OLD_FILES+=usr/share/man/man7/ld.7.gz +OLD_FILES+=usr/share/man/man7/ldint.7.gz +OLD_FILES+=usr/share/man/man7/binutils.7.gz +.endif +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.x +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xbn +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xc +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xd +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xdc +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xdw +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xn +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xr +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xs +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xsc +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xsw +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xu +OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xw +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.x +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xbn +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xc +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xd +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xdc +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xdw +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xn +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xr +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xs +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xsc +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xsw +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xu +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xw +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xw +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xc +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xd +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xdc +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xdw +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xn +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xr +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xs +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xsc +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xsw +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xu +OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xw + # 20200601: OpenSSL 32-bit compat engines moved to /usr/lib32/engines OLD_LIBS+=usr/lib32/capi.so OLD_LIBS+=usr/lib32/padlock.so Modified: head/gnu/usr.bin/Makefile ============================================================================== --- head/gnu/usr.bin/Makefile Sat Jun 6 22:26:44 2020 (r361879) +++ head/gnu/usr.bin/Makefile Sun Jun 7 00:07:21 2020 (r361880) @@ -2,15 +2,10 @@ .include - -.if ${MK_GDB} != "no" || ${MK_BINUTILS} != "no" -SUBDIR+= binutils -.endif - SUBDIR.${MK_DIALOG}+= dialog SUBDIR.${MK_GNU_DIFF}+= diff3 SUBDIR.${MK_GNU_GREP}+= grep -SUBDIR.${MK_GDB}+= gdb +SUBDIR.${MK_GDB}+= binutils gdb SUBDIR_DEPEND_gdb= binutils SUBDIR.${MK_TESTS}+= tests Modified: head/gnu/usr.bin/binutils/Makefile ============================================================================== --- head/gnu/usr.bin/binutils/Makefile Sat Jun 6 22:26:44 2020 (r361879) +++ head/gnu/usr.bin/binutils/Makefile Sun Jun 7 00:07:21 2020 (r361880) @@ -6,18 +6,6 @@ SUBDIR= libiberty \ libbfd \ libopcodes -SUBDIR.${MK_BINUTILS}+= doc - -# GNU as is used on x86 only, for a few files that cannot be assembled by -# Clang IAS. Other archs either use Clang IAS for every assembly file, or -# use external toolchain. -.if (${TARGET} == "amd64" || ${TARGET} == "i386") && \ - (${MK_BINUTILS} != "no" || ${MK_BINUTILS_BOOTSTRAP} != "no") -SUBDIR+= as -.endif - -SUBDIR_DEPEND_as=libbfd libiberty libopcodes - .if !make(install) SUBDIR_PARALLEL= .endif Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Sat Jun 6 22:26:44 2020 (r361879) +++ head/share/mk/src.opts.mk Sun Jun 7 00:07:21 2020 (r361880) @@ -200,8 +200,6 @@ __DEFAULT_YES_OPTIONS = \ __DEFAULT_NO_OPTIONS = \ BEARSSL \ BHYVE_SNAPSHOT \ - BINUTILS \ - BINUTILS_BOOTSTRAP \ BSD_GREP \ CLANG_EXTRAS \ DTRACE_TESTS \ @@ -288,9 +286,9 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF .include -# In-tree binutils/gcc are older versions without modern architecture support. +# In-tree gdb is an older versions without modern architecture support. .if ${__T} == "aarch64" || ${__T:Mriscv*} != "" -BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB +BROKEN_OPTIONS+=GDB .endif .if ${__T:Mriscv*} != "" BROKEN_OPTIONS+=OFED @@ -469,14 +467,12 @@ MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no .endif .if ${MK_CROSS_COMPILER} == "no" -MK_BINUTILS_BOOTSTRAP:= no MK_CLANG_BOOTSTRAP:= no MK_ELFTOOLCHAIN_BOOTSTRAP:= no MK_LLD_BOOTSTRAP:= no .endif .if ${MK_TOOLCHAIN} == "no" -MK_BINUTILS:= no MK_CLANG:= no MK_GDB:= no MK_INCLUDES:= no Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sat Jun 6 22:26:44 2020 (r361879) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sun Jun 7 00:07:21 2020 (r361880) @@ -200,219 +200,11 @@ OLD_FILES+=usr/share/man/man8/bhyveload.8.gz OLD_DIRS+=usr/share/examples/bhyve .endif -.if ${MK_BINUTILS} == no .if !defined(WITH_PORT_BASE_BINUTILS) -OLD_FILES+=usr/bin/as .if ${MK_LLD_IS_LD} == no OLD_FILES+=usr/bin/ld OLD_FILES+=usr/share/man/man1/ld.1.gz .endif -.endif -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/armelf_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/armelfb_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.x -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xbn -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xc -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xd -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xdc -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xdw -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xn -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xr -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xs -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xsc -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xsw -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xu -OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xw -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf32btsmip_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf32btsmipn32_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmip_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf32ltsmipn32_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf32ppc_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.x -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xbn -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xc -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xd -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xdc -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xdw -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xn -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xr -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xs -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xsc -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xsw -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xu -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xw -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf64_sparc_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf64btsmip_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf64ltsmip_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf64ppc_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf_i386_fbsd.xw -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xc -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xd -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xdc -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xdw -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xn -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xr -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xs -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xsc -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xsw -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xu -OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xw -.if !defined(WITH_PORT_BASE_BINUTILS) -OLD_FILES+=usr/share/man/man1/as.1.gz -OLD_FILES+=usr/share/man/man7/as.7.gz -OLD_FILES+=usr/share/man/man7/ld.7.gz -OLD_FILES+=usr/share/man/man7/ldint.7.gz -OLD_FILES+=usr/share/man/man7/binutils.7.gz -.endif -.endif -.if !defined(WITH_PORT_BASE_BINUTILS) -OLD_FILES+=usr/bin/ld.bfd .endif .if ${MK_BLACKLIST} == no From owner-svn-src-head@freebsd.org Sun Jun 7 02:40:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 776FD346DA2; Sun, 7 Jun 2020 02:40:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fgbV2WCHz4XfC; Sun, 7 Jun 2020 02:40:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 518ABC2B4; Sun, 7 Jun 2020 02:40:22 +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 0572eMdl089656; Sun, 7 Jun 2020 02:40:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0572eMPG089655; Sun, 7 Jun 2020 02:40:22 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202006070240.0572eMPG089655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sun, 7 Jun 2020 02:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361882 - 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: 361882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 02:40:22 -0000 Author: imp Date: Sun Jun 7 02:40:21 2020 New Revision: 361882 URL: https://svnweb.freebsd.org/changeset/base/361882 Log: Mention nda where we mention nvd. Modified: head/share/man/man4/nvme.4 Modified: head/share/man/man4/nvme.4 ============================================================================== --- head/share/man/man4/nvme.4 Sun Jun 7 00:41:43 2020 (r361881) +++ head/share/man/man4/nvme.4 Sun Jun 7 02:40:21 2020 (r361882) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 6, 2020 +.Dd June 6, 2020 .Dt NVME 4 .Os .Sh NAME @@ -54,6 +54,8 @@ nvme_load="YES" .Pp Most users will also want to enable .Xr nvd 4 +or +.Xr nda 4 to expose NVM Express namespaces as disk devices which can be partitioned. Note that in NVM Express terms, a namespace is roughly equivalent to a From owner-svn-src-head@freebsd.org Sun Jun 7 04:32:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49CB9348BD2; Sun, 7 Jun 2020 04:32:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fk531DNxz3W6r; Sun, 7 Jun 2020 04:32:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 256A6D8CD; Sun, 7 Jun 2020 04:32:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0574WdKx063321; Sun, 7 Jun 2020 04:32:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0574Wc1L063319; Sun, 7 Jun 2020 04:32:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006070432.0574Wc1L063319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 7 Jun 2020 04:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361884 - in head/usr.bin/sed: . tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/usr.bin/sed: . tests X-SVN-Commit-Revision: 361884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 04:32:39 -0000 Author: kevans Date: Sun Jun 7 04:32:38 2020 New Revision: 361884 URL: https://svnweb.freebsd.org/changeset/base/361884 Log: sed: attempt to learn about hex escapes (e.g. \x27) Somewhat predictably, software often wants to use \x27/\x24 among others so that they can decline worrying about ugly escaping, if said escaping is even possible. Right now, this software is using these and getting the wrong results, as we'll interpret those as x27 and x24 respectively. Some examples of this, when an exp-run was ran, were science/octopus and misc/vifm. Go ahead and process these at all times. We allow either one or two digits, and the tests account for both. If extra digits are specified, e.g. \x2727, then the third and fourth digits are interpreted literally as one might expect. PR: 229925 MFC after: 2 weeks Modified: head/usr.bin/sed/compile.c head/usr.bin/sed/tests/sed2_test.sh Modified: head/usr.bin/sed/compile.c ============================================================================== --- head/usr.bin/sed/compile.c Sun Jun 7 03:11:34 2020 (r361883) +++ head/usr.bin/sed/compile.c Sun Jun 7 04:32:38 2020 (r361884) @@ -49,6 +49,7 @@ static const char sccsid[] = "@(#)compile.c 8.1 (Berke #include #include #include +#include #include #include #include @@ -365,6 +366,51 @@ nonsel: /* Now parse the command */ } } +static int +hex2char(const char *in, char *out, int len) +{ + long ord; + char *endptr, hexbuf[3]; + + hexbuf[0] = in[0]; + hexbuf[1] = len > 1 ? in[1] : '\0'; + hexbuf[2] = '\0'; + + errno = 0; + ord = strtol(hexbuf, &endptr, 16); + if (*endptr != '\0' || errno != 0) + return (ERANGE); + *out = (char)ord; + return (0); +} + +static bool +hexdigit(char c) +{ + int lc; + + lc = tolower(c); + return isdigit(lc) || (lc >= 'a' && lc <= 'f'); +} + +static bool +dohex(const char *in, char *out, int *len) +{ + int tmplen; + + if (!hexdigit(in[0])) + return (false); + tmplen = 1; + if (hexdigit(in[1])) + ++tmplen; + if (hex2char(in, out, tmplen) == 0) { + *len = tmplen; + return (true); + } + + return (false); +} + /* * Get a delimited string. P points to the delimiter of the string; d points * to a buffer area. Newline and delimiter escapes are processed; other @@ -377,6 +423,7 @@ nonsel: /* Now parse the command */ static char * compile_delimited(char *p, char *d, int is_tr) { + int hexlen; char c; c = *p++; @@ -412,6 +459,12 @@ compile_delimited(char *p, char *d, int is_tr) } p += 2; continue; + } else if (*p == '\\' && p[1] == 'x') { + if (dohex(&p[2], d, &hexlen)) { + ++d; + p += hexlen + 2; + continue; + } } else if (*p == '\\' && p[1] == '\\') { if (is_tr) p++; @@ -431,7 +484,7 @@ compile_delimited(char *p, char *d, int is_tr) static char * compile_ccl(char **sp, char *t) { - int c, d; + int c, d, hexlen; char *s = *sp; *t++ = *s++; @@ -459,6 +512,10 @@ compile_ccl(char **sp, char *t) *t = '\t'; s++; break; + case 'x': + if (dohex(&s[2], t, &hexlen)) + s += hexlen + 1; + break; } } } @@ -499,7 +556,7 @@ static char * compile_subst(char *p, struct s_subst *s) { static char lbuf[_POSIX2_LINE_MAX + 1]; - int asize, size; + int asize, hexlen, size; u_char ref; char c, *text, *op, *sp; int more = 1, sawesc = 0; @@ -562,6 +619,21 @@ compile_subst(char *p, struct s_subst *s) break; case 't': *p = '\t'; + break; + case 'x': +#define ADVANCE_N(s, n) \ + do { \ + char *adv = (s); \ + while (*(adv + (n) - 1) != '\0') { \ + *adv = *(adv + (n)); \ + ++adv; \ + } \ + *adv = '\0'; \ + } while (0); + if (dohex(&p[1], p, &hexlen)) { + ADVANCE_N(p + 1, + hexlen); + } break; } } Modified: head/usr.bin/sed/tests/sed2_test.sh ============================================================================== --- head/usr.bin/sed/tests/sed2_test.sh Sun Jun 7 03:11:34 2020 (r361883) +++ head/usr.bin/sed/tests/sed2_test.sh Sun Jun 7 04:32:38 2020 (r361884) @@ -88,10 +88,39 @@ escape_subst_body() atf_check -o 'inline:abcx\n' sed 's/[ \r\t]//g' c } +atf_test_case hex_subst +hex_subst_head() +{ + atf_set "descr" "Verify proper conversion of hex escapes" +} +hex_subst_body() +{ + printf "test='foo'" > a + printf "test='27foo'" > b + printf "\rn" > c + printf "xx" > d + + atf_check -o 'inline:test="foo"' sed 's/\x27/"/g' a + atf_check -o "inline:'test'='foo'" sed 's/test/\x27test\x27/g' a + + # Make sure we take trailing digits literally. + atf_check -o "inline:test=\"foo'" sed 's/\x2727/"/g' b + + # Single digit \x should work as well. + atf_check -o "inline:xn" sed 's/\xd/x/' c + + # Invalid digit should cause us to ignore the sequence. This test + # invokes UB, escapes of an ordinary character. A future change will + # make regex(3) on longer tolerate this and we'll need to adjust what + # we're doing, but for now this will suffice. + atf_check -o "inline:" sed 's/\xx//' d +} + atf_init_test_cases() { atf_add_test_case inplace_command_q atf_add_test_case inplace_hardlink_src atf_add_test_case inplace_symlink_src atf_add_test_case escape_subst + atf_add_test_case hex_subst } From owner-svn-src-head@freebsd.org Sun Jun 7 04:57:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D5C834923F; Sun, 7 Jun 2020 04:57:49 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fkf46YsHz3YCQ; Sun, 7 Jun 2020 04:57:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC755DE33; Sun, 7 Jun 2020 04:57:48 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0574vmsv075948; Sun, 7 Jun 2020 04:57:48 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0574vm7f075947; Sun, 7 Jun 2020 04:57:48 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006070457.0574vm7f075947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 7 Jun 2020 04:57:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361885 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 361885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 04:57:49 -0000 Author: adrian Date: Sun Jun 7 04:57:48 2020 New Revision: 361885 URL: https://svnweb.freebsd.org/changeset/base/361885 Log: [net80211] Add a method to return the vap's ifname. This removes the requirement to know what's in the ifp. (If someone wants a quick clean-up task, it'd be nice to convert instances of ifp dereferencing for if_xname over to this method.) Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Sun Jun 7 04:32:38 2020 (r361884) +++ head/sys/net80211/ieee80211_freebsd.c Sun Jun 7 04:57:48 2020 (r361885) @@ -1034,6 +1034,20 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp) } /* + * Fetch the VAP name. + * + * This returns a const char pointer suitable for debugging, + * but don't expect it to stick around for much longer. + */ +const char * +ieee80211_get_vap_ifname(struct ieee80211vap *vap) +{ + if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL)) + return "(none)"; + return vap->iv_ifp->if_xname; +} + +/* * Module glue. * * NB: the module name is "wlan" for compatibility with NetBSD. Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Sun Jun 7 04:32:38 2020 (r361884) +++ head/sys/net80211/ieee80211_freebsd.h Sun Jun 7 04:57:48 2020 (r361885) @@ -245,6 +245,7 @@ void ieee80211_drain_ifq(struct ifqueue *); void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *); void ieee80211_vap_destroy(struct ieee80211vap *); +const char * ieee80211_get_vap_ifname(struct ieee80211vap *); #define IFNET_IS_UP_RUNNING(_ifp) \ (((_ifp)->if_flags & IFF_UP) && \ From owner-svn-src-head@freebsd.org Sun Jun 7 05:08:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56C60349882; Sun, 7 Jun 2020 05:08:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fktj1gQgz3ZHC; Sun, 7 Jun 2020 05:08:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E3FED87C; Sun, 7 Jun 2020 05:08:45 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05758jlO082066; Sun, 7 Jun 2020 05:08:45 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05758jlJ082065; Sun, 7 Jun 2020 05:08:45 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006070508.05758jlJ082065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 7 Jun 2020 05:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361886 - head/sys/dev/ath X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/ath X-SVN-Commit-Revision: 361886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 05:08:45 -0000 Author: adrian Date: Sun Jun 7 05:08:44 2020 New Revision: 361886 URL: https://svnweb.freebsd.org/changeset/base/361886 Log: [if_ath] Don't update the beacon bits from beacon frames in hostapd mode. This logic is running the beacon receive bits in STA+AP mode on both the STA and AP side. The STA side sees its beacons from the BSS fine; the AP side is seeing other beacons on the same channel but with the BSS node for some odd reason. (I think it's a valid reason, but I currently forget what that valid reason is.) So, just to be cleaner about things, don't run the nexttbtt/etc bits at all if we're in hostap mode. If I ever get mesh working then maybe I'll make sure it works right on mesh+ap and mesh+sta modes. Whilst here, log the VAP i'm being called on to make it clearer what is going on. I may end up adding a VAP dprintf version of this at some point. Tested: * AR9380, STA (DWDS client) + hostap on the same NIC Modified: head/sys/dev/ath/if_ath_rx.c Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Sun Jun 7 04:57:48 2020 (r361885) +++ head/sys/dev/ath/if_ath_rx.c Sun Jun 7 05:08:44 2020 (r361886) @@ -379,12 +379,12 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf * * trying to sync / merge to BSSes that aren't * actually us. */ - if (IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { + if ((vap->iv_opmode != IEEE80211_M_HOSTAP) && + IEEE80211_ADDR_EQ(ni->ni_bssid, vap->iv_bss->ni_bssid)) { /* update rssi statistics for use by the hal */ /* XXX unlocked check against vap->iv_bss? */ ATH_RSSI_LPF(sc->sc_halstats.ns_avgbrssi, rssi); - tsf_beacon = ((uint64_t) le32dec(ni->ni_tstamp.data + 4)) << 32; tsf_beacon |= le32dec(ni->ni_tstamp.data); @@ -427,8 +427,9 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf * tsf_remainder = (tsf_beacon - tsf_beacon_old) % tsf_intval; } - DPRINTF(sc, ATH_DEBUG_BEACON, "%s: old_tsf=%llu (%u), new_tsf=%llu (%u), target_tsf=%llu (%u), delta=%lld, bmiss=%d, remainder=%d\n", + DPRINTF(sc, ATH_DEBUG_BEACON, "%s: %s: old_tsf=%llu (%u), new_tsf=%llu (%u), target_tsf=%llu (%u), delta=%lld, bmiss=%d, remainder=%d\n", __func__, + ieee80211_get_vap_ifname(vap), (unsigned long long) tsf_beacon_old, (unsigned int) (tsf_beacon_old >> 10), (unsigned long long) tsf_beacon, @@ -439,8 +440,11 @@ ath_recv_mgmt(struct ieee80211_node *ni, struct mbuf * tsf_delta_bmiss, tsf_remainder); - DPRINTF(sc, ATH_DEBUG_BEACON, "%s: tsf=%llu (%u), nexttbtt=%llu (%u), delta=%d\n", + DPRINTF(sc, ATH_DEBUG_BEACON, "%s: %s: ni=%6D bssid=%6D tsf=%llu (%u), nexttbtt=%llu (%u), delta=%d\n", __func__, + ieee80211_get_vap_ifname(vap), + ni->ni_bssid, ":", + vap->iv_bss->ni_bssid, ":", (unsigned long long) tsf_beacon, (unsigned int) (tsf_beacon >> 10), (unsigned long long) nexttbtt, From owner-svn-src-head@freebsd.org Sun Jun 7 08:21:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B37A434C6D9; Sun, 7 Jun 2020 08:21:20 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fq8w4Lx5z49t3; Sun, 7 Jun 2020 08:21:20 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 766CAFEE7; Sun, 7 Jun 2020 08:21:20 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0578LKiu098670; Sun, 7 Jun 2020 08:21:20 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0578LJlv098668; Sun, 7 Jun 2020 08:21:19 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202006070821.0578LJlv098668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sun, 7 Jun 2020 08:21:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361887 - head/bin/ps X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/bin/ps X-SVN-Commit-Revision: 361887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 08:21:20 -0000 Author: yuripv Date: Sun Jun 7 08:21:19 2020 New Revision: 361887 URL: https://svnweb.freebsd.org/changeset/base/361887 Log: ps: use %hs instead of %s format specifiers Use %hs (locale-based encoding) instead of %s (UTF-8) format for strings that are expected to be in current locale encoding (date/time, process names/argument list). PR: 241491 Reviewed by: phil Differential Revision: https://reviews.freebsd.org/D22160 Modified: head/bin/ps/keyword.c head/bin/ps/print.c head/bin/ps/ps.c Modified: head/bin/ps/keyword.c ============================================================================== --- head/bin/ps/keyword.c Sun Jun 7 05:08:44 2020 (r361886) +++ head/bin/ps/keyword.c Sun Jun 7 08:21:19 2020 (r361887) @@ -254,7 +254,7 @@ showkey(void) i = len; sep = "\n"; } - xo_emit("{P:/%s}{l:key/%s}", sep, p); + xo_emit("{P:/%hs}{l:key/%hs}", sep, p); sep = " "; } xo_emit("\n"); Modified: head/bin/ps/print.c ============================================================================== --- head/bin/ps/print.c Sun Jun 7 05:08:44 2020 (r361886) +++ head/bin/ps/print.c Sun Jun 7 08:21:19 2020 (r361887) @@ -89,11 +89,11 @@ printheader(void) v = vent->var; if (v->flag & LJUST) { if (STAILQ_NEXT(vent, next_ve) == NULL) /* last one */ - xo_emit("{T:/%s}", vent->header); + xo_emit("{T:/%hs}", vent->header); else - xo_emit("{T:/%-*s}", v->width, vent->header); + xo_emit("{T:/%-*hs}", v->width, vent->header); } else - xo_emit("{T:/%*s}", v->width, vent->header); + xo_emit("{T:/%*hs}", v->width, vent->header); if (STAILQ_NEXT(vent, next_ve) != NULL) xo_emit("{P: }"); } Modified: head/bin/ps/ps.c ============================================================================== --- head/bin/ps/ps.c Sun Jun 7 05:08:44 2020 (r361886) +++ head/bin/ps/ps.c Sun Jun 7 08:21:19 2020 (r361887) @@ -192,6 +192,7 @@ main(int argc, char *argv[]) char fmtbuf[_POSIX2_LINE_MAX]; (void) setlocale(LC_ALL, ""); + xo_no_setlocale(); time(&now); /* Used by routines in print.c. */ /* @@ -696,7 +697,7 @@ main(int argc, char *argv[]) fwidthmin = (xo_get_style(NULL) != XO_STYLE_TEXT || (STAILQ_NEXT(vent, next_ve) == NULL && (vent->var->flag & LJUST))) ? 0 : vent->var->width; - snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%ds}", + snprintf(fmtbuf, sizeof(fmtbuf), "{:%s/%%%s%d..%dhs}", vent->var->field ? vent->var->field : vent->var->name, (vent->var->flag & LJUST) ? "-" : "", fwidthmin, fwidthmax); From owner-svn-src-head@freebsd.org Sun Jun 7 09:17:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65BFC34DC84; Sun, 7 Jun 2020 09:17:58 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49frQG281Mz4HFV; Sun, 7 Jun 2020 09:17:58 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44E4B10F90; Sun, 7 Jun 2020 09:17:58 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0579HwWj035155; Sun, 7 Jun 2020 09:17:58 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0579Hwdd035154; Sun, 7 Jun 2020 09:17:58 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202006070917.0579Hwdd035154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sun, 7 Jun 2020 09:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361888 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 361888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 09:17:58 -0000 Author: yuripv Date: Sun Jun 7 09:17:57 2020 New Revision: 361888 URL: https://svnweb.freebsd.org/changeset/base/361888 Log: taskqueue(9): reference callout(9) instead of timeout(9) As timeout(9) was removed and all consumers were converted to callout(9), reference it instead for the description of sbt, pr, and flags arguments. Reviewed by: trasz Differential Revision: https://reviews.freebsd.org/D25165 Modified: head/share/man/man9/taskqueue.9 Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Sun Jun 7 08:21:19 2020 (r361887) +++ head/share/man/man9/taskqueue.9 Sun Jun 7 09:17:57 2020 (r361888) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 17, 2019 +.Dd June 6, 2020 .Dt TASKQUEUE 9 .Os .Sh NAME @@ -236,7 +236,7 @@ function provides finer control over the scheduling ba and .Va flags , as detailed in -.Xr timeout 9 . +.Xr callout 9 . Only non-fast task queues can be used for .Va timeout_task scheduling. @@ -510,10 +510,10 @@ may be delayed an indeterminate amount of time before If queueing delays cannot be tolerated then a private taskqueue should be created with a dedicated processing thread. .Sh SEE ALSO +.Xr callout 9 , .Xr ithread 9 , .Xr kthread 9 , .Xr swi 9 -.Xr timeout 9 .Sh HISTORY This interface first appeared in .Fx 5.0 . From owner-svn-src-head@freebsd.org Sun Jun 7 13:21:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FE7E32B72B; Sun, 7 Jun 2020 13:21:48 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fxqc2K4jz3TTl; Sun, 7 Jun 2020 13:21:48 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AE2013EC8; Sun, 7 Jun 2020 13:21:48 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 057DLm4h088408; Sun, 7 Jun 2020 13:21:48 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 057DLmuq088407; Sun, 7 Jun 2020 13:21:48 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <202006071321.057DLmuq088407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sun, 7 Jun 2020 13:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361891 - head/usr.bin/uniq X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/usr.bin/uniq X-SVN-Commit-Revision: 361891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 13:21:48 -0000 Author: bcr (doc committer) Date: Sun Jun 7 13:21:47 2020 New Revision: 361891 URL: https://svnweb.freebsd.org/changeset/base/361891 Log: Add EXAMPLES to cover all flags except -f since it is analogous to -s. An EXAMPLE section was adding with some basic examples that show the use of uniq(1) with various flags. Submitted by: fernape@ Approved by: bcr@ MFC after: 4 days Relnotes: yes (EXAMPLE section for uniq(1)) Differential Revision: https://reviews.freebsd.org/D25149 Modified: head/usr.bin/uniq/uniq.1 Modified: head/usr.bin/uniq/uniq.1 ============================================================================== --- head/usr.bin/uniq/uniq.1 Sun Jun 7 12:15:41 2020 (r361890) +++ head/usr.bin/uniq/uniq.1 Sun Jun 7 13:21:47 2020 (r361891) @@ -31,7 +31,7 @@ .\" From: @(#)uniq.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 15, 2019 +.Dd June 7, 2020 .Dt UNIQ 1 .Os .Sh NAME @@ -147,6 +147,56 @@ as described in .Xr environ 7 . .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Assuming a file named cities.txt with the following content: +.Bd -literal -offset indent +Madrid +Lisbon +Madrid +.Ed +.Pp +The following command reports three different lines since identical elements +are not adjacent: +.Bd -literal -offset indent +$ uniq -u cities.txt +Madrid +Lisbon +Madrid +.Ed +.Pp +Sort the file and count the number of identical lines: +.Bd -literal -offset indent +$ sort cities.txt | uniq -c + 1 Lisbon + 2 Madrid +.Ed +.Pp +Assuming the following content for the file cities.txt: +.Bd -literal -offset indent +madrid +Madrid +Lisbon +.Ed +.Pp +Show repeated lines ignoring case sensitiveness: +.Bd -literal -offset indent +$ uniq -d -i cities.txt +madrid +.Ed +.Pp +Same as above but showing the whole group of repeated lines: +.Bd -literal -offset indent +$ uniq -D -i cities.txt +madrid +Madrid +.Ed +.Pp +Report the number of identical lines ignoring the first character of every line: +.Bd -literal -offset indent +$ uniq -s 1 -c cities.txt + 2 madrid + 1 Lisbon +.Ed .Sh COMPATIBILITY The historic .Cm \&\(pl Ns Ar number From owner-svn-src-head@freebsd.org Sun Jun 7 13:31:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44A5232BA68; Sun, 7 Jun 2020 13:31:15 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49fy2V0ZFKz3VJR; Sun, 7 Jun 2020 13:31:13 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 057DV56H040384; Sun, 7 Jun 2020 06:31:05 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 057DV4Vo040383; Sun, 7 Jun 2020 06:31:04 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202006071331.057DV4Vo040383@gndrsh.dnsmgr.net> Subject: Re: svn commit: r361884 - in head/usr.bin/sed: . tests In-Reply-To: <202006070432.0574Wc1L063319@repo.freebsd.org> To: Kyle Evans Date: Sun, 7 Jun 2020 06:31:04 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49fy2V0ZFKz3VJR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 13:31:15 -0000 > Author: kevans > Date: Sun Jun 7 04:32:38 2020 > New Revision: 361884 > URL: https://svnweb.freebsd.org/changeset/base/361884 > > Log: > sed: attempt to learn about hex escapes (e.g. \x27) > > Somewhat predictably, software often wants to use \x27/\x24 among others so > that they can decline worrying about ugly escaping, if said escaping is even > possible. Right now, this software is using these and getting the wrong > results, as we'll interpret those as x27 and x24 respectively. Some examples > of this, when an exp-run was ran, were science/octopus and misc/vifm. > > Go ahead and process these at all times. We allow either one or two digits, > and the tests account for both. If extra digits are specified, e.g. \x2727, > then the third and fourth digits are interpreted literally as one might > expect. Does it work to do \\x27, ie I want it to NOT do \x27 so I can sed on files that contain sequences of escapes. > > PR: 229925 > MFC after: 2 weeks > > Modified: > head/usr.bin/sed/compile.c > head/usr.bin/sed/tests/sed2_test.sh > > Modified: head/usr.bin/sed/compile.c > ============================================================================== > --- head/usr.bin/sed/compile.c Sun Jun 7 03:11:34 2020 (r361883) > +++ head/usr.bin/sed/compile.c Sun Jun 7 04:32:38 2020 (r361884) > @@ -49,6 +49,7 @@ static const char sccsid[] = "@(#)compile.c 8.1 (Berke > #include > #include > #include > +#include > #include > #include > #include > @@ -365,6 +366,51 @@ nonsel: /* Now parse the command */ > } > } > > +static int > +hex2char(const char *in, char *out, int len) > +{ > + long ord; > + char *endptr, hexbuf[3]; > + > + hexbuf[0] = in[0]; > + hexbuf[1] = len > 1 ? in[1] : '\0'; > + hexbuf[2] = '\0'; > + > + errno = 0; > + ord = strtol(hexbuf, &endptr, 16); > + if (*endptr != '\0' || errno != 0) > + return (ERANGE); > + *out = (char)ord; > + return (0); > +} > + > +static bool > +hexdigit(char c) > +{ > + int lc; > + > + lc = tolower(c); > + return isdigit(lc) || (lc >= 'a' && lc <= 'f'); > +} > + > +static bool > +dohex(const char *in, char *out, int *len) > +{ > + int tmplen; > + > + if (!hexdigit(in[0])) > + return (false); > + tmplen = 1; > + if (hexdigit(in[1])) > + ++tmplen; > + if (hex2char(in, out, tmplen) == 0) { > + *len = tmplen; > + return (true); > + } > + > + return (false); > +} > + > /* > * Get a delimited string. P points to the delimiter of the string; d points > * to a buffer area. Newline and delimiter escapes are processed; other > @@ -377,6 +423,7 @@ nonsel: /* Now parse the command */ > static char * > compile_delimited(char *p, char *d, int is_tr) > { > + int hexlen; > char c; > > c = *p++; > @@ -412,6 +459,12 @@ compile_delimited(char *p, char *d, int is_tr) > } > p += 2; > continue; > + } else if (*p == '\\' && p[1] == 'x') { > + if (dohex(&p[2], d, &hexlen)) { > + ++d; > + p += hexlen + 2; > + continue; > + } > } else if (*p == '\\' && p[1] == '\\') { > if (is_tr) > p++; > @@ -431,7 +484,7 @@ compile_delimited(char *p, char *d, int is_tr) > static char * > compile_ccl(char **sp, char *t) > { > - int c, d; > + int c, d, hexlen; > char *s = *sp; > > *t++ = *s++; > @@ -459,6 +512,10 @@ compile_ccl(char **sp, char *t) > *t = '\t'; > s++; > break; > + case 'x': > + if (dohex(&s[2], t, &hexlen)) > + s += hexlen + 1; > + break; > } > } > } > @@ -499,7 +556,7 @@ static char * > compile_subst(char *p, struct s_subst *s) > { > static char lbuf[_POSIX2_LINE_MAX + 1]; > - int asize, size; > + int asize, hexlen, size; > u_char ref; > char c, *text, *op, *sp; > int more = 1, sawesc = 0; > @@ -562,6 +619,21 @@ compile_subst(char *p, struct s_subst *s) > break; > case 't': > *p = '\t'; > + break; > + case 'x': > +#define ADVANCE_N(s, n) \ > + do { \ > + char *adv = (s); \ > + while (*(adv + (n) - 1) != '\0') { \ > + *adv = *(adv + (n)); \ > + ++adv; \ > + } \ > + *adv = '\0'; \ > + } while (0); > + if (dohex(&p[1], p, &hexlen)) { > + ADVANCE_N(p + 1, > + hexlen); > + } > break; > } > } > > Modified: head/usr.bin/sed/tests/sed2_test.sh > ============================================================================== > --- head/usr.bin/sed/tests/sed2_test.sh Sun Jun 7 03:11:34 2020 (r361883) > +++ head/usr.bin/sed/tests/sed2_test.sh Sun Jun 7 04:32:38 2020 (r361884) > @@ -88,10 +88,39 @@ escape_subst_body() > atf_check -o 'inline:abcx\n' sed 's/[ \r\t]//g' c > } > > +atf_test_case hex_subst > +hex_subst_head() > +{ > + atf_set "descr" "Verify proper conversion of hex escapes" > +} > +hex_subst_body() > +{ > + printf "test='foo'" > a > + printf "test='27foo'" > b > + printf "\rn" > c > + printf "xx" > d > + > + atf_check -o 'inline:test="foo"' sed 's/\x27/"/g' a > + atf_check -o "inline:'test'='foo'" sed 's/test/\x27test\x27/g' a > + > + # Make sure we take trailing digits literally. > + atf_check -o "inline:test=\"foo'" sed 's/\x2727/"/g' b > + > + # Single digit \x should work as well. > + atf_check -o "inline:xn" sed 's/\xd/x/' c > + > + # Invalid digit should cause us to ignore the sequence. This test > + # invokes UB, escapes of an ordinary character. A future change will > + # make regex(3) on longer tolerate this and we'll need to adjust what > + # we're doing, but for now this will suffice. > + atf_check -o "inline:" sed 's/\xx//' d > +} > + > atf_init_test_cases() > { > atf_add_test_case inplace_command_q > atf_add_test_case inplace_hardlink_src > atf_add_test_case inplace_symlink_src > atf_add_test_case escape_subst > + atf_add_test_case hex_subst > } > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Jun 7 13:52:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21F0D32C708; Sun, 7 Jun 2020 13:52:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fyWQ08Nbz3Y5T; Sun, 7 Jun 2020 13:52:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00787144A7; Sun, 7 Jun 2020 13:52:50 +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 057Dqn7L008284; Sun, 7 Jun 2020 13:52:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 057Dqnm8008283; Sun, 7 Jun 2020 13:52:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202006071352.057Dqnm8008283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 7 Jun 2020 13:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361892 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 361892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 13:52:50 -0000 Author: emaste Date: Sun Jun 7 13:52:49 2020 New Revision: 361892 URL: https://svnweb.freebsd.org/changeset/base/361892 Log: src.conf.5: regen after BINUTILS options removal Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Sun Jun 7 13:21:47 2020 (r361891) +++ head/share/man/man5/src.conf.5 Sun Jun 7 13:52:49 2020 (r361892) @@ -182,15 +182,6 @@ Build all binaries with the .Dv DF_BIND_NOW flag set to indicate that the run-time loader should perform all relocation processing at process startup rather than on demand. -.It Va WITH_BINUTILS -Build and install GNU -.Xr as 1 -as part of the normal system build. -This option is not available as of -.Fx 13.0 . -.It Va WITH_BINUTILS_BOOTSTRAP -Build GNU binutils -as part of the bootstrap process. .It Va WITHOUT_BLACKLIST Set this if you do not want to build .Xr blacklistd 8 @@ -371,8 +362,6 @@ When set, it enforces these options: .Pp .Bl -item -compact .It -.Va WITHOUT_BINUTILS_BOOTSTRAP -.It .Va WITHOUT_CLANG_BOOTSTRAP .It .Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP @@ -1630,8 +1619,6 @@ compilers, debuggers etc. When set, it enforces these options: .Pp .Bl -item -compact -.It -.Va WITHOUT_BINUTILS .It .Va WITHOUT_CLANG .It From owner-svn-src-head@freebsd.org Sun Jun 7 13:53:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56BE732C070; Sun, 7 Jun 2020 13:53:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fyWg1jWgz3Y6F; Sun, 7 Jun 2020 13:53:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 362E114535; Sun, 7 Jun 2020 13:53:03 +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 057Dr3i5008341; Sun, 7 Jun 2020 13:53:03 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 057Dr3ZJ008340; Sun, 7 Jun 2020 13:53:03 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202006071353.057Dr3ZJ008340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 7 Jun 2020 13:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361893 - head/tests/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/net X-SVN-Commit-Revision: 361893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 13:53:03 -0000 Author: kp Date: Sun Jun 7 13:53:02 2020 New Revision: 361893 URL: https://svnweb.freebsd.org/changeset/base/361893 Log: bridge tests: Re-enable STP test This test should no longer provoke large amounts of traffic, which can overwhelm single-core systems, preventing them from making progress in the tests. The test can now be re-enabled. PR: 246448 Modified: head/tests/sys/net/if_bridge_test.sh Modified: head/tests/sys/net/if_bridge_test.sh ============================================================================== --- head/tests/sys/net/if_bridge_test.sh Sun Jun 7 13:52:49 2020 (r361892) +++ head/tests/sys/net/if_bridge_test.sh Sun Jun 7 13:53:02 2020 (r361893) @@ -76,10 +76,6 @@ stp_head() stp_body() { - if [ "$(atf_config_get ci false)" = "true" ]; then - atf_skip "https://bugs.freebsd.org/246448" - fi - vnet_init epair_one=$(vnet_mkepair) From owner-svn-src-head@freebsd.org Sun Jun 7 13:53:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 915E132C47D; Sun, 7 Jun 2020 13:53:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fyX43PdBz3YSn; Sun, 7 Jun 2020 13:53:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56160144A8; Sun, 7 Jun 2020 13:53:24 +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 057DrOgQ008413; Sun, 7 Jun 2020 13:53:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 057DrOvA008412; Sun, 7 Jun 2020 13:53:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202006071353.057DrOvA008412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 7 Jun 2020 13:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361894 - head/gnu/usr.bin/binutils/as X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/gnu/usr.bin/binutils/as X-SVN-Commit-Revision: 361894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 13:53:24 -0000 Author: emaste Date: Sun Jun 7 13:53:23 2020 New Revision: 361894 URL: https://svnweb.freebsd.org/changeset/base/361894 Log: Remove now-unused GNU as build infrastructure Deleted: head/gnu/usr.bin/binutils/as/ From owner-svn-src-head@freebsd.org Sun Jun 7 14:04:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AC3932CB20; Sun, 7 Jun 2020 14:04:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fymZ0JD6z3ZcK; Sun, 7 Jun 2020 14:04:14 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id F3B1E1109F; Sun, 7 Jun 2020 14:04:13 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f172.google.com with SMTP id i16so12623789qtr.7; Sun, 07 Jun 2020 07:04:13 -0700 (PDT) X-Gm-Message-State: AOAM5304X9zJdGx3IXmJ/HQmVRiPjRD6KaxEeWI61p0S9d62zbhYdWnh IMfjMpanbuyBanyaBsyn1w5oPXNGX4u7U58mOv8= X-Google-Smtp-Source: ABdhPJyMFgmElzS0uRQ+ag9l02uiVDc/hXcY7U/io/TqQhjlp3G+nYyAbiV9XyL31tH+GhT1LMGAATaWzG2gAU7CnE0= X-Received: by 2002:ac8:36ec:: with SMTP id b41mr19166763qtc.53.1591538653400; Sun, 07 Jun 2020 07:04:13 -0700 (PDT) MIME-Version: 1.0 References: <202006070432.0574Wc1L063319@repo.freebsd.org> <202006071331.057DV4Vo040383@gndrsh.dnsmgr.net> In-Reply-To: <202006071331.057DV4Vo040383@gndrsh.dnsmgr.net> From: Kyle Evans Date: Sun, 7 Jun 2020 09:04:02 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361884 - in head/usr.bin/sed: . tests To: "Rodney W. Grimes" Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 14:04:14 -0000 On Sun, Jun 7, 2020 at 8:31 AM Rodney W. Grimes wrote: > > > Author: kevans > > Date: Sun Jun 7 04:32:38 2020 > > New Revision: 361884 > > URL: https://svnweb.freebsd.org/changeset/base/361884 > > > > Log: > > sed: attempt to learn about hex escapes (e.g. \x27) > > > > Somewhat predictably, software often wants to use \x27/\x24 among others so > > that they can decline worrying about ugly escaping, if said escaping is even > > possible. Right now, this software is using these and getting the wrong > > results, as we'll interpret those as x27 and x24 respectively. Some examples > > of this, when an exp-run was ran, were science/octopus and misc/vifm. > > > > Go ahead and process these at all times. We allow either one or two digits, > > and the tests account for both. If extra digits are specified, e.g. \x2727, > > then the third and fourth digits are interpreted literally as one might > > expect. > > Does it work to do \\x27, ie I want it to NOT do \x27 so I can sed > on files that contain sequences of escapes. I'm so glad you asked this. :-) For your immediate answer: yes, the semantics there work as you expect. For the long answer, that's actually what you should have been doing all along; raising awareness of that fact is what PR 229925 aims to do, by switching our interpretation of the UB for escaping ordinary characters to make them an error if it's not specially interpreted. Prior to this change, if you had: printf "\\\\x27\n" | sed -e 's/\x27//' What you end up with is actually *not* an empty string with a newline, but just a single backslash! \x27 in the replacement pattern gets passed through to the underlying regex(3) implementation, which then happily interprets \x => x and replaces the literal 'x27', leaving \ -- which is perhaps not what you might have expected if \x27 didn't have special meaning and it almost certainly isn't what you wanted. With the new sed, you can change 'x27' to 'b27' in both strings above to see what I mean. In the New World Order, all regex(3) users will be forced to be precise here so that we don't get it wrong. This is especially important when I add GNU extensions to libregex, because some of those escaped-ordinaries will now be granted special meaning, so \s will no longer match a literal s but instead [[:space:]]; using the unadulterated libc regex(3) interface instead will give you an error and allow you to detect whether you're accidentally using libc regex(3) rather than the GNU-extended libregex. This is going to be a large and potentially world-breaking change for many, but I think we'll all be better for it in the end. The symbol version of regcomp will get bumped, so that older binaries will continue to operate with the old escaping behavior in case that was actually pertinent to their functionality. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Sun Jun 7 14:39:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8ADA832D626; Sun, 7 Jun 2020 14:39:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49fzY63C5Mz3dvQ; Sun, 7 Jun 2020 14:39:22 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 669B414B39; Sun, 7 Jun 2020 14:39:22 +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 057EdMBK033086; Sun, 7 Jun 2020 14:39:22 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 057EdK1i033076; Sun, 7 Jun 2020 14:39:20 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006071439.057EdK1i033076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 7 Jun 2020 14:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361895 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 361895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 14:39:22 -0000 Author: tuexen Date: Sun Jun 7 14:39:20 2020 New Revision: 361895 URL: https://svnweb.freebsd.org/changeset/base/361895 Log: Retire SCTP_SO_LOCK_TESTING. This was intended to test the locking used in the MacOS X kernel on a FreeBSD system, to make use of WITNESS and other debugging infrastructure. This hasn't been used for ages, to take it out to reduce the #ifdef complexity. MFC after: 1 week Modified: head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_auth.c Sun Jun 7 14:39:20 2020 (r361895) @@ -566,9 +566,7 @@ sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t void sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { sctp_sharedkey_t *skey; @@ -1721,9 +1719,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au void sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, uint16_t keyid, uint16_t alt_keyid, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct mbuf *m_notify; Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_constants.h Sun Jun 7 14:39:20 2020 (r361895) @@ -943,7 +943,7 @@ __FBSDID("$FreeBSD$"); /*- * defines for socket lock states. - * Used by __APPLE__ and SCTP_SO_LOCK_TESTING + * Used by __APPLE__ */ #define SCTP_SO_LOCKED 1 #define SCTP_SO_NOT_LOCKED 0 Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_indata.c Sun Jun 7 14:39:20 2020 (r361895) @@ -555,20 +555,6 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, sctp_ucount_incr(asoc->cnt_on_all_streams); nxt_todel = strm->last_mid_delivered + 1; if (SCTP_MID_EQ(asoc->idata_supported, nxt_todel, control->mid)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif /* can be delivered right away? */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_IMMED_DEL); @@ -638,9 +624,6 @@ sctp_queue_data_to_stream(struct sctp_tcb *stcb, } break; } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } if (queue_needed) { /* @@ -1956,25 +1939,7 @@ sctp_process_a_data_chunk(struct sctp_tcb *stcb, struc */ if (stcb->sctp_socket->so_rcv.sb_cc) { /* some to read, wake-up */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return (0); - } -#endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* now is it in the mapping array of what we have accepted? */ if (chk_type == SCTP_DATA) { @@ -4182,32 +4147,12 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 } /* sa_ignore NO_NULL_CHK */ if (stcb->sctp_socket) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - -#endif SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { /* sa_ignore NO_NULL_CHK */ sctp_wakeup_log(stcb, 1, SCTP_WAKESND_FROM_SACK); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } else { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, 1, SCTP_NOWAKE_FROM_SACK); @@ -4894,31 +4839,11 @@ hopeless_peer: /* sa_ignore NO_NULL_CHK */ if ((wake_him) && (stcb->sctp_socket)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - -#endif SOCKBUF_LOCK(&stcb->sctp_socket->so_snd); if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, wake_him, SCTP_WAKESND_FROM_SACK); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } else { if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_WAKE_LOGGING_ENABLE) { sctp_wakeup_log(stcb, wake_him, SCTP_NOWAKE_FROM_SACK); Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_input.c Sun Jun 7 14:39:20 2020 (r361895) @@ -214,9 +214,7 @@ outnow: int sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { int unsent_data; @@ -788,9 +786,6 @@ static int sctp_handle_abort(struct sctp_abort_chunk *abort, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif uint16_t len; uint16_t error; @@ -838,20 +833,9 @@ sctp_handle_abort(struct sctp_abort_chunk *abort, #ifdef SCTP_ASOCLOG_OF_TSNS sctp_print_out_track_log(stcb); #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_WAS_ABORTED); (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_8); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_abort: finished\n"); return (1); } @@ -892,9 +876,6 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp, struct sctp_association *asoc; int some_on_streamwheel; int old_state; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown: handling SHUTDOWN\n"); @@ -943,25 +924,9 @@ sctp_handle_shutdown(struct sctp_shutdown_chunk *cp, asoc->control_pdapi->pdapi_aborted = 1; asoc->control_pdapi = NULL; SCTP_INP_READ_UNLOCK(stcb->sctp_ep); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif if (stcb->sctp_socket) { sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* goto SHUTDOWN_RECEIVED state to block new requests */ if (stcb->sctp_socket) { @@ -1021,11 +986,7 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun struct sctp_nets *net) { struct sctp_association *asoc; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - so = SCTP_INP_SO(stcb->sctp_ep); -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown_ack: handling SHUTDOWN ACK\n"); if (stcb == NULL) @@ -1055,22 +1016,7 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun asoc->control_pdapi->pdapi_aborted = 1; asoc->control_pdapi = NULL; SCTP_INP_READ_UNLOCK(stcb->sctp_ep); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - /* assoc was freed while we were unlocked */ - SCTP_SOCKET_UNLOCK(so, 1); - return; - } -#endif sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } #ifdef INVARIANTS if (!TAILQ_EMPTY(&asoc->send_queue) || @@ -1094,18 +1040,8 @@ sctp_handle_shutdown_ack(struct sctp_shutdown_ack_chun } SCTP_STAT_INCR_COUNTER32(sctps_shutdown); /* free the TCB but first save off the ep */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_11); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } static void @@ -1176,9 +1112,6 @@ sctp_handle_error(struct sctp_chunkhdr *ch, struct sctp_association *asoc; uint32_t remaining_length, adjust; uint16_t code, cause_code, cause_length; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif /* parse through all of the errors and process */ asoc = &stcb->asoc; @@ -1252,19 +1185,8 @@ sctp_handle_error(struct sctp_chunkhdr *ch, asoc->max_init_times) { sctp_abort_notification(stcb, 0, 0, NULL, SCTP_SO_NOT_LOCKED); /* now free the asoc */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_12); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (-1); } /* blast back to INIT state */ @@ -1648,9 +1570,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && (!SCTP_IS_LISTENING(inp))) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif /* * Here is where collision would go if we * did a connect() and instead got a @@ -1659,22 +1578,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle */ stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_add_int(&stcb->asoc.refcnt, -1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return (NULL); - } -#endif soisconnected(stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* notify upper layer */ *notification = SCTP_NOTIFY_ASSOC_UP; @@ -1849,27 +1753,9 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && (!SCTP_IS_LISTENING(inp))) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_add_int(&stcb->asoc.refcnt, -1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return (NULL); - } -#endif soisconnected(stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) SCTP_STAT_INCR_COUNTER32(sctps_activeestab); @@ -1910,9 +1796,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle cookie->tie_tag_peer_vtag == asoc->peer_vtag_nonce && cookie->tie_tag_peer_vtag != 0) { struct sctpasochead *head; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif if (asoc->peer_supports_nat) { /* @@ -1980,10 +1863,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle asoc->mapping_array_size); } SCTP_TCB_UNLOCK(stcb); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - SCTP_SOCKET_LOCK(so, 1); -#endif SCTP_INP_INFO_WLOCK(); SCTP_INP_WLOCK(stcb->sctp_ep); SCTP_TCB_LOCK(stcb); @@ -2026,9 +1905,6 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle SCTP_TCB_SEND_UNLOCK(stcb); SCTP_INP_WUNLOCK(stcb->sctp_ep); SCTP_INP_INFO_WUNLOCK(); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif asoc->total_flight = 0; asoc->total_flight_count = 0; /* process the INIT info (peer's info) */ @@ -2095,12 +1971,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in int retval; int error = 0; uint8_t auth_chunk_buf[SCTP_CHUNK_BUFFER_SIZE]; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - so = SCTP_INP_SO(inp); -#endif - /* * find and validate the INIT chunk in the cookie (peer's info) the * INIT should start after the cookie-echo header struct (chunk @@ -2199,18 +2070,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in src, dst, sh, op_err, mflowtype, mflowid, vrf_id, port); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_18); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (NULL); } /* process the INIT-ACK info (my info) */ @@ -2231,36 +2092,16 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in else retval = 0; if (retval < 0) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_19); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (NULL); } /* load all addresses */ if (sctp_load_addresses_from_init(stcb, m, init_offset + sizeof(struct sctp_init_chunk), initack_offset, src, dst, init_src, port)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_20); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (NULL); } /* @@ -2282,18 +2123,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in /* auth HMAC failed, dump the assoc and packet */ SCTPDBG(SCTP_DEBUG_AUTH1, "COOKIE-ECHO: AUTH failed\n"); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_21); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (NULL); } else { /* remaining chunks checked... good to go */ @@ -2333,18 +2164,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in break; #endif default: -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_22); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (NULL); } @@ -2373,21 +2194,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in * a bit of protection is worth having.. */ stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return (NULL); - } -#endif soisconnected(stcb->sctp_socket); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } else if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && (SCTP_IS_LISTENING(inp))) { /* @@ -2807,9 +2614,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in if (so == NULL) { struct mbuf *op_err; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *pcb_so; -#endif + /* Too many sockets */ SCTPDBG(SCTP_DEBUG_INPUT1, "process_cookie_new: no room for another socket!\n"); op_err = sctp_generate_cause(SCTP_CAUSE_OUT_OF_RESC, ""); @@ -2817,19 +2622,8 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in src, dst, sh, op_err, mflowtype, mflowid, vrf_id, port); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - pcb_so = SCTP_INP_SO(*inp_p); - atomic_add_int(&(*stcb)->asoc.refcnt, 1); - SCTP_TCB_UNLOCK((*stcb)); - SCTP_SOCKET_LOCK(pcb_so, 1); - SCTP_TCB_LOCK((*stcb)); - atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(*inp_p, *stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_23); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(pcb_so, 1); -#endif return (NULL); } inp = (struct sctp_inpcb *)so->so_pcb; @@ -2926,17 +2720,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in * Pull it from the incomplete queue and wake the * guy */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - atomic_add_int(&(*stcb)->asoc.refcnt, 1); - SCTP_TCB_UNLOCK((*stcb)); - SCTP_SOCKET_LOCK(so, 1); -#endif soisconnected(so); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_TCB_LOCK((*stcb)); - atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); - SCTP_SOCKET_UNLOCK(so, 1); -#endif return (m); } } @@ -2996,25 +2780,10 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; - -#endif stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif if ((stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) == 0) { soisconnected(stcb->sctp_socket); } -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } /* * since we did not send a HB make sure we don't double @@ -3238,9 +3007,6 @@ static void sctp_handle_shutdown_complete(struct sctp_shutdown_complete_chunk *cp SCTP_UNUSED, struct sctp_tcb *stcb, struct sctp_nets *net) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown_complete: handling SHUTDOWN-COMPLETE\n"); @@ -3273,19 +3039,8 @@ sctp_handle_shutdown_complete(struct sctp_shutdown_com /* free the TCB */ SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_shutdown_complete: calls free-asoc\n"); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(stcb->sctp_ep); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_25); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif return; } @@ -4570,9 +4325,6 @@ sctp_process_control(struct mbuf *m, int iphlen, int * uint32_t auth_offset = 0, auth_len = 0; int auth_skipped = 0; int asconf_cnt = 0; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif SCTPDBG(SCTP_DEBUG_INPUT1, "sctp_process_control: iphlen=%u, offset=%u, length=%u stcb:%p\n", iphlen, *offset, length, (void *)stcb); @@ -4881,19 +4633,8 @@ process_control_chunks: } else { *offset = length; if (stcb != NULL) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_29); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif } return (NULL); } @@ -5245,19 +4986,8 @@ process_control_chunks: if ((stcb) && (stcb->asoc.total_output_queue_size)) { ; } else if (stcb) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_30); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif *offset = length; return (NULL); } @@ -5360,19 +5090,8 @@ process_control_chunks: *fwd_tsn_seen = 1; if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); -#endif (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_INPUT + SCTP_LOC_31); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_SOCKET_UNLOCK(so, 1); -#endif *offset = length; return (NULL); } Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_output.c Sun Jun 7 14:39:20 2020 (r361895) @@ -3990,11 +3990,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, uint16_t port, union sctp_sockstore *over_addr, uint8_t mflowtype, uint32_t mflowid, -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) int so_locked SCTP_UNUSED -#else - int so_locked -#endif ) { /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */ @@ -4024,9 +4020,6 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, struct udphdr *udp = NULL; #endif uint8_t tos_value; -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so = NULL; -#endif if ((net) && (net->dest_state & SCTP_ADDR_OUT_OF_SCOPE)) { SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, EFAULT); @@ -4247,23 +4240,8 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, sctp_packet_log(o_pak); #endif /* send it out. table id is taken from stcb */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - so = SCTP_INP_SO(inp); - SCTP_SOCKET_UNLOCK(so, 0); - } -#endif SCTP_PROBE5(send, NULL, stcb, ip, stcb, sctphdr); SCTP_IP_OUTPUT(ret, o_pak, ro, stcb, vrf_id); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 0); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - } -#endif if (port) { UDPSTAT_INC(udps_opackets); } @@ -4582,27 +4560,12 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, SCTP_STAT_INCR(sctps_sendhwcrc); } /* send it out. table id is taken from stcb */ -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - so = SCTP_INP_SO(inp); - SCTP_SOCKET_UNLOCK(so, 0); - } -#endif #ifdef SCTP_PACKET_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) sctp_packet_log(o_pak); #endif SCTP_PROBE5(send, NULL, stcb, ip6h, stcb, sctphdr); SCTP_IP6_OUTPUT(ret, o_pak, (struct route_in6 *)ro, &ifp, stcb, vrf_id); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - if ((SCTP_BASE_SYSCTL(sctp_output_unlocked)) && (so_locked)) { - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 0); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); - } -#endif if (net) { /* for link local this must be done */ sin6->sin6_scope_id = prev_scope; @@ -4674,9 +4637,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, void sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct mbuf *m, *m_last; @@ -6612,9 +6573,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *reason_code, int control_only, int from_where, struct timeval *now, int *now_filled, int frag_point, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); static void @@ -7076,9 +7035,7 @@ all_done: static void sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct sctp_tmit_chunk *chk, *nchk; @@ -7185,9 +7142,7 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, int eeor_mode, int *bail, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /* Move from the stream to the send_queue keeping track of the total */ @@ -7716,9 +7671,7 @@ out_of: static void sctp_fill_outqueue(struct sctp_tcb *stcb, struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct sctp_association *asoc; @@ -7839,9 +7792,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *reason_code, int control_only, int from_where, struct timeval *now, int *now_filled, int frag_point, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /** @@ -9458,9 +9409,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, int *cnt_out, struct timeval *now, int *now_filled, int *fr_done, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /*- @@ -10011,9 +9960,7 @@ sctp_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_where, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /*- @@ -10532,9 +10479,7 @@ sctp_fill_in_rest: void sctp_send_sack(struct sctp_tcb *stcb, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { /*- @@ -10930,9 +10875,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked void sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct mbuf *m_abort, *m, *m_last; @@ -11350,9 +11293,7 @@ sctp_send_shutdown_complete2(struct sockaddr *src, str void sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ) { struct sctp_tmit_chunk *chk; Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_output.h Sun Jun 7 14:39:20 2020 (r361895) @@ -76,9 +76,7 @@ int void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); void @@ -148,15 +146,11 @@ sctp_output(struct sctp_inpcb *, struct mbuf *, struct void sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int -#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING) SCTP_UNUSED -#endif ); void send_forward_tsn(struct sctp_tcb *, struct sctp_association *); Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_sysctl.c Sun Jun 7 14:39:20 2020 (r361895) @@ -130,9 +130,6 @@ sctp_init_sysctls() #if defined(SCTP_DEBUG) SCTP_BASE_SYSCTL(sctp_debug_on) = SCTPCTL_DEBUG_DEFAULT; #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - SCTP_BASE_SYSCTL(sctp_output_unlocked) = SCTPCTL_OUTPUT_UNLOCKED_DEFAULT; -#endif } @@ -958,9 +955,6 @@ SCTP_UINT_SYSCTL(sendall_limit, sctp_sendall_limit, SC SCTP_UINT_SYSCTL(diag_info_code, sctp_diag_info_code, SCTPCTL_DIAG_INFO_CODE) #ifdef SCTP_DEBUG SCTP_UINT_SYSCTL(debug, sctp_debug_on, SCTPCTL_DEBUG) -#endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) -SCTP_UINT_SYSCTL(output_unlocked, sctp_output_unlocked, SCTPCTL_OUTPUT_UNLOCKED) #endif SYSCTL_PROC(_net_inet_sctp, OID_AUTO, stats, CTLFLAG_VNET | CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_sysctl.h Sun Jun 7 14:39:20 2020 (r361895) @@ -120,9 +120,6 @@ struct sctp_sysctl { #if defined(SCTP_DEBUG) uint32_t sctp_debug_on; #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - uint32_t sctp_output_unlocked; -#endif }; /* @@ -559,12 +556,6 @@ struct sctp_sysctl { #endif -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) -#define SCTPCTL_OUTPUT_UNLOCKED_DESC "Unlock socket when sending packets down to IP" -#define SCTPCTL_OUTPUT_UNLOCKED_MIN 0 -#define SCTPCTL_OUTPUT_UNLOCKED_MAX 1 -#define SCTPCTL_OUTPUT_UNLOCKED_DEFAULT SCTPCTL_OUTPUT_UNLOCKED_MIN -#endif #if defined(_KERNEL) || defined(__Userspace__) Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Jun 7 13:53:23 2020 (r361894) +++ head/sys/netinet/sctp_usrreq.c Sun Jun 7 14:39:20 2020 (r361895) @@ -162,9 +162,6 @@ sctp_notify(struct sctp_inpcb *inp, uint16_t ip_len, uint32_t next_mtu) { -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - struct socket *so; -#endif int timer_stopped; if (icmp_type != ICMP_UNREACH) { @@ -194,20 +191,8 @@ sctp_notify(struct sctp_inpcb *inp, (icmp_code == ICMP_UNREACH_PORT)) { /* Treat it like an ABORT. */ sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED); -#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) - so = SCTP_INP_SO(inp); - atomic_add_int(&stcb->asoc.refcnt, 1); - SCTP_TCB_UNLOCK(stcb); - SCTP_SOCKET_LOCK(so, 1); - SCTP_TCB_LOCK(stcb); - atomic_subtract_int(&stcb->asoc.refcnt, 1); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jun 7 15:41:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CF4732F886 for ; Sun, 7 Jun 2020 15:41:12 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49g0wQ6dyPz43Np for ; Sun, 7 Jun 2020 15:41:10 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72e.google.com with SMTP id c185so14891249qke.7 for ; Sun, 07 Jun 2020 08:41:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tGY+jttYWOSwzRRGXEYuXQJrE52/XT/4561RK0pffpk=; b=tv7HstEu/xZmaRV5iOjGm8TB4hoeEt5IlwXzW405C5gIwz7b+fuepTrQ4740oQpja+ lAte0c6Dchl5NBbwJDqVpW2AdjqyLORVmaRUrqat+t3y5GKNRCBF46P1tBbtwo/i0C3d D7RN4wRUNQlwRqnVfZ1l/txDbarxvzuR8ItkLxsOskCoa/cjNIuJnls6efT7LpYofcge x2c/rbrq4sk7UvxuzGHn8zTM4bq9efNAPA0xGWFXdJVrwQ/Soq0wzfLM0mlb6IsXW81f pitIxrN5y8bJUNaeqvByLsJH9cZ2EnI8nf0ef+BVX71jzTEyBxWpuHmwoPFY94TnIFZJ 15Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tGY+jttYWOSwzRRGXEYuXQJrE52/XT/4561RK0pffpk=; b=jgX3JoR3DZGwqzkdv1uM7z48bTR7wzC6ZMCgRszsAlyWdFQ10tIPQOF4X3K2et0DUM rjIRRRw0sM/VNbA8afUPFBbVr41JLUHdjZgIhBUG2q8QWi8P9XSWImAKLOjxVmgH0Pdx Gww+ZigHS1+3ZirRnr9mYq0jzK7YasxynWkPXhIztYI/IwJIt6B3YfYt3F+oCQRem4iq WoeWbNgHq6hFXzb73csAh+0GVdRHs66A2iyzYd7ezr9S8KeR7Y4dQdVM3lAm/IL//TY5 vH2olDO3x2h26R+h1dCTypvKJUzW+2U1dMGThStQrXnJc0ID1xAGod3TjusDdi5pdp2Z +QDQ== X-Gm-Message-State: AOAM5333YRqcrX3W5J0cBDsoeE9B3dD7RpR0OP/7++u3xId8yvo/pWyo dO3+dKdkmqNNJnqsRyf9dNFVIKgDB7fwAqGNTtBBHg== X-Google-Smtp-Source: ABdhPJz5hBl3+vb71hpN+jUvxjef90R5epBiEwG488W25ezpcYC2frUJB4+j4J85lZP/Le0gBNYG8H5Gbiz1ZnYwczw= X-Received: by 2002:a05:620a:2050:: with SMTP id d16mr2262721qka.215.1591544469647; Sun, 07 Jun 2020 08:41:09 -0700 (PDT) MIME-Version: 1.0 References: <202006070432.0574Wc1L063319@repo.freebsd.org> <202006071331.057DV4Vo040383@gndrsh.dnsmgr.net> In-Reply-To: From: Warner Losh Date: Sun, 7 Jun 2020 09:40:57 -0600 Message-ID: Subject: Re: svn commit: r361884 - in head/usr.bin/sed: . tests To: Kyle Evans Cc: "Rodney W. Grimes" , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 49g0wQ6dyPz43Np X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=tv7HstEu; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72e) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.98 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-0.99)[-0.992]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.00)[0.003]; NEURAL_HAM_LONG(-0.99)[-0.986]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72e:from]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 15:41:12 -0000 On Sun, Jun 7, 2020, 8:04 AM Kyle Evans wrote: > On Sun, Jun 7, 2020 at 8:31 AM Rodney W. Grimes > wrote: > > > > > Author: kevans > > > Date: Sun Jun 7 04:32:38 2020 > > > New Revision: 361884 > > > URL: https://svnweb.freebsd.org/changeset/base/361884 > > > > > > Log: > > > sed: attempt to learn about hex escapes (e.g. \x27) > > > > > > Somewhat predictably, software often wants to use \x27/\x24 among > others so > > > that they can decline worrying about ugly escaping, if said escaping > is even > > > possible. Right now, this software is using these and getting the > wrong > > > results, as we'll interpret those as x27 and x24 respectively. Some > examples > > > of this, when an exp-run was ran, were science/octopus and misc/vifm. > > > > > > Go ahead and process these at all times. We allow either one or two > digits, > > > and the tests account for both. If extra digits are specified, e.g. > \x2727, > > > then the third and fourth digits are interpreted literally as one > might > > > expect. > > > > Does it work to do \\x27, ie I want it to NOT do \x27 so I can sed > > on files that contain sequences of escapes. > > I'm so glad you asked this. :-) For your immediate answer: yes, the > semantics there work as you expect. > > For the long answer, that's actually what you should have been doing > all along; raising awareness of that fact is what PR 229925 aims to > do, by switching our interpretation of the UB for escaping ordinary > characters to make them an error if it's not specially interpreted. > > Prior to this change, if you had: > > printf "\\\\x27\n" | sed -e 's/\x27//' > > What you end up with is actually *not* an empty string with a newline, > but just a single backslash! \x27 in the replacement pattern gets > passed through to the underlying regex(3) implementation, which then > happily interprets \x => x and replaces the literal 'x27', leaving \ > -- which is perhaps not what you might have expected if \x27 didn't > have special meaning and it almost certainly isn't what you wanted. > With the new sed, you can change 'x27' to 'b27' in both strings above > to see what I mean. > > In the New World Order, all regex(3) users will be forced to be > precise here so that we don't get it wrong. This is especially > important when I add GNU extensions to libregex, because some of those > escaped-ordinaries will now be granted special meaning, so \s will no > longer match a literal s but instead [[:space:]]; using the > unadulterated libc regex(3) interface instead will give you an error > and allow you to detect whether you're accidentally using libc > regex(3) rather than the GNU-extended libregex. > > This is going to be a large and potentially world-breaking change for > many, but I think we'll all be better for it in the end. The symbol > version of regcomp will get bumped, so that older binaries will > continue to operate with the old escaping behavior in case that was > actually pertinent to their functionality. > Thanks for taking this on. We are actually stuck between two POLAs here: existing behavior and what users of other systems expect on FreeBSD. Given how edge-Casey the breakage will be, I'm glad you've decided to try full new semantics. I've had *LOTS* of code I've downloaded that I had to hack sed to be gsed for exactly this reason. I think it is one area we've failed to keep up. It's an area where the anti linux bias of the project's early days is hurting us now. Thanks for seeing how feasible this is and retiring this technical debt. Warner Thanks, > > Kyle Evans > From owner-svn-src-head@freebsd.org Sun Jun 7 18:58:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27593334901; Sun, 7 Jun 2020 18:58:58 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49g5Jd3BHKz4WG9; Sun, 7 Jun 2020 18:58:57 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-yb1-xb2f.google.com with SMTP id j8so7968490ybj.12; Sun, 07 Jun 2020 11:58:57 -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=mUVJrRriZYKFadQ5MsRztb7V5nsAh/Di0RkNRMJW27M=; b=HAi6XAZmUbBaQSeZd8Cys+oPtR68JhzUEz4WELDCpg37gpi47c6WDjwih4QzzygISJ gN7oEgUoY5V0V4GvManaRvi0/Z2FDDSNQ0SvgWyktOBy9pHZCCpzlwgAN+Dtdavysimn 9t+663FOgxmKKSQlnpPpMV3G2dHv+ruFVerudR/Cia4MqhbIm/pP7V6Peuxi5SdGl9AZ TA1fAmBpgAp/MSMVrH5sq/jHU2x0ysbqGNJBylpH/5Q1GJhO9mY58KHjb8+CftQuuM6T F6GQzS4wyjl86v8dmJ9jrmCi8Z5nOwXp+LdV2e7VsuYibJ9qGkT5CpfQVfUPOhVHOjNr L4ew== 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=mUVJrRriZYKFadQ5MsRztb7V5nsAh/Di0RkNRMJW27M=; b=AjTwY45xTsGWEb1OmjGXUN861f14hqgjxqcC+gMAWkNpWgZMz8BSujuZ1EQWaSkvbN 4yO5qBz0QbAVSPmIChz8w3SYZI+rWYOR/T82XtyGss//27T6dqc47GRvUQ5xz6eyMUPG fwBWdGbj0Iq0grgNfz0qhYfWRuP6GSmLmNp/6j31x4IrMVrXSveGm0QOw1uUUG2DDxs1 MAuF3WIam5SR3LojizUlZWaYfTetTnz1EL7JnvqOGld/dreXIrYQgM2DBb9XLZpkTAs9 AtZnqru+KwGxCEHez1uSobUotPtbRrYhm5CXVlHscipWv/eAtD6BAmzbCgI1rVqssD8o yYPw== X-Gm-Message-State: AOAM530tV1hmjUVu5gtJpjZ0Z22853ee9jjMt9yXnP5VAZca++GS/6ET ddgOHl4PvMzgk1V74AJSYA4rE/H/uh9blirLjKmtqQ== X-Google-Smtp-Source: ABdhPJySrVdw9866rDIFDs+p1/7dQHogm1imHU4o4T7LV5zZU0C/1XIA9d6JRr3uhj2hZPJ69ZkiIHuYnqJ3p3Xj0+k= X-Received: by 2002:a25:1f05:: with SMTP id f5mr31966414ybf.44.1591556336516; Sun, 07 Jun 2020 11:58:56 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:2bc5:0:0:0:0:0 with HTTP; Sun, 7 Jun 2020 11:58:55 -0700 (PDT) In-Reply-To: <202006070432.0574Wc1L063319@repo.freebsd.org> References: <202006070432.0574Wc1L063319@repo.freebsd.org> From: Oliver Pinter Date: Sun, 7 Jun 2020 20:58:55 +0200 Message-ID: Subject: Re: svn commit: r361884 - in head/usr.bin/sed: . tests To: Kyle Evans Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 49g5Jd3BHKz4WG9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 18:58:58 -0000 On Sunday, June 7, 2020, Kyle Evans wrote: > Author: kevans > Date: Sun Jun 7 04:32:38 2020 > New Revision: 361884 > URL: https://svnweb.freebsd.org/changeset/base/361884 > > Log: > sed: attempt to learn about hex escapes (e.g. \x27) > > Somewhat predictably, software often wants to use \x27/\x24 among others > so > that they can decline worrying about ugly escaping, if said escaping is > even > possible. Right now, this software is using these and getting the wrong > results, as we'll interpret those as x27 and x24 respectively. Some > examples > of this, when an exp-run was ran, were science/octopus and misc/vifm. > > Go ahead and process these at all times. We allow either one or two > digits, > and the tests account for both. If extra digits are specified, e.g. > \x2727, > then the third and fourth digits are interpreted literally as one might > expect. > > PR: 229925 > MFC after: 2 weeks Could you please put an entry from this to release notes? :) > > Modified: > head/usr.bin/sed/compile.c > head/usr.bin/sed/tests/sed2_test.sh > > Modified: head/usr.bin/sed/compile.c > ============================================================ > ================== > --- head/usr.bin/sed/compile.c Sun Jun 7 03:11:34 2020 (r361883) > +++ head/usr.bin/sed/compile.c Sun Jun 7 04:32:38 2020 (r361884) > @@ -49,6 +49,7 @@ static const char sccsid[] = "@(#)compile.c 8.1 (Berke > #include > #include > #include > +#include > #include > #include > #include > @@ -365,6 +366,51 @@ nonsel: /* Now parse the command */ > } > } > > +static int > +hex2char(const char *in, char *out, int len) > +{ > + long ord; > + char *endptr, hexbuf[3]; > + > + hexbuf[0] = in[0]; > + hexbuf[1] = len > 1 ? in[1] : '\0'; > + hexbuf[2] = '\0'; > + > + errno = 0; > + ord = strtol(hexbuf, &endptr, 16); > + if (*endptr != '\0' || errno != 0) > + return (ERANGE); > + *out = (char)ord; > + return (0); > +} > + > +static bool > +hexdigit(char c) > +{ > + int lc; > + > + lc = tolower(c); > + return isdigit(lc) || (lc >= 'a' && lc <= 'f'); > +} > + > +static bool > +dohex(const char *in, char *out, int *len) > +{ > + int tmplen; > + > + if (!hexdigit(in[0])) > + return (false); > + tmplen = 1; > + if (hexdigit(in[1])) > + ++tmplen; > + if (hex2char(in, out, tmplen) == 0) { > + *len = tmplen; > + return (true); > + } > + > + return (false); > +} > + > /* > * Get a delimited string. P points to the delimiter of the string; d > points > * to a buffer area. Newline and delimiter escapes are processed; other > @@ -377,6 +423,7 @@ nonsel: /* Now parse the command */ > static char * > compile_delimited(char *p, char *d, int is_tr) > { > + int hexlen; > char c; > > c = *p++; > @@ -412,6 +459,12 @@ compile_delimited(char *p, char *d, int is_tr) > } > p += 2; > continue; > + } else if (*p == '\\' && p[1] == 'x') { > + if (dohex(&p[2], d, &hexlen)) { > + ++d; > + p += hexlen + 2; > + continue; > + } > } else if (*p == '\\' && p[1] == '\\') { > if (is_tr) > p++; > @@ -431,7 +484,7 @@ compile_delimited(char *p, char *d, int is_tr) > static char * > compile_ccl(char **sp, char *t) > { > - int c, d; > + int c, d, hexlen; > char *s = *sp; > > *t++ = *s++; > @@ -459,6 +512,10 @@ compile_ccl(char **sp, char *t) > *t = '\t'; > s++; > break; > + case 'x': > + if (dohex(&s[2], t, &hexlen)) > + s += hexlen + 1; > + break; > } > } > } > @@ -499,7 +556,7 @@ static char * > compile_subst(char *p, struct s_subst *s) > { > static char lbuf[_POSIX2_LINE_MAX + 1]; > - int asize, size; > + int asize, hexlen, size; > u_char ref; > char c, *text, *op, *sp; > int more = 1, sawesc = 0; > @@ -562,6 +619,21 @@ compile_subst(char *p, struct s_subst *s) > break; > case 't': > *p = '\t'; > + break; > + case 'x': > +#define ADVANCE_N(s, n) \ > + do { \ > + char *adv = (s); \ > + while (*(adv + (n) - 1) != '\0') { \ > + *adv = *(adv + (n)); \ > + ++adv; \ > + } \ > + *adv = '\0'; \ > + } while (0); > + if (dohex(&p[1], p, > &hexlen)) { > + ADVANCE_N(p + 1, > + hexlen); > + } > break; > } > } > > Modified: head/usr.bin/sed/tests/sed2_test.sh > ============================================================ > ================== > --- head/usr.bin/sed/tests/sed2_test.sh Sun Jun 7 03:11:34 2020 > (r361883) > +++ head/usr.bin/sed/tests/sed2_test.sh Sun Jun 7 04:32:38 2020 > (r361884) > @@ -88,10 +88,39 @@ escape_subst_body() > atf_check -o 'inline:abcx\n' sed 's/[ \r\t]//g' c > } > > +atf_test_case hex_subst > +hex_subst_head() > +{ > + atf_set "descr" "Verify proper conversion of hex escapes" > +} > +hex_subst_body() > +{ > + printf "test='foo'" > a > + printf "test='27foo'" > b > + printf "\rn" > c > + printf "xx" > d > + > + atf_check -o 'inline:test="foo"' sed 's/\x27/"/g' a > + atf_check -o "inline:'test'='foo'" sed 's/test/\x27test\x27/g' a > + > + # Make sure we take trailing digits literally. > + atf_check -o "inline:test=\"foo'" sed 's/\x2727/"/g' b > + > + # Single digit \x should work as well. > + atf_check -o "inline:xn" sed 's/\xd/x/' c > + > + # Invalid digit should cause us to ignore the sequence. This test > + # invokes UB, escapes of an ordinary character. A future change > will > + # make regex(3) on longer tolerate this and we'll need to adjust > what > + # we're doing, but for now this will suffice. > + atf_check -o "inline:" sed 's/\xx//' d > +} > + > atf_init_test_cases() > { > atf_add_test_case inplace_command_q > atf_add_test_case inplace_hardlink_src > atf_add_test_case inplace_symlink_src > atf_add_test_case escape_subst > + atf_add_test_case hex_subst > } > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Sun Jun 7 19:56:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CADFB335DD3; Sun, 7 Jun 2020 19:56:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49g6Zn55zNz4d9c; Sun, 7 Jun 2020 19:56:17 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA85218A4E; Sun, 7 Jun 2020 19:56:17 +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 057JuHZp032385; Sun, 7 Jun 2020 19:56:17 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 057JuHVg032384; Sun, 7 Jun 2020 19:56:17 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <202006071956.057JuHVg032384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 7 Jun 2020 19:56:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361898 - head/usr.sbin/services_mkdb X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.sbin/services_mkdb X-SVN-Commit-Revision: 361898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 07 Jun 2020 19:56:17 -0000 Author: pfg Date: Sun Jun 7 19:56:17 2020 New Revision: 361898 URL: https://svnweb.freebsd.org/changeset/base/361898 Log: services: Add SSDP to service database This is used for UPnP and is registered in the IANA database. MFC after: 2 weeks PR: 241573 Modified: head/usr.sbin/services_mkdb/services Modified: head/usr.sbin/services_mkdb/services ============================================================================== --- head/usr.sbin/services_mkdb/services Sun Jun 7 17:40:29 2020 (r361897) +++ head/usr.sbin/services_mkdb/services Sun Jun 7 19:56:17 2020 (r361898) @@ -1602,6 +1602,8 @@ pptp 1723/tcp #Point-to-point tunnelling protocol # IMPORTANT NOTE: See comments for ports 1645/1646 when using older equipment radius 1812/udp #RADIUS authentication protocol (IANA sanctioned) radacct 1813/udp #RADIUS accounting protocol (IANA sanctioned) +ssdp 1900/tcp #Selective Service Discovery Protocol (UPnP) +ssdp 1900/udp #Selective Service Discovery Protocol (UPnP) licensedaemon 1986/tcp #cisco license management licensedaemon 1986/udp #cisco license management tr-rsrb-p1 1987/tcp #cisco RSRB Priority 1 port From owner-svn-src-head@freebsd.org Mon Jun 8 00:46:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D07C233CC8E; Mon, 8 Jun 2020 00:46:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gF1R5F4vz41bx; Mon, 8 Jun 2020 00:46:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAA331BFD4; Mon, 8 Jun 2020 00:46:19 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0580kJKV009948; Mon, 8 Jun 2020 00:46:19 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0580kJsN009947; Mon, 8 Jun 2020 00:46:19 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202006080046.0580kJsN009947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 8 Jun 2020 00:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361900 - head/sbin/reboot X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sbin/reboot X-SVN-Commit-Revision: 361900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 00:46:19 -0000 Author: cem Date: Mon Jun 8 00:46:19 2020 New Revision: 361900 URL: https://svnweb.freebsd.org/changeset/base/361900 Log: x86 boot.8: Remove obsolescent non-loader x86 boot documentation x86 boot uses loader(8) and the boot2-direct-to-kernel process is not supported. Remove the documentation, which doesn't document a working process and leads to confusion. PR: 247074 Reported by: Alex K. Modified: head/sbin/reboot/boot_i386.8 Modified: head/sbin/reboot/boot_i386.8 ============================================================================== --- head/sbin/reboot/boot_i386.8 Mon Jun 8 00:20:15 2020 (r361899) +++ head/sbin/reboot/boot_i386.8 Mon Jun 8 00:46:19 2020 (r361900) @@ -36,7 +36,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 19, 2019 +.Dd June 7, 2020 .Dt BOOT 8 i386 .Os .Sh NAME @@ -61,31 +61,13 @@ That process is described in .Xr uefi 8 . .Pp -By default, a three-stage bootstrap is employed, and control is -automatically passed from the boot blocks (bootstrap stages one and -two) to a separate third-stage bootstrap program, +A three-stage bootstrap is employed. +Control is passed from the boot blocks (bootstrap stages one and two) to a +third-stage bootstrap program, .Xr loader 8 . This third stage provides more sophisticated control over the booting process than it is possible to achieve in the boot blocks, which are constrained by occupying limited fixed space on a given disk or slice. -.Pp -However, it is possible to dispense with the third stage altogether, -either by specifying a kernel name in the boot block parameter -file, -.Pa /boot.config , -or, unless option -.Fl n -is set, by hitting a key during a brief pause (while one of the characters -.Sy - , -.Sy \e , -.Sy \&| , -or -.Sy / -is displayed) before -.Xr loader 8 -is invoked. -Booting will also be attempted at stage two, if the -third stage cannot be loaded. .Pp The remainder of this subsection deals only with the boot blocks. The From owner-svn-src-head@freebsd.org Mon Jun 8 02:28:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFF1E33E8B9; Mon, 8 Jun 2020 02:28:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gHGm4lYqz4CFX; Mon, 8 Jun 2020 02:28:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E5E91D1FA; Mon, 8 Jun 2020 02:28:00 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0582S0YU071177; Mon, 8 Jun 2020 02:28:00 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0582S0Ys071176; Mon, 8 Jun 2020 02:28:00 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202006080228.0582S0Ys071176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 8 Jun 2020 02:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361901 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 361901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 02:28:00 -0000 Author: jhibbits Date: Mon Jun 8 02:28:00 2020 New Revision: 361901 URL: https://svnweb.freebsd.org/changeset/base/361901 Log: powerpc/powernv: Don't configure disabled CPUs If the POWER firmware detects a bad CPU core, it will "GUARD" it out, marking it disabled. Any attempt to spin up a bad CPU will trigger a panic later on when waiting for threads on said core to wake up. Support limping along on fewer cores instead. Modified: head/sys/powerpc/powernv/platform_powernv.c Modified: head/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- head/sys/powerpc/powernv/platform_powernv.c Mon Jun 8 00:46:19 2020 (r361900) +++ head/sys/powerpc/powernv/platform_powernv.c Mon Jun 8 02:28:00 2020 (r361901) @@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include @@ -332,6 +334,8 @@ powernv_cpuref_init(void) for (cpu = OF_child(dev); cpu != 0; cpu = OF_peer(cpu)) { res = OF_getprop(cpu, "device_type", buf, sizeof(buf)); if (res > 0 && strcmp(buf, "cpu") == 0) { + if (!ofw_bus_node_status_okay(cpu)) + continue; res = OF_getproplen(cpu, "ibm,ppc-interrupt-server#s"); if (res > 0) { OF_getencprop(cpu, "ibm,ppc-interrupt-server#s", From owner-svn-src-head@freebsd.org Mon Jun 8 02:42:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AECC933ECEF; Mon, 8 Jun 2020 02:42:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gHbk2b0Wz4DpJ; Mon, 8 Jun 2020 02:42:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 462991D658; Mon, 8 Jun 2020 02:42:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0582ggH9083032; Mon, 8 Jun 2020 02:42:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0582ggac083031; Mon, 8 Jun 2020 02:42:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006080242.0582ggac083031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 8 Jun 2020 02:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361902 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 361902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 02:42:42 -0000 Author: kevans Date: Mon Jun 8 02:42:41 2020 New Revision: 361902 URL: https://svnweb.freebsd.org/changeset/base/361902 Log: RELNOTES: Post-portem note about sed(1) \x support Requested by: Oliver Pinter Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Mon Jun 8 02:28:00 2020 (r361901) +++ head/RELNOTES Mon Jun 8 02:42:41 2020 (r361902) @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r361884: + sed(1) has learned about hex escapes (e.g. \x27) and will now do the + right thing with them, removing the need for printf magic or obnoxious + escaping in many scenarios. + r361238, r361798, r361799: ZFS will now unconditionally reject read(2) of a directory with EISDIR. Additionally, read(2) of a directory is now rejected with EISDIR by From owner-svn-src-head@freebsd.org Mon Jun 8 08:51:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69529347C25; Mon, 8 Jun 2020 08:51:53 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gRnj2CRFz3g9C; Mon, 8 Jun 2020 08:51:53 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 472EF21DE3; Mon, 8 Jun 2020 08:51:53 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0588pr3e010083; Mon, 8 Jun 2020 08:51:53 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0588prB1010082; Mon, 8 Jun 2020 08:51:53 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202006080851.0588prB1010082@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Mon, 8 Jun 2020 08:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361903 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 361903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 08:51:53 -0000 Author: arichardson Date: Mon Jun 8 08:51:52 2020 New Revision: 361903 URL: https://svnweb.freebsd.org/changeset/base/361903 Log: RISC-V: handle DTB aligned to less than 2MB By default OpenSBI and BBL will pass the DTB at a 2MB-aligned address. However, by default there are no 2MB aligned regions between the SBI and the kernel, so we have to choose a 2MB aligned region after the kernel. OpenSBI defaults to placing the DTB 32MB after the start of the kernel but this is not sufficient for a kernel with a large MFS embedded. We could increase this offset to a larger number (e.g. 64/128/256) but that imposes restrictions on the minimum RAM size. Another solution would be to place the DTB between OpenSBI and the kernel at 1MB alignment, but current locore.S code assumes 2MB alignment. With this change I can now boot on QEMU with an OpenSBI configured to store the DTB at an offset of 1MB. See also https://github.com/riscv/opensbi/issues/169 Reviewed By: mhorne Differential Revision: https://reviews.freebsd.org/D25151 Modified: head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Mon Jun 8 02:42:41 2020 (r361902) +++ head/sys/riscv/riscv/locore.S Mon Jun 8 08:51:52 2020 (r361903) @@ -139,6 +139,8 @@ _start: lla s1, pagetable_l2_devmap mv s2, a1 srli s2, s2, PAGE_SHIFT + /* Mask off any bits that aren't aligned */ + andi s2, s2, ~((1 << (PTE_PPN1_S - PTE_PPN0_S)) - 1) li t0, (PTE_KERN) slli t2, s2, PTE_PPN0_S /* << PTE_PPN0_S */ @@ -214,6 +216,10 @@ va: sd t0, RISCV_BOOTPARAMS_KERN_STACK(sp) li t0, (VM_EARLY_DTB_ADDRESS) + /* Add offset of DTB within superpage */ + li t1, (L2_OFFSET) + and t1, a1, t1 + add t0, t0, t1 sd t0, RISCV_BOOTPARAMS_DTBP_VIRT(sp) mv a0, sp From owner-svn-src-head@freebsd.org Mon Jun 8 08:52:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC2C8347E72; Mon, 8 Jun 2020 08:52:01 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gRnp5QFjz3gCS; Mon, 8 Jun 2020 08:51:58 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3450721971; Mon, 8 Jun 2020 08:51:58 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0588pwXm010137; Mon, 8 Jun 2020 08:51:58 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0588pwDO010136; Mon, 8 Jun 2020 08:51:58 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202006080851.0588pwDO010136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Mon, 8 Jun 2020 08:51:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361904 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 361904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 08:52:01 -0000 Author: arichardson Date: Mon Jun 8 08:51:57 2020 New Revision: 361904 URL: https://svnweb.freebsd.org/changeset/base/361904 Log: sys/riscv: Remove debug printfs They are only visible with EARLY_PRINTF so don't show up by default. Reviewed By: mhorne Differential Revision: https://reviews.freebsd.org/D25152 Modified: head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Mon Jun 8 08:51:52 2020 (r361903) +++ head/sys/riscv/riscv/pmap.c Mon Jun 8 08:51:57 2020 (r361904) @@ -563,8 +563,6 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, int i; printf("pmap_bootstrap %lx %lx %lx\n", l1pt, kernstart, kernlen); - printf("%lx\n", l1pt); - printf("%lx\n", (KERNBASE >> L1_SHIFT) & Ln_ADDR_MASK); /* Set this early so we can use the pagetable walking functions */ kernel_pmap_store.pm_l1 = (pd_entry_t *)l1pt; From owner-svn-src-head@freebsd.org Mon Jun 8 08:52:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 077CC347C37; Mon, 8 Jun 2020 08:52:04 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gRnv5tdmz3gc5; Mon, 8 Jun 2020 08:52:03 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B392621AD6; Mon, 8 Jun 2020 08:52:03 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0588q3V9010872; Mon, 8 Jun 2020 08:52:03 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0588q25X010868; Mon, 8 Jun 2020 08:52:02 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202006080852.0588q25X010868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Mon, 8 Jun 2020 08:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361905 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 361905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 08:52:04 -0000 Author: arichardson Date: Mon Jun 8 08:52:02 2020 New Revision: 361905 URL: https://svnweb.freebsd.org/changeset/base/361905 Log: RISC-V: Check that the DTB doesn't overlap with kernel This can happen with very large kernels (e.g. ones embedding a root filesystem). The DTB written by OpenSBI/BBL is quite small so this is unlikely to hit important data, but if it does this can result in very confusing and hard-to-debug crashes. Add a KASSERT() and a verbose print to catch this problem with debug kernels. While this will not print any output by default if it fails (that would depend on EARLY_PRINTF), at least the kernel now halts reliably instead of randomly crashing. Reviewed By: mhorne Differential Revision: https://reviews.freebsd.org/D25153 Modified: head/sys/riscv/include/machdep.h head/sys/riscv/riscv/genassym.c head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/include/machdep.h ============================================================================== --- head/sys/riscv/include/machdep.h Mon Jun 8 08:51:57 2020 (r361904) +++ head/sys/riscv/include/machdep.h Mon Jun 8 08:52:02 2020 (r361905) @@ -42,6 +42,7 @@ struct riscv_bootparams { vm_offset_t kern_phys; /* Kernel base (physical) addr */ vm_offset_t kern_stack; vm_offset_t dtbp_virt; /* Device tree blob virtual addr */ + vm_offset_t dtbp_phys; /* Device tree blob physical addr */ }; extern vm_paddr_t physmap[PHYS_AVAIL_ENTRIES]; Modified: head/sys/riscv/riscv/genassym.c ============================================================================== --- head/sys/riscv/riscv/genassym.c Mon Jun 8 08:51:57 2020 (r361904) +++ head/sys/riscv/riscv/genassym.c Mon Jun 8 08:52:02 2020 (r361905) @@ -106,3 +106,4 @@ ASSYM(RISCV_BOOTPARAMS_KERN_PHYS, offsetof(struct risc ASSYM(RISCV_BOOTPARAMS_KERN_STACK, offsetof(struct riscv_bootparams, kern_stack)); ASSYM(RISCV_BOOTPARAMS_DTBP_VIRT, offsetof(struct riscv_bootparams, dtbp_virt)); +ASSYM(RISCV_BOOTPARAMS_DTBP_PHYS, offsetof(struct riscv_bootparams, dtbp_phys)); Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Mon Jun 8 08:51:57 2020 (r361904) +++ head/sys/riscv/riscv/locore.S Mon Jun 8 08:52:02 2020 (r361905) @@ -221,6 +221,7 @@ va: and t1, a1, t1 add t0, t0, t1 sd t0, RISCV_BOOTPARAMS_DTBP_VIRT(sp) + sd a1, RISCV_BOOTPARAMS_DTBP_PHYS(sp) mv a0, sp call _C_LABEL(initriscv) /* Off we go */ Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Mon Jun 8 08:51:57 2020 (r361904) +++ head/sys/riscv/riscv/machdep.c Mon Jun 8 08:52:02 2020 (r361905) @@ -776,8 +776,19 @@ fake_preload_metadata(struct riscv_bootparams *rvbp) PRELOAD_PUSH_VALUE(uint32_t, 0); preload_metadata = (caddr_t)fake_preload; + /* Check if bootloader clobbered part of the kernel with the DTB. */ + KASSERT(rvbp->dtbp_phys + dtb_size <= rvbp->kern_phys || + rvbp->dtbp_phys >= rvbp->kern_phys + (lastaddr - KERNBASE), + ("FDT (%lx-%lx) and kernel (%lx-%lx) overlap", rvbp->dtbp_phys, + rvbp->dtbp_phys + dtb_size, rvbp->kern_phys, + rvbp->kern_phys + (lastaddr - KERNBASE))); KASSERT(fake_size < sizeof(fake_preload), ("Too many fake_preload items")); + + if (boothowto & RB_VERBOSE) + printf("FDT phys (%lx-%lx), kernel phys (%lx-%lx)\n", + rvbp->dtbp_phys, rvbp->dtbp_phys + dtb_size, + rvbp->kern_phys, rvbp->kern_phys + (lastaddr - KERNBASE)); return (lastaddr); } From owner-svn-src-head@freebsd.org Mon Jun 8 09:33:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E1F6329518; Mon, 8 Jun 2020 09:33:47 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gSk25jS7z43Y0; Mon, 8 Jun 2020 09:33:46 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F50E22716; Mon, 8 Jun 2020 09:33:46 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0589XkDv036563; Mon, 8 Jun 2020 09:33:46 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0589Xk4C036562; Mon, 8 Jun 2020 09:33:46 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006080933.0589Xk4C036562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Mon, 8 Jun 2020 09:33:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361920 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 361920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 09:33:47 -0000 Author: 0mp (doc,ports committer) Date: Mon Jun 8 09:33:45 2020 New Revision: 361920 URL: https://svnweb.freebsd.org/changeset/base/361920 Log: Document that /lib is always in the list of shared library paths /lib was added to the list in r119011. MFC after: 1 week Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Mon Jun 8 09:33:37 2020 (r361919) +++ head/share/man/man5/rc.conf.5 Mon Jun 8 09:33:45 2020 (r361920) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 9, 2020 +.Dd June 8, 2020 .Dt RC.CONF 5 .Os .Sh NAME @@ -3637,8 +3637,10 @@ related programs. Set to the list of shared library paths to use with .Xr ldconfig 8 . NOTE: +.Pa /lib +and .Pa /usr/lib -will always be added first, so it need not appear in this list. +will always be added first, so they need not appear in this list. .It Va ldconfig32_paths .Pq Vt str Set to the list of 32-bit compatibility shared library paths to From owner-svn-src-head@freebsd.org Mon Jun 8 11:48:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 407A832CEB9; Mon, 8 Jun 2020 11:48:09 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gWj50wnvz4KD5; Mon, 8 Jun 2020 11:48:09 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1ACCC23C3E; Mon, 8 Jun 2020 11:48:09 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058Bm8fn017915; Mon, 8 Jun 2020 11:48:08 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058Bm7p2017908; Mon, 8 Jun 2020 11:48:07 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <202006081148.058Bm7p2017908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Mon, 8 Jun 2020 11:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361926 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 361926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 11:48:09 -0000 Author: rrs Date: Mon Jun 8 11:48:07 2020 New Revision: 361926 URL: https://svnweb.freebsd.org/changeset/base/361926 Log: An important statistic in determining if a server process (or client) is being delayed is to know the time to first byte in and time to first byte out. Currently we have no way to know these all we have is t_starttime. That (t_starttime) tells us what time the 3 way handshake completed. We don't know when the first request came in or how quickly we responded. Nor from a client perspective do we know how long from when we sent out the first byte before the server responded. This small change adds the ability to track the TTFB's. This will show up in BB logging which then can be pulled for later analysis. Note that currently the tracking is via the ticks variable of all three variables. This provides a very rough estimate (hz=1000 its 1ms). A follow-on set of work will be to change all three of these values into something with a much finer resolution (either microseconds or nanoseconds), though we may want to make the resolution configurable so that on lower powered machines we could still use the much cheaper ticks variable. Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D24902 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_log_buf.c head/sys/netinet/tcp_log_buf.h head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon Jun 8 09:39:48 2020 (r361925) +++ head/sys/netinet/tcp_input.c Mon Jun 8 11:48:07 2020 (r361926) @@ -1841,6 +1841,15 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru tcp_clean_sackreport(tp); TCPSTAT_INC(tcps_preddat); tp->rcv_nxt += tlen; + if (tlen && + ((tp->t_flags2 & TF2_FBYTES_COMPLETE) == 0) && + (tp->t_fbyte_in == 0)) { + tp->t_fbyte_in = ticks; + if (tp->t_fbyte_in == 0) + tp->t_fbyte_in = 1; + if (tp->t_fbyte_out && tp->t_fbyte_in) + tp->t_flags2 |= TF2_FBYTES_COMPLETE; + } /* * Pull snd_wl1 up to prevent seq wrap relative to * th_seq. @@ -3016,6 +3025,15 @@ dodata: /* XXX */ else tp->t_flags |= TF_ACKNOW; tp->rcv_nxt += tlen; + if (tlen && + ((tp->t_flags2 & TF2_FBYTES_COMPLETE) == 0) && + (tp->t_fbyte_in == 0)) { + tp->t_fbyte_in = ticks; + if (tp->t_fbyte_in == 0) + tp->t_fbyte_in = 1; + if (tp->t_fbyte_out && tp->t_fbyte_in) + tp->t_flags2 |= TF2_FBYTES_COMPLETE; + } thflags = th->th_flags & TH_FIN; TCPSTAT_INC(tcps_rcvpack); TCPSTAT_ADD(tcps_rcvbyte, tlen); Modified: head/sys/netinet/tcp_log_buf.c ============================================================================== --- head/sys/netinet/tcp_log_buf.c Mon Jun 8 09:39:48 2020 (r361925) +++ head/sys/netinet/tcp_log_buf.c Mon Jun 8 11:48:07 2020 (r361926) @@ -1693,6 +1693,9 @@ retry: COPY_STAT(snd_numholes); COPY_STAT(snd_scale); COPY_STAT(rcv_scale); + COPY_STAT_T(flags2); + COPY_STAT_T(fbyte_in); + COPY_STAT_T(fbyte_out); #undef COPY_STAT #undef COPY_STAT_T log_buf->tlb_flex1 = 0; Modified: head/sys/netinet/tcp_log_buf.h ============================================================================== --- head/sys/netinet/tcp_log_buf.h Mon Jun 8 09:39:48 2020 (r361925) +++ head/sys/netinet/tcp_log_buf.h Mon Jun 8 11:48:07 2020 (r361926) @@ -32,7 +32,7 @@ #define TCP_LOG_REASON_LEN 32 #define TCP_LOG_TAG_LEN 32 -#define TCP_LOG_BUF_VER (8) +#define TCP_LOG_BUF_VER (9) /* * Because the (struct tcp_log_buffer) includes 8-byte uint64_t's, it requires @@ -143,6 +143,7 @@ struct tcp_log_buffer uint32_t tlb_rttvar; /* TCPCB t_rttvar */ uint32_t tlb_rcv_up; /* TCPCB rcv_up */ uint32_t tlb_rcv_adv; /* TCPCB rcv_adv */ + uint32_t tlb_flags2; /* TCPCB t_flags2 */ uint32_t tlb_rcv_nxt; /* TCPCB rcv_nxt */ uint32_t tlb_rcv_wnd; /* TCPCB rcv_wnd */ uint32_t tlb_dupacks; /* TCPCB t_dupacks */ @@ -150,6 +151,8 @@ struct tcp_log_buffer int tlb_snd_numholes; /* TCPCB snd_numholes */ uint32_t tlb_flex1; /* Event specific information */ uint32_t tlb_flex2; /* Event specific information */ + uint32_t tlb_fbyte_in; /* TCPCB first byte in time */ + uint32_t tlb_fbyte_out; /* TCPCB first byte out time */ uint8_t tlb_snd_scale:4, /* TCPCB snd_scale */ tlb_rcv_scale:4; /* TCPCB rcv_scale */ uint8_t _pad[3]; /* Padding */ Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Mon Jun 8 09:39:48 2020 (r361925) +++ head/sys/netinet/tcp_stacks/bbr.c Mon Jun 8 11:48:07 2020 (r361926) @@ -8415,6 +8415,15 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, st tp->t_flags |= TF_ACKNOW; } tp->rcv_nxt += tlen; + if (tlen && + ((tp->t_flags2 & TF2_FBYTES_COMPLETE) == 0) && + (tp->t_fbyte_in == 0)) { + tp->t_fbyte_in = ticks; + if (tp->t_fbyte_in == 0) + tp->t_fbyte_in = 1; + if (tp->t_fbyte_out && tp->t_fbyte_in) + tp->t_flags2 |= TF2_FBYTES_COMPLETE; + } thflags = th->th_flags & TH_FIN; KMOD_TCPSTAT_ADD(tcps_rcvpack, (int)nsegs); KMOD_TCPSTAT_ADD(tcps_rcvbyte, tlen); @@ -8631,6 +8640,15 @@ bbr_do_fastnewdata(struct mbuf *m, struct tcphdr *th, tcp_clean_sackreport(tp); KMOD_TCPSTAT_INC(tcps_preddat); tp->rcv_nxt += tlen; + if (tlen && + ((tp->t_flags2 & TF2_FBYTES_COMPLETE) == 0) && + (tp->t_fbyte_in == 0)) { + tp->t_fbyte_in = ticks; + if (tp->t_fbyte_in == 0) + tp->t_fbyte_in = 1; + if (tp->t_fbyte_out && tp->t_fbyte_in) + tp->t_flags2 |= TF2_FBYTES_COMPLETE; + } /* * Pull snd_wl1 up to prevent seq wrap relative to th_seq. */ Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Mon Jun 8 09:39:48 2020 (r361925) +++ head/sys/netinet/tcp_stacks/rack.c Mon Jun 8 11:48:07 2020 (r361926) @@ -8763,6 +8763,15 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, s #endif rack_handle_delayed_ack(tp, rack, tlen, tfo_syn); tp->rcv_nxt += tlen; + if (tlen && + ((tp->t_flags2 & TF2_FBYTES_COMPLETE) == 0) && + (tp->t_fbyte_in == 0)) { + tp->t_fbyte_in = ticks; + if (tp->t_fbyte_in == 0) + tp->t_fbyte_in = 1; + if (tp->t_fbyte_out && tp->t_fbyte_in) + tp->t_flags2 |= TF2_FBYTES_COMPLETE; + } thflags = th->th_flags & TH_FIN; KMOD_TCPSTAT_ADD(tcps_rcvpack, nsegs); KMOD_TCPSTAT_ADD(tcps_rcvbyte, tlen); @@ -8986,6 +8995,15 @@ rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, tcp_clean_sackreport(tp); KMOD_TCPSTAT_INC(tcps_preddat); tp->rcv_nxt += tlen; + if (tlen && + ((tp->t_flags2 & TF2_FBYTES_COMPLETE) == 0) && + (tp->t_fbyte_in == 0)) { + tp->t_fbyte_in = ticks; + if (tp->t_fbyte_in == 0) + tp->t_fbyte_in = 1; + if (tp->t_fbyte_out && tp->t_fbyte_in) + tp->t_flags2 |= TF2_FBYTES_COMPLETE; + } /* * Pull snd_wl1 up to prevent seq wrap relative to th_seq. */ Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Mon Jun 8 09:39:48 2020 (r361925) +++ head/sys/netinet/tcp_usrreq.c Mon Jun 8 11:48:07 2020 (r361926) @@ -1196,6 +1196,16 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf socantsendmore(so); tcp_usrclosed(tp); } + if (TCPS_HAVEESTABLISHED(tp->t_state) && + ((tp->t_flags2 & TF2_FBYTES_COMPLETE) == 0) && + (tp->t_fbyte_out == 0) && + (so->so_snd.sb_ccc > 0)) { + tp->t_fbyte_out = ticks; + if (tp->t_fbyte_out == 0) + tp->t_fbyte_out = 1; + if (tp->t_fbyte_out && tp->t_fbyte_in) + tp->t_flags2 |= TF2_FBYTES_COMPLETE; + } if (!(inp->inp_flags & INP_DROPPED) && !(flags & PRUS_NOTREADY)) { if (flags & PRUS_MORETOCOME) Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Mon Jun 8 09:39:48 2020 (r361925) +++ head/sys/netinet/tcp_var.h Mon Jun 8 11:48:07 2020 (r361926) @@ -202,6 +202,8 @@ struct tcpcb { tcp_seq t_rtseq; /* sequence number being timed */ u_int t_starttime; /* time connection was established */ + u_int t_fbyte_in; /* ticks time when first byte queued in */ + u_int t_fbyte_out; /* ticks time when first byte queued out */ u_int t_pmtud_saved_maxseg; /* pre-blackhole MSS */ int t_blackhole_enter; /* when to enter blackhole detection */ @@ -434,7 +436,7 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF2_ECN_SND_CWR 0x00000040 /* ECN CWR in queue */ #define TF2_ECN_SND_ECE 0x00000080 /* ECN ECE in queue */ #define TF2_ACE_PERMIT 0x00000100 /* Accurate ECN mode */ - +#define TF2_FBYTES_COMPLETE 0x00000400 /* We have first bytes in and out */ /* * Structure to hold TCP options that are only used during segment * processing (in tcp_input), but not held in the tcpcb. From owner-svn-src-head@freebsd.org Mon Jun 8 16:11:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14D9B3343B9; Mon, 8 Jun 2020 16:11:45 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gdYD6qB7z3dW5; Mon, 8 Jun 2020 16:11:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E575327304; Mon, 8 Jun 2020 16:11:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058GBiR2084474; Mon, 8 Jun 2020 16:11:44 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058GBiOt084473; Mon, 8 Jun 2020 16:11:44 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202006081611.058GBiOt084473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 8 Jun 2020 16:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361930 - head/usr.sbin/crashinfo X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/crashinfo X-SVN-Commit-Revision: 361930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 16:11:45 -0000 Author: emaste Date: Mon Jun 8 16:11:44 2020 New Revision: 361930 URL: https://svnweb.freebsd.org/changeset/base/361930 Log: crashinfo: stop looking for gdb in /usr/bin/gdb As of r359457 we removed the GDB_LIBEXEC option, always installing in-tree gdb into /usr/libexec/. Thus, there is now no need for crashinfo to include /usr/bin/gdb in the list of pathnames to check when looking for gdb. Modified: head/usr.sbin/crashinfo/crashinfo.sh Modified: head/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- head/usr.sbin/crashinfo/crashinfo.sh Mon Jun 8 15:27:44 2020 (r361929) +++ head/usr.sbin/crashinfo/crashinfo.sh Mon Jun 8 16:11:44 2020 (r361930) @@ -50,7 +50,7 @@ find_gdb() { local binary - for binary in /usr/local/bin/gdb /usr/libexec/gdb /usr/bin/gdb; do + for binary in /usr/local/bin/gdb /usr/libexec/gdb; do if [ -x ${binary} ]; then GDB=${binary} return From owner-svn-src-head@freebsd.org Mon Jun 8 17:40:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 999643369D4; Mon, 8 Jun 2020 17:40:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49ggWr3cfzz46xp; Mon, 8 Jun 2020 17:40:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 778E127E69; Mon, 8 Jun 2020 17:40:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058Hee7l039984; Mon, 8 Jun 2020 17:40:40 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058Heemo039980; Mon, 8 Jun 2020 17:40:40 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202006081740.058Heemo039980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 8 Jun 2020 17:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361931 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 361931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 17:40:40 -0000 Author: glebius Date: Mon Jun 8 17:40:39 2020 New Revision: 361931 URL: https://svnweb.freebsd.org/changeset/base/361931 Log: Move MPASS() macros to systm.h. They are widely used all over the kernel and aren't contained only to the locking code. Reviewed by: kib, mjg Differential Revision: https://reviews.freebsd.org/D23656 Modified: head/sys/sys/lock.h head/sys/sys/systm.h Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Mon Jun 8 16:11:44 2020 (r361930) +++ head/sys/sys/lock.h Mon Jun 8 17:40:39 2020 (r361931) @@ -162,16 +162,6 @@ struct lock_class { #define lock_initialized(lo) ((lo)->lo_flags & LO_INITIALIZED) -/* - * Helpful macros for quickly coming up with assertions with informative - * panic messages. - */ -#define MPASS(ex) MPASS4(ex, #ex, __FILE__, __LINE__) -#define MPASS2(ex, what) MPASS4(ex, what, __FILE__, __LINE__) -#define MPASS3(ex, file, line) MPASS4(ex, #ex, file, line) -#define MPASS4(ex, what, file, line) \ - KASSERT((ex), ("Assertion %s failed at %s:%d", what, file, line)) - extern struct lock_class lock_class_mtx_sleep; extern struct lock_class lock_class_mtx_spin; extern struct lock_class lock_class_sx; Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Mon Jun 8 16:11:44 2020 (r361930) +++ head/sys/sys/systm.h Mon Jun 8 17:40:39 2020 (r361931) @@ -142,6 +142,16 @@ void kassert_panic(const char *fmt, ...) __printflike #endif /* + * Helpful macros for quickly coming up with assertions with informative + * panic messages. + */ +#define MPASS(ex) MPASS4(ex, #ex, __FILE__, __LINE__) +#define MPASS2(ex, what) MPASS4(ex, what, __FILE__, __LINE__) +#define MPASS3(ex, file, line) MPASS4(ex, #ex, file, line) +#define MPASS4(ex, what, file, line) \ + KASSERT((ex), ("Assertion %s failed at %s:%d", what, file, line)) + +/* * Assert that a pointer can be loaded from memory atomically. * * This assertion enforces stronger alignment than necessary. For example, From owner-svn-src-head@freebsd.org Mon Jun 8 17:51:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AF083369F0; Mon, 8 Jun 2020 17:51:47 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49ggmg0Ncsz47b3; Mon, 8 Jun 2020 17:51:47 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 0802E1DDBF; Mon, 8 Jun 2020 17:51:47 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-yb1-f181.google.com with SMTP id t9so9653392ybk.9; Mon, 08 Jun 2020 10:51:47 -0700 (PDT) X-Gm-Message-State: AOAM530cxVTC7CdSAjMfmcdhN8ixfmcvG532L1nmnVhx0sgL3smcROLZ Bzii1dWnaIrRv1yCmsyVEiPe9lmu5kIXUtkFYgA= X-Google-Smtp-Source: ABdhPJyKqb7qZbQknANyaSXA/JJkWO8wSzkj82w5CRQoip5x109lhc7+s/HDCye3nRfNqbTNGDgBMTJDOruntWm4OPw= X-Received: by 2002:a25:b315:: with SMTP id l21mr41470977ybj.214.1591638706459; Mon, 08 Jun 2020 10:51:46 -0700 (PDT) MIME-Version: 1.0 References: <202005281456.04SEuBkO025187@repo.freebsd.org> In-Reply-To: <202005281456.04SEuBkO025187@repo.freebsd.org> From: Mitchell Horne Date: Mon, 8 Jun 2020 14:51:35 -0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361587 - in head/sys/riscv: include riscv To: src-committers@freebsd.org Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org, rpokala@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 17:51:47 -0000 On Thu, May 28, 2020 at 11:56 AM Mitchell Horne wrote: > > Author: mhorne > Date: Thu May 28 14:56:11 2020 > New Revision: 361587 > URL: https://svnweb.freebsd.org/changeset/base/361587 > > Log: > Add macros simplifying the fake preload setup > > This is in preparation for booting via loader(8). Lift these macros from arm64 > so we don't need to worry about the size when inserting new elements. This > could have been done in r359673, but I didn't think I would be returning to > this function so soon. > > Reviewed by: markj > Differential Revision: https://reviews.freebsd.org/D24910 > > Modified: > head/sys/riscv/include/vmparam.h > head/sys/riscv/riscv/machdep.c > > Modified: head/sys/riscv/include/vmparam.h > ============================================================================== > --- head/sys/riscv/include/vmparam.h Thu May 28 13:48:33 2020 (r361586) > +++ head/sys/riscv/include/vmparam.h Thu May 28 14:56:11 2020 (r361587) > @@ -190,8 +190,6 @@ > #define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) > #define USRSTACK SHAREDPAGE > > -#define KERNENTRY (0) > - > #define VM_EARLY_DTB_ADDRESS (VM_MAX_KERNEL_ADDRESS - (2 * L2_SIZE)) > > /* > > Modified: head/sys/riscv/riscv/machdep.c > ============================================================================== > --- head/sys/riscv/riscv/machdep.c Thu May 28 13:48:33 2020 (r361586) > +++ head/sys/riscv/riscv/machdep.c Thu May 28 14:56:11 2020 (r361587) > @@ -733,29 +733,36 @@ fake_preload_metadata(struct riscv_bootparams *rvbp) > vm_offset_t zstart = 0, zend = 0; > #endif > vm_offset_t lastaddr; > - size_t dtb_size; > - int i; > + size_t fake_size, dtb_size; > > - i = 0; > +#define PRELOAD_PUSH_VALUE(type, value) do { \ > + *(type *)((char *)fake_preload + fake_size) = (value); \ > + fake_size += sizeof(type); \ > +} while (0) > > - fake_preload[i++] = MODINFO_NAME; > - fake_preload[i++] = strlen("kernel") + 1; > - strcpy((char*)&fake_preload[i++], "kernel"); > - i += 1; > - fake_preload[i++] = MODINFO_TYPE; > - fake_preload[i++] = strlen("elf64 kernel") + 1; > - strcpy((char*)&fake_preload[i++], "elf64 kernel"); > - i += 3; > - fake_preload[i++] = MODINFO_ADDR; > - fake_preload[i++] = sizeof(vm_offset_t); > - *(vm_offset_t *)&fake_preload[i++] = > - (vm_offset_t)(KERNBASE + KERNENTRY); > - i += 1; > - fake_preload[i++] = MODINFO_SIZE; > - fake_preload[i++] = sizeof(vm_offset_t); > - fake_preload[i++] = (vm_offset_t)&end - > - (vm_offset_t)(KERNBASE + KERNENTRY); > - i += 1; > +#define PRELOAD_PUSH_STRING(str) do { \ > + uint32_t ssize; \ > + ssize = strlen(str) + 1; \ > + PRELOAD_PUSH_VALUE(uint32_t, ssize); \ > + strcpy(((char *)fake_preload + fake_size), str); \ > + fake_size += ssize; \ > + fake_size = roundup(fake_size, sizeof(u_long)); \ > +} while (0) > + > + fake_size = 0; > + > + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME); > + PRELOAD_PUSH_STRING("kernel"); > + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); > + PRELOAD_PUSH_STRING("elf kernel"); Note that the type here was unintentionally changed from "elf64 kernel" to "elf kernel". Fortunately, this ends up being more consistent with both loader(8) and the other fake_preload_metadata routines, which set the type as "elf kernel". Thanks to rpokala@ for pointing this out. > + > + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); > + PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); > + PRELOAD_PUSH_VALUE(uint64_t, KERNBASE); > + > + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE); > + PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t)); > + PRELOAD_PUSH_VALUE(uint64_t, (size_t)((vm_offset_t)&end - KERNBASE)); > #ifdef DDB > #if 0 > /* RISCVTODO */ > @@ -777,19 +784,20 @@ fake_preload_metadata(struct riscv_bootparams *rvbp) > > /* Copy the DTB to KVA space. */ > lastaddr = roundup(lastaddr, sizeof(int)); > - fake_preload[i++] = MODINFO_METADATA | MODINFOMD_DTBP; > - fake_preload[i++] = sizeof(vm_offset_t); > - *(vm_offset_t *)&fake_preload[i] = (vm_offset_t)lastaddr; > - i += sizeof(vm_offset_t) / sizeof(uint32_t); > + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA | MODINFOMD_DTBP); > + PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); > + PRELOAD_PUSH_VALUE(vm_offset_t, lastaddr); > dtb_size = fdt_totalsize(rvbp->dtbp_virt); > memmove((void *)lastaddr, (const void *)rvbp->dtbp_virt, dtb_size); > lastaddr = roundup(lastaddr + dtb_size, sizeof(int)); > > - fake_preload[i++] = 0; > - fake_preload[i] = 0; > - preload_metadata = (void *)fake_preload; > + /* End marker */ > + PRELOAD_PUSH_VALUE(uint32_t, 0); > + PRELOAD_PUSH_VALUE(uint32_t, 0); > + preload_metadata = (caddr_t)fake_preload; > > - KASSERT(i < nitems(fake_preload), ("Too many fake_preload items")); > + KASSERT(fake_size < sizeof(fake_preload), > + ("Too many fake_preload items")); > > return (lastaddr); > } From owner-svn-src-head@freebsd.org Mon Jun 8 17:57:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75E6F33728C; Mon, 8 Jun 2020 17:57:22 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49ggv62ZfVz48gl; Mon, 8 Jun 2020 17:57:22 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F40082E6; Mon, 8 Jun 2020 17:57:22 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058HvMXg051249; Mon, 8 Jun 2020 17:57:22 GMT (envelope-from jrtc27@FreeBSD.org) Received: (from jrtc27@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058HvMAp051248; Mon, 8 Jun 2020 17:57:22 GMT (envelope-from jrtc27@FreeBSD.org) Message-Id: <202006081757.058HvMAp051248@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrtc27 set sender to jrtc27@FreeBSD.org using -f From: Jessica Clarke Date: Mon, 8 Jun 2020 17:57:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361932 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: jrtc27 X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 361932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 17:57:22 -0000 Author: jrtc27 Date: Mon Jun 8 17:57:21 2020 New Revision: 361932 URL: https://svnweb.freebsd.org/changeset/base/361932 Log: riscv: Use SBI shutdown call to implement RB_POWEROFF Currently we only call sbi_shutdown in cpu_reset, which means we reach "Please press any key to reboot." even when RB_POWEROFF is set, and only once the user presses a key do we then shutdown. Instead, register a shutdown_final event handler and make an SBI shutdown call if RB_POWEROFF is set. Reviewed by: br, jhb (mentor), kp Approved by: br, jhb (mentor), kp Differential Revision: https://reviews.freebsd.org/D25183 Modified: head/sys/riscv/riscv/sbi.c Modified: head/sys/riscv/riscv/sbi.c ============================================================================== --- head/sys/riscv/riscv/sbi.c Mon Jun 8 17:40:39 2020 (r361931) +++ head/sys/riscv/riscv/sbi.c Mon Jun 8 17:57:21 2020 (r361932) @@ -29,8 +29,11 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include +#include +#include #include #include @@ -80,6 +83,13 @@ sbi_get_mimpid(void) return (SBI_CALL0(SBI_EXT_ID_BASE, SBI_BASE_GET_MIMPID)); } +static void +sbi_shutdown_final(void *dummy __unused, int howto) +{ + if ((howto & RB_POWEROFF) != 0) + sbi_shutdown(); +} + void sbi_print_version(void) { @@ -187,3 +197,12 @@ sbi_init(void) KASSERT(sbi_probe_extension(SBI_SHUTDOWN) != 0, ("SBI doesn't implement sbi_shutdown()")); } + +static void +sbi_late_init(void *dummy __unused) +{ + EVENTHANDLER_REGISTER(shutdown_final, sbi_shutdown_final, NULL, + SHUTDOWN_PRI_LAST); +} + +SYSINIT(sbi, SI_SUB_KLD, SI_ORDER_ANY, sbi_late_init, NULL); From owner-svn-src-head@freebsd.org Mon Jun 8 18:13:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FC00336F56; Mon, 8 Jun 2020 18:13:39 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49ghFv0xhvz4BQX; Mon, 8 Jun 2020 18:13:39 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B648884A; Mon, 8 Jun 2020 18:13:39 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058IDc8p063985; Mon, 8 Jun 2020 18:13:38 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058IDcja063984; Mon, 8 Jun 2020 18:13:38 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202006081813.058IDcja063984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Mon, 8 Jun 2020 18:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361933 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 361933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 18:13:39 -0000 Author: sjg Date: Mon Jun 8 18:13:38 2020 New Revision: 361933 URL: https://svnweb.freebsd.org/changeset/base/361933 Log: loader: install allow for more complete device spec in url Rework to simplify and impose sane url syntax. That is we allow for file://[devname[:fstype]]/package Reviewed by: stevek MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org//D25134 Modified: head/stand/common/install.c Modified: head/stand/common/install.c ============================================================================== --- head/stand/common/install.c Mon Jun 8 17:57:21 2020 (r361932) +++ head/stand/common/install.c Mon Jun 8 18:13:38 2020 (r361933) @@ -184,7 +184,8 @@ cleanup(void) /* * usage: install URL - * where: URL = (tftp|file)://[host]/ + * where: URL = tftp://[host]/ + * or file://[devname[:fstype]]/ */ static int install(char *pkgname) @@ -192,8 +193,9 @@ install(char *pkgname) static char buf[256]; struct fs_ops *proto; struct preloaded_file *fp; - char *s, *currdev; - const char *devname; + char *e, *s, *currdev; + char *devname; + size_t devnamelen; int error, fd, i, local; s = strstr(pkgname, "://"); @@ -201,34 +203,74 @@ install(char *pkgname) goto invalid_url; i = s - pkgname; + s += 3; + if (*s == '\0') + goto invalid_url; + + proto = NULL; + devname = NULL; + devnamelen = 0; + if (i == 4 && !strncasecmp(pkgname, "tftp", i)) { devname = "net0"; + devnamelen = 4; proto = &tftp_fsops; local = 0; } else if (i == 4 && !strncasecmp(pkgname, "file", i)) { currdev = getenv("currdev"); - if (currdev != NULL && strcmp(currdev, "pxe0:") == 0) { - devname = "pxe0"; - proto = NULL; + local = 1; + + if (*s == '/') { /* file:/// */ + if (devname == NULL) + devname = currdev; + if (devname == NULL) + devname = "disk1"; + } else { /* file://devname[:fstype]/ */ + devname = s; + e = strchr(devname, '/'); + if (!e) + goto invalid_url; + devnamelen = e - devname; + s = e; /* consume devname */ + } + if ((e = strchr(devname, ':')) != NULL) { + /* could be :fstype */ + devnamelen = e - devname; + switch (e[1]) { + case '\0': /* just currdev */ + break; + case 'd': + proto = &dosfs_fsops; + break; #ifdef HOSTPROG - } else if (currdev != NULL && strcmp(currdev, "host0:") == 0) { - extern struct fs_ops host_fsops; + case 'h': + { + extern struct fs_ops host_fsops; - devname = "host0"; - proto = &host_fsops; + proto = &host_fsops; + } + break; #endif - } else { - devname = "disk1"; + case 'u': + proto = &ufs_fsops; + break; + } + } + if (proto == NULL && strncmp(devname, "disk", 4) == 0) { proto = &dosfs_fsops; } - local = 1; - } else - goto invalid_url; + } - s += 3; - if (*s == '\0') + if (devname == NULL) goto invalid_url; + if (devnamelen == 0) { + /* default is currdev which ends with ':' */ + devnamelen = strlen(devname); + if (devname[devnamelen - 1] == ':') + devnamelen--; + } + if (*s != '/' ) { if (local) goto invalid_url; @@ -252,11 +294,12 @@ install(char *pkgname) } else pkgname = s; - if (strlen(devname) + strlen(pkgname) + 2 > sizeof(buf)) { + i = snprintf(buf, sizeof(buf), "%.*s:%s", + (int) devnamelen, devname, pkgname); + if (i >= (int) sizeof(buf)) { command_errmsg = "package name too long"; return (CMD_ERROR); } - sprintf(buf, "%s:%s", devname, pkgname); setenv("install_package", buf, 1); error = pkgfs_init(buf, proto); From owner-svn-src-head@freebsd.org Mon Jun 8 20:23:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEE6C33A617; Mon, 8 Jun 2020 20:23:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gl7Y4GjZz4S2P; Mon, 8 Jun 2020 20:23:21 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DE07A332; Mon, 8 Jun 2020 20:23:21 +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 058KNL2Z044324; Mon, 8 Jun 2020 20:23:21 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058KNLXV044321; Mon, 8 Jun 2020 20:23:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006082023.058KNLXV044321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 8 Jun 2020 20:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361934 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 361934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 20:23:21 -0000 Author: tuexen Date: Mon Jun 8 20:23:20 2020 New Revision: 361934 URL: https://svnweb.freebsd.org/changeset/base/361934 Log: Whitespace cleanups and removal of a stale comment. MFC after: 1 week Modified: head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Mon Jun 8 18:13:38 2020 (r361933) +++ head/sys/netinet/sctp_pcb.c Mon Jun 8 20:23:20 2020 (r361934) @@ -5686,7 +5686,6 @@ sctp_startup_mcore_threads(void) i++; } } - /* Now start them all */ CPU_FOREACH(cpu) { (void)kproc_create(sctp_mcore_thread, @@ -5695,7 +5694,6 @@ sctp_startup_mcore_threads(void) RFPROC, SCTP_KTHREAD_PAGES, SCTP_MCORE_NAME); - } } #endif Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Mon Jun 8 18:13:38 2020 (r361933) +++ head/sys/netinet/sctp_sysctl.c Mon Jun 8 20:23:20 2020 (r361934) @@ -451,7 +451,6 @@ sctp_sysctl_handle_assoclist(SYSCTL_HANDLER_ARGS) xstcb.primary_addr = stcb->asoc.primary_destination->ro._l_addr; xstcb.heartbeat_interval = stcb->asoc.heart_beat_delay; xstcb.state = (uint32_t)sctp_map_assoc_state(stcb->asoc.state); - /* 7.0 does not support these */ xstcb.assoc_id = sctp_get_associd(stcb); xstcb.peers_rwnd = stcb->asoc.peers_rwnd; xstcb.in_streams = stcb->asoc.streamincnt; Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Mon Jun 8 18:13:38 2020 (r361933) +++ head/sys/netinet/sctputil.c Mon Jun 8 20:23:20 2020 (r361934) @@ -5565,7 +5565,6 @@ sctp_sorecvmsg(struct socket *so, sockbuf_lock = 1; restart: - restart_nosblocks: if (hold_sblock == 0) { SOCKBUF_LOCK(&so->so_rcv); From owner-svn-src-head@freebsd.org Mon Jun 8 20:28:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3B2C33A729; Mon, 8 Jun 2020 20:28:35 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49glFb4BThz4T37; Mon, 8 Jun 2020 20:28:35 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A308A606; Mon, 8 Jun 2020 20:28:35 +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 058KSZNv044758; Mon, 8 Jun 2020 20:28:35 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058KSWDr044742; Mon, 8 Jun 2020 20:28:32 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202006082028.058KSWDr044742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 8 Jun 2020 20:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361935 - in head/usr.bin/mkimg: . tests X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/usr.bin/mkimg: . tests X-SVN-Commit-Revision: 361935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 20:28:35 -0000 Author: gonzo Date: Mon Jun 8 20:28:32 2020 New Revision: 361935 URL: https://svnweb.freebsd.org/changeset/base/361935 Log: Add VHDX support to mkimg(1) VHDX is the successor of Microsoft's VHD file format. It increases maximum capacity of the virtual drive to 64TB and introduces features to better handle power/system failures. VHDX is the required format for 2nd generation Hyper-V VMs. Reviewed by: marcel MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25184 Added: head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-apm.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-mbr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-4096-apm.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-4096-bsd.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-4096-ebr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-4096-mbr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-4096-vtoc8.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-512-apm.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-512-bsd.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-512-ebr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-512-mbr.vhdx.hex (contents, props changed) head/usr.bin/mkimg/tests/img-63x255-512-vtoc8.vhdx.hex (contents, props changed) head/usr.bin/mkimg/vhdx.c (contents, props changed) Modified: head/usr.bin/mkimg/Makefile head/usr.bin/mkimg/mkimg.1 head/usr.bin/mkimg/tests/mkimg_test.sh Modified: head/usr.bin/mkimg/Makefile ============================================================================== --- head/usr.bin/mkimg/Makefile Mon Jun 8 20:23:20 2020 (r361934) +++ head/usr.bin/mkimg/Makefile Mon Jun 8 20:28:32 2020 (r361935) @@ -18,6 +18,7 @@ SRCS+= \ qcow.c \ raw.c \ vhd.c \ + vhdx.c \ vmdk.c # List of schemes to support Modified: head/usr.bin/mkimg/mkimg.1 ============================================================================== --- head/usr.bin/mkimg/mkimg.1 Mon Jun 8 20:23:20 2020 (r361934) +++ head/usr.bin/mkimg/mkimg.1 Mon Jun 8 20:28:32 2020 (r361935) @@ -257,6 +257,16 @@ To create a fixed VHD file for use by Azure, specify .Fl f Ar vhdf on the command line. The preferred file extension is ".vhd". +.Ss Dynamic VHDX +Microsoft's "Virtual Hard Disk v2" file formats, the +successor to VHD. +VHDX is the required format for the 2nd generation Hyper-V VMs. +To have +.Nm +create a dynamic VHDX file, specify +.Fl f Ar vhdx +on the command line. +The preferred file extension is ".vhdx". .Ss VMDK VMware's "Virtual Machine Disk" file format. It's a sparse file format akin to QCOW and VHD and supported by many Added: head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,79 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 10 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 45 52 02 00 00 00 80 00 00 00 00 00 00 00 00 00 |ER..............| +00400010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400200 50 4d 00 00 00 00 00 03 00 00 00 01 00 00 00 03 |PM..............| +00400210 41 70 70 6c 65 00 00 00 00 00 00 00 00 00 00 00 |Apple...........| +00400220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400230 41 70 70 6c 65 5f 70 61 72 74 69 74 69 6f 6e 5f |Apple_partition_| +00400240 6d 61 70 00 00 00 00 00 00 00 00 00 00 00 00 00 |map.............| +00400250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400400 50 4d 00 00 00 00 00 03 00 00 00 08 00 00 20 00 |PM............ .| +00400410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400430 46 72 65 65 42 53 44 2d 55 46 53 00 00 00 00 00 |FreeBSD-UFS.....| +00400440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400600 50 4d 00 00 00 00 00 03 00 00 20 08 00 00 01 00 |PM........ .....| +00400610 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400630 46 72 65 65 42 53 44 2d 73 77 61 70 00 00 00 00 |FreeBSD-swap....| +00400640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00401000 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00801000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,75 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 10 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00400200 57 45 56 82 00 00 00 00 00 00 00 00 00 00 00 00 |WEV.............| +00400210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400220 00 00 00 00 00 00 00 00 00 02 00 00 01 00 00 00 |................| +00400230 01 00 00 00 00 80 00 00 01 00 00 00 00 80 00 00 |................| +00400240 00 00 00 00 00 00 00 00 10 0e 00 00 00 00 00 00 |................| +00400250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400280 00 00 00 00 57 45 56 82 1f ad 08 00 00 20 00 00 |....WEV...... ..| +00400290 00 00 00 00 00 20 00 00 10 00 00 00 00 00 00 00 |..... ..........| +004002a0 07 00 00 00 00 01 00 00 10 20 00 00 00 00 00 00 |......... ......| +004002b0 01 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 |................| +004002c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400310 00 00 00 00 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |....B.B.B.B.B.B.| +00400320 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00402000 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00802000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,80 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 10 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff |................| +004001c0 ff ff a5 ff ff ff 01 00 00 00 10 21 00 00 00 00 |...........!....| +004001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| +00400200 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00400400 57 45 56 82 00 00 00 00 00 00 00 00 00 00 00 00 |WEV.............| +00400410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400420 00 00 00 00 00 00 00 00 00 02 00 00 01 00 00 00 |................| +00400430 01 00 00 00 10 21 00 00 01 00 00 00 10 21 00 00 |.....!.......!..| +00400440 00 00 00 00 00 00 00 00 10 0e 00 00 00 00 00 00 |................| +00400450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400480 00 00 00 00 57 45 56 82 0f 0c 08 00 00 20 00 00 |....WEV...... ..| +00400490 00 00 00 00 00 20 00 00 10 00 00 00 00 00 00 00 |..... ..........| +004004a0 07 00 00 00 00 01 00 00 10 20 00 00 00 00 00 00 |......... ......| +004004b0 01 00 00 00 10 21 00 00 00 00 00 00 00 00 00 00 |.....!..........| +004004c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400510 00 00 00 00 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |....B.B.B.B.B.B.| +00400520 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00402200 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00802200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,100 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| +00210020 00 02 00 00 00 10 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +004001b0 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 00 00 |B.B.B.B.B.B.B...| +004001c0 02 00 ee ff ff ff 01 00 00 00 ff 7f 00 00 00 00 |................| +004001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| +00400200 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 |EFI PART....\...| +00400210 74 bd 80 b6 00 00 00 00 01 00 00 00 00 00 00 00 |t...............| +00400220 ff 7f 00 00 00 00 00 00 03 00 00 00 00 00 00 00 |................| +00400230 fd 7f 00 00 00 00 00 00 03 03 03 03 03 03 03 03 |................| +00400240 03 03 03 03 03 03 03 03 02 00 00 00 00 00 00 00 |................| +00400250 04 00 00 00 80 00 00 00 b2 50 1a c4 00 00 00 00 |.........P......| +00400260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400400 b6 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +00400410 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00400420 08 00 00 00 00 00 00 00 07 20 00 00 00 00 00 00 |......... ......| +00400430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400480 b5 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +00400490 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 |................| +004004a0 08 20 00 00 00 00 00 00 07 21 00 00 00 00 00 00 |. .......!......| +004004b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00401000 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00801000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +013ffc00 b6 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +013ffc10 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +013ffc20 08 00 00 00 00 00 00 00 07 20 00 00 00 00 00 00 |......... ......| +013ffc30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +013ffc80 b5 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +013ffc90 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 |................| +013ffca0 08 20 00 00 00 00 00 00 07 21 00 00 00 00 00 00 |. .......!......| +013ffcb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +013ffe00 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 |EFI PART....\...| +013ffe10 87 87 ed 30 00 00 00 00 ff 7f 00 00 00 00 00 00 |...0............| +013ffe20 01 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 |................| +013ffe30 fd 7f 00 00 00 00 00 00 03 03 03 03 03 03 03 03 |................| +013ffe40 03 03 03 03 03 03 03 03 fe 7f 00 00 00 00 00 00 |................| +013ffe50 04 00 00 00 80 00 00 00 b2 50 1a c4 00 00 00 00 |.........P......| +013ffe60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,82 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 10 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +004001b0 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 80 ff |B.B.B.B.B.B.B...| +004001c0 ff ff a5 ff ff ff 01 00 00 00 10 21 00 00 00 00 |...........!....| +004001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| +00400200 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00400400 57 45 56 82 00 00 00 00 00 00 00 00 00 00 00 00 |WEV.............| +00400410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400420 00 00 00 00 00 00 00 00 00 02 00 00 01 00 00 00 |................| +00400430 01 00 00 00 10 21 00 00 01 00 00 00 10 21 00 00 |.....!.......!..| +00400440 00 00 00 00 00 00 00 00 10 0e 00 00 00 00 00 00 |................| +00400450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400480 00 00 00 00 57 45 56 82 0f 0c 08 00 00 20 00 00 |....WEV...... ..| +00400490 00 00 00 00 00 20 00 00 10 00 00 00 00 00 00 00 |..... ..........| +004004a0 07 00 00 00 00 01 00 00 10 20 00 00 00 00 00 00 |......... ......| +004004b0 01 00 00 00 10 21 00 00 00 00 00 00 00 00 00 00 |.....!..........| +004004c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400510 00 00 00 00 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |....B.B.B.B.B.B.| +00400520 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00402200 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00802200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,72 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 10 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 46 72 65 65 42 53 44 31 36 4d 00 00 00 00 00 00 |FreeBSD16M......| +00400010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400080 00 00 00 01 00 00 00 00 00 00 00 00 00 08 09 02 |................| +00400090 00 00 09 01 00 00 00 00 00 00 00 00 00 00 00 00 |................| +004000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +004000b0 00 00 00 00 00 00 00 00 00 00 00 00 60 0d de ee |............`...| +004000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001a0 00 00 00 00 0e 10 80 00 00 00 00 00 00 00 00 00 |................| +004001b0 80 00 00 00 00 01 00 01 00 00 00 00 00 00 00 01 |................| +004001c0 00 00 20 00 00 00 20 01 00 00 01 00 00 00 00 00 |.. ... .........| +004001d0 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +004001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +004001f0 00 00 00 00 00 00 00 00 00 00 00 00 da be f8 7f |................| +00400200 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00800200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-512-apm.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-512-apm.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,79 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 45 52 02 00 00 00 80 00 00 00 00 00 00 00 00 00 |ER..............| +00400010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400200 50 4d 00 00 00 00 00 03 00 00 00 01 00 00 00 03 |PM..............| +00400210 41 70 70 6c 65 00 00 00 00 00 00 00 00 00 00 00 |Apple...........| +00400220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400230 41 70 70 6c 65 5f 70 61 72 74 69 74 69 6f 6e 5f |Apple_partition_| +00400240 6d 61 70 00 00 00 00 00 00 00 00 00 00 00 00 00 |map.............| +00400250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400400 50 4d 00 00 00 00 00 03 00 00 00 04 00 00 20 00 |PM............ .| +00400410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400430 46 72 65 65 42 53 44 2d 55 46 53 00 00 00 00 00 |FreeBSD-UFS.....| +00400440 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400600 50 4d 00 00 00 00 00 03 00 00 20 04 00 00 01 00 |PM........ .....| +00400610 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400630 46 72 65 65 42 53 44 2d 73 77 61 70 00 00 00 00 |FreeBSD-swap....| +00400640 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400800 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00800800 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,75 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00400200 57 45 56 82 00 00 00 00 00 00 00 00 00 00 00 00 |WEV.............| +00400210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400220 00 00 00 00 00 00 00 00 00 02 00 00 01 00 00 00 |................| +00400230 01 00 00 00 00 80 00 00 01 00 00 00 00 80 00 00 |................| +00400240 00 00 00 00 00 00 00 00 10 0e 00 00 00 00 00 00 |................| +00400250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400280 00 00 00 00 57 45 56 82 1f ad 08 00 00 20 00 00 |....WEV...... ..| +00400290 00 00 00 00 00 20 00 00 10 00 00 00 00 00 00 00 |..... ..........| +004002a0 07 00 00 00 00 01 00 00 10 20 00 00 00 00 00 00 |......... ......| +004002b0 01 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 |................| +004002c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400310 00 00 00 00 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |....B.B.B.B.B.B.| +00400320 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00402000 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00802000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,80 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff |................| +004001c0 ff ff a5 ff ff ff 01 00 00 00 10 21 00 00 00 00 |...........!....| +004001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| +00400200 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00400400 57 45 56 82 00 00 00 00 00 00 00 00 00 00 00 00 |WEV.............| +00400410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400420 00 00 00 00 00 00 00 00 00 02 00 00 01 00 00 00 |................| +00400430 01 00 00 00 10 21 00 00 01 00 00 00 10 21 00 00 |.....!.......!..| +00400440 00 00 00 00 00 00 00 00 10 0e 00 00 00 00 00 00 |................| +00400450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400480 00 00 00 00 57 45 56 82 0f 0c 08 00 00 20 00 00 |....WEV...... ..| +00400490 00 00 00 00 00 20 00 00 10 00 00 00 00 00 00 00 |..... ..........| +004004a0 07 00 00 00 00 01 00 00 10 20 00 00 00 00 00 00 |......... ......| +004004b0 01 00 00 00 10 21 00 00 00 00 00 00 00 00 00 00 |.....!..........| +004004c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400510 00 00 00 00 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |....B.B.B.B.B.B.| +00400520 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00402200 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00802200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,100 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 |................| +00210020 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +004001b0 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 00 00 |B.B.B.B.B.B.B...| +004001c0 02 00 ee ff ff ff 01 00 00 00 ff 7f 00 00 00 00 |................| +004001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| +00400200 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 |EFI PART....\...| +00400210 71 3e 06 15 00 00 00 00 01 00 00 00 00 00 00 00 |q>..............| +00400220 ff 7f 00 00 00 00 00 00 03 00 00 00 00 00 00 00 |................| +00400230 fd 7f 00 00 00 00 00 00 03 03 03 03 03 03 03 03 |................| +00400240 03 03 03 03 03 03 03 03 02 00 00 00 00 00 00 00 |................| +00400250 04 00 00 00 80 00 00 00 45 45 ea fb 00 00 00 00 |........EE......| +00400260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400400 b6 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +00400410 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00400420 03 00 00 00 00 00 00 00 02 20 00 00 00 00 00 00 |......... ......| +00400430 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400480 b5 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +00400490 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 |................| +004004a0 03 20 00 00 00 00 00 00 02 21 00 00 00 00 00 00 |. .......!......| +004004b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400600 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00800600 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +013ffc00 b6 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +013ffc10 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +013ffc20 03 00 00 00 00 00 00 00 02 20 00 00 00 00 00 00 |......... ......| +013ffc30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +013ffc80 b5 7c 6e 51 cf 6e d6 11 8f f8 00 02 2d 09 71 2b |.|nQ.n......-.q+| +013ffc90 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 |................| +013ffca0 03 20 00 00 00 00 00 00 02 21 00 00 00 00 00 00 |. .......!......| +013ffcb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +013ffe00 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 |EFI PART....\...| +013ffe10 82 04 6b 93 00 00 00 00 ff 7f 00 00 00 00 00 00 |..k.............| +013ffe20 01 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 |................| +013ffe30 fd 7f 00 00 00 00 00 00 03 03 03 03 03 03 03 03 |................| +013ffe40 03 03 03 03 03 03 03 03 fe 7f 00 00 00 00 00 00 |................| +013ffe50 04 00 00 00 80 00 00 00 45 45 ea fb 00 00 00 00 |........EE......| +013ffe60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-512-mbr.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-512-mbr.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,82 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| +00200010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00200020 37 67 a1 ca 36 fa 43 4d b3 b6 33 f0 aa 44 e7 6b |7g..6.CM..3..D.k| +00200030 00 00 01 00 08 00 00 00 04 00 00 00 00 00 00 00 |................| +00200040 24 42 a5 2f 1b cd 76 48 b2 11 5d be d8 3b f4 b8 |$B./..vH..]..;..| +00200050 08 00 01 00 08 00 00 00 06 00 00 00 00 00 00 00 |................| +00200060 ab 12 ca be e6 b2 23 45 93 ef c3 09 e0 00 c7 46 |......#E.......F| +00200070 10 00 01 00 10 00 00 00 06 00 00 00 00 00 00 00 |................| +00200080 1d bf 41 81 6f a9 09 47 ba 47 f2 33 a8 fa ab 5f |..A.o..G.G.3..._| +00200090 20 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 | ...............| +002000a0 c7 48 a3 cd 5d 44 71 44 9c c9 e9 88 52 51 c5 56 |.H..]DqD....RQ.V| +002000b0 24 00 01 00 04 00 00 00 06 00 00 00 00 00 00 00 |$...............| +002000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00210000 00 00 00 01 00 00 00 00 00 00 00 01 00 00 00 00 |................| +00210010 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................| +00210020 00 02 00 00 00 02 00 00 00 00 00 00 00 00 00 00 |................| +00210030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00300000 06 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| +00300010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400000 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +004001b0 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 80 ff |B.B.B.B.B.B.B...| +004001c0 ff ff a5 ff ff ff 01 00 00 00 10 21 00 00 00 00 |...........!....| +004001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +004001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.| +00400200 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00400400 57 45 56 82 00 00 00 00 00 00 00 00 00 00 00 00 |WEV.............| +00400410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +00400420 00 00 00 00 00 00 00 00 00 02 00 00 01 00 00 00 |................| +00400430 01 00 00 00 10 21 00 00 01 00 00 00 10 21 00 00 |.....!.......!..| +00400440 00 00 00 00 00 00 00 00 10 0e 00 00 00 00 00 00 |................| +00400450 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400480 00 00 00 00 57 45 56 82 0f 0c 08 00 00 20 00 00 |....WEV...... ..| +00400490 00 00 00 00 00 20 00 00 10 00 00 00 00 00 00 00 |..... ..........| +004004a0 07 00 00 00 00 01 00 00 10 20 00 00 00 00 00 00 |......... ......| +004004b0 01 00 00 00 10 21 00 00 00 00 00 00 00 00 00 00 |.....!..........| +004004c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00400510 00 00 00 00 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |....B.B.B.B.B.B.| +00400520 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a 42 0a |B.B.B.B.B.B.B.B.| +* +00402200 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a 50 0a |P.P.P.P.P.P.P.P.| +* +00802200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +01400000 Added: head/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdx.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/tests/img-1x1-512-vtoc8.vhdx.hex Mon Jun 8 20:28:32 2020 (r361935) @@ -0,0 +1,72 @@ +# $FreeBSD$ +00000000 76 68 64 78 66 69 6c 65 00 00 00 00 00 00 00 00 |vhdxfile........| +00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010000 68 65 61 64 64 db 05 73 00 00 00 00 00 00 00 00 |headd..s........| +00010010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00010040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00010050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020000 68 65 61 64 13 47 fd f1 01 00 00 00 00 00 00 00 |head.G..........| +00020010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00020040 00 00 01 00 00 00 10 00 00 00 10 00 00 00 00 00 |................| +00020050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00030000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00030010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00030020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00030030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00030040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00030050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00040000 72 65 67 69 4c d5 3e 14 02 00 00 00 00 00 00 00 |regiL.>.........| +00040010 06 a2 7c 8b 90 47 9a 4b b8 fe 57 5f 05 0f 88 6e |..|..G.K..W_...n| +00040020 00 00 20 00 00 00 00 00 00 00 10 00 00 00 00 00 |.. .............| +00040030 66 77 c2 2d 23 f6 00 42 9d 64 11 5e 9b fd 4a 08 |fw.-#..B.d.^..J.| +00040040 00 00 30 00 00 00 00 00 00 00 10 00 00 00 00 00 |..0.............| +00040050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| +* +00200000 6d 65 74 61 64 61 74 61 00 00 05 00 00 00 00 00 |metadata........| *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Jun 8 20:53:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A87DF33AF6B; Mon, 8 Jun 2020 20:53:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49glpv4RGnz4X9x; Mon, 8 Jun 2020 20:53:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93733A5C2; Mon, 8 Jun 2020 20:53:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058Krxoa064301; Mon, 8 Jun 2020 20:53:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058KrwD4064292; Mon, 8 Jun 2020 20:53:58 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202006082053.058KrwD4064292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 8 Jun 2020 20:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361939 - in head/sys: cam/ctl dev/iscsi X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: cam/ctl dev/iscsi X-SVN-Commit-Revision: 361939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 20:53:59 -0000 Author: mav Date: Mon Jun 8 20:53:57 2020 New Revision: 361939 URL: https://svnweb.freebsd.org/changeset/base/361939 Log: Implement zero-copy iSCSI target transmission/read. Add ICL_NOCOPY flag to icl_pdu_append_data(), specifying that the method can just reference the data buffer instead of immediately copying it. Extend the offload KPI with optional PDU queue method, allowing to specify completion callback, called when all the data referenced by above has been transferred and won't be accessed any more (the buffers can be freed). Implement the above functionality in software iSCSI driver using mbufs with external storage and reference counter. Note that some NICs (ixl(4)) may keep the mbuf in TX queue for a long time, so CTL has to be ready. Add optional method to struct ctl_scsiio for buffer reference counting. Implement it for CTL block backend, allowing to delay free of the struct ctl_be_block_io and memory it references as needed. In first reincarnation of the patch I tried to delay whole I/O as it is done for FibreChannel, that was cleaner, but due to the above callback delays I had to rewrite it this way to not leave LUN referenced potentially for hours or more. All together on sequential read from ZFS ARC this saves about 30% of CPU time and memory bandwidth by avoiding one of 3 memory copies (the other two are from ZFS ARC to DMU cache and then from DMU cache to CTL buffers). On tests with 2x Xeon Silver 4114 this allows to reach full line rate of 100GigE NIC. Tests with Gold CPUs and two 100GigE NICs are stil TBD, but expectations to saturate them are pretty high. ;) Discussed with: Chelsio Sponsored by: iXsystems, Inc. Modified: head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_io.h head/sys/dev/iscsi/icl.h head/sys/dev/iscsi/icl_conn_if.m head/sys/dev/iscsi/icl_soft.c head/sys/dev/iscsi/icl_wrappers.h Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Mon Jun 8 20:40:09 2020 (r361938) +++ head/sys/cam/ctl/ctl_backend_block.c Mon Jun 8 20:53:57 2020 (r361939) @@ -201,6 +201,7 @@ struct ctl_be_block_io { union ctl_io *io; struct ctl_sg_entry sg_segs[CTLBLK_MAX_SEGS]; struct iovec xiovecs[CTLBLK_MAX_SEGS]; + int refcnt; int bio_cmd; int two_sglists; int num_segs; @@ -305,11 +306,12 @@ ctl_alloc_beio(struct ctl_be_block_softc *softc) beio = uma_zalloc(softc->beio_zone, M_WAITOK | M_ZERO); beio->softc = softc; + beio->refcnt = 1; return (beio); } static void -ctl_free_beio(struct ctl_be_block_io *beio) +ctl_real_free_beio(struct ctl_be_block_io *beio) { struct ctl_be_block_softc *softc = beio->softc; int i; @@ -328,6 +330,22 @@ ctl_free_beio(struct ctl_be_block_io *beio) } static void +ctl_refcnt_beio(void *arg, int diff) +{ + struct ctl_be_block_io *beio = arg; + + if (atomic_fetchadd_int(&beio->refcnt, diff) + diff == 0) + ctl_real_free_beio(beio); +} + +static void +ctl_free_beio(struct ctl_be_block_io *beio) +{ + + ctl_refcnt_beio(beio, -1); +} + +static void ctl_complete_beio(struct ctl_be_block_io *beio) { union ctl_io *io = beio->io; @@ -1613,6 +1631,8 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, io->scsiio.kern_data_ptr = (uint8_t *)beio->sg_segs; io->scsiio.kern_data_len = beio->io_len; io->scsiio.kern_sg_entries = beio->num_segs; + io->scsiio.kern_data_ref = ctl_refcnt_beio; + io->scsiio.kern_data_arg = beio; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; /* Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Jun 8 20:40:09 2020 (r361938) +++ head/sys/cam/ctl/ctl_frontend_iscsi.c Mon Jun 8 20:53:57 2020 (r361939) @@ -424,6 +424,17 @@ cfiscsi_pdu_queue(struct icl_pdu *response) CFISCSI_SESSION_UNLOCK(cs); } + static void +cfiscsi_pdu_queue_cb(struct icl_pdu *response, icl_pdu_cb cb) +{ + struct cfiscsi_session *cs = PDU_SESSION(response); + + CFISCSI_SESSION_LOCK(cs); + cfiscsi_pdu_prepare(response); + icl_pdu_queue_cb(response, cb); + CFISCSI_SESSION_UNLOCK(cs); +} + static void cfiscsi_pdu_handle_nop_out(struct icl_pdu *request) { @@ -2417,6 +2428,15 @@ cfiscsi_target_find_or_create(struct cfiscsi_softc *so } static void +cfiscsi_pdu_done(struct icl_pdu *ip, int error) +{ + + if (error != 0) + ; // XXX: Do something on error? + ((ctl_ref)ip->ip_prv0)(ip->ip_prv1, -1); +} + +static void cfiscsi_datamove_in(union ctl_io *io) { struct cfiscsi_session *cs; @@ -2426,6 +2446,7 @@ cfiscsi_datamove_in(union ctl_io *io) struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; size_t len, expected_len, sg_len, buffer_offset; const char *sg_addr; + icl_pdu_cb cb; int ctl_sg_count, error, i; request = PRIV_REQUEST(io); @@ -2471,6 +2492,11 @@ cfiscsi_datamove_in(union ctl_io *io) return; } + if (io->scsiio.kern_data_ref != NULL) + cb = cfiscsi_pdu_done; + else + cb = NULL; + i = 0; sg_addr = NULL; sg_len = 0; @@ -2534,7 +2560,8 @@ cfiscsi_datamove_in(union ctl_io *io) len, sg_len)); } - error = icl_pdu_append_data(response, sg_addr, len, M_NOWAIT); + error = icl_pdu_append_data(response, sg_addr, len, + M_NOWAIT | (cb ? ICL_NOCOPY : 0)); if (error != 0) { CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); @@ -2587,7 +2614,12 @@ cfiscsi_datamove_in(union ctl_io *io) buffer_offset -= response->ip_data_len; break; } - cfiscsi_pdu_queue(response); + if (cb != NULL) { + response->ip_prv0 = io->scsiio.kern_data_ref; + response->ip_prv1 = io->scsiio.kern_data_arg; + io->scsiio.kern_data_ref(io->scsiio.kern_data_arg, 1); + } + cfiscsi_pdu_queue_cb(response, cb); response = NULL; bhsdi = NULL; } @@ -2617,7 +2649,12 @@ cfiscsi_datamove_in(union ctl_io *io) } } KASSERT(response->ip_data_len > 0, ("sending empty Data-In")); - cfiscsi_pdu_queue(response); + if (cb != NULL) { + response->ip_prv0 = io->scsiio.kern_data_ref; + response->ip_prv1 = io->scsiio.kern_data_arg; + io->scsiio.kern_data_ref(io->scsiio.kern_data_arg, 1); + } + cfiscsi_pdu_queue_cb(response, cb); } io->scsiio.be_move_done(io); Modified: head/sys/cam/ctl/ctl_io.h ============================================================================== --- head/sys/cam/ctl/ctl_io.h Mon Jun 8 20:40:09 2020 (r361938) +++ head/sys/cam/ctl/ctl_io.h Mon Jun 8 20:53:57 2020 (r361939) @@ -257,6 +257,8 @@ typedef enum { union ctl_io; +typedef void (*ctl_ref)(void *arg, int diff); + /* * SCSI passthrough I/O structure for the CAM Target Layer. Note * that some of these fields are here for completeness, but they aren't @@ -329,6 +331,8 @@ struct ctl_scsiio { uint8_t cdb[CTL_MAX_CDBLEN]; /* CDB */ int (*be_move_done)(union ctl_io *io); /* called by fe */ int (*io_cont)(union ctl_io *io); /* to continue processing */ + ctl_ref kern_data_ref; /* Method to reference/release data */ + void *kern_data_arg; /* Opaque argument for kern_data_ref() */ }; typedef enum { Modified: head/sys/dev/iscsi/icl.h ============================================================================== --- head/sys/dev/iscsi/icl.h Mon Jun 8 20:40:09 2020 (r361938) +++ head/sys/dev/iscsi/icl.h Mon Jun 8 20:53:57 2020 (r361939) @@ -79,9 +79,8 @@ struct icl_pdu { /* * User (initiator or provider) private fields. */ - uint32_t ip_prv0; - uint32_t ip_prv1; - uint32_t ip_prv2; + void *ip_prv0; + void *ip_prv1; }; #define ICL_CONN_STATE_INVALID 0 @@ -93,6 +92,8 @@ struct icl_pdu { #define ICL_MAX_DATA_SEGMENT_LENGTH (128 * 1024) +#define ICL_NOCOPY (1 << 30) + struct icl_conn { KOBJ_FIELDS; struct mtx *ic_lock; @@ -135,6 +136,8 @@ struct icl_drv_limits { int idl_first_burst_length; int spare[4]; }; + +typedef void (*icl_pdu_cb)(struct icl_pdu *, int error); struct icl_conn *icl_new_conn(const char *offload, bool iser, const char *name, struct mtx *lock); Modified: head/sys/dev/iscsi/icl_conn_if.m ============================================================================== --- head/sys/dev/iscsi/icl_conn_if.m Mon Jun 8 20:40:09 2020 (r361938) +++ head/sys/dev/iscsi/icl_conn_if.m Mon Jun 8 20:53:57 2020 (r361939) @@ -36,6 +36,16 @@ INTERFACE icl_conn; +CODE { + static void null_pdu_queue_cb(struct icl_conn *ic, + struct icl_pdu *ip, icl_pdu_cb cb) + { + ICL_CONN_PDU_QUEUE(ic, ip); + if (cb) + cb(ip, 0); + } +}; + METHOD size_t pdu_data_segment_length { struct icl_conn *_ic; const struct icl_pdu *_ip; @@ -61,6 +71,12 @@ METHOD void pdu_queue { struct icl_conn *_ic; struct icl_pdu *_ip; }; + +METHOD void pdu_queue_cb { + struct icl_conn *_ic; + struct icl_pdu *_ip; + icl_pdu_cb cb; +} DEFAULT null_pdu_queue_cb; METHOD void pdu_free { struct icl_conn *_ic; Modified: head/sys/dev/iscsi/icl_soft.c ============================================================================== --- head/sys/dev/iscsi/icl_soft.c Mon Jun 8 20:40:09 2020 (r361938) +++ head/sys/dev/iscsi/icl_soft.c Mon Jun 8 20:53:57 2020 (r361939) @@ -64,6 +64,15 @@ __FBSDID("$FreeBSD$"); #include #include +struct icl_soft_pdu { + struct icl_pdu ip; + + /* soft specific stuff goes here. */ + u_int ref_cnt; + icl_pdu_cb cb; + int error; +}; + static int coalesce = 1; SYSCTL_INT(_kern_icl, OID_AUTO, coalesce, CTLFLAG_RWTUN, &coalesce, 0, "Try to coalesce PDUs before sending"); @@ -79,7 +88,7 @@ SYSCTL_INT(_kern_icl, OID_AUTO, recvspace, CTLFLAG_RWT &recvspace, 0, "Default receive socket buffer size"); static MALLOC_DEFINE(M_ICL_SOFT, "icl_soft", "iSCSI software backend"); -static uma_zone_t icl_pdu_zone; +static uma_zone_t icl_soft_pdu_zone; static volatile u_int icl_ncons; @@ -97,6 +106,7 @@ static icl_conn_pdu_data_segment_length_t static icl_conn_pdu_append_data_t icl_soft_conn_pdu_append_data; static icl_conn_pdu_get_data_t icl_soft_conn_pdu_get_data; static icl_conn_pdu_queue_t icl_soft_conn_pdu_queue; +static icl_conn_pdu_queue_cb_t icl_soft_conn_pdu_queue_cb; static icl_conn_handoff_t icl_soft_conn_handoff; static icl_conn_free_t icl_soft_conn_free; static icl_conn_close_t icl_soft_conn_close; @@ -116,6 +126,7 @@ static kobj_method_t icl_soft_methods[] = { KOBJMETHOD(icl_conn_pdu_append_data, icl_soft_conn_pdu_append_data), KOBJMETHOD(icl_conn_pdu_get_data, icl_soft_conn_pdu_get_data), KOBJMETHOD(icl_conn_pdu_queue, icl_soft_conn_pdu_queue), + KOBJMETHOD(icl_conn_pdu_queue_cb, icl_soft_conn_pdu_queue_cb), KOBJMETHOD(icl_conn_handoff, icl_soft_conn_handoff), KOBJMETHOD(icl_conn_free, icl_soft_conn_free), KOBJMETHOD(icl_conn_close, icl_soft_conn_close), @@ -209,35 +220,79 @@ icl_conn_receive_buf(struct icl_conn *ic, void *buf, s static void icl_soft_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) { + struct icl_soft_pdu *isp = (struct icl_soft_pdu *)ip; + KASSERT(isp->ref_cnt == 0, ("freeing active PDU")); m_freem(ip->ip_bhs_mbuf); m_freem(ip->ip_ahs_mbuf); m_freem(ip->ip_data_mbuf); - uma_zfree(icl_pdu_zone, ip); + uma_zfree(icl_soft_pdu_zone, isp); #ifdef DIAGNOSTIC refcount_release(&ic->ic_outstanding_pdus); #endif } +static void +icl_soft_pdu_call_cb(struct icl_pdu *ip) +{ + struct icl_soft_pdu *isp = (struct icl_soft_pdu *)ip; + + if (isp->cb != NULL) + isp->cb(ip, isp->error); +#ifdef DIAGNOSTIC + refcount_release(&ip->ip_conn->ic_outstanding_pdus); +#endif + uma_zfree(icl_soft_pdu_zone, isp); +} + +static void +icl_soft_pdu_done(struct icl_pdu *ip, int error) +{ + struct icl_soft_pdu *isp = (struct icl_soft_pdu *)ip; + + if (error != 0) + isp->error = error; + + m_freem(ip->ip_bhs_mbuf); + ip->ip_bhs_mbuf = NULL; + m_freem(ip->ip_ahs_mbuf); + ip->ip_ahs_mbuf = NULL; + m_freem(ip->ip_data_mbuf); + ip->ip_data_mbuf = NULL; + + if (atomic_fetchadd_int(&isp->ref_cnt, -1) == 1) + icl_soft_pdu_call_cb(ip); +} + +static void +icl_soft_mbuf_done(struct mbuf *mb) +{ + struct icl_soft_pdu *isp = (struct icl_soft_pdu *)mb->m_ext.ext_arg1; + + icl_soft_pdu_call_cb(&isp->ip); +} + /* * Allocate icl_pdu with empty BHS to fill up by the caller. */ struct icl_pdu * icl_soft_conn_new_pdu(struct icl_conn *ic, int flags) { + struct icl_soft_pdu *isp; struct icl_pdu *ip; #ifdef DIAGNOSTIC refcount_acquire(&ic->ic_outstanding_pdus); #endif - ip = uma_zalloc(icl_pdu_zone, flags | M_ZERO); - if (ip == NULL) { - ICL_WARN("failed to allocate %zd bytes", sizeof(*ip)); + isp = uma_zalloc(icl_soft_pdu_zone, flags | M_ZERO); + if (isp == NULL) { + ICL_WARN("failed to allocate soft PDU"); #ifdef DIAGNOSTIC refcount_release(&ic->ic_outstanding_pdus); #endif return (NULL); } + ip = &isp->ip; ip->ip_conn = ic; CTASSERT(sizeof(struct iscsi_bhs) <= MHLEN); @@ -926,7 +981,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu if (error != 0) { ICL_DEBUG("failed to finalize PDU; " "dropping connection"); - icl_soft_conn_pdu_free(ic, request); + icl_soft_pdu_done(request, EIO); icl_conn_fail(ic); return; } @@ -944,8 +999,8 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu if (error != 0) { ICL_DEBUG("failed to finalize PDU; " "dropping connection"); - icl_soft_conn_pdu_free(ic, request); - icl_soft_conn_pdu_free(ic, request2); + icl_soft_pdu_done(request, EIO); + icl_soft_pdu_done(request2, EIO); icl_conn_fail(ic); return; } @@ -954,7 +1009,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu request->ip_bhs_mbuf->m_pkthdr.len += size2; size += size2; STAILQ_REMOVE_AFTER(queue, request, ip_next); - icl_soft_conn_pdu_free(ic, request2); + icl_soft_pdu_done(request2, 0); coalesced++; } #if 0 @@ -971,11 +1026,11 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu if (error != 0) { ICL_DEBUG("failed to send PDU, error %d; " "dropping connection", error); - icl_soft_conn_pdu_free(ic, request); + icl_soft_pdu_done(request, error); icl_conn_fail(ic); return; } - icl_soft_conn_pdu_free(ic, request); + icl_soft_pdu_done(request, 0); } } @@ -1072,24 +1127,38 @@ static int icl_soft_conn_pdu_append_data(struct icl_conn *ic, struct icl_pdu *request, const void *addr, size_t len, int flags) { + struct icl_soft_pdu *isp = (struct icl_soft_pdu *)request; struct mbuf *mb, *newmb; size_t copylen, off = 0; KASSERT(len > 0, ("len == 0")); - newmb = m_getm2(NULL, len, flags, MT_DATA, 0); - if (newmb == NULL) { - ICL_WARN("failed to allocate mbuf for %zd bytes", len); - return (ENOMEM); - } + if (flags & ICL_NOCOPY) { + newmb = m_get(flags & ~ICL_NOCOPY, MT_DATA); + if (newmb == NULL) { + ICL_WARN("failed to allocate mbuf"); + return (ENOMEM); + } - for (mb = newmb; mb != NULL; mb = mb->m_next) { - copylen = min(M_TRAILINGSPACE(mb), len - off); - memcpy(mtod(mb, char *), (const char *)addr + off, copylen); - mb->m_len = copylen; - off += copylen; + newmb->m_flags |= M_RDONLY; + m_extaddref(newmb, __DECONST(char *, addr), len, &isp->ref_cnt, + icl_soft_mbuf_done, isp, NULL); + newmb->m_len = len; + } else { + newmb = m_getm2(NULL, len, flags, MT_DATA, 0); + if (newmb == NULL) { + ICL_WARN("failed to allocate mbuf for %zd bytes", len); + return (ENOMEM); + } + + for (mb = newmb; mb != NULL; mb = mb->m_next) { + copylen = min(M_TRAILINGSPACE(mb), len - off); + memcpy(mtod(mb, char *), (const char *)addr + off, copylen); + mb->m_len = copylen; + off += copylen; + } + KASSERT(off == len, ("%s: off != len", __func__)); } - KASSERT(off == len, ("%s: off != len", __func__)); if (request->ip_data_mbuf == NULL) { request->ip_data_mbuf = newmb; @@ -1111,17 +1180,25 @@ icl_soft_conn_pdu_get_data(struct icl_conn *ic, struct } static void -icl_pdu_queue(struct icl_pdu *ip) +icl_soft_conn_pdu_queue(struct icl_conn *ic, struct icl_pdu *ip) { - struct icl_conn *ic; - ic = ip->ip_conn; + icl_soft_conn_pdu_queue_cb(ic, ip, NULL); +} +static void +icl_soft_conn_pdu_queue_cb(struct icl_conn *ic, struct icl_pdu *ip, + icl_pdu_cb cb) +{ + struct icl_soft_pdu *isp = (struct icl_soft_pdu *)ip; + ICL_CONN_LOCK_ASSERT(ic); + isp->ref_cnt++; + isp->cb = cb; if (ic->ic_disconnecting || ic->ic_socket == NULL) { ICL_DEBUG("icl_pdu_queue on closed connection"); - icl_soft_conn_pdu_free(ic, ip); + icl_soft_pdu_done(ip, ENOTCONN); return; } @@ -1139,13 +1216,6 @@ icl_pdu_queue(struct icl_pdu *ip) cv_signal(&ic->ic_send_cv); } -void -icl_soft_conn_pdu_queue(struct icl_conn *ic, struct icl_pdu *ip) -{ - - icl_pdu_queue(ip); -} - static struct icl_conn * icl_soft_new_conn(const char *name, struct mtx *lock) { @@ -1414,7 +1484,7 @@ icl_soft_conn_close(struct icl_conn *ic) while (!STAILQ_EMPTY(&ic->ic_to_send)) { pdu = STAILQ_FIRST(&ic->ic_to_send); STAILQ_REMOVE_HEAD(&ic->ic_to_send, ip_next); - icl_soft_conn_pdu_free(ic, pdu); + icl_soft_pdu_done(pdu, ENOTCONN); } KASSERT(STAILQ_EMPTY(&ic->ic_to_send), @@ -1499,8 +1569,8 @@ icl_soft_load(void) { int error; - icl_pdu_zone = uma_zcreate("icl_pdu", - sizeof(struct icl_pdu), NULL, NULL, NULL, NULL, + icl_soft_pdu_zone = uma_zcreate("icl_soft_pdu", + sizeof(struct icl_soft_pdu), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); refcount_init(&icl_ncons, 0); @@ -1537,7 +1607,7 @@ icl_soft_unload(void) icl_unregister("proxytest", true); #endif - uma_zdestroy(icl_pdu_zone); + uma_zdestroy(icl_soft_pdu_zone); return (0); } Modified: head/sys/dev/iscsi/icl_wrappers.h ============================================================================== --- head/sys/dev/iscsi/icl_wrappers.h Mon Jun 8 20:40:09 2020 (r361938) +++ head/sys/dev/iscsi/icl_wrappers.h Mon Jun 8 20:53:57 2020 (r361939) @@ -80,6 +80,13 @@ icl_pdu_queue(struct icl_pdu *ip) } static inline void +icl_pdu_queue_cb(struct icl_pdu *ip, icl_pdu_cb cb) +{ + + ICL_CONN_PDU_QUEUE_CB(ip->ip_conn, ip, cb); +} + +static inline void icl_pdu_free(struct icl_pdu *ip) { From owner-svn-src-head@freebsd.org Mon Jun 8 21:11:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8E9033BB03; Mon, 8 Jun 2020 21:11:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gmCB4ZSgz4Yx6; Mon, 8 Jun 2020 21:11:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98446A86A; Mon, 8 Jun 2020 21:11:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058LBY4M075206; Mon, 8 Jun 2020 21:11:34 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058LBYfj075205; Mon, 8 Jun 2020 21:11:34 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006082111.058LBYfj075205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Mon, 8 Jun 2020 21:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361940 - head/usr.bin/mkimg X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.bin/mkimg X-SVN-Commit-Revision: 361940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 21:11:34 -0000 Author: 0mp (doc,ports committer) Date: Mon Jun 8 21:11:34 2020 New Revision: 361940 URL: https://svnweb.freebsd.org/changeset/base/361940 Log: Use Fl instead of Ar for long flags Also, bump date after r361935. MFC after: 1 week Modified: head/usr.bin/mkimg/mkimg.1 Modified: head/usr.bin/mkimg/mkimg.1 ============================================================================== --- head/usr.bin/mkimg/mkimg.1 Mon Jun 8 20:53:57 2020 (r361939) +++ head/usr.bin/mkimg/mkimg.1 Mon Jun 8 21:11:34 2020 (r361940) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 26, 2017 +.Dd June 8, 2020 .Dt MKIMG 1 .Os .Sh NAME @@ -47,7 +47,7 @@ .Op Fl y .Op Fl s Ar scheme Op Fl p Ar partition ... .Nm -.Ar --formats | --schemes | --version +.Fl -formats | Fl -schemes | Fl -version .Sh DESCRIPTION The .Nm @@ -183,13 +183,13 @@ utility exits immediately after providing the requeste The version of the .Nm utility is printed when the -.Ar --version +.Fl -version option is given. The list of supported output formats is printed when the -.Ar --formats +.Fl -formats option is given and the list of supported partitioning schemes is printed when the -.Ar --schemes +.Fl -schemes option is given. Both the format and scheme lists a space-separated lists for easy handling in scripts. From owner-svn-src-head@freebsd.org Mon Jun 8 21:49:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B891A33C338; Mon, 8 Jun 2020 21:49:42 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gn3B4WRQz4ddM; Mon, 8 Jun 2020 21:49:42 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91DA3B3BC; Mon, 8 Jun 2020 21:49:42 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058LngAx001220; Mon, 8 Jun 2020 21:49:42 GMT (envelope-from jrtc27@FreeBSD.org) Received: (from jrtc27@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058LngRR001219; Mon, 8 Jun 2020 21:49:42 GMT (envelope-from jrtc27@FreeBSD.org) Message-Id: <202006082149.058LngRR001219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrtc27 set sender to jrtc27@FreeBSD.org using -f From: Jessica Clarke Date: Mon, 8 Jun 2020 21:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361943 - head/sys/dev/virtio/mmio X-SVN-Group: head X-SVN-Commit-Author: jrtc27 X-SVN-Commit-Paths: head/sys/dev/virtio/mmio X-SVN-Commit-Revision: 361943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 21:49:42 -0000 Author: jrtc27 Date: Mon Jun 8 21:49:42 2020 New Revision: 361943 URL: https://svnweb.freebsd.org/changeset/base/361943 Log: virtio_mmio: Negotiate the upper half of the feature bits too The feature bits are exposed as a 32-bit register with 2 banks, so we should negotiate both halves. Notably, VIRTIO_F_VERSION_1 is in the upper half, and will be used in an upcoming commit. The PCI bus driver also has this bug, but the legacy BAR layout did not include selector registers and is rather different from the modern layout, so it remains solely as legacy. Reviewed by: br, brooks (mentor), jhb (mentor) Approved by: br, brooks (mentor), jhb (mentor) Differential Revision: https://reviews.freebsd.org/D25131 Modified: head/sys/dev/virtio/mmio/virtio_mmio.c Modified: head/sys/dev/virtio/mmio/virtio_mmio.c ============================================================================== --- head/sys/dev/virtio/mmio/virtio_mmio.c Mon Jun 8 21:38:52 2020 (r361942) +++ head/sys/dev/virtio/mmio/virtio_mmio.c Mon Jun 8 21:49:42 2020 (r361943) @@ -390,7 +390,13 @@ vtmmio_negotiate_features(device_t dev, uint64_t child sc = device_get_softc(dev); + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 1); host_features = vtmmio_read_config_4(sc, VIRTIO_MMIO_HOST_FEATURES); + host_features <<= 32; + + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 0); + host_features |= vtmmio_read_config_4(sc, VIRTIO_MMIO_HOST_FEATURES); + vtmmio_describe_features(sc, "host", host_features); /* @@ -402,6 +408,11 @@ vtmmio_negotiate_features(device_t dev, uint64_t child sc->vtmmio_features = features; vtmmio_describe_features(sc, "negotiated", features); + + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 1); + vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_FEATURES, features >> 32); + + vtmmio_write_config_4(sc, VIRTIO_MMIO_HOST_FEATURES_SEL, 0); vtmmio_write_config_4(sc, VIRTIO_MMIO_GUEST_FEATURES, features); return (features); From owner-svn-src-head@freebsd.org Mon Jun 8 21:51:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB84033C70A; Mon, 8 Jun 2020 21:51:37 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gn5P53k5z4dkw; Mon, 8 Jun 2020 21:51:37 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8FB8B50E; Mon, 8 Jun 2020 21:51:37 +0000 (UTC) (envelope-from jrtc27@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 058LpbJl003005; Mon, 8 Jun 2020 21:51:37 GMT (envelope-from jrtc27@FreeBSD.org) Received: (from jrtc27@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058LpabU003001; Mon, 8 Jun 2020 21:51:36 GMT (envelope-from jrtc27@FreeBSD.org) Message-Id: <202006082151.058LpabU003001@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jrtc27 set sender to jrtc27@FreeBSD.org using -f From: Jessica Clarke Date: Mon, 8 Jun 2020 21:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361944 - in head/sys/dev/virtio: . network X-SVN-Group: head X-SVN-Commit-Author: jrtc27 X-SVN-Commit-Paths: in head/sys/dev/virtio: . network X-SVN-Commit-Revision: 361944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 21:51:37 -0000 Author: jrtc27 Date: Mon Jun 8 21:51:36 2020 New Revision: 361944 URL: https://svnweb.freebsd.org/changeset/base/361944 Log: virtio: Support non-legacy network device and queue The non-legacy interface always defines num_buffers in the header, regardless of whether VIRTIO_NET_F_MRG_RXBUF, just leaving it unused. We also need to ensure our virtqueue doesn't filter out VIRTIO_F_VERSION_1 during negotiation, as it supports non-legacy transports just fine. This fixes network packet transmission on TinyEMU. Reviewed by: br, brooks (mentor), jhb (mentor) Approved by: br, brooks (mentor), jhb (mentor) Differential Revision: https://reviews.freebsd.org/D25132 Modified: head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/network/if_vtnetvar.h head/sys/dev/virtio/virtio.c head/sys/dev/virtio/virtqueue.c Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Mon Jun 8 21:49:42 2020 (r361943) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Jun 8 21:51:36 2020 (r361944) @@ -640,10 +640,13 @@ vtnet_setup_features(struct vtnet_softc *sc) sc->vtnet_flags |= VTNET_FLAG_MAC; } - if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) { + if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) sc->vtnet_flags |= VTNET_FLAG_MRG_RXBUFS; + + if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) || + virtio_with_feature(dev, VIRTIO_F_VERSION_1)) sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr_mrg_rxbuf); - } else + else sc->vtnet_hdr_size = sizeof(struct virtio_net_hdr); if (sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) @@ -1459,9 +1462,10 @@ vtnet_rxq_enqueue_buf(struct vtnet_rxq *rxq, struct mb sglist_reset(sg); if ((sc->vtnet_flags & VTNET_FLAG_MRG_RXBUFS) == 0) { - MPASS(sc->vtnet_hdr_size == sizeof(struct virtio_net_hdr)); + MPASS(sc->vtnet_hdr_size == sizeof(rxhdr->vrh_uhdr.hdr) || + sc->vtnet_hdr_size == sizeof(rxhdr->vrh_uhdr.mhdr)); rxhdr = (struct vtnet_rx_header *) mdata; - sglist_append(sg, &rxhdr->vrh_hdr, sc->vtnet_hdr_size); + sglist_append(sg, &rxhdr->vrh_uhdr, sc->vtnet_hdr_size); offset = sizeof(struct vtnet_rx_header); } else offset = 0; Modified: head/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- head/sys/dev/virtio/network/if_vtnetvar.h Mon Jun 8 21:49:42 2020 (r361943) +++ head/sys/dev/virtio/network/if_vtnetvar.h Mon Jun 8 21:51:36 2020 (r361944) @@ -219,15 +219,20 @@ struct vtnet_softc { * When mergeable buffers are not negotiated, the vtnet_rx_header structure * below is placed at the beginning of the mbuf data. Use 4 bytes of pad to * both keep the VirtIO header and the data non-contiguous and to keep the - * frame's payload 4 byte aligned. + * frame's payload 4 byte aligned. Note that non-legacy drivers still want + * room for a full mergeable buffer header. * * When mergeable buffers are negotiated, the host puts the VirtIO header in * the beginning of the first mbuf's data. */ #define VTNET_RX_HEADER_PAD 4 struct vtnet_rx_header { - struct virtio_net_hdr vrh_hdr; - char vrh_pad[VTNET_RX_HEADER_PAD]; + union { + struct virtio_net_hdr hdr; + struct virtio_net_hdr_mrg_rxbuf mhdr; + } vrh_uhdr; + + char vrh_pad[VTNET_RX_HEADER_PAD]; } __packed; /* @@ -296,7 +301,8 @@ CTASSERT(sizeof(struct vtnet_mac_filter) <= PAGE_SIZE) VIRTIO_NET_F_MRG_RXBUF | \ VIRTIO_NET_F_MQ | \ VIRTIO_RING_F_EVENT_IDX | \ - VIRTIO_RING_F_INDIRECT_DESC) + VIRTIO_RING_F_INDIRECT_DESC | \ + VIRTIO_F_VERSION_1) /* * The VIRTIO_NET_F_HOST_TSO[46] features permit us to send the host Modified: head/sys/dev/virtio/virtio.c ============================================================================== --- head/sys/dev/virtio/virtio.c Mon Jun 8 21:49:42 2020 (r361943) +++ head/sys/dev/virtio/virtio.c Mon Jun 8 21:51:36 2020 (r361944) @@ -79,6 +79,7 @@ static struct virtio_feature_desc virtio_common_featur { VIRTIO_RING_F_INDIRECT_DESC, "RingIndirect" }, { VIRTIO_RING_F_EVENT_IDX, "EventIdx" }, { VIRTIO_F_BAD_FEATURE, "BadFeature" }, + { VIRTIO_F_VERSION_1, "Version1" }, { 0, NULL } }; Modified: head/sys/dev/virtio/virtqueue.c ============================================================================== --- head/sys/dev/virtio/virtqueue.c Mon Jun 8 21:49:42 2020 (r361943) +++ head/sys/dev/virtio/virtqueue.c Mon Jun 8 21:51:36 2020 (r361944) @@ -142,6 +142,7 @@ virtqueue_filter_features(uint64_t features) mask = (1 << VIRTIO_TRANSPORT_F_START) - 1; mask |= VIRTIO_RING_F_INDIRECT_DESC; mask |= VIRTIO_RING_F_EVENT_IDX; + mask |= VIRTIO_F_VERSION_1; return (features & mask); } From owner-svn-src-head@freebsd.org Mon Jun 8 22:29:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 330AF33CFA9; Mon, 8 Jun 2020 22:29:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gnxY0cdzz3TKJ; Mon, 8 Jun 2020 22:29:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 105A0BC89; Mon, 8 Jun 2020 22:29:53 +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 058MTqCK027092; Mon, 8 Jun 2020 22:29:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 058MTqZj027091; Mon, 8 Jun 2020 22:29:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006082229.058MTqZj027091@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 8 Jun 2020 22:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361945 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 361945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 08 Jun 2020 22:29:53 -0000 Author: markj Date: Mon Jun 8 22:29:52 2020 New Revision: 361945 URL: https://svnweb.freebsd.org/changeset/base/361945 Log: Stop computing a "sharedram" value when emulating Linux sysinfo(2). The previous code was computing an incorrect value in a very expensive manner. "sharedram" is supposed to be the amount of memory used by named swap objects, which on FreeBSD basically corresponds to memory usage by shared memory objects (including, for example, GEM objects) and tmpfs. We currently have no cheap way to count such pages. The previous code tried to determine the number of copy-on-write pages shared between processes. Just replace the computed value with 0. illumos reportedly does the same thing. Linux itself did not populate this field until a 2014 commit, "mm: export NR_SHMEM via sysinfo(2) / si_meminfo() interfaces". Reported by: mjg MFC after: 1 week Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Mon Jun 8 21:51:36 2020 (r361944) +++ head/sys/compat/linux/linux_misc.c Mon Jun 8 22:29:52 2020 (r361945) @@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef COMPAT_LINUX32 @@ -151,7 +150,6 @@ int linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) { struct l_sysinfo sysinfo; - vm_object_t object; int i, j; struct timespec ts; @@ -170,13 +168,6 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_ sysinfo.freeram = sysinfo.totalram - vm_wire_count() * PAGE_SIZE; sysinfo.sharedram = 0; - mtx_lock(&vm_object_list_mtx); - TAILQ_FOREACH(object, &vm_object_list, object_list) - if (object->shadow_count > 1) - sysinfo.sharedram += object->resident_page_count; - mtx_unlock(&vm_object_list_mtx); - - sysinfo.sharedram *= PAGE_SIZE; sysinfo.bufferram = 0; swap_pager_status(&i, &j); From owner-svn-src-head@freebsd.org Tue Jun 9 05:01:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFF89348B23; Tue, 9 Jun 2020 05:01:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gydH4jknz4Ygw; Tue, 9 Jun 2020 05:01:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D0D1FF6E; Tue, 9 Jun 2020 05:01:23 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05951N15068235; Tue, 9 Jun 2020 05:01:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05951NVo068234; Tue, 9 Jun 2020 05:01:23 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202006090501.05951NVo068234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 9 Jun 2020 05:01:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361956 - head/usr.sbin/mountd X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/usr.sbin/mountd X-SVN-Commit-Revision: 361956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 05:01:23 -0000 Author: rmacklem Date: Tue Jun 9 05:01:23 2020 New Revision: 361956 URL: https://svnweb.freebsd.org/changeset/base/361956 Log: Fix a bug where XU_NGROUPS + 1 groups might be copied. r361780 fixed the code so that it would only remove the duplicate when it actually existed. However, that might have resulted in XU_NGROUPS + 1 groups being copied, running off the end of the array. This patch fixes the problem. Spotted during code inspection for other mountd changes. MFC after: 2 weeks Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Jun 9 02:07:43 2020 (r361955) +++ head/usr.sbin/mountd/mountd.c Tue Jun 9 05:01:23 2020 (r361956) @@ -3481,6 +3481,8 @@ parsecred(char *namelist, struct xucred *cr) cr->cr_groups[cnt - 1] = groups[cnt]; } else { cr->cr_ngroups = ngroups; + if (cr->cr_ngroups > XU_NGROUPS) + cr->cr_ngroups = XU_NGROUPS; for (cnt = 1; cnt < ngroups; cnt++) cr->cr_groups[cnt] = groups[cnt]; } From owner-svn-src-head@freebsd.org Tue Jun 9 05:35:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E4F23495DC; Tue, 9 Jun 2020 05:35:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gzNq1xgqz4dTq; Tue, 9 Jun 2020 05:35:39 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37034108E1; Tue, 9 Jun 2020 05:35:39 +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 0595ZdZT091970; Tue, 9 Jun 2020 05:35:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0595ZcCv091967; Tue, 9 Jun 2020 05:35:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202006090535.0595ZcCv091967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 9 Jun 2020 05:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361957 - head/contrib/wpa/src/wps X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/wpa/src/wps X-SVN-Commit-Revision: 361957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 05:35:39 -0000 Author: cy Date: Tue Jun 9 05:35:38 2020 New Revision: 361957 URL: https://svnweb.freebsd.org/changeset/base/361957 Log: MFV r361936: Upstream commit message: [PATCH 1/3] WPS UPnP: Do not allow event subscriptions with URLs to other networks The UPnP Device Architecture 2.0 specification errata ("UDA errata 16-04-2020.docx") addresses a problem with notifications being allowed to go out to other domains by disallowing such cases. Do such filtering for the notification callback URLs to avoid undesired connections to external networks based on subscriptions that any device in the local network could request when WPS support for external registrars is enabled (the upnp_iface parameter in hostapd configuration). Obtained from: https://w1.fi/security/2020-1/\ 0001-WPS-UPnP-Do-not-allow-event-subscriptions-with-URLs-.patch MFC after: 3 days Security: VU#339275 and CVE-2020-12695 Modified: head/contrib/wpa/src/wps/wps_er.c head/contrib/wpa/src/wps/wps_upnp.c head/contrib/wpa/src/wps/wps_upnp_i.h Directory Properties: head/contrib/wpa/ (props changed) Modified: head/contrib/wpa/src/wps/wps_er.c ============================================================================== --- head/contrib/wpa/src/wps/wps_er.c Tue Jun 9 05:01:23 2020 (r361956) +++ head/contrib/wpa/src/wps/wps_er.c Tue Jun 9 05:35:38 2020 (r361957) @@ -1298,7 +1298,7 @@ wps_er_init(struct wps_context *wps, const char *ifnam "with %s", filter); } if (get_netif_info(er->ifname, &er->ip_addr, &er->ip_addr_text, - er->mac_addr)) { + NULL, er->mac_addr)) { wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address " "for %s. Does it have IP address?", er->ifname); wps_er_deinit(er, NULL, NULL); Modified: head/contrib/wpa/src/wps/wps_upnp.c ============================================================================== --- head/contrib/wpa/src/wps/wps_upnp.c Tue Jun 9 05:01:23 2020 (r361956) +++ head/contrib/wpa/src/wps/wps_upnp.c Tue Jun 9 05:35:38 2020 (r361957) @@ -303,6 +303,14 @@ static void subscr_addr_free_all(struct subscription * } +static int local_network_addr(struct upnp_wps_device_sm *sm, + struct sockaddr_in *addr) +{ + return (addr->sin_addr.s_addr & sm->netmask.s_addr) == + (sm->ip_addr & sm->netmask.s_addr); +} + + /* subscr_addr_add_url -- add address(es) for one url to subscription */ static void subscr_addr_add_url(struct subscription *s, const char *url, size_t url_len) @@ -381,6 +389,7 @@ static void subscr_addr_add_url(struct subscription *s for (rp = result; rp; rp = rp->ai_next) { struct subscr_addr *a; + struct sockaddr_in *addr = (struct sockaddr_in *) rp->ai_addr; /* Limit no. of address to avoid denial of service attack */ if (dl_list_len(&s->addr_list) >= MAX_ADDR_PER_SUBSCRIPTION) { @@ -389,6 +398,13 @@ static void subscr_addr_add_url(struct subscription *s break; } + if (!local_network_addr(s->sm, addr)) { + wpa_printf(MSG_INFO, + "WPS UPnP: Ignore a delivery URL that points to another network %s", + inet_ntoa(addr->sin_addr)); + continue; + } + a = os_zalloc(sizeof(*a) + alloc_len); if (a == NULL) break; @@ -889,11 +905,12 @@ static int eth_get(const char *device, u8 ea[ETH_ALEN] * @net_if: Selected network interface name * @ip_addr: Buffer for returning IP address in network byte order * @ip_addr_text: Buffer for returning a pointer to allocated IP address text + * @netmask: Buffer for returning netmask or %NULL if not needed * @mac: Buffer for returning MAC address * Returns: 0 on success, -1 on failure */ int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text, - u8 mac[ETH_ALEN]) + struct in_addr *netmask, u8 mac[ETH_ALEN]) { struct ifreq req; int sock = -1; @@ -919,6 +936,19 @@ int get_netif_info(const char *net_if, unsigned *ip_ad in_addr.s_addr = *ip_addr; os_snprintf(*ip_addr_text, 16, "%s", inet_ntoa(in_addr)); + if (netmask) { + os_memset(&req, 0, sizeof(req)); + os_strlcpy(req.ifr_name, net_if, sizeof(req.ifr_name)); + if (ioctl(sock, SIOCGIFNETMASK, &req) < 0) { + wpa_printf(MSG_ERROR, + "WPS UPnP: SIOCGIFNETMASK failed: %d (%s)", + errno, strerror(errno)); + goto fail; + } + addr = (struct sockaddr_in *) &req.ifr_netmask; + netmask->s_addr = addr->sin_addr.s_addr; + } + #ifdef __linux__ os_strlcpy(req.ifr_name, net_if, sizeof(req.ifr_name)); if (ioctl(sock, SIOCGIFHWADDR, &req) < 0) { @@ -1025,11 +1055,15 @@ static int upnp_wps_device_start(struct upnp_wps_devic /* Determine which IP and mac address we're using */ if (get_netif_info(net_if, &sm->ip_addr, &sm->ip_addr_text, - sm->mac_addr)) { + &sm->netmask, sm->mac_addr)) { wpa_printf(MSG_INFO, "WPS UPnP: Could not get IP/MAC address " "for %s. Does it have IP address?", net_if); goto fail; } + wpa_printf(MSG_DEBUG, "WPS UPnP: Local IP address %s netmask %s hwaddr " + MACSTR, + sm->ip_addr_text, inet_ntoa(sm->netmask), + MAC2STR(sm->mac_addr)); /* Listen for incoming TCP connections so that others * can fetch our "xml files" from us. Modified: head/contrib/wpa/src/wps/wps_upnp_i.h ============================================================================== --- head/contrib/wpa/src/wps/wps_upnp_i.h Tue Jun 9 05:01:23 2020 (r361956) +++ head/contrib/wpa/src/wps/wps_upnp_i.h Tue Jun 9 05:35:38 2020 (r361957) @@ -128,6 +128,7 @@ struct upnp_wps_device_sm { u8 mac_addr[ETH_ALEN]; /* mac addr of network i.f. we use */ char *ip_addr_text; /* IP address of network i.f. we use */ unsigned ip_addr; /* IP address of network i.f. we use (host order) */ + struct in_addr netmask; int multicast_sd; /* send multicast messages over this socket */ int ssdp_sd; /* receive discovery UPD packets on socket */ int ssdp_sd_registered; /* nonzero if we must unregister */ @@ -158,7 +159,7 @@ struct subscription * subscription_find(struct upnp_wp const u8 uuid[UUID_LEN]); void subscr_addr_delete(struct subscr_addr *a); int get_netif_info(const char *net_if, unsigned *ip_addr, char **ip_addr_text, - u8 mac[ETH_ALEN]); + struct in_addr *netmask, u8 mac[ETH_ALEN]); /* wps_upnp_ssdp.c */ void msearchreply_state_machine_stop(struct advertisement_state_machine *a); From owner-svn-src-head@freebsd.org Tue Jun 9 05:38:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7452134972A; Tue, 9 Jun 2020 05:38:13 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gzRn2YRtz4dgx; Tue, 9 Jun 2020 05:38:13 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3983910CF3; Tue, 9 Jun 2020 05:38:13 +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 0595cDOR092124; Tue, 9 Jun 2020 05:38:13 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0595cCtZ092122; Tue, 9 Jun 2020 05:38:12 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202006090538.0595cCtZ092122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 9 Jun 2020 05:38:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361958 - head/contrib/wpa/src/wps X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/wpa/src/wps X-SVN-Commit-Revision: 361958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 05:38:13 -0000 Author: cy Date: Tue Jun 9 05:38:12 2020 New Revision: 361958 URL: https://svnweb.freebsd.org/changeset/base/361958 Log: MFV r361937: Upstream commit message: [PATCH 2/3] WPS UPnP: Fix event message generation using a long URL path More than about 700 character URL ended up overflowing the wpabuf used for building the event notification and this resulted in the wpabuf buffer overflow checks terminating the hostapd process. Fix this by allocating the buffer to be large enough to contain the full URL path. However, since that around 700 character limit has been the practical limit for more than ten years, start explicitly enforcing that as the limit or the callback URLs since any longer ones had not worked before and there is no need to enable them now either. Obtained from: https://w1.fi/security/2020-1/\ 0002-WPS-UPnP-Fix-event-message-generation-using-a-long-U.patch MFC after: 3 days Security: VU#339275 and CVE-2020-12695 Modified: head/contrib/wpa/src/wps/wps_upnp.c head/contrib/wpa/src/wps/wps_upnp_event.c Directory Properties: head/contrib/wpa/ (props changed) Modified: head/contrib/wpa/src/wps/wps_upnp.c ============================================================================== --- head/contrib/wpa/src/wps/wps_upnp.c Tue Jun 9 05:35:38 2020 (r361957) +++ head/contrib/wpa/src/wps/wps_upnp.c Tue Jun 9 05:38:12 2020 (r361958) @@ -328,9 +328,14 @@ static void subscr_addr_add_url(struct subscription *s int rerr; size_t host_len, path_len; - /* url MUST begin with http: */ - if (url_len < 7 || os_strncasecmp(url, "http://", 7)) + /* URL MUST begin with HTTP scheme. In addition, limit the length of + * the URL to 700 characters which is around the limit that was + * implicitly enforced for more than 10 years due to a bug in + * generating the event messages. */ + if (url_len < 7 || os_strncasecmp(url, "http://", 7) || url_len > 700) { + wpa_printf(MSG_DEBUG, "WPS UPnP: Reject an unacceptable URL"); goto fail; + } url += 7; url_len -= 7; Modified: head/contrib/wpa/src/wps/wps_upnp_event.c ============================================================================== --- head/contrib/wpa/src/wps/wps_upnp_event.c Tue Jun 9 05:35:38 2020 (r361957) +++ head/contrib/wpa/src/wps/wps_upnp_event.c Tue Jun 9 05:38:12 2020 (r361958) @@ -147,7 +147,8 @@ static struct wpabuf * event_build_message(struct wps_ struct wpabuf *buf; char *b; - buf = wpabuf_alloc(1000 + wpabuf_len(e->data)); + buf = wpabuf_alloc(1000 + os_strlen(e->addr->path) + + wpabuf_len(e->data)); if (buf == NULL) return NULL; wpabuf_printf(buf, "NOTIFY %s HTTP/1.1\r\n", e->addr->path); From owner-svn-src-head@freebsd.org Tue Jun 9 05:39:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49F813496C7; Tue, 9 Jun 2020 05:39:38 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gzTQ1Dvmz4dtY; Tue, 9 Jun 2020 05:39:38 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25B2C10BA7; Tue, 9 Jun 2020 05:39:38 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0595dcvI092363; Tue, 9 Jun 2020 05:39:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0595dcVl092362; Tue, 9 Jun 2020 05:39:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202006090539.0595dcVl092362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 9 Jun 2020 05:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361959 - head/contrib/wpa/src/wps X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/wpa/src/wps X-SVN-Commit-Revision: 361959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 05:39:38 -0000 Author: cy Date: Tue Jun 9 05:39:37 2020 New Revision: 361959 URL: https://svnweb.freebsd.org/changeset/base/361959 Log: MFV r361938: Upstream commit message: [PATCH 3/3] WPS UPnP: Handle HTTP initiation failures for events more properly While it is appropriate to try to retransmit the event to another callback URL on a failure to initiate the HTTP client connection, there is no point in trying the exact same operation multiple times in a row. Replve the event_retry() calls with event_addr_failure() for these cases to avoid busy loops trying to repeat the same failing operation. These potential busy loops would go through eloop callbacks, so the process is not completely stuck on handling them, but unnecessary CPU would be used to process the continues retries that will keep failing for the same reason. Obtained from: https://w1.fi/security/2020-1/\ 0003-WPS-UPnP-Handle-HTTP-initiation-failures-for-events-.patch MFC after: 3 days Security: VU#339275 and CVE-2020-12695 Modified: head/contrib/wpa/src/wps/wps_upnp_event.c Directory Properties: head/contrib/wpa/ (props changed) Modified: head/contrib/wpa/src/wps/wps_upnp_event.c ============================================================================== --- head/contrib/wpa/src/wps/wps_upnp_event.c Tue Jun 9 05:38:12 2020 (r361958) +++ head/contrib/wpa/src/wps/wps_upnp_event.c Tue Jun 9 05:39:37 2020 (r361959) @@ -294,7 +294,7 @@ static int event_send_start(struct subscription *s) buf = event_build_message(e); if (buf == NULL) { - event_retry(e, 0); + event_addr_failure(e); return -1; } @@ -302,7 +302,7 @@ static int event_send_start(struct subscription *s) event_http_cb, e); if (e->http_event == NULL) { wpabuf_free(buf); - event_retry(e, 0); + event_addr_failure(e); return -1; } From owner-svn-src-head@freebsd.org Tue Jun 9 05:43:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EBF63497DF; Tue, 9 Jun 2020 05:43:51 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49gzZH3lkRz4fCs; Tue, 9 Jun 2020 05:43:51 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C05D10F02; Tue, 9 Jun 2020 05:43:51 +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 0595hpNm098316; Tue, 9 Jun 2020 05:43:51 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0595hpmP098315; Tue, 9 Jun 2020 05:43:51 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202006090543.0595hpmP098315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 9 Jun 2020 05:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361960 - head/contrib/wpa/src/wps X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/wpa/src/wps X-SVN-Commit-Revision: 361960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 05:43:51 -0000 Author: cy Date: Tue Jun 9 05:43:51 2020 New Revision: 361960 URL: https://svnweb.freebsd.org/changeset/base/361960 Log: Post CVE-2020-12695 cleanup patch: Resolve a Linuxism to fix the build. MFC after: 3 days X-MFC with: r361957, r361958, r361959 Modified: head/contrib/wpa/src/wps/wps_upnp.c Modified: head/contrib/wpa/src/wps/wps_upnp.c ============================================================================== --- head/contrib/wpa/src/wps/wps_upnp.c Tue Jun 9 05:39:37 2020 (r361959) +++ head/contrib/wpa/src/wps/wps_upnp.c Tue Jun 9 05:43:51 2020 (r361960) @@ -950,7 +950,11 @@ int get_netif_info(const char *net_if, unsigned *ip_ad errno, strerror(errno)); goto fail; } +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + addr = (struct sockaddr_in *) &req.ifr_addr; +#else addr = (struct sockaddr_in *) &req.ifr_netmask; +#endif netmask->s_addr = addr->sin_addr.s_addr; } From owner-svn-src-head@freebsd.org Tue Jun 9 07:07:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 373D934C109; Tue, 9 Jun 2020 07:07:30 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49h1Qp0H5nz3bn0; Tue, 9 Jun 2020 07:07:30 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04D8111F09; Tue, 9 Jun 2020 07:07:30 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05977TxK048870; Tue, 9 Jun 2020 07:07:29 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05977TI2048869; Tue, 9 Jun 2020 07:07:29 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202006090707.05977TI2048869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Tue, 9 Jun 2020 07:07:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361962 - head/bin/ps X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/bin/ps X-SVN-Commit-Revision: 361962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 07:07:30 -0000 Author: yuripv Date: Tue Jun 9 07:07:29 2020 New Revision: 361962 URL: https://svnweb.freebsd.org/changeset/base/361962 Log: ps: remove xo_no_setlocale() call Apparently libxo was fixed to do the right thing on FreeBSD, and calling xo_no_setlocale() is no longer needed. Reported by: phil Modified: head/bin/ps/ps.c Modified: head/bin/ps/ps.c ============================================================================== --- head/bin/ps/ps.c Tue Jun 9 06:48:25 2020 (r361961) +++ head/bin/ps/ps.c Tue Jun 9 07:07:29 2020 (r361962) @@ -192,7 +192,6 @@ main(int argc, char *argv[]) char fmtbuf[_POSIX2_LINE_MAX]; (void) setlocale(LC_ALL, ""); - xo_no_setlocale(); time(&now); /* Used by routines in print.c. */ /* From owner-svn-src-head@freebsd.org Tue Jun 9 09:42:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF04F34EB25; Tue, 9 Jun 2020 09:42:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49h4sq624sz48LN; Tue, 9 Jun 2020 09:42:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA3A913BB0; Tue, 9 Jun 2020 09:42:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0599gdcE047104; Tue, 9 Jun 2020 09:42:39 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0599gdba047103; Tue, 9 Jun 2020 09:42:39 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202006090942.0599gdba047103@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 9 Jun 2020 09:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361964 - head/sys/dev/cpufreq X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/cpufreq X-SVN-Commit-Revision: 361964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 09:42:40 -0000 Author: manu Date: Tue Jun 9 09:42:39 2020 New Revision: 361964 URL: https://svnweb.freebsd.org/changeset/base/361964 Log: coufreq_dt: Rename DEBUG to DPRINTF DEBUG is a kernel configuration flag and if used cpufreq_dt.c will fail the build of kernel. PR: 246867 Submitted by: Oskar Holmund (oskar.holmlund@ohdata.se) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25080 Modified: head/sys/dev/cpufreq/cpufreq_dt.c Modified: head/sys/dev/cpufreq/cpufreq_dt.c ============================================================================== --- head/sys/dev/cpufreq/cpufreq_dt.c Tue Jun 9 09:04:57 2020 (r361963) +++ head/sys/dev/cpufreq/cpufreq_dt.c Tue Jun 9 09:42:39 2020 (r361964) @@ -52,9 +52,9 @@ __FBSDID("$FreeBSD$"); #include "cpufreq_if.h" #if 0 -#define DEBUG(dev, msg...) device_printf(dev, "cpufreq_dt: " msg); +#define DPRINTF(dev, msg...) device_printf(dev, "cpufreq_dt: " msg); #else -#define DEBUG(dev, msg...) +#define DPRINTF(dev, msg...) #endif enum opp_version { @@ -110,12 +110,12 @@ cpufreq_dt_find_opp(device_t dev, uint64_t freq) sc = device_get_softc(dev); - DEBUG(dev, "Looking for freq %ju\n", freq); + DPRINTF(dev, "Looking for freq %ju\n", freq); for (n = 0; n < sc->nopp; n++) if (CPUFREQ_CMP(sc->opp[n].freq, freq)) return (&sc->opp[n]); - DEBUG(dev, "Couldn't find one\n"); + DPRINTF(dev, "Couldn't find one\n"); return (NULL); } @@ -144,7 +144,7 @@ cpufreq_dt_get(device_t dev, struct cf_setting *set) sc = device_get_softc(dev); - DEBUG(dev, "cpufreq_dt_get\n"); + DPRINTF(dev, "cpufreq_dt_get\n"); if (clk_get_freq(sc->clk, &freq) != 0) return (ENXIO); @@ -156,7 +156,7 @@ cpufreq_dt_get(device_t dev, struct cf_setting *set) cpufreq_dt_opp_to_setting(dev, opp, set); - DEBUG(dev, "Current freq %dMhz\n", set->freq); + DPRINTF(dev, "Current freq %dMhz\n", set->freq); return (0); } @@ -170,10 +170,10 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * sc = device_get_softc(dev); - DEBUG(dev, "Working on cpu %d\n", sc->cpu); - DEBUG(dev, "We have %d cpu on this dev\n", CPU_COUNT(&sc->cpus)); + DPRINTF(dev, "Working on cpu %d\n", sc->cpu); + DPRINTF(dev, "We have %d cpu on this dev\n", CPU_COUNT(&sc->cpus)); if (!CPU_ISSET(sc->cpu, &sc->cpus)) { - DEBUG(dev, "Not for this CPU\n"); + DPRINTF(dev, "Not for this CPU\n"); return (0); } @@ -205,26 +205,26 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * device_printf(dev, "Couldn't find an opp for this freq\n"); return (EINVAL); } - DEBUG(sc->dev, "Current freq %ju, uvolt: %d\n", freq, uvolt); - DEBUG(sc->dev, "Target freq %ju, , uvolt: %d\n", + DPRINTF(sc->dev, "Current freq %ju, uvolt: %d\n", freq, uvolt); + DPRINTF(sc->dev, "Target freq %ju, , uvolt: %d\n", opp->freq, opp->uvolt_target); if (uvolt < opp->uvolt_target) { - DEBUG(dev, "Changing regulator from %u to %u\n", + DPRINTF(dev, "Changing regulator from %u to %u\n", uvolt, opp->uvolt_target); error = regulator_set_voltage(sc->reg, opp->uvolt_min, opp->uvolt_max); if (error != 0) { - DEBUG(dev, "Failed, backout\n"); + DPRINTF(dev, "Failed, backout\n"); return (ENXIO); } } - DEBUG(dev, "Setting clk to %ju\n", opp->freq); + DPRINTF(dev, "Setting clk to %ju\n", opp->freq); error = clk_set_freq(sc->clk, opp->freq, CLK_SET_ROUND_DOWN); if (error != 0) { - DEBUG(dev, "Failed, backout\n"); + DPRINTF(dev, "Failed, backout\n"); /* Restore previous voltage (best effort) */ error = regulator_set_voltage(sc->reg, copp->uvolt_min, @@ -233,13 +233,13 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * } if (uvolt > opp->uvolt_target) { - DEBUG(dev, "Changing regulator from %u to %u\n", + DPRINTF(dev, "Changing regulator from %u to %u\n", uvolt, opp->uvolt_target); error = regulator_set_voltage(sc->reg, opp->uvolt_min, opp->uvolt_max); if (error != 0) { - DEBUG(dev, "Failed to switch regulator to %d\n", + DPRINTF(dev, "Failed to switch regulator to %d\n", opp->uvolt_target); /* Restore previous CPU frequency (best effort) */ (void)clk_set_freq(sc->clk, copp->freq, 0); @@ -270,7 +270,7 @@ cpufreq_dt_settings(device_t dev, struct cf_setting *s struct cpufreq_dt_softc *sc; ssize_t n; - DEBUG(dev, "cpufreq_dt_settings\n"); + DPRINTF(dev, "cpufreq_dt_settings\n"); if (sets == NULL || count == NULL) return (EINVAL); @@ -464,7 +464,7 @@ cpufreq_dt_attach(device_t dev) node = ofw_bus_get_node(device_get_parent(dev)); sc->cpu = device_get_unit(device_get_parent(dev)); - DEBUG(dev, "cpu=%d\n", sc->cpu); + DPRINTF(dev, "cpu=%d\n", sc->cpu); if (sc->cpu >= mp_ncpus) { device_printf(dev, "Not attaching as cpu is not present\n"); return (ENXIO); @@ -518,12 +518,12 @@ cpufreq_dt_attach(device_t dev) if (strcmp(device_type, "cpu") != 0) continue; if (cpu == sc->cpu) { - DEBUG(dev, "Skipping our cpu\n"); + DPRINTF(dev, "Skipping our cpu\n"); CPU_SET(cpu, &sc->cpus); cpu++; continue; } - DEBUG(dev, "Testing CPU %d\n", cpu); + DPRINTF(dev, "Testing CPU %d\n", cpu); copp = -1; if (version == OPP_V1) OF_getencprop(cnode, "operating-points", &copp, @@ -532,7 +532,8 @@ cpufreq_dt_attach(device_t dev) OF_getencprop(cnode, "operating-points-v2", &copp, sizeof(copp)); if (opp == copp) { - DEBUG(dev, "CPU %d is using the same opp as this one (%d)\n", cpu, sc->cpu); + DPRINTF(dev, "CPU %d is using the same opp as this one (%d)\n", + cpu, sc->cpu); CPU_SET(cpu, &sc->cpus); } cpu++; From owner-svn-src-head@freebsd.org Tue Jun 9 14:16:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4548B32E927; Tue, 9 Jun 2020 14:16:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hBxb17c0z3RgZ; Tue, 9 Jun 2020 14:16:19 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2226F16EF6; Tue, 9 Jun 2020 14:16:19 +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 059EGIjX013470; Tue, 9 Jun 2020 14:16:18 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059EGIZt013469; Tue, 9 Jun 2020 14:16:18 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202006091416.059EGIZt013469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 9 Jun 2020 14:16:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361965 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 361965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 14:16:19 -0000 Author: mjg Date: Tue Jun 9 14:16:18 2020 New Revision: 361965 URL: https://svnweb.freebsd.org/changeset/base/361965 Log: vm: rework swap_pager_status to execute in constant time The lock-protected iteration is trivially avoidable. This removes a serialisation point from Linux binaries (which end up calling here from the sysinfo syscall). Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Jun 9 09:42:39 2020 (r361964) +++ head/sys/vm/swap_pager.c Tue Jun 9 14:16:18 2020 (r361965) @@ -2541,16 +2541,10 @@ swapoff_all(void) void swap_pager_status(int *total, int *used) { - struct swdevt *sp; - *total = 0; - *used = 0; - mtx_lock(&sw_dev_mtx); - TAILQ_FOREACH(sp, &swtailq, sw_list) { - *total += sp->sw_nblks; - *used += sp->sw_used; - } - mtx_unlock(&sw_dev_mtx); + *total = swap_total; + *used = swap_total - swap_pager_avail - + nswapdev * howmany(BBSIZE, PAGE_SIZE); } int From owner-svn-src-head@freebsd.org Tue Jun 9 14:26:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0F0532ED17; Tue, 9 Jun 2020 14:26:06 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hC8t0cWZz3SwS; Tue, 9 Jun 2020 14:26:05 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x429.google.com with SMTP id c3so21523219wru.12; Tue, 09 Jun 2020 07:26:05 -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=h8o4blXwzfFfG8ivDcyU3CaU17w0OVG2LBdZ9+ksPwE=; b=Yp03E0u8seyfsXcDOKNKdxwqQEnE2zndAHK0LU5J2wb1z+FaZ4NM2XfZSL/F0LftbS UelvU01D9klsMBph/gyCzpicWJKNbfy2BHCoUOFGwFjv/Di6VBhHfAqVBWu2Is3phITD hMK+gkBB9xiObuxSFrR53SMOM0iMvZ3eWjlgjuphJ/0z+z81xPpWyHaL967lzUuErKuC JdyY2tfXxPunlpN58g2nB/+PQSEkaNRAzv1OIbUsqiruJH+0lrahhDi6MD8DwieU5neJ +ph3yobck1x4BQzZfmB5yHoLpWDcUtZVio2f62A+ZpE6qWkiBe3cJ1MyB42VspTcMC4j LPPg== 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=h8o4blXwzfFfG8ivDcyU3CaU17w0OVG2LBdZ9+ksPwE=; b=kb2qkB1T69CFXpyzvvMdRNT7SlbwU7NICGVXsCoaS3T4vSoi4TeBkzSH2GSQoI1YPL IXYxHbBJkc1/eadOvluXjD0uzNAa0UXxV7t4aAcvkEuWXFJ4fJiqOpoa8Gfdg5kAvc+/ dzXgj9xb7ixMs3S744/iC4jkt7n942n+h9uNrpUlY+yRBcN1azeoHAe9Wcx+FL0+1lpy EAq1k/jChLcbU9bGo6Rv2eTs8MdR4xNwtmdQE2UN/uhpr+cOKNuiTIKa8TnxNIvgU4oV 30zeQbTY6EVRDL4GUPBaanqOtn7nvhTQXXNWknFE65ylaPLWMs199I5z+f3rg6xh6+HB oebA== X-Gm-Message-State: AOAM531zzil+7UiU0PrDTm63Usa4k9pw8ZxQGPVus/gmiz8Bh5KFJffs 2vzRQ3gl1/OnTy7N4SSSozQb1rsy/hw6NEvnf8cm+gr4 X-Google-Smtp-Source: ABdhPJxC1i0LAhnyXWa9tzMji+Zi3WZo3QzSi5qdx1Y7IDSI/qWO4E+OSoNbm59me/sxwcIw30BdhNSCbuWY8OfDxA4= X-Received: by 2002:a05:6000:18c:: with SMTP id p12mr5114719wrx.66.1591712764293; Tue, 09 Jun 2020 07:26:04 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:fd8f:0:0:0:0:0 with HTTP; Tue, 9 Jun 2020 07:26:03 -0700 (PDT) In-Reply-To: <202006070457.0574vm7f075947@repo.freebsd.org> References: <202006070457.0574vm7f075947@repo.freebsd.org> From: Mateusz Guzik Date: Tue, 9 Jun 2020 16:26:03 +0200 Message-ID: Subject: Re: svn commit: r361885 - head/sys/net80211 To: Adrian Chadd Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 49hC8t0cWZz3SwS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Yp03E0u8; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::429 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.09 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.985]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.03)[-1.026]; TO_DN_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::429:from]; NEURAL_HAM_SHORT(-0.08)[-0.081]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 14:26:06 -0000 On 6/7/20, Adrian Chadd wrote: > Author: adrian > Date: Sun Jun 7 04:57:48 2020 > New Revision: 361885 > URL: https://svnweb.freebsd.org/changeset/base/361885 > > Log: > [net80211] Add a method to return the vap's ifname. > > This removes the requirement to know what's in the ifp. > > (If someone wants a quick clean-up task, it'd be nice to convert > instances > of ifp dereferencing for if_xname over to this method.) > > Modified: > head/sys/net80211/ieee80211_freebsd.c > head/sys/net80211/ieee80211_freebsd.h > > Modified: head/sys/net80211/ieee80211_freebsd.c > ============================================================================== > --- head/sys/net80211/ieee80211_freebsd.c Sun Jun 7 04:32:38 > 2020 (r361884) > +++ head/sys/net80211/ieee80211_freebsd.c Sun Jun 7 04:57:48 > 2020 (r361885) > @@ -1034,6 +1034,20 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp) > } > > /* > + * Fetch the VAP name. > + * > + * This returns a const char pointer suitable for debugging, > + * but don't expect it to stick around for much longer. > + */ > +const char * > +ieee80211_get_vap_ifname(struct ieee80211vap *vap) > +{ > + if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL)) > + return "(none)"; > + return vap->iv_ifp->if_xname; > +} > + This gives me: /usr/src/sys/net80211/ieee80211_freebsd.c:1045:45: warning: comparison of array 'vap->iv_ifp->if_xname' equal to a null pointer is always false [-Wtautological-pointer-compare] if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL)) -- Mateusz Guzik From owner-svn-src-head@freebsd.org Tue Jun 9 15:17:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0901033023B; Tue, 9 Jun 2020 15:17:24 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hDJ36WWDz3YkP; Tue, 9 Jun 2020 15:17:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAD8F17A12; Tue, 9 Jun 2020 15:17:23 +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 059FHNX9050197; Tue, 9 Jun 2020 15:17:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059FHNS9050196; Tue, 9 Jun 2020 15:17:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202006091517.059FHNS9050196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 9 Jun 2020 15:17:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361967 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 361967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 15:17:24 -0000 Author: mjg Date: Tue Jun 9 15:17:23 2020 New Revision: 361967 URL: https://svnweb.freebsd.org/changeset/base/361967 Log: Assert on pg_jobc state. Stolen from NetBSD. Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Jun 9 14:20:16 2020 (r361966) +++ head/sys/kern/kern_proc.c Tue Jun 9 15:17:23 2020 (r361967) @@ -751,9 +751,11 @@ pgadjustjobc(struct pgrp *pgrp, int entering) { PGRP_LOCK(pgrp); - if (entering) + if (entering) { + MPASS(pgrp->pg_jobc >= 0); pgrp->pg_jobc++; - else { + } else { + MPASS(pgrp->pg_jobc > 0); --pgrp->pg_jobc; if (pgrp->pg_jobc == 0) orphanpg(pgrp); From owner-svn-src-head@freebsd.org Tue Jun 9 15:56:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEF993312FA; Tue, 9 Jun 2020 15:56:43 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hF9R52Wnz3dsG; Tue, 9 Jun 2020 15:56:43 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A39E417DCE; Tue, 9 Jun 2020 15:56:43 +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 059FuhVa076642; Tue, 9 Jun 2020 15:56:43 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059FufZl076630; Tue, 9 Jun 2020 15:56:41 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006091556.059FufZl076630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 9 Jun 2020 15:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361968 - in head/sys: arm64/coresight conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/coresight conf X-SVN-Commit-Revision: 361968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 15:56:43 -0000 Author: br Date: Tue Jun 9 15:56:41 2020 New Revision: 361968 URL: https://svnweb.freebsd.org/changeset/base/361968 Log: Rename coresight drivers: use underscores in filenames. Sponsored by: DARPA, AFRL Added: head/sys/arm64/coresight/coresight_cmd.c - copied unchanged from r361967, head/sys/arm64/coresight/coresight-cmd.c head/sys/arm64/coresight/coresight_cpu_debug.c - copied unchanged from r361967, head/sys/arm64/coresight/coresight-cpu-debug.c head/sys/arm64/coresight/coresight_dynamic_replicator.c - copied unchanged from r361967, head/sys/arm64/coresight/coresight-dynamic-replicator.c head/sys/arm64/coresight/coresight_etm4x.c - copied, changed from r361967, head/sys/arm64/coresight/coresight-etm4x.c head/sys/arm64/coresight/coresight_etm4x.h - copied unchanged from r361967, head/sys/arm64/coresight/coresight-etm4x.h head/sys/arm64/coresight/coresight_funnel.c - copied, changed from r361967, head/sys/arm64/coresight/coresight-funnel.c head/sys/arm64/coresight/coresight_funnel.h - copied unchanged from r361967, head/sys/arm64/coresight/coresight-funnel.h head/sys/arm64/coresight/coresight_tmc.c - copied, changed from r361967, head/sys/arm64/coresight/coresight-tmc.c head/sys/arm64/coresight/coresight_tmc.h - copied unchanged from r361967, head/sys/arm64/coresight/coresight-tmc.h Deleted: head/sys/arm64/coresight/coresight-cmd.c head/sys/arm64/coresight/coresight-cpu-debug.c head/sys/arm64/coresight/coresight-dynamic-replicator.c head/sys/arm64/coresight/coresight-etm4x.c head/sys/arm64/coresight/coresight-etm4x.h head/sys/arm64/coresight/coresight-funnel.c head/sys/arm64/coresight/coresight-funnel.h head/sys/arm64/coresight/coresight-tmc.c head/sys/arm64/coresight/coresight-tmc.h Modified: head/sys/conf/files.arm64 Copied: head/sys/arm64/coresight/coresight_cmd.c (from r361967, head/sys/arm64/coresight/coresight-cmd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_cmd.c Tue Jun 9 15:56:41 2020 (r361968, copy of r361967, head/sys/arm64/coresight/coresight-cmd.c) @@ -0,0 +1,156 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "coresight_if.h" + +extern struct coresight_device_list cs_devs; + +static struct coresight_device * +coresight_next_device(struct coresight_device *cs_dev, + struct coresight_event *event) +{ + struct coresight_device *out; + struct endpoint *out_endp; + struct endpoint *endp; + + TAILQ_FOREACH(endp, &cs_dev->pdata->endpoints, link) { + if (endp->slave != 0) + continue; + + out = coresight_get_output_device(endp, &out_endp); + if (out != NULL) { + if (LIST_EMPTY(&event->endplist)) { + /* Add source device */ + endp->cs_dev = cs_dev; + LIST_INSERT_HEAD(&event->endplist, endp, + endplink); + } + + /* Add output device */ + out_endp->cs_dev = out; + LIST_INSERT_HEAD(&event->endplist, out_endp, endplink); + + return (out); + } + } + + return (NULL); +} + +static int +coresight_build_list(struct coresight_device *cs_dev, + struct coresight_event *event) +{ + struct coresight_device *out; + + out = cs_dev; + while (out != NULL) + out = coresight_next_device(out, event); + + return (0); +} + +int +coresight_init_event(int cpu, struct coresight_event *event) +{ + struct coresight_device *cs_dev; + struct endpoint *endp; + + /* Start building path from source device */ + TAILQ_FOREACH(cs_dev, &cs_devs, link) { + if (cs_dev->dev_type == event->src && + cs_dev->pdata->cpu == cpu) { + LIST_INIT(&event->endplist); + coresight_build_list(cs_dev, event); + break; + } + } + + /* Ensure Coresight is initialized for the CPU */ + TAILQ_FOREACH(cs_dev, &cs_devs, link) { + if (cs_dev->dev_type == CORESIGHT_CPU_DEBUG && + cs_dev->pdata->cpu == cpu) + CORESIGHT_INIT(cs_dev->dev); + } + + /* Init all devices in the path */ + LIST_FOREACH(endp, &event->endplist, endplink) { + cs_dev = endp->cs_dev; + CORESIGHT_INIT(cs_dev->dev); + } + + return (0); +} + +void +coresight_enable(int cpu, struct coresight_event *event) +{ + struct coresight_device *cs_dev; + struct endpoint *endp; + + LIST_FOREACH(endp, &event->endplist, endplink) { + cs_dev = endp->cs_dev; + CORESIGHT_ENABLE(cs_dev->dev, endp, event); + } +} + +void +coresight_disable(int cpu, struct coresight_event *event) +{ + struct coresight_device *cs_dev; + struct endpoint *endp; + + LIST_FOREACH(endp, &event->endplist, endplink) { + cs_dev = endp->cs_dev; + CORESIGHT_DISABLE(cs_dev->dev, endp, event); + } +} + +void +coresight_read(int cpu, struct coresight_event *event) +{ + struct endpoint *endp; + + LIST_FOREACH(endp, &event->endplist, endplink) + CORESIGHT_READ(endp->cs_dev->dev, endp, event); +} Copied: head/sys/arm64/coresight/coresight_cpu_debug.c (from r361967, head/sys/arm64/coresight/coresight-cpu-debug.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_cpu_debug.c Tue Jun 9 15:56:41 2020 (r361968, copy of r361967, head/sys/arm64/coresight/coresight-cpu-debug.c) @@ -0,0 +1,164 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 "coresight_if.h" + +#define EDPCSR 0x0a0 +#define EDCIDSR 0x0a4 +#define EDVIDSR 0x0a8 +#define EDPCSR_HI 0x0ac +#define EDOSLAR 0x300 +#define EDPRCR 0x310 +#define EDPRCR_COREPURQ (1 << 3) +#define EDPRCR_CORENPDRQ (1 << 0) +#define EDPRSR 0x314 +#define EDDEVID1 0xfc4 +#define EDDEVID 0xfc8 + +static struct ofw_compat_data compat_data[] = { + { "arm,coresight-cpu-debug", 1 }, + { NULL, 0 } +}; + +struct debug_softc { + struct resource *res; + struct coresight_platform_data *pdata; +}; + +static struct resource_spec debug_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int +debug_init(device_t dev) +{ + struct debug_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + /* Unlock Coresight */ + bus_write_4(sc->res, CORESIGHT_LAR, CORESIGHT_UNLOCK); + + /* Unlock Debug */ + bus_write_4(sc->res, EDOSLAR, 0); + + /* Already initialized? */ + reg = bus_read_4(sc->res, EDPRCR); + if (reg & EDPRCR_CORENPDRQ) + return (0); + + /* Enable power */ + reg |= EDPRCR_COREPURQ; + bus_write_4(sc->res, EDPRCR, reg); + + do { + reg = bus_read_4(sc->res, EDPRSR); + } while ((reg & EDPRCR_CORENPDRQ) == 0); + + return (0); +} + +static int +debug_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Coresight CPU Debug"); + + return (BUS_PROBE_DEFAULT); +} + +static int +debug_attach(device_t dev) +{ + struct coresight_desc desc; + struct debug_softc *sc; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, debug_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + return (ENXIO); + } + + sc->pdata = coresight_get_platform_data(dev); + desc.pdata = sc->pdata; + desc.dev = dev; + desc.dev_type = CORESIGHT_CPU_DEBUG; + coresight_register(&desc); + + return (0); +} + +static device_method_t debug_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, debug_probe), + DEVMETHOD(device_attach, debug_attach), + + /* Coresight interface */ + DEVMETHOD(coresight_init, debug_init), + DEVMETHOD_END +}; + +static driver_t debug_driver = { + "debug", + debug_methods, + sizeof(struct debug_softc), +}; + +static devclass_t debug_devclass; + +EARLY_DRIVER_MODULE(debug, simplebus, debug_driver, debug_devclass, + 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LATE); +MODULE_VERSION(debug, 1); Copied: head/sys/arm64/coresight/coresight_dynamic_replicator.c (from r361967, head/sys/arm64/coresight/coresight-dynamic-replicator.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_dynamic_replicator.c Tue Jun 9 15:56:41 2020 (r361968, copy of r361967, head/sys/arm64/coresight/coresight-dynamic-replicator.c) @@ -0,0 +1,172 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 "coresight_if.h" + +#define REPLICATOR_IDFILTER0 0x00 +#define REPLICATOR_IDFILTER1 0x04 + +static struct ofw_compat_data compat_data[] = { + { "arm,coresight-dynamic-replicator", 1 }, + { NULL, 0 } +}; + +struct replicator_softc { + struct resource *res; + struct coresight_platform_data *pdata; +}; + +static struct resource_spec replicator_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int +replicator_init(device_t dev) +{ + struct replicator_softc *sc; + + sc = device_get_softc(dev); + + /* Unlock Coresight */ + bus_write_4(sc->res, CORESIGHT_LAR, CORESIGHT_UNLOCK); + + return (0); +} + +static int +replicator_enable(device_t dev, struct endpoint *endp, + struct coresight_event *event) +{ + struct replicator_softc *sc; + + sc = device_get_softc(dev); + + /* Enable the port. Keep the other port disabled */ + if (endp->reg == 0) { + bus_write_4(sc->res, REPLICATOR_IDFILTER0, 0x00); + bus_write_4(sc->res, REPLICATOR_IDFILTER1, 0xff); + } else { + bus_write_4(sc->res, REPLICATOR_IDFILTER0, 0xff); + bus_write_4(sc->res, REPLICATOR_IDFILTER1, 0x00); + } + + return (0); +} + +static void +replicator_disable(device_t dev, struct endpoint *endp, + struct coresight_event *event) +{ + struct replicator_softc *sc; + + sc = device_get_softc(dev); + + bus_write_4(sc->res, REPLICATOR_IDFILTER0, 0xff); + bus_write_4(sc->res, REPLICATOR_IDFILTER1, 0xff); +} + +static int +replicator_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Coresight Dynamic Replicator"); + + return (BUS_PROBE_DEFAULT); +} + +static int +replicator_attach(device_t dev) +{ + struct replicator_softc *sc; + struct coresight_desc desc; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, replicator_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + return (ENXIO); + } + + sc->pdata = coresight_get_platform_data(dev); + desc.pdata = sc->pdata; + desc.dev = dev; + desc.dev_type = CORESIGHT_DYNAMIC_REPLICATOR; + coresight_register(&desc); + + return (0); +} + +static device_method_t replicator_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, replicator_probe), + DEVMETHOD(device_attach, replicator_attach), + + /* Coresight interface */ + DEVMETHOD(coresight_init, replicator_init), + DEVMETHOD(coresight_enable, replicator_enable), + DEVMETHOD(coresight_disable, replicator_disable), + DEVMETHOD_END +}; + +static driver_t replicator_driver = { + "replicator", + replicator_methods, + sizeof(struct replicator_softc), +}; + +static devclass_t replicator_devclass; + +DRIVER_MODULE(replicator, simplebus, replicator_driver, replicator_devclass, + 0, 0); +MODULE_VERSION(replicator, 1); Copied and modified: head/sys/arm64/coresight/coresight_etm4x.c (from r361967, head/sys/arm64/coresight/coresight-etm4x.c) ============================================================================== --- head/sys/arm64/coresight/coresight-etm4x.c Tue Jun 9 15:17:23 2020 (r361967, copy source) +++ head/sys/arm64/coresight/coresight_etm4x.c Tue Jun 9 15:56:41 2020 (r361968) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "coresight_if.h" Copied: head/sys/arm64/coresight/coresight_etm4x.h (from r361967, head/sys/arm64/coresight/coresight-etm4x.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_etm4x.h Tue Jun 9 15:56:41 2020 (r361968, copy of r361967, head/sys/arm64/coresight/coresight-etm4x.h) @@ -0,0 +1,175 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 _ARM64_CORESIGHT_ETM4X_H_ +#define _ARM64_CORESIGHT_ETM4X_H_ + +#define TRCPRGCTLR 0x004 /* Trace Programming Control Register */ +#define TRCPRGCTLR_EN (1 << 0) /* Trace unit enable bit */ +#define TRCPROCSELR 0x008 /* Trace PE Select Control Register */ +#define TRCSTATR 0x00C /* Trace Trace Status Register */ +#define TRCSTATR_PMSTABLE (1 << 1) /* The programmers' model is stable. */ +#define TRCSTATR_IDLE (1 << 0) /* The trace unit is idle. */ +#define TRCCONFIGR 0x010 /* Trace Trace Configuration Register */ +#define TRCCONFIGR_DV (1 << 17) /* Data value tracing is enabled when INSTP0 is not 0b00 */ +#define TRCCONFIGR_DA (1 << 16) /* Data address tracing is enabled when INSTP0 is not 0b00. */ +#define TRCCONFIGR_VMIDOPT (1 << 15) /* Control bit to configure the Virtual context identifier value */ +#define TRCCONFIGR_QE_S 13 /* Q element enable field */ +#define TRCCONFIGR_QE_M (0x3 << TRCCONFIGR_QE_S) +#define TRCCONFIGR_RS (1 << 12) /* Return stack enable bit */ +#define TRCCONFIGR_TS (1 << 11) /* Global timestamp tracing is enabled. */ +#define TRCCONFIGR_COND_S 8 /* Conditional instruction tracing bit. */ +#define TRCCONFIGR_COND_M (0x7 << TRCCONFIGR_COND_S) +#define TRCCONFIGR_COND_DIS 0 +#define TRCCONFIGR_COND_LDR (1 << TRCCONFIGR_COND_S) /* Conditional load instructions are traced. */ +#define TRCCONFIGR_COND_STR (2 << TRCCONFIGR_COND_S) /* Conditional store instructions are traced. */ +#define TRCCONFIGR_COND_LDRSTR (3 << TRCCONFIGR_COND_S) /* Conditional load and store instructions are traced. */ +#define TRCCONFIGR_COND_ALL (7 << TRCCONFIGR_COND_S) /* All conditional instructions are traced. */ +#define TRCCONFIGR_VMID (1 << 7) /* Virtual context identifier tracing is enabled. */ +#define TRCCONFIGR_CID (1 << 6) /* Context ID tracing is enabled. */ +#define TRCCONFIGR_CCI (1 << 4) /* Cycle counting in the instruction trace is enabled. */ +#define TRCCONFIGR_BB (1 << 3) /* Branch broadcast mode is enabled. */ +#define TRCCONFIGR_INSTP0_S 1 /* Instruction P0 field. */ +#define TRCCONFIGR_INSTP0_M (0x3 << TRCCONFIGR_INSTP0_S) +#define TRCCONFIGR_INSTP0_NONE 0 /* Do not trace load and store instructions as P0 instructions. */ +#define TRCCONFIGR_INSTP0_LDR (1 << TRCCONFIGR_INSTP0_S) /* Trace load instructions as P0 instructions. */ +#define TRCCONFIGR_INSTP0_STR (2 << TRCCONFIGR_INSTP0_S) /* Trace store instructions as P0 instructions. */ +#define TRCCONFIGR_INSTP0_LDRSTR (3 << TRCCONFIGR_INSTP0_S) /* Trace load and store instructions as P0 instr. */ +#define TRCAUXCTLR 0x018 /* Trace Auxiliary Control Register */ +#define TRCEVENTCTL0R 0x020 /* Trace Event Control 0 Register */ +#define TRCEVENTCTL1R 0x024 /* Trace Event Control 1 Register */ +#define TRCSTALLCTLR 0x02C /* Trace Stall Control Register */ +#define TRCTSCTLR 0x030 /* Trace Global Timestamp Control Register */ +#define TRCSYNCPR 0x034 /* Trace Synchronization Period Register */ +#define TRCSYNCPR_PERIOD_S 0 +#define TRCSYNCPR_PERIOD_M 0x1f +#define TRCSYNCPR_1K (10 << TRCSYNCPR_PERIOD_S) +#define TRCSYNCPR_2K (11 << TRCSYNCPR_PERIOD_S) +#define TRCSYNCPR_4K (12 << TRCSYNCPR_PERIOD_S) +#define TRCCCCTLR 0x038 /* Trace Cycle Count Control Register */ +#define TRCBBCTLR 0x03C /* Trace Branch Broadcast Control Register */ +#define TRCTRACEIDR 0x040 /* Trace Trace ID Register */ +#define TRCQCTLR 0x044 /* Trace Q Element Control Register */ +#define TRCQCTLR_MODE_INC (1 << 8) /* Include mode. */ +#define TRCVICTLR 0x080 /* Trace ViewInst Main Control Register */ +#define TRCVICTLR_SSSTATUS (1 << 9) /* The start/stop logic is in the started state. */ +#define TRCVICTLR_EXLEVEL_NS_S 20 +#define TRCVICTLR_EXLEVEL_NS_M (0xf << TRCVICTLR_EXLEVEL_NS_S) +#define TRCVICTLR_EXLEVEL_NS(n) (0x1 << ((n) + TRCVICTLR_EXLEVEL_NS_S)) +#define TRCVICTLR_EXLEVEL_S_S 16 +#define TRCVICTLR_EXLEVEL_S_M (0xf << TRCVICTLR_EXLEVEL_S_S) +#define TRCVICTLR_EXLEVEL_S(n) (0x1 << ((n) + TRCVICTLR_EXLEVEL_S_S)) +#define EVENT_SEL_S 0 +#define EVENT_SEL_M (0x1f << EVENT_SEL_S) +#define TRCVIIECTLR 0x084 /* Trace ViewInst Include/Exclude Control Register */ +#define TRCVIIECTLR_INCLUDE_S 0 +#define TRCVISSCTLR 0x088 /* Trace ViewInst Start/Stop Control Register */ +#define TRCVIPCSSCTLR 0x08C /* Trace ViewInst Start/Stop PE Comparator Control Register */ +#define TRCVDCTLR 0x0A0 /* Trace ViewData Main Control Register */ +#define TRCVDCTLR_TRCEXDATA (1 << 12) /* Exception and exception return data transfers are traced */ +#define TRCVDCTLR_TBI (1 << 11) /* The trace unit assigns bits[63:56] to have the same value as bits[63:56] of the data address. */ +#define TRCVDCTLR_PCREL (1 << 10) /* The trace unit does not trace the address or value portions of PC-relative transfers. */ +#define TRCVDCTLR_SPREL_S 8 +#define TRCVDCTLR_SPREL_M (0x3 << TRCVDCTLR_SPREL_S) +#define TRCVDCTLR_EVENT_S 0 +#define TRCVDCTLR_EVENT_M (0xff << TRCVDCTLR_EVENT_S) +#define TRCVDSACCTLR 0x0A4 /* Trace ViewData Include/Exclude Single Address Comparator Control Register */ +#define TRCVDARCCTLR 0x0A8 /* Trace ViewData Include/Exclude Address Range Comparator Control Register */ +#define TRCSEQEVR(n) (0x100 + (n) * 0x4) /* Trace Sequencer State Transition Control Register [n=0-2] */ +#define TRCSEQRSTEVR 0x118 /* Trace Sequencer Reset Control Register */ +#define TRCSEQSTR 0x11C /* Trace Sequencer State Register */ +#define TRCEXTINSELR 0x120 /* Trace External Input Select Register */ +#define TRCCNTRLDVR(n) (0x140 + (n) * 0x4) /* 32 Trace Counter Reload Value Register [n=0-3] */ +#define TRCCNTCTLR(n) (0x150 + (n) * 0x4) /* 32 Trace Counter Control Register [n=0-3] */ +#define TRCCNTVR(n) (0x160 + (n) * 0x4) /* 32 Trace Counter Value Register [n=0-3] */ +#define TRCIMSPEC(n) (0x1C0 + (n) * 0x4) /* Trace IMPLEMENTATION DEFINED register [n=0-7] */ + +#define TRCIDR0(n) (0x1E0 + 0x4 * (n)) +#define TRCIDR8(n) (0x180 + 0x4 * (n)) +#define TRCIDR(n) ((n > 7) ? TRCIDR8(n) : TRCIDR0(n)) +#define TRCIDR1_TRCARCHMAJ_S 8 +#define TRCIDR1_TRCARCHMAJ_M (0xf << TRCIDR1_TRCARCHMAJ_S) +#define TRCIDR1_TRCARCHMIN_S 4 +#define TRCIDR1_TRCARCHMIN_M (0xf << TRCIDR1_TRCARCHMIN_S) + +#define TRCRSCTLR(n) (0x200 + (n) * 0x4) /* Trace Resource Selection Control Register [n=2-31] */ +#define TRCSSCCR(n) (0x280 + (n) * 0x4) /* Trace Single-shot Comparator Control Register [n=0-7] */ +#define TRCSSCSR(n) (0x2A0 + (n) * 0x4) /* Trace Single-shot Comparator Status Register [n=0-7] */ +#define TRCSSPCICR(n) (0x2C0 + (n) * 0x4) /* Trace Single-shot PE Comparator Input Control [n=0-7] */ +#define TRCOSLAR 0x300 /* Management OS Lock Access Register */ +#define TRCOSLSR 0x304 /* Management OS Lock Status Register */ +#define TRCPDCR 0x310 /* Management PowerDown Control Register */ +#define TRCPDSR 0x314 /* Management PowerDown Status Register */ +#define TRCACVR(n) (0x400 + (n) * 0x8) /* Trace Address Comparator Value Register [n=0-15] */ +#define TRCACATR(n) (0x480 + (n) * 0x8) /* Trace Address Comparator Access Type Register [n=0-15] */ +#define TRCACATR_DTBM (1 << 21) +#define TRCACATR_DATARANGE (1 << 20) +#define TRCACATR_DATASIZE_S 18 +#define TRCACATR_DATASIZE_M (0x3 << TRCACATR_DATASIZE_S) +#define TRCACATR_DATASIZE_B (0x0 << TRCACATR_DATASIZE_S) +#define TRCACATR_DATASIZE_HW (0x1 << TRCACATR_DATASIZE_S) +#define TRCACATR_DATASIZE_W (0x2 << TRCACATR_DATASIZE_S) +#define TRCACATR_DATASIZE_DW (0x3 << TRCACATR_DATASIZE_S) +#define TRCACATR_DATAMATCH_S 16 +#define TRCACATR_DATAMATCH_M (0x3 << TRCACATR_DATAMATCH_S) +#define TRCACATR_EXLEVEL_S_S 8 +#define TRCACATR_EXLEVEL_S_M (0xf << TRCACATR_EXLEVEL_S_S) +#define TRCACATR_EXLEVEL_S(n) (0x1 << ((n) + TRCACATR_EXLEVEL_S_S)) +#define TRCACATR_EXLEVEL_NS_S 12 +#define TRCACATR_EXLEVEL_NS_M (0xf << TRCACATR_EXLEVEL_NS_S) +#define TRCACATR_EXLEVEL_NS(n) (0x1 << ((n) + TRCACATR_EXLEVEL_NS_S)) +#define TRCDVCVR(n) (0x500 + (n) * 0x8) /* Trace Data Value Comparator Value Register [n=0-7] */ +#define TRCDVCMR(n) (0x580 + (n) * 0x8) /* Trace Data Value Comparator Mask Register [n=0-7] */ +#define TRCCIDCVR(n) (0x600 + (n) * 0x8) /* Trace Context ID Comparator Value Register [n=0-7] */ +#define TRCVMIDCVR(n) (0x640 + (n) * 0x8) /* Trace Virtual context identifier Comparator Value [n=0-7] */ +#define TRCCIDCCTLR0 0x680 /* Trace Context ID Comparator Control Register 0 */ +#define TRCCIDCCTLR1 0x684 /* Trace Context ID Comparator Control Register 1 */ +#define TRCVMIDCCTLR0 0x688 /* Trace Virtual context identifier Comparator Control Register 0 */ +#define TRCVMIDCCTLR1 0x68C /* Trace Virtual context identifier Comparator Control Register 1 */ +#define TRCITCTRL 0xF00 /* Management Integration Mode Control register */ +#define TRCCLAIMSET 0xFA0 /* Trace Claim Tag Set register */ +#define TRCCLAIMCLR 0xFA4 /* Trace Claim Tag Clear register */ +#define TRCDEVAFF0 0xFA8 /* Management Device Affinity register 0 */ +#define TRCDEVAFF1 0xFAC /* Management Device Affinity register 1 */ +#define TRCLAR 0xFB0 /* Management Software Lock Access Register */ +#define TRCLSR 0xFB4 /* Management Software Lock Status Register */ +#define TRCAUTHSTATUS 0xFB8 /* Management Authentication Status register */ +#define TRCDEVARCH 0xFBC /* Management Device Architecture register */ +#define TRCDEVID 0xFC8 /* Management Device ID register */ +#define TRCDEVTYPE 0xFCC /* Management Device Type register */ +#define TRCPIDR4 0xFD0 /* Management Peripheral ID4 Register */ +#define TRCPIDR(n) (0xFE0 + (n) * 0x4) /* Management Peripheral IDn Register [n=0-3] */ +#define TRCPIDR567(n) (0xFD4 + ((n) - 5) * 0x4) /* Management Peripheral ID5 to Peripheral ID7 Registers */ +#define TRCCIDR(n) (0xFF0 + (n) * 0x4) /* Management Component IDn Register [n=0-4] */ + +#endif /* !_ARM64_CORESIGHT_ETM4X_H_ */ Copied and modified: head/sys/arm64/coresight/coresight_funnel.c (from r361967, head/sys/arm64/coresight/coresight-funnel.c) ============================================================================== --- head/sys/arm64/coresight/coresight-funnel.c Tue Jun 9 15:17:23 2020 (r361967, copy source) +++ head/sys/arm64/coresight/coresight_funnel.c Tue Jun 9 15:56:41 2020 (r361968) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Copied: head/sys/arm64/coresight/coresight_funnel.h (from r361967, head/sys/arm64/coresight/coresight-funnel.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_funnel.h Tue Jun 9 15:56:41 2020 (r361968, copy of r361967, head/sys/arm64/coresight/coresight-funnel.h) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 _ARM64_CORESIGHT_CORESIGHT_FUNNEL_H_ +#define _ARM64_CORESIGHT_CORESIGHT_FUNNEL_H_ + +#define FUNNEL_FUNCTL 0x000 /* Funnel Control Register */ +#define FUNCTL_HOLDTIME_SHIFT 8 +#define FUNCTL_HOLDTIME_MASK (0xf << FUNCTL_HOLDTIME_SHIFT) +#define FUNNEL_PRICTL 0x004 /* Priority Control Register */ +#define FUNNEL_ITATBDATA0 0xEEC /* Integration Register, ITATBDATA0 */ +#define FUNNEL_ITATBCTR2 0xEF0 /* Integration Register, ITATBCTR2 */ +#define FUNNEL_ITATBCTR1 0xEF4 /* Integration Register, ITATBCTR1 */ +#define FUNNEL_ITATBCTR0 0xEF8 /* Integration Register, ITATBCTR0 */ +#define FUNNEL_IMCR 0xF00 /* Integration Mode Control Register */ +#define FUNNEL_CTSR 0xFA0 /* Claim Tag Set Register */ +#define FUNNEL_CTCR 0xFA4 /* Claim Tag Clear Register */ +#define FUNNEL_LOCKACCESS 0xFB0 /* Lock Access */ +#define FUNNEL_LOCKSTATUS 0xFB4 /* Lock Status */ +#define FUNNEL_AUTHSTATUS 0xFB8 /* Authentication status */ +#define FUNNEL_DEVICEID 0xFC8 /* Device ID */ +#define FUNNEL_DEVICETYPE 0xFCC /* Device Type Identifier */ +#define FUNNEL_PERIPH4 0xFD0 /* Peripheral ID4 */ +#define FUNNEL_PERIPH5 0xFD4 /* Peripheral ID5 */ +#define FUNNEL_PERIPH6 0xFD8 /* Peripheral ID6 */ +#define FUNNEL_PERIPH7 0xFDC /* Peripheral ID7 */ +#define FUNNEL_PERIPH0 0xFE0 /* Peripheral ID0 */ +#define FUNNEL_PERIPH1 0xFE4 /* Peripheral ID1 */ +#define FUNNEL_PERIPH2 0xFE8 /* Peripheral ID2 */ +#define FUNNEL_PERIPH3 0xFEC /* Peripheral ID3 */ +#define FUNNEL_COMP0 0xFF0 /* Component ID0 */ +#define FUNNEL_COMP1 0xFF4 /* Component ID1 */ +#define FUNNEL_COMP2 0xFF8 /* Component ID2 */ +#define FUNNEL_COMP3 0xFFC /* Component ID3 */ + +#endif /* !_ARM64_CORESIGHT_CORESIGHT_FUNNEL_H_ */ Copied and modified: head/sys/arm64/coresight/coresight_tmc.c (from r361967, head/sys/arm64/coresight/coresight-tmc.c) ============================================================================== --- head/sys/arm64/coresight/coresight-tmc.c Tue Jun 9 15:17:23 2020 (r361967, copy source) +++ head/sys/arm64/coresight/coresight_tmc.c Tue Jun 9 15:56:41 2020 (r361968) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Copied: head/sys/arm64/coresight/coresight_tmc.h (from r361967, head/sys/arm64/coresight/coresight-tmc.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_tmc.h Tue Jun 9 15:56:41 2020 (r361968, copy of r361967, head/sys/arm64/coresight/coresight-tmc.h) @@ -0,0 +1,119 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ARM64_CORESIGHT_CORESIGHT_TMC_H_ +#define _ARM64_CORESIGHT_CORESIGHT_TMC_H_ + +#define TMC_RSZ 0x004 /* RAM Size Register */ +#define TMC_STS 0x00C /* Status Register */ +#define STS_MEMERR (1 << 5) +#define STS_EMPTY (1 << 4) +#define STS_FTEMPTY (1 << 3) +#define STS_TMCREADY (1 << 2) +#define STS_TRIGGERED (1 << 1) +#define STS_FULL (1 << 0) +#define TMC_RRD 0x010 /* RAM Read Data Register */ +#define TMC_RRP 0x014 /* RAM Read Pointer Register */ +#define TMC_RWP 0x018 /* RAM Write Pointer Register */ +#define TMC_TRG 0x01C /* Trigger Counter Register */ +#define TMC_CTL 0x020 /* Control Register */ +#define CTL_TRACECAPTEN (1 << 0) /* Controls trace capture. */ +#define TMC_RWD 0x024 /* RAM Write Data Register */ +#define TMC_MODE 0x028 /* Mode Register */ +#define MODE_HW_FIFO 2 +#define MODE_SW_FIFO 1 +#define MODE_CIRCULAR_BUFFER 0 +#define TMC_LBUFLEVEL 0x02C /* Latched Buffer Fill Level */ +#define TMC_CBUFLEVEL 0x030 /* Current Buffer Fill Level */ +#define TMC_BUFWM 0x034 /* Buffer Level Water Mark */ +#define TMC_RRPHI 0x038 /* RAM Read Pointer High Register */ +#define TMC_RWPHI 0x03C /* RAM Write Pointer High Register */ +#define TMC_AXICTL 0x110 /* AXI Control Register */ +#define AXICTL_WRBURSTLEN_S 8 +#define AXICTL_WRBURSTLEN_M (0xf << AXICTL_WRBURSTLEN_S) +#define AXICTL_WRBURSTLEN_16 (0xf << AXICTL_WRBURSTLEN_S) +#define AXICTL_SG_MODE (1 << 7) /* Scatter Gather Mode */ +#define AXICTL_CACHE_CTRL_BIT3 (1 << 5) +#define AXICTL_CACHE_CTRL_BIT2 (1 << 4) +#define AXICTL_CACHE_CTRL_BIT1 (1 << 3) +#define AXICTL_CACHE_CTRL_BIT0 (1 << 2) +#define AXICTL_AXCACHE_OS (0xf << 2) +#define AXICTL_PROT_CTRL_BIT1 (1 << 1) +#define AXICTL_PROT_CTRL_BIT0 (1 << 0) +#define TMC_DBALO 0x118 /* Data Buffer Address Low Register */ +#define TMC_DBAHI 0x11C /* Data Buffer Address High Register */ +#define TMC_FFSR 0x300 /* Formatter and Flush Status Register */ +#define TMC_FFCR 0x304 /* Formatter and Flush Control Register */ +#define FFCR_EN_FMT (1 << 0) +#define FFCR_EN_TI (1 << 1) +#define FFCR_FON_FLIN (1 << 4) +#define FFCR_FON_TRIG_EVT (1 << 5) +#define FFCR_FLUSH_MAN (1 << 6) +#define FFCR_TRIGON_TRIGIN (1 << 8) +#define TMC_PSCR 0x308 /* Periodic Synchronization Counter Register */ +#define TMC_ITATBMDATA0 0xED0 /* Integration Test ATB Master Data Register 0 */ +#define TMC_ITATBMCTR2 0xED4 /* Integration Test ATB Master Interface Control 2 Register */ +#define TMC_ITATBMCTR1 0xED8 /* Integration Test ATB Master Control Register 1 */ +#define TMC_ITATBMCTR0 0xEDC /* Integration Test ATB Master Interface Control 0 Register */ +#define TMC_ITMISCOP0 0xEE0 /* Integration Test Miscellaneous Output Register 0 */ +#define TMC_ITTRFLIN 0xEE8 /* Integration Test Trigger In and Flush In Register */ +#define TMC_ITATBDATA0 0xEEC /* Integration Test ATB Data Register 0 */ +#define TMC_ITATBCTR2 0xEF0 /* Integration Test ATB Control 2 Register */ +#define TMC_ITATBCTR1 0xEF4 /* Integration Test ATB Control 1 Register */ +#define TMC_ITATBCTR0 0xEF8 /* Integration Test ATB Control 0 Register */ +#define TMC_ITCTRL 0xF00 /* Integration Mode Control Register */ +#define TMC_CLAIMSET 0xFA0 /* Claim Tag Set Register */ +#define TMC_CLAIMCLR 0xFA4 /* Claim Tag Clear Register */ +#define TMC_LAR 0xFB0 /* Lock Access Register */ +#define TMC_LSR 0xFB4 /* Lock Status Register */ +#define TMC_AUTHSTATUS 0xFB8 /* Authentication Status Register */ +#define TMC_DEVID 0xFC8 /* Device Configuration Register */ +#define DEVID_CONFIGTYPE_S 6 +#define DEVID_CONFIGTYPE_M (0x3 << DEVID_CONFIGTYPE_S) +#define DEVID_CONFIGTYPE_ETB (0 << DEVID_CONFIGTYPE_S) +#define DEVID_CONFIGTYPE_ETR (1 << DEVID_CONFIGTYPE_S) +#define DEVID_CONFIGTYPE_ETF (2 << DEVID_CONFIGTYPE_S) +#define TMC_DEVTYPE 0xFCC /* Device Type Identifier Register */ +#define TMC_PERIPHID4 0xFD0 /* Peripheral ID4 Register */ +#define TMC_PERIPHID5 0xFD4 /* Peripheral ID5 Register */ +#define TMC_PERIPHID6 0xFD8 /* Peripheral ID6 Register */ +#define TMC_PERIPHID7 0xFDC /* Peripheral ID7 Register */ +#define TMC_PERIPHID0 0xFE0 /* Peripheral ID0 Register */ +#define TMC_PERIPHID1 0xFE4 /* Peripheral ID1 Register */ +#define TMC_PERIPHID2 0xFE8 /* Peripheral ID2 Register */ +#define TMC_PERIPHID3 0xFEC /* Peripheral ID3 Register */ +#define TMC_COMPID0 0xFF0 /* Component ID0 Register */ +#define TMC_COMPID1 0xFF4 /* Component ID1 Register */ +#define TMC_COMPID2 0xFF8 /* Component ID2 Register */ +#define TMC_COMPID3 0xFFC /* Component ID3 Register */ + +#endif /* !_ARM64_CORESIGHT_CORESIGHT_TMC_H_ */ Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Tue Jun 9 15:17:23 2020 (r361967) +++ head/sys/conf/files.arm64 Tue Jun 9 15:56:41 2020 (r361968) @@ -187,12 +187,12 @@ arm64/cloudabi32/cloudabi32_sysvec.c optional compat_c arm64/cloudabi64/cloudabi64_sysvec.c optional compat_cloudabi64 arm64/coresight/coresight.c standard arm64/coresight/coresight_if.m standard -arm64/coresight/coresight-cmd.c standard -arm64/coresight/coresight-cpu-debug.c standard -arm64/coresight/coresight-dynamic-replicator.c standard -arm64/coresight/coresight-etm4x.c standard -arm64/coresight/coresight-funnel.c standard -arm64/coresight/coresight-tmc.c standard +arm64/coresight/coresight_cmd.c standard +arm64/coresight/coresight_cpu_debug.c standard +arm64/coresight/coresight_dynamic_replicator.c standard +arm64/coresight/coresight_etm4x.c standard +arm64/coresight/coresight_funnel.c standard +arm64/coresight/coresight_tmc.c standard arm64/intel/firmware.c optional soc_intel_stratix10 arm64/intel/stratix10-soc-fpga-mgr.c optional soc_intel_stratix10 arm64/intel/stratix10-svc.c optional soc_intel_stratix10 From owner-svn-src-head@freebsd.org Tue Jun 9 16:06:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A9A7331856; Tue, 9 Jun 2020 16:06:11 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hFNL6ZFKz3gB2; Tue, 9 Jun 2020 16:06:10 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCBFB17DED; Tue, 9 Jun 2020 16:06:10 +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 059G6A2c082983; Tue, 9 Jun 2020 16:06:10 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059G6ABX082982; Tue, 9 Jun 2020 16:06:10 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006091606.059G6ABX082982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 9 Jun 2020 16:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361969 - head/sys/arm64/coresight X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/arm64/coresight X-SVN-Commit-Revision: 361969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 16:06:11 -0000 Author: br Date: Tue Jun 9 16:06:10 2020 New Revision: 361969 URL: https://svnweb.freebsd.org/changeset/base/361969 Log: Fix style: wrap long lines. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/coresight/coresight.c Modified: head/sys/arm64/coresight/coresight.c ============================================================================== --- head/sys/arm64/coresight/coresight.c Tue Jun 9 15:56:41 2020 (r361968) +++ head/sys/arm64/coresight/coresight.c Tue Jun 9 16:06:10 2020 (r361969) @@ -78,30 +78,33 @@ coresight_get_ports(phandle_t dev_node, strncasecmp(name, "port@", 6)) { port_reg = -1; - OF_getencprop(child, "reg", (void *)&port_reg, sizeof(port_reg)); + OF_getencprop(child, "reg", (void *)&port_reg, + sizeof(port_reg)); endpoint_child = ofw_bus_find_child(child, "endpoint"); if (endpoint_child) { - if (OF_getencprop(endpoint_child, "remote-endpoint", &xref, + if (OF_getencprop(endpoint_child, + "remote-endpoint", &xref, sizeof(xref)) == -1) { printf("failed\n"); continue; } - endp = malloc(sizeof(struct endpoint), M_CORESIGHT, - M_WAITOK | M_ZERO); + endp = malloc(sizeof(struct endpoint), + M_CORESIGHT, M_WAITOK | M_ZERO); endp->my_node = endpoint_child; endp->their_node = OF_node_from_xref(xref); endp->dev_node = dev_node; endp->reg = port_reg; - if (OF_getproplen(endpoint_child, "slave-mode") >= 0) { + if (OF_getproplen(endpoint_child, + "slave-mode") >= 0) { pdata->in_ports++; endp->slave = 1; - } else { + } else pdata->out_ports++; - } mtx_lock(&pdata->mtx_lock); - TAILQ_INSERT_TAIL(&pdata->endpoints, endp, link); + TAILQ_INSERT_TAIL(&pdata->endpoints, + endp, link); mtx_unlock(&pdata->mtx_lock); } } From owner-svn-src-head@freebsd.org Tue Jun 9 16:43:18 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 218DF332901; Tue, 9 Jun 2020 16:43:18 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hGCB05ntz42wG; Tue, 9 Jun 2020 16:43:18 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2D2A18770; Tue, 9 Jun 2020 16:43:17 +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 059GhHPq007840; Tue, 9 Jun 2020 16:43:17 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059GhGZf007835; Tue, 9 Jun 2020 16:43:16 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006091643.059GhGZf007835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 9 Jun 2020 16:43:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361974 - in head/sys: arm64/coresight conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/coresight conf X-SVN-Commit-Revision: 361974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 16:43:18 -0000 Author: br Date: Tue Jun 9 16:43:16 2020 New Revision: 361974 URL: https://svnweb.freebsd.org/changeset/base/361974 Log: ARM Embedded Trace Macrocell v4.x driver: o Split-out FDT attachment to a separate file; o Add ACPI attachment. Sponsored by: DARPA, AFRL Added: head/sys/arm64/coresight/coresight_etm4x_acpi.c (contents, props changed) head/sys/arm64/coresight/coresight_etm4x_fdt.c (contents, props changed) Modified: head/sys/arm64/coresight/coresight_etm4x.c head/sys/arm64/coresight/coresight_etm4x.h head/sys/conf/files.arm64 Modified: head/sys/arm64/coresight/coresight_etm4x.c ============================================================================== --- head/sys/arm64/coresight/coresight_etm4x.c Tue Jun 9 16:15:07 2020 (r361973) +++ head/sys/arm64/coresight/coresight_etm4x.c Tue Jun 9 16:43:16 2020 (r361974) @@ -40,9 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include #include @@ -66,16 +63,6 @@ __FBSDID("$FreeBSD$"); * CPU3 -> ETM3 -> funnel1 -^ */ -static struct ofw_compat_data compat_data[] = { - { "arm,coresight-etm4x", 1 }, - { NULL, 0 } -}; - -struct etm_softc { - struct resource *res; - struct coresight_platform_data *pdata; -}; - static struct resource_spec etm_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { -1, 0 } @@ -248,20 +235,6 @@ etm_disable(device_t dev, struct endpoint *endp, } static int -etm_probe(device_t dev) -{ - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) - return (ENXIO); - - device_set_desc(dev, "AArch64 Embedded Trace Macrocell"); - - return (BUS_PROBE_DEFAULT); -} - -static int etm_attach(device_t dev) { struct coresight_desc desc; @@ -285,7 +258,6 @@ etm_attach(device_t dev) static device_method_t etm_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, etm_probe), DEVMETHOD(device_attach, etm_attach), /* Coresight interface */ @@ -295,13 +267,4 @@ static device_method_t etm_methods[] = { DEVMETHOD_END }; -static driver_t etm_driver = { - "etm", - etm_methods, - sizeof(struct etm_softc), -}; - -static devclass_t etm_devclass; - -DRIVER_MODULE(etm, simplebus, etm_driver, etm_devclass, 0, 0); -MODULE_VERSION(etm, 1); +DEFINE_CLASS_0(etm, etm_driver, etm_methods, sizeof(struct etm_softc)); Modified: head/sys/arm64/coresight/coresight_etm4x.h ============================================================================== --- head/sys/arm64/coresight/coresight_etm4x.h Tue Jun 9 16:15:07 2020 (r361973) +++ head/sys/arm64/coresight/coresight_etm4x.h Tue Jun 9 16:43:16 2020 (r361974) @@ -34,6 +34,13 @@ #ifndef _ARM64_CORESIGHT_ETM4X_H_ #define _ARM64_CORESIGHT_ETM4X_H_ +DECLARE_CLASS(etm_driver); + +struct etm_softc { + struct resource *res; + struct coresight_platform_data *pdata; +}; + #define TRCPRGCTLR 0x004 /* Trace Programming Control Register */ #define TRCPRGCTLR_EN (1 << 0) /* Trace unit enable bit */ #define TRCPROCSELR 0x008 /* Trace PE Select Control Register */ Added: head/sys/arm64/coresight/coresight_etm4x_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_etm4x_acpi.c Tue Jun 9 16:43:16 2020 (r361974) @@ -0,0 +1,79 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_acpi.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +static int +etm_acpi_probe(device_t dev) +{ + static char *etm_ids[] = { "ARMHC500", NULL }; + int error; + + error = ACPI_ID_PROBE(device_get_parent(dev), dev, etm_ids, NULL); + if (error <= 0) + device_set_desc(dev, "ARM Embedded Trace Macrocell"); + + return (error); +} + +static device_method_t etm_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, etm_acpi_probe), + + /* End */ + DEVMETHOD_END +}; + +DEFINE_CLASS_1(etm, etm_acpi_driver, etm_acpi_methods, + sizeof(struct etm_softc), etm_driver); + +static devclass_t etm_acpi_devclass; + +EARLY_DRIVER_MODULE(etm, acpi, etm_acpi_driver, etm_acpi_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Added: head/sys/arm64/coresight/coresight_etm4x_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_etm4x_fdt.c Tue Jun 9 16:43:16 2020 (r361974) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2018-2020 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 "coresight_if.h" + +static struct ofw_compat_data compat_data[] = { + { "arm,coresight-etm4x", 1 }, + { NULL, 0 } +}; + +static int +etm_fdt_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "AArch64 Embedded Trace Macrocell"); + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t etm_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, etm_fdt_probe), + DEVMETHOD_END +}; + +DEFINE_CLASS_1(etm, etm_fdt_driver, etm_fdt_methods, + sizeof(struct etm_softc), etm_driver); + +static devclass_t etm_fdt_devclass; + +EARLY_DRIVER_MODULE(etm, simplebus, etm_fdt_driver, etm_fdt_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Tue Jun 9 16:15:07 2020 (r361973) +++ head/sys/conf/files.arm64 Tue Jun 9 16:43:16 2020 (r361974) @@ -191,6 +191,8 @@ arm64/coresight/coresight_cmd.c standard arm64/coresight/coresight_cpu_debug.c standard arm64/coresight/coresight_dynamic_replicator.c standard arm64/coresight/coresight_etm4x.c standard +arm64/coresight/coresight_etm4x_acpi.c optional acpi +arm64/coresight/coresight_etm4x_fdt.c optional fdt arm64/coresight/coresight_funnel.c standard arm64/coresight/coresight_tmc.c standard arm64/intel/firmware.c optional soc_intel_stratix10 From owner-svn-src-head@freebsd.org Tue Jun 9 16:43:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBF423328CF; Tue, 9 Jun 2020 16:43:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hGCL6PBfz42Z4; Tue, 9 Jun 2020 16:43:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 896981885E; Tue, 9 Jun 2020 16:43:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059GhP8b007900; Tue, 9 Jun 2020 16:43:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059GhNAm007891; Tue, 9 Jun 2020 16:43:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006091643.059GhNAm007891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 9 Jun 2020 16:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361975 - in head/sys: compat/freebsd32 kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 361975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 16:43:27 -0000 Author: jhb Date: Tue Jun 9 16:43:23 2020 New Revision: 361975 URL: https://svnweb.freebsd.org/changeset/base/361975 Log: Refactor ptrace() ABI compatibility. Add a freebsd32_ptrace() and move as many freebsd32 shims as possible to freebsd32_ptrace(). Aside from register sets, freebsd32 passes pointers to native structures to kern_ptrace() and converts to/from native/32-bit structure formats in freebsd32_ptrace() outside of kern_ptrace(). Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25195 Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/sys_process.c Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Jun 9 16:43:23 2020 (r361975) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -121,6 +122,31 @@ __FBSDID("$FreeBSD$"); FEATURE(compat_freebsd_32bit, "Compatible with 32-bit FreeBSD"); +struct ptrace_io_desc32 { + int piod_op; + uint32_t piod_offs; + uint32_t piod_addr; + uint32_t piod_len; +}; + +struct ptrace_sc_ret32 { + uint32_t sr_retval[2]; + int sr_error; +}; + +struct ptrace_vm_entry32 { + int pve_entry; + int pve_timestamp; + uint32_t pve_start; + uint32_t pve_end; + uint32_t pve_offset; + u_int pve_prot; + u_int pve_pathlen; + int32_t pve_fileid; + u_int pve_fsid; + uint32_t pve_path; +}; + #ifdef __amd64__ CTASSERT(sizeof(struct timeval32) == 8); CTASSERT(sizeof(struct timespec32) == 8); @@ -853,6 +879,192 @@ freebsd32_getrusage(struct thread *td, struct freebsd3 freebsd32_rusage_out(&s, &s32); error = copyout(&s32, uap->rusage, sizeof(s32)); } + return (error); +} + +static void +ptrace_lwpinfo_to32(const struct ptrace_lwpinfo *pl, + struct ptrace_lwpinfo32 *pl32) +{ + + bzero(pl32, sizeof(*pl32)); + pl32->pl_lwpid = pl->pl_lwpid; + pl32->pl_event = pl->pl_event; + pl32->pl_flags = pl->pl_flags; + pl32->pl_sigmask = pl->pl_sigmask; + pl32->pl_siglist = pl->pl_siglist; + siginfo_to_siginfo32(&pl->pl_siginfo, &pl32->pl_siginfo); + strcpy(pl32->pl_tdname, pl->pl_tdname); + pl32->pl_child_pid = pl->pl_child_pid; + pl32->pl_syscall_code = pl->pl_syscall_code; + pl32->pl_syscall_narg = pl->pl_syscall_narg; +} + +static void +ptrace_sc_ret_to32(const struct ptrace_sc_ret *psr, + struct ptrace_sc_ret32 *psr32) +{ + + bzero(psr32, sizeof(*psr32)); + psr32->sr_retval[0] = psr->sr_retval[0]; + psr32->sr_retval[1] = psr->sr_retval[1]; + psr32->sr_error = psr->sr_error; +} + +int +freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) +{ + union { + struct ptrace_io_desc piod; + struct ptrace_lwpinfo pl; + struct ptrace_vm_entry pve; + struct dbreg32 dbreg; + struct fpreg32 fpreg; + struct reg32 reg; + register_t args[nitems(td->td_sa.args)]; + struct ptrace_sc_ret psr; + int ptevents; + } r; + union { + struct ptrace_io_desc32 piod; + struct ptrace_lwpinfo32 pl; + struct ptrace_vm_entry32 pve; + uint32_t args[nitems(td->td_sa.args)]; + struct ptrace_sc_ret32 psr; + } r32; + void *addr; + int data, error = 0, i; + + AUDIT_ARG_PID(uap->pid); + AUDIT_ARG_CMD(uap->req); + AUDIT_ARG_VALUE(uap->data); + addr = &r; + data = uap->data; + switch (uap->req) { + case PT_GET_EVENT_MASK: + case PT_GET_SC_ARGS: + case PT_GET_SC_RET: + break; + case PT_LWPINFO: + if (uap->data > sizeof(r32.pl)) + return (EINVAL); + + /* + * Pass size of native structure in 'data'. Truncate + * if necessary to avoid siginfo. + */ + data = sizeof(r.pl); + if (uap->data < offsetof(struct ptrace_lwpinfo32, pl_siginfo) + + sizeof(struct siginfo32)) + data = offsetof(struct ptrace_lwpinfo, pl_siginfo); + break; + case PT_GETREGS: + bzero(&r.reg, sizeof(r.reg)); + break; + case PT_GETFPREGS: + bzero(&r.fpreg, sizeof(r.fpreg)); + break; + case PT_GETDBREGS: + bzero(&r.dbreg, sizeof(r.dbreg)); + break; + case PT_SETREGS: + error = copyin(uap->addr, &r.reg, sizeof(r.reg)); + break; + case PT_SETFPREGS: + error = copyin(uap->addr, &r.fpreg, sizeof(r.fpreg)); + break; + case PT_SETDBREGS: + error = copyin(uap->addr, &r.dbreg, sizeof(r.dbreg)); + break; + case PT_SET_EVENT_MASK: + if (uap->data != sizeof(r.ptevents)) + error = EINVAL; + else + error = copyin(uap->addr, &r.ptevents, uap->data); + break; + case PT_IO: + error = copyin(uap->addr, &r32.piod, sizeof(r32.piod)); + if (error) + break; + CP(r32.piod, r.piod, piod_op); + PTRIN_CP(r32.piod, r.piod, piod_offs); + PTRIN_CP(r32.piod, r.piod, piod_addr); + CP(r32.piod, r.piod, piod_len); + break; + case PT_VM_ENTRY: + error = copyin(uap->addr, &r32.pve, sizeof(r32.pve)); + if (error) + break; + + CP(r32.pve, r.pve, pve_entry); + CP(r32.pve, r.pve, pve_timestamp); + CP(r32.pve, r.pve, pve_start); + CP(r32.pve, r.pve, pve_end); + CP(r32.pve, r.pve, pve_offset); + CP(r32.pve, r.pve, pve_prot); + CP(r32.pve, r.pve, pve_pathlen); + CP(r32.pve, r.pve, pve_fileid); + CP(r32.pve, r.pve, pve_fsid); + PTRIN_CP(r32.pve, r.pve, pve_path); + break; + default: + addr = uap->addr; + break; + } + if (error) + return (error); + + error = kern_ptrace(td, uap->req, uap->pid, addr, data); + if (error) + return (error); + + switch (uap->req) { + case PT_VM_ENTRY: + CP(r.pve, r32.pve, pve_entry); + CP(r.pve, r32.pve, pve_timestamp); + CP(r.pve, r32.pve, pve_start); + CP(r.pve, r32.pve, pve_end); + CP(r.pve, r32.pve, pve_offset); + CP(r.pve, r32.pve, pve_prot); + CP(r.pve, r32.pve, pve_pathlen); + CP(r.pve, r32.pve, pve_fileid); + CP(r.pve, r32.pve, pve_fsid); + error = copyout(&r32.pve, uap->addr, sizeof(r32.pve)); + break; + case PT_IO: + CP(r.piod, r32.piod, piod_len); + error = copyout(&r32.piod, uap->addr, sizeof(r32.piod)); + break; + case PT_GETREGS: + error = copyout(&r.reg, uap->addr, sizeof(r.reg)); + break; + case PT_GETFPREGS: + error = copyout(&r.fpreg, uap->addr, sizeof(r.fpreg)); + break; + case PT_GETDBREGS: + error = copyout(&r.dbreg, uap->addr, sizeof(r.dbreg)); + break; + case PT_GET_EVENT_MASK: + /* NB: The size in uap->data is validated in kern_ptrace(). */ + error = copyout(&r.ptevents, uap->addr, uap->data); + break; + case PT_LWPINFO: + ptrace_lwpinfo_to32(&r.pl, &r32.pl); + error = copyout(&r32.pl, uap->addr, uap->data); + break; + case PT_GET_SC_ARGS: + for (i = 0; i < nitems(r.args); i++) + r32.args[i] = (uint32_t)r.args[i]; + error = copyout(r32.args, uap->addr, MIN(uap->data, + sizeof(r32.args))); + break; + case PT_GET_SC_RET: + ptrace_sc_ret_to32(&r.psr, &r32.psr); + error = copyout(&r32.psr, uap->addr, MIN(uap->data, + sizeof(r32.psr))); + break; + } + return (error); } Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/compat/freebsd32/freebsd32_proto.h Tue Jun 9 16:43:23 2020 (r361975) @@ -43,6 +43,12 @@ struct freebsd32_wait4_args { char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)]; char rusage_l_[PADL_(struct rusage32 *)]; struct rusage32 * rusage; char rusage_r_[PADR_(struct rusage32 *)]; }; +struct freebsd32_ptrace_args { + char req_l_[PADL_(int)]; int req; char req_r_[PADR_(int)]; + char pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)]; + char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; + char data_l_[PADL_(int)]; int data; char data_r_[PADR_(int)]; +}; struct freebsd32_recvmsg_args { char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; char msg_l_[PADL_(struct msghdr32 *)]; struct msghdr32 * msg; char msg_r_[PADR_(struct msghdr32 *)]; @@ -740,6 +746,7 @@ struct freebsd32___sysctlbyname_args { #define PAD64_REQUIRED #endif int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); +int freebsd32_ptrace(struct thread *, struct freebsd32_ptrace_args *); int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *); int freebsd32_recvfrom(struct thread *, struct freebsd32_recvfrom_args *); @@ -1293,6 +1300,7 @@ int freebsd11_freebsd32_fstatat(struct thread *, struc #define FREEBSD32_SYS_AUE_freebsd32_wait4 AUE_WAIT4 #define FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat AUE_GETFSSTAT #define FREEBSD32_SYS_AUE_ofreebsd32_lseek AUE_LSEEK +#define FREEBSD32_SYS_AUE_freebsd32_ptrace AUE_PTRACE #define FREEBSD32_SYS_AUE_freebsd32_recvmsg AUE_RECVMSG #define FREEBSD32_SYS_AUE_freebsd32_sendmsg AUE_SENDMSG #define FREEBSD32_SYS_AUE_freebsd32_recvfrom AUE_RECVFROM Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Tue Jun 9 16:43:23 2020 (r361975) @@ -31,7 +31,7 @@ #define FREEBSD32_SYS_setuid 23 #define FREEBSD32_SYS_getuid 24 #define FREEBSD32_SYS_geteuid 25 -#define FREEBSD32_SYS_ptrace 26 +#define FREEBSD32_SYS_freebsd32_ptrace 26 #define FREEBSD32_SYS_freebsd32_recvmsg 27 #define FREEBSD32_SYS_freebsd32_sendmsg 28 #define FREEBSD32_SYS_freebsd32_recvfrom 29 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Tue Jun 9 16:43:23 2020 (r361975) @@ -35,7 +35,7 @@ const char *freebsd32_syscallnames[] = { "setuid", /* 23 = setuid */ "getuid", /* 24 = getuid */ "geteuid", /* 25 = geteuid */ - "ptrace", /* 26 = ptrace */ + "freebsd32_ptrace", /* 26 = freebsd32_ptrace */ "freebsd32_recvmsg", /* 27 = freebsd32_recvmsg */ "freebsd32_sendmsg", /* 28 = freebsd32_sendmsg */ "freebsd32_recvfrom", /* 29 = freebsd32_recvfrom */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Tue Jun 9 16:43:23 2020 (r361975) @@ -88,7 +88,7 @@ struct sysent freebsd32_sysent[] = { { AS(setuid_args), (sy_call_t *)sys_setuid, AUE_SETUID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 23 = setuid */ { 0, (sy_call_t *)sys_getuid, AUE_GETUID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 24 = getuid */ { 0, (sy_call_t *)sys_geteuid, AUE_GETEUID, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 25 = geteuid */ - { AS(ptrace_args), (sy_call_t *)sys_ptrace, AUE_PTRACE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 26 = ptrace */ + { AS(freebsd32_ptrace_args), (sy_call_t *)freebsd32_ptrace, AUE_PTRACE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 26 = freebsd32_ptrace */ { AS(freebsd32_recvmsg_args), (sy_call_t *)freebsd32_recvmsg, AUE_RECVMSG, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 27 = freebsd32_recvmsg */ { AS(freebsd32_sendmsg_args), (sy_call_t *)freebsd32_sendmsg, AUE_SENDMSG, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 28 = freebsd32_sendmsg */ { AS(freebsd32_recvfrom_args), (sy_call_t *)freebsd32_recvfrom, AUE_RECVFROM, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 29 = freebsd32_recvfrom */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Jun 9 16:43:23 2020 (r361975) @@ -168,9 +168,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 0; break; } - /* ptrace */ + /* freebsd32_ptrace */ case 26: { - struct ptrace_args *p = params; + struct freebsd32_ptrace_args *p = params; iarg[0] = p->req; /* int */ iarg[1] = p->pid; /* pid_t */ uarg[2] = (intptr_t) p->addr; /* caddr_t */ @@ -3623,7 +3623,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d /* geteuid */ case 25: break; - /* ptrace */ + /* freebsd32_ptrace */ case 26: switch(ndx) { case 0: @@ -9228,7 +9228,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * case 24: /* geteuid */ case 25: - /* ptrace */ + /* freebsd32_ptrace */ case 26: if (ndx == 0 || ndx == 1) p = "int"; Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/compat/freebsd32/syscalls.master Tue Jun 9 16:43:23 2020 (r361975) @@ -103,7 +103,7 @@ 23 AUE_SETUID NOPROTO { int setuid(uid_t uid); } 24 AUE_GETUID NOPROTO { uid_t getuid(void); } 25 AUE_GETEUID NOPROTO { uid_t geteuid(void); } -26 AUE_PTRACE NOPROTO { int ptrace(int req, pid_t pid, \ +26 AUE_PTRACE STD { int freebsd32_ptrace(int req, pid_t pid, \ caddr_t addr, int data); } 27 AUE_RECVMSG STD { int freebsd32_recvmsg(int s, struct msghdr32 *msg, \ int flags); } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Tue Jun 9 16:43:16 2020 (r361974) +++ head/sys/kern/sys_process.c Tue Jun 9 16:43:23 2020 (r361975) @@ -67,32 +67,6 @@ __FBSDID("$FreeBSD$"); #ifdef COMPAT_FREEBSD32 #include -#include - -struct ptrace_io_desc32 { - int piod_op; - uint32_t piod_offs; - uint32_t piod_addr; - uint32_t piod_len; -}; - -struct ptrace_sc_ret32 { - uint32_t sr_retval[2]; - int sr_error; -}; - -struct ptrace_vm_entry32 { - int pve_entry; - int pve_timestamp; - uint32_t pve_start; - uint32_t pve_end; - uint32_t pve_offset; - u_int pve_prot; - u_int pve_pathlen; - int32_t pve_fileid; - u_int pve_fsid; - uint32_t pve_path; -}; #endif /* @@ -472,64 +446,6 @@ ptrace_vm_entry(struct thread *td, struct proc *p, str return (error); } -#ifdef COMPAT_FREEBSD32 -static int -ptrace_vm_entry32(struct thread *td, struct proc *p, - struct ptrace_vm_entry32 *pve32) -{ - struct ptrace_vm_entry pve; - int error; - - pve.pve_entry = pve32->pve_entry; - pve.pve_pathlen = pve32->pve_pathlen; - pve.pve_path = (void *)(uintptr_t)pve32->pve_path; - - error = ptrace_vm_entry(td, p, &pve); - if (error == 0) { - pve32->pve_entry = pve.pve_entry; - pve32->pve_timestamp = pve.pve_timestamp; - pve32->pve_start = pve.pve_start; - pve32->pve_end = pve.pve_end; - pve32->pve_offset = pve.pve_offset; - pve32->pve_prot = pve.pve_prot; - pve32->pve_fileid = pve.pve_fileid; - pve32->pve_fsid = pve.pve_fsid; - } - - pve32->pve_pathlen = pve.pve_pathlen; - return (error); -} - -static void -ptrace_lwpinfo_to32(const struct ptrace_lwpinfo *pl, - struct ptrace_lwpinfo32 *pl32) -{ - - bzero(pl32, sizeof(*pl32)); - pl32->pl_lwpid = pl->pl_lwpid; - pl32->pl_event = pl->pl_event; - pl32->pl_flags = pl->pl_flags; - pl32->pl_sigmask = pl->pl_sigmask; - pl32->pl_siglist = pl->pl_siglist; - siginfo_to_siginfo32(&pl->pl_siginfo, &pl32->pl_siginfo); - strcpy(pl32->pl_tdname, pl->pl_tdname); - pl32->pl_child_pid = pl->pl_child_pid; - pl32->pl_syscall_code = pl->pl_syscall_code; - pl32->pl_syscall_narg = pl->pl_syscall_narg; -} - -static void -ptrace_sc_ret_to32(const struct ptrace_sc_ret *psr, - struct ptrace_sc_ret32 *psr32) -{ - - bzero(psr32, sizeof(*psr32)); - psr32->sr_retval[0] = psr->sr_retval[0]; - psr32->sr_retval[1] = psr->sr_retval[1]; - psr32->sr_error = psr->sr_error; -} -#endif /* COMPAT_FREEBSD32 */ - /* * Process debugging system call. */ @@ -542,31 +458,6 @@ struct ptrace_args { }; #endif -#ifdef COMPAT_FREEBSD32 -/* - * This CPP subterfuge is to try and reduce the number of ifdefs in - * the body of the code. - * COPYIN(uap->addr, &r.reg, sizeof r.reg); - * becomes either: - * copyin(uap->addr, &r.reg, sizeof r.reg); - * or - * copyin(uap->addr, &r.reg32, sizeof r.reg32); - * .. except this is done at runtime. - */ -#define BZERO(a, s) wrap32 ? \ - bzero(a ## 32, s ## 32) : \ - bzero(a, s) -#define COPYIN(u, k, s) wrap32 ? \ - copyin(u, k ## 32, s ## 32) : \ - copyin(u, k, s) -#define COPYOUT(k, u, s) wrap32 ? \ - copyout(k ## 32, u, s ## 32) : \ - copyout(k, u, s) -#else -#define BZERO(a, s) bzero(a, s) -#define COPYIN(u, k, s) copyin(u, k, s) -#define COPYOUT(k, u, s) copyout(k, u, s) -#endif int sys_ptrace(struct thread *td, struct ptrace_args *uap) { @@ -581,26 +472,13 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) struct dbreg dbreg; struct fpreg fpreg; struct reg reg; -#ifdef COMPAT_FREEBSD32 - struct dbreg32 dbreg32; - struct fpreg32 fpreg32; - struct reg32 reg32; - struct ptrace_io_desc32 piod32; - struct ptrace_lwpinfo32 pl32; - struct ptrace_vm_entry32 pve32; -#endif char args[sizeof(td->td_sa.args)]; struct ptrace_sc_ret psr; int ptevents; } r; void *addr; int error = 0; -#ifdef COMPAT_FREEBSD32 - int wrap32 = 0; - if (SV_CURPROC_FLAG(SV_ILP32)) - wrap32 = 1; -#endif AUDIT_ARG_PID(uap->pid); AUDIT_ARG_CMD(uap->req); AUDIT_ARG_VALUE(uap->data); @@ -612,22 +490,22 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) case PT_GET_SC_RET: break; case PT_GETREGS: - BZERO(&r.reg, sizeof r.reg); + bzero(&r.reg, sizeof(r.reg)); break; case PT_GETFPREGS: - BZERO(&r.fpreg, sizeof r.fpreg); + bzero(&r.fpreg, sizeof(r.fpreg)); break; case PT_GETDBREGS: - BZERO(&r.dbreg, sizeof r.dbreg); + bzero(&r.dbreg, sizeof(r.dbreg)); break; case PT_SETREGS: - error = COPYIN(uap->addr, &r.reg, sizeof r.reg); + error = copyin(uap->addr, &r.reg, sizeof(r.reg)); break; case PT_SETFPREGS: - error = COPYIN(uap->addr, &r.fpreg, sizeof r.fpreg); + error = copyin(uap->addr, &r.fpreg, sizeof(r.fpreg)); break; case PT_SETDBREGS: - error = COPYIN(uap->addr, &r.dbreg, sizeof r.dbreg); + error = copyin(uap->addr, &r.dbreg, sizeof(r.dbreg)); break; case PT_SET_EVENT_MASK: if (uap->data != sizeof(r.ptevents)) @@ -636,10 +514,10 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) error = copyin(uap->addr, &r.ptevents, uap->data); break; case PT_IO: - error = COPYIN(uap->addr, &r.piod, sizeof r.piod); + error = copyin(uap->addr, &r.piod, sizeof(r.piod)); break; case PT_VM_ENTRY: - error = COPYIN(uap->addr, &r.pve, sizeof r.pve); + error = copyin(uap->addr, &r.pve, sizeof(r.pve)); break; default: addr = uap->addr; @@ -654,19 +532,19 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) switch (uap->req) { case PT_VM_ENTRY: - error = COPYOUT(&r.pve, uap->addr, sizeof r.pve); + error = copyout(&r.pve, uap->addr, sizeof(r.pve)); break; case PT_IO: - error = COPYOUT(&r.piod, uap->addr, sizeof r.piod); + error = copyout(&r.piod, uap->addr, sizeof(r.piod)); break; case PT_GETREGS: - error = COPYOUT(&r.reg, uap->addr, sizeof r.reg); + error = copyout(&r.reg, uap->addr, sizeof(r.reg)); break; case PT_GETFPREGS: - error = COPYOUT(&r.fpreg, uap->addr, sizeof r.fpreg); + error = copyout(&r.fpreg, uap->addr, sizeof(r.fpreg)); break; case PT_GETDBREGS: - error = COPYOUT(&r.dbreg, uap->addr, sizeof r.dbreg); + error = copyout(&r.dbreg, uap->addr, sizeof(r.dbreg)); break; case PT_GET_EVENT_MASK: /* NB: The size in uap->data is validated in kern_ptrace(). */ @@ -688,9 +566,6 @@ sys_ptrace(struct thread *td, struct ptrace_args *uap) return (error); } -#undef COPYIN -#undef COPYOUT -#undef BZERO #ifdef COMPAT_FREEBSD32 /* @@ -741,13 +616,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi lwpid_t tid = 0, *buf; #ifdef COMPAT_FREEBSD32 int wrap32 = 0, safe = 0; - struct ptrace_io_desc32 *piod32 = NULL; - struct ptrace_lwpinfo32 *pl32 = NULL; - struct ptrace_sc_ret32 *psr32 = NULL; - union { - struct ptrace_lwpinfo pl; - struct ptrace_sc_ret psr; - } r; #endif curp = td->td_proc; @@ -1057,15 +925,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi break; } bzero(addr, sizeof(td2->td_sa.args)); -#ifdef COMPAT_FREEBSD32 - if (wrap32) - for (num = 0; num < nitems(td2->td_sa.args); num++) - ((uint32_t *)addr)[num] = (uint32_t) - td2->td_sa.args[num]; - else -#endif - bcopy(td2->td_sa.args, addr, td2->td_sa.narg * - sizeof(register_t)); + bcopy(td2->td_sa.args, addr, td2->td_sa.narg * + sizeof(register_t)); break; case PT_GET_SC_RET: @@ -1077,12 +938,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi error = EINVAL; break; } -#ifdef COMPAT_FREEBSD32 - if (wrap32) { - psr = &r.psr; - psr32 = addr; - } else -#endif psr = addr; bzero(psr, sizeof(*psr)); psr->sr_error = td2->td_errno; @@ -1090,10 +945,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi psr->sr_retval[0] = td2->td_retval[0]; psr->sr_retval[1] = td2->td_retval[1]; } -#ifdef COMPAT_FREEBSD32 - if (wrap32) - ptrace_sc_ret_to32(psr, psr32); -#endif CTR4(KTR_PTRACE, "PT_GET_SC_RET: pid %d error %d retval %#lx,%#lx", p->p_pid, psr->sr_error, psr->sr_retval[0], @@ -1274,32 +1125,16 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi break; case PT_IO: -#ifdef COMPAT_FREEBSD32 - if (wrap32) { - piod32 = addr; - iov.iov_base = (void *)(uintptr_t)piod32->piod_addr; - iov.iov_len = piod32->piod_len; - uio.uio_offset = (off_t)(uintptr_t)piod32->piod_offs; - uio.uio_resid = piod32->piod_len; - } else -#endif - { - piod = addr; - iov.iov_base = piod->piod_addr; - iov.iov_len = piod->piod_len; - uio.uio_offset = (off_t)(uintptr_t)piod->piod_offs; - uio.uio_resid = piod->piod_len; - } + piod = addr; + iov.iov_base = piod->piod_addr; + iov.iov_len = piod->piod_len; + uio.uio_offset = (off_t)(uintptr_t)piod->piod_offs; + uio.uio_resid = piod->piod_len; uio.uio_iov = &iov; uio.uio_iovcnt = 1; uio.uio_segflg = UIO_USERSPACE; uio.uio_td = td; -#ifdef COMPAT_FREEBSD32 - tmp = wrap32 ? piod32->piod_op : piod->piod_op; -#else - tmp = piod->piod_op; -#endif - switch (tmp) { + switch (piod->piod_op) { case PIOD_READ_D: case PIOD_READ_I: CTR3(KTR_PTRACE, "PT_IO: pid %d: READ (%p, %#x)", @@ -1319,12 +1154,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi } PROC_UNLOCK(p); error = proc_rwmem(p, &uio); -#ifdef COMPAT_FREEBSD32 - if (wrap32) - piod32->piod_len -= uio.uio_resid; - else -#endif - piod->piod_len -= uio.uio_resid; + piod->piod_len -= uio.uio_resid; PROC_LOCK(p); break; @@ -1373,22 +1203,10 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi break; case PT_LWPINFO: - if (data <= 0 || -#ifdef COMPAT_FREEBSD32 - (!wrap32 && data > sizeof(*pl)) || - (wrap32 && data > sizeof(*pl32))) { -#else - data > sizeof(*pl)) { -#endif + if (data <= 0 || data > sizeof(*pl)) { error = EINVAL; break; } -#ifdef COMPAT_FREEBSD32 - if (wrap32) { - pl = &r.pl; - pl32 = addr; - } else -#endif pl = addr; bzero(pl, sizeof(*pl)); pl->pl_lwpid = td2->td_tid; @@ -1397,16 +1215,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi if (td2->td_dbgflags & TDB_XSIG) { pl->pl_event = PL_EVENT_SIGNAL; if (td2->td_si.si_signo != 0 && -#ifdef COMPAT_FREEBSD32 - ((!wrap32 && data >= offsetof(struct ptrace_lwpinfo, - pl_siginfo) + sizeof(pl->pl_siginfo)) || - (wrap32 && data >= offsetof(struct ptrace_lwpinfo32, - pl_siginfo) + sizeof(struct siginfo32))) -#else data >= offsetof(struct ptrace_lwpinfo, pl_siginfo) - + sizeof(pl->pl_siginfo) -#endif - ){ + + sizeof(pl->pl_siginfo)){ pl->pl_flags |= PL_FLAG_SI; pl->pl_siginfo = td2->td_si; } @@ -1441,10 +1251,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi pl->pl_syscall_code = 0; pl->pl_syscall_narg = 0; } -#ifdef COMPAT_FREEBSD32 - if (wrap32) - ptrace_lwpinfo_to32(pl, pl32); -#endif CTR6(KTR_PTRACE, "PT_LWPINFO: tid %d (pid %d) event %d flags %#x child pid %d syscall %d", td2->td_tid, p->p_pid, pl->pl_event, pl->pl_flags, @@ -1490,11 +1296,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, voi case PT_VM_ENTRY: PROC_UNLOCK(p); -#ifdef COMPAT_FREEBSD32 - if (wrap32) - error = ptrace_vm_entry32(td, p, addr); - else -#endif error = ptrace_vm_entry(td, p, addr); PROC_LOCK(p); break; From owner-svn-src-head@freebsd.org Tue Jun 9 17:07:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7540B33651E; Tue, 9 Jun 2020 17:07:43 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hGlM1tp2z47n2; Tue, 9 Jun 2020 17:07:43 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 398BA18D5D; Tue, 9 Jun 2020 17:07:43 +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 059H7hQv020748; Tue, 9 Jun 2020 17:07:43 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059H7hO3020747; Tue, 9 Jun 2020 17:07:43 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006091707.059H7hO3020747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 9 Jun 2020 17:07:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361976 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 361976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 17:07:43 -0000 Author: br Date: Tue Jun 9 17:07:42 2020 New Revision: 361976 URL: https://svnweb.freebsd.org/changeset/base/361976 Log: Similar to UART on ThunderX2, the ARM Coresight (ETM component) set ResourceProducer on memory resources: ignore it. Tested on ARM N1SDP board. Sponsored by: DARPA, AFRL Modified: head/sys/dev/acpica/acpi_resource.c Modified: head/sys/dev/acpica/acpi_resource.c ============================================================================== --- head/sys/dev/acpica/acpi_resource.c Tue Jun 9 16:43:23 2020 (r361975) +++ head/sys/dev/acpica/acpi_resource.c Tue Jun 9 17:07:42 2020 (r361976) @@ -484,6 +484,10 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, if (acpi_MatchHid(handle, "ARMH0011") != ACPI_MATCHHID_NOMATCH) arc.ignore_producer_flag = true; + /* ARM Coresight on N1SDP set ResourceProducer on memory resources. */ + if (acpi_MatchHid(handle, "ARMHC500") != ACPI_MATCHHID_NOMATCH) + arc.ignore_producer_flag = true; + status = AcpiWalkResources(handle, "_CRS", acpi_parse_resource, &arc); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { printf("can't fetch resources for %s - %s\n", From owner-svn-src-head@freebsd.org Tue Jun 9 17:17:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B927336D10; Tue, 9 Jun 2020 17:17:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hGyx0kPHz498H; Tue, 9 Jun 2020 17:17:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EC1618EEC; Tue, 9 Jun 2020 17:17:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059HHiHo027027; Tue, 9 Jun 2020 17:17:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059HHiee027024; Tue, 9 Jun 2020 17:17:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006091717.059HHiee027024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 9 Jun 2020 17:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361977 - head/lib/libusb X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libusb X-SVN-Commit-Revision: 361977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 17:17:45 -0000 Author: kevans Date: Tue Jun 9 17:17:43 2020 New Revision: 361977 URL: https://svnweb.freebsd.org/changeset/base/361977 Log: libusb: improve compatibility Specifically, add LIBUSB_CLASS_PHYSICAL and the libusb_has_capability API. Descriptions and functionality for these derived from the documentation at [0]. The current set of capabilities are all supported by libusb. These were detected as missing after updating net/freerdp to 2.1.1, which attempted to use both. [0] http://libusb.sourceforge.net/api-1.0/group__libusb__misc.html Reviewed by: hselasky MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25194 Modified: head/lib/libusb/Makefile head/lib/libusb/libusb.3 head/lib/libusb/libusb.h head/lib/libusb/libusb10.c Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Tue Jun 9 17:07:42 2020 (r361976) +++ head/lib/libusb/Makefile Tue Jun 9 17:17:43 2020 (r361977) @@ -68,6 +68,7 @@ CFLAGS+= -I ../../sys MLINKS += libusb.3 libusb_get_version.3 MLINKS += libusb.3 libusb_init.3 MLINKS += libusb.3 libusb_exit.3 +MLINKS += libusb.3 libusb_has_capability.3 MLINKS += libusb.3 libusb_strerror.3 MLINKS += libusb.3 libusb_error_name.3 MLINKS += libusb.3 libusb_set_debug.3 Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Tue Jun 9 17:07:42 2020 (r361976) +++ head/lib/libusb/libusb.3 Tue Jun 9 17:17:43 2020 (r361977) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 11, 2018 +.Dd June 9, 2020 .Dt LIBUSB 3 .Os .Sh NAME @@ -60,6 +60,33 @@ failure. Deinitialise libusb. Must be called at the end of the application. Other libusb routines may not be called after this function. +.Pp +.Ft int +.Fn libusb_has_capability "uint32_t capability" +This function checks the runtime capabilities of +.Nm . +This function will return non-zero if the given +.Fa capability +is supported, 0 if it is not supported. +The valid values for +.Fa capability +are: +.Bl -tag -width LIBUSB_CAP -offset indent +.It Va LIBUSB_CAP_HAS_CAPABILITY +.Nm +supports +.Fn libusb_has_capability . +.It Va LIBUSB_CAP_HAS_HOTPLUG +.Nm +supports hotplug notifications. +.It Va LIBUSB_CAP_HAS_HID_ACCESS +.Nm +can access HID devices without requiring user intervention. +.It Va LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER +.Nm +supports detaching of the default USB driver with +.Fn libusb_detach_kernel_driver . +.El .Pp .Ft const char * .Fn libusb_strerror "int code" Modified: head/lib/libusb/libusb.h ============================================================================== --- head/lib/libusb/libusb.h Tue Jun 9 17:07:42 2020 (r361976) +++ head/lib/libusb/libusb.h Tue Jun 9 17:17:43 2020 (r361977) @@ -54,6 +54,7 @@ enum libusb_class_code { LIBUSB_CLASS_AUDIO = 1, LIBUSB_CLASS_COMM = 2, LIBUSB_CLASS_HID = 3, + LIBUSB_CLASS_PHYSICAL = 5, LIBUSB_CLASS_PTP = 6, LIBUSB_CLASS_IMAGE = 6, LIBUSB_CLASS_PRINTER = 7, @@ -178,6 +179,21 @@ enum libusb_bos_type { LIBUSB_BT_CONTAINER_ID = 4, }; +enum libusb_capability { + /* libusb supports libusb_has_capability(). */ + LIBUSB_CAP_HAS_CAPABILITY = 0, + /* Hotplug support is available. */ + LIBUSB_CAP_HAS_HOTPLUG, + /* Can access HID devices without requiring user intervention. */ + LIBUSB_CAP_HAS_HID_ACCESS, + + /* + * Supports detaching of the default USB driver with + * libusb_detach_kernel_driver(). + */ + LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER, +}; + enum libusb_error { LIBUSB_SUCCESS = 0, LIBUSB_ERROR_IO = -1, @@ -450,6 +466,7 @@ const char *libusb_strerror(int code); const char *libusb_error_name(int code); int libusb_init(libusb_context ** context); void libusb_exit(struct libusb_context *ctx); +int libusb_has_capability(uint32_t capability); /* Device handling and enumeration */ Modified: head/lib/libusb/libusb10.c ============================================================================== --- head/lib/libusb/libusb10.c Tue Jun 9 17:07:42 2020 (r361976) +++ head/lib/libusb/libusb10.c Tue Jun 9 17:17:43 2020 (r361977) @@ -1716,3 +1716,18 @@ libusb_error_name(int code) return ("LIBUSB_ERROR_UNKNOWN"); } } + +int +libusb_has_capability(uint32_t capability) +{ + + switch (capability) { + case LIBUSB_CAP_HAS_CAPABILITY: + case LIBUSB_CAP_HAS_HOTPLUG: + case LIBUSB_CAP_HAS_HID_ACCESS: + case LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER: + return (1); + default: + return (0); + } +} From owner-svn-src-head@freebsd.org Tue Jun 9 18:13:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F008E338843; Tue, 9 Jun 2020 18:13:52 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hJCh66Y3z4HyS; Tue, 9 Jun 2020 18:13:52 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD34019BE1; Tue, 9 Jun 2020 18:13:52 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059IDqKE063845; Tue, 9 Jun 2020 18:13:52 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059IDq2j063844; Tue, 9 Jun 2020 18:13:52 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202006091813.059IDq2j063844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 9 Jun 2020 18:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361980 - head/release X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/release X-SVN-Commit-Revision: 361980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 18:13:53 -0000 Author: manu Date: Tue Jun 9 18:13:52 2020 New Revision: 361980 URL: https://svnweb.freebsd.org/changeset/base/361980 Log: release: amd64 efi boot name is bootx64 efi_boot_name is just used for arm image so no harm done. Reported by: gonzo MFC after: 3 days Modified: head/release/release.sh Modified: head/release/release.sh ============================================================================== --- head/release/release.sh Tue Jun 9 17:35:14 2020 (r361979) +++ head/release/release.sh Tue Jun 9 18:13:52 2020 (r361980) @@ -368,7 +368,7 @@ efi_boot_name() echo "bootaa64.efi" ;; amd64) - echo "bootx86.efi" + echo "bootx64.efi" ;; esac } From owner-svn-src-head@freebsd.org Tue Jun 9 19:15:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8209339ADD; Tue, 9 Jun 2020 19:15:43 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hKb34yyWz4QgB; Tue, 9 Jun 2020 19:15:43 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A583D1A834; Tue, 9 Jun 2020 19:15:43 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059JFh4v001695; Tue, 9 Jun 2020 19:15:43 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059JFh2m001694; Tue, 9 Jun 2020 19:15:43 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202006091915.059JFh2m001694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 9 Jun 2020 19:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361982 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 361982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 19:15:43 -0000 Author: vmaffione Date: Tue Jun 9 19:15:43 2020 New Revision: 361982 URL: https://svnweb.freebsd.org/changeset/base/361982 Log: iflib: netmap: honor netmap_irx_irq return values In the receive interrupt routine, always call netmap_rx_irq(). The latter function will return != NM_IRQ_PASS if netmap is not active on that specific receive queue, so that the driver can go on with iflib_rxeof(). Note that netmap supports partial opening, where only a subset of the RX or TX rings can be open in netmap mode. Checking the IFCAP_NETMAP flag is not enough to make sure that the queue is indeed in netmap mode. Moreover, in case netmap_rx_irq() returns NM_IRQ_RESCHED, it means that netmap expects the driver to call netmap_rx_irq() again as soon as possible. Currently, this may happen when the device is attached to a VALE switch. Reviewed by: gallatin MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25167 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Jun 9 19:07:44 2020 (r361981) +++ head/sys/net/iflib.c Tue Jun 9 19:15:43 2020 (r361982) @@ -3790,6 +3790,10 @@ _task_fn_rx(void *context) if_ctx_t ctx = rxq->ifr_ctx; uint8_t more; uint16_t budget; +#ifdef DEV_NETMAP + u_int work = 0; + int nmirq; +#endif #ifdef IFLIB_DIAGNOSTICS rxq->ifr_cpu_exec_count[curcpu]++; @@ -3798,12 +3802,10 @@ _task_fn_rx(void *context) if (__predict_false(!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING))) return; #ifdef DEV_NETMAP - if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP) { - u_int work = 0; - if (netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work)) { - more = 0; - goto skip_rxeof; - } + nmirq = netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work); + if (nmirq != NM_IRQ_PASS) { + more = (nmirq == NM_IRQ_RESCHED) ? IFLIB_RXEOF_MORE : 0; + goto skip_rxeof; } #endif budget = ctx->ifc_sysctl_rx_budget; From owner-svn-src-head@freebsd.org Tue Jun 9 20:19:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E5BE33B9E0; Tue, 9 Jun 2020 20:19:12 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hM0J3Hd1z4Zgp; Tue, 9 Jun 2020 20:19:12 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6BE731B34A; Tue, 9 Jun 2020 20:19:12 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059KJCb7039102; Tue, 9 Jun 2020 20:19:12 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059KJCLG039099; Tue, 9 Jun 2020 20:19:12 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <202006092019.059KJCLG039099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Tue, 9 Jun 2020 20:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361984 - in head/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 361984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 20:19:12 -0000 Author: dougm Date: Tue Jun 9 20:19:11 2020 New Revision: 361984 URL: https://svnweb.freebsd.org/changeset/base/361984 Log: To reduce the size of an rb_node, drop the color field. Set the least significant bit in the pointer to the node from its parent to indicate that the node is red. Have the tree rotation macros leave the old-parent/new-child node red and the new-parent/old-child node black. This change makes RB_LEFT and RB_RIGHT no longer assignable, and RB_COLOR no longer defined. Any code that modifies the tree or examines a node color would have to be modified after this change. Reviewed by: markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D25105 Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h head/sys/sys/tree.h Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h Tue Jun 9 19:16:49 2020 (r361983) +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h Tue Jun 9 20:19:11 2020 (r361984) @@ -57,11 +57,7 @@ RB_HEAD(linux_root, rb_node); RB_PROTOTYPE(linux_root, rb_node, __entry, panic_cmp); #define rb_parent(r) RB_PARENT(r, __entry) -#define rb_color(r) RB_COLOR(r, __entry) -#define rb_is_red(r) (rb_color(r) == RB_RED) -#define rb_is_black(r) (rb_color(r) == RB_BLACK) #define rb_set_parent(r, p) rb_parent((r)) = (p) -#define rb_set_color(r, c) rb_color((r)) = (c) #define rb_entry(ptr, type, member) container_of(ptr, type, member) #define RB_EMPTY_ROOT(root) RB_EMPTY((struct linux_root *)root) @@ -82,7 +78,6 @@ rb_link_node(struct rb_node *node, struct rb_node *par struct rb_node **rb_link) { rb_set_parent(node, parent); - rb_set_color(node, RB_RED); node->__entry.rbe_left = node->__entry.rbe_right = NULL; *rb_link = node; } Modified: head/sys/sys/tree.h ============================================================================== --- head/sys/sys/tree.h Tue Jun 9 19:16:49 2020 (r361983) +++ head/sys/sys/tree.h Tue Jun 9 20:19:11 2020 (r361984) @@ -307,35 +307,32 @@ struct name { \ (root)->rbh_root = NULL; \ } while (/*CONSTCOND*/ 0) -#define RB_BLACK 0 -#define RB_RED 1 #define RB_ENTRY(type) \ struct { \ struct type *rbe_left; /* left element */ \ struct type *rbe_right; /* right element */ \ struct type *rbe_parent; /* parent element */ \ - int rbe_color; /* node color */ \ } -#define RB_LEFT(elm, field) (elm)->field.rbe_left -#define RB_RIGHT(elm, field) (elm)->field.rbe_right +#define RB_LF(elm, field) (elm)->field.rbe_left +#define RB_RT(elm, field) (elm)->field.rbe_right +#define RB_FLIP(elm) (*(__uintptr_t *)&(elm) ^= 1) +#define RB_FLIP_LF(elm, field) RB_FLIP(RB_LF(elm, field)) +#define RB_FLIP_RT(elm, field) RB_FLIP(RB_RT(elm, field)) +#define RB_ISRED(elm) ((*(__uintptr_t *)&(elm) & 1) != 0) +#define RB_RED_LF(elm, field) RB_ISRED(RB_LF(elm, field)) +#define RB_RED_RT(elm, field) RB_ISRED(RB_RT(elm, field)) +#define RB_PTR(elm, field) ((__typeof(elm->field.rbe_parent)) \ + ((__uintptr_t)(elm) & ~(__uintptr_t)1)) +#define RB_LEFT(elm, field) RB_PTR(RB_LF(elm, field), field) +#define RB_RIGHT(elm, field) RB_PTR(RB_RT(elm, field), field) #define RB_PARENT(elm, field) (elm)->field.rbe_parent -#define RB_COLOR(elm, field) (elm)->field.rbe_color -#define RB_ISRED(elm, field) ((elm) != NULL && RB_COLOR(elm, field) == RB_RED) #define RB_ROOT(head) (head)->rbh_root #define RB_EMPTY(head) (RB_ROOT(head) == NULL) +#define RB_BOOL int +#define RB_TRUE 1 +#define RB_FALSE 0 -#define RB_SET(elm, parent, field) do { \ - RB_PARENT(elm, field) = parent; \ - RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ - RB_COLOR(elm, field) = RB_RED; \ -} while (/*CONSTCOND*/ 0) - -#define RB_SET_BLACKRED(black, red, field) do { \ - RB_COLOR(black, field) = RB_BLACK; \ - RB_COLOR(red, field) = RB_RED; \ -} while (/*CONSTCOND*/ 0) - /* * Something to be invoked in a loop at the root of every modified subtree, * from the bottom up to the root, to update augmented node data. @@ -344,37 +341,42 @@ struct { \ #define RB_AUGMENT(x) break #endif +/* + * Fix pointers to a parent, and from a parent, as part of rotation. + */ +#define RB_ROTATE_PARENT(head, elm, tmp, field) do { \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) == NULL) \ + RB_ROOT(head) = (tmp); \ + else if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ + RB_LF(RB_PARENT(elm, field), field) = (tmp); \ + else \ + RB_RT(RB_PARENT(elm, field), field) = (tmp); \ + RB_PARENT(elm, field) = (tmp); \ +} while (/*CONSTCOND*/ 0) + +/* + * Rotation makes the descending node red, and the ascending + * node not-red. + */ #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ (tmp) = RB_RIGHT(elm, field); \ - if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ + if ((RB_RT(elm, field) = RB_LF(tmp, field)) != NULL) { \ RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ } \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_LEFT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ + RB_ROTATE_PARENT(head, elm, tmp, field); \ + RB_LF(tmp, field) = (elm); \ + RB_FLIP_LF(tmp, field); \ RB_AUGMENT(elm); \ } while (/*CONSTCOND*/ 0) #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ (tmp) = RB_LEFT(elm, field); \ - if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ + if ((RB_LF(elm, field) = RB_RT(tmp, field)) != NULL) { \ RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ } \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ - } else \ - (head)->rbh_root = (tmp); \ - RB_RIGHT(tmp, field) = (elm); \ - RB_PARENT(elm, field) = (tmp); \ + RB_ROTATE_PARENT(head, elm, tmp, field); \ + RB_RT(tmp, field) = (elm); \ + RB_FLIP_RT(tmp, field); \ RB_AUGMENT(elm); \ } while (/*CONSTCOND*/ 0) @@ -439,110 +441,105 @@ struct { \ attr void \ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ { \ - struct type *parent, *gparent, *tmp; \ - while (RB_ISRED((parent = RB_PARENT(elm, field)), field)) { \ - gparent = RB_PARENT(parent, field); \ - if (parent == RB_LEFT(gparent, field)) { \ - tmp = RB_RIGHT(gparent, field); \ - if (RB_ISRED(tmp, field)) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field);\ - elm = gparent; \ - continue; \ - } \ + struct type *gparent, *parent; \ + while ((parent = RB_PARENT(elm, field)) != NULL) { \ + if (RB_LEFT(parent, field) == elm) \ + RB_FLIP_LF(parent, field); \ + else \ + RB_FLIP_RT(parent, field); \ + if ((gparent = RB_PARENT(parent, field)) == NULL) \ + break; \ + if (RB_RED_LF(gparent, field) && \ + RB_RED_RT(gparent, field)) { \ + RB_FLIP_LF(gparent, field); \ + RB_FLIP_RT(gparent, field); \ + elm = gparent; \ + continue; \ + } \ + if (RB_RED_LF(gparent, field) && \ + parent == RB_LEFT(gparent, field)) { \ if (RB_RIGHT(parent, field) == elm) { \ - RB_ROTATE_LEFT(head, parent, tmp, field);\ - tmp = parent; \ + RB_ROTATE_LEFT(head, parent, elm, field);\ parent = elm; \ - elm = tmp; \ } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_RIGHT(head, gparent, tmp, field); \ - } else { \ - tmp = RB_LEFT(gparent, field); \ - if (RB_ISRED(tmp, field)) { \ - RB_COLOR(tmp, field) = RB_BLACK; \ - RB_SET_BLACKRED(parent, gparent, field);\ - elm = gparent; \ - continue; \ - } \ + RB_ROTATE_RIGHT(head, gparent, parent, field); \ + } else if (RB_RED_RT(gparent, field) && \ + parent == RB_RIGHT(gparent, field)) { \ if (RB_LEFT(parent, field) == elm) { \ - RB_ROTATE_RIGHT(head, parent, tmp, field);\ - tmp = parent; \ + RB_ROTATE_RIGHT(head, parent, elm, field);\ parent = elm; \ - elm = tmp; \ } \ - RB_SET_BLACKRED(parent, gparent, field); \ - RB_ROTATE_LEFT(head, gparent, tmp, field); \ + RB_ROTATE_LEFT(head, gparent, parent, field); \ } \ + break; \ } \ - RB_COLOR(head->rbh_root, field) = RB_BLACK; \ } #define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ attr void \ -name##_RB_REMOVE_COLOR(struct name *head, struct type *parent) \ +name##_RB_REMOVE_COLOR(struct name *head, struct type *elm) \ { \ - struct type *elm, *tmp; \ - elm = NULL; \ + struct type *par, *sib, *tmp; \ + RB_BOOL go_left, left_child, red_par; \ + left_child = (RB_LEFT(elm, field) == NULL); \ do { \ - if (RB_LEFT(parent, field) == elm) { \ - tmp = RB_RIGHT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_LEFT(head, parent, tmp, field);\ - tmp = RB_RIGHT(parent, field); \ + go_left = left_child; \ + if (go_left ? \ + !RB_RED_RT(elm, field) : \ + !RB_RED_LF(elm, field)) { \ + par = RB_PARENT(elm, field); \ + left_child = par != NULL && \ + RB_LEFT(par, field) == elm; \ + red_par = left_child ? RB_RED_LF(par, field) : \ + par == NULL ? RB_TRUE : \ + RB_RED_RT(par, field); \ + } \ + if (go_left) { \ + if (RB_RED_RT(elm, field)) { \ + red_par = RB_TRUE; \ + RB_ROTATE_LEFT(head, elm, par, field); \ } \ - if (RB_ISRED(RB_LEFT(tmp, field), field)) { \ - struct type *oleft; \ - oleft = RB_LEFT(tmp, field); \ - RB_COLOR(oleft, field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_RIGHT(head, tmp, oleft, field); \ - tmp = RB_RIGHT(parent, field); \ - } else if (!RB_ISRED(RB_RIGHT(tmp, field), field)) { \ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ + sib = RB_RIGHT(elm, field); \ + if (RB_RED_LF(sib, field)) { \ + RB_ROTATE_RIGHT(head, sib, tmp, field); \ + sib = tmp; \ + } else if (!RB_RED_RT(sib, field)) { \ + RB_FLIP_RT(elm, field); \ + elm = par; \ continue; \ } \ - if (RB_ISRED(RB_RIGHT(tmp, field), field)) \ - RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ - RB_COLOR(parent, field) = RB_BLACK; \ - RB_ROTATE_LEFT(head, parent, tmp, field); \ - elm = RB_ROOT(head); \ + if (RB_RED_RT(sib, field)) \ + RB_FLIP_RT(sib, field); \ + RB_ROTATE_LEFT(head, elm, sib, field); \ + RB_FLIP_LF(sib, field); \ break; \ } else { \ - tmp = RB_LEFT(parent, field); \ - if (RB_COLOR(tmp, field) == RB_RED) { \ - RB_SET_BLACKRED(tmp, parent, field); \ - RB_ROTATE_RIGHT(head, parent, tmp, field);\ - tmp = RB_LEFT(parent, field); \ + if (RB_RED_LF(elm, field)) { \ + red_par = RB_TRUE; \ + RB_ROTATE_RIGHT(head, elm, par, field); \ } \ - if (RB_ISRED(RB_RIGHT(tmp, field), field)) { \ - struct type *oright; \ - oright = RB_RIGHT(tmp, field); \ - RB_COLOR(oright, field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_RED; \ - RB_ROTATE_LEFT(head, tmp, oright, field); \ - tmp = RB_LEFT(parent, field); \ - } else if (!RB_ISRED(RB_LEFT(tmp, field), field)) { \ - RB_COLOR(tmp, field) = RB_RED; \ - elm = parent; \ - parent = RB_PARENT(elm, field); \ + sib = RB_LEFT(elm, field); \ + if (RB_RED_RT(sib, field)) { \ + RB_ROTATE_LEFT(head, sib, tmp, field); \ + sib = tmp; \ + } else if (!RB_RED_LF(sib, field)) { \ + RB_FLIP_LF(elm, field); \ + elm = par; \ continue; \ } \ - if (RB_ISRED(RB_LEFT(tmp, field), field)) \ - RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ - RB_COLOR(parent, field) = RB_BLACK; \ - RB_ROTATE_RIGHT(head, parent, tmp, field); \ - elm = RB_ROOT(head); \ + if (RB_RED_LF(sib, field)) \ + RB_FLIP_LF(sib, field); \ + RB_ROTATE_RIGHT(head, elm, sib, field); \ + RB_FLIP_RT(sib, field); \ break; \ } \ - } while (!RB_ISRED(elm, field) && parent != NULL); \ - RB_COLOR(elm, field) = RB_BLACK; \ + } while (!red_par); \ + if (par != NULL && red_par) { \ + if (left_child) \ + RB_FLIP_LF(par, field); \ + else \ + RB_FLIP_RT(par, field); \ + } \ } #define RB_GENERATE_REMOVE(name, type, field, attr) \ @@ -550,12 +547,11 @@ attr struct type * \ name##_RB_REMOVE(struct name *head, struct type *elm) \ { \ struct type *child, *old, *parent, *parent_old, *right; \ - int color; \ + RB_BOOL old_red, red; \ \ old = elm; \ parent_old = parent = RB_PARENT(elm, field); \ right = RB_RIGHT(elm, field); \ - color = RB_COLOR(elm, field); \ if (RB_LEFT(elm, field) == NULL) \ elm = child = right; \ else if (right == NULL) \ @@ -563,7 +559,8 @@ name##_RB_REMOVE(struct name *head, struct type *elm) else { \ if ((child = RB_LEFT(right, field)) == NULL) { \ child = RB_RIGHT(right, field); \ - RB_RIGHT(old, field) = child; \ + red = RB_RED_RT(old, field); \ + RB_RT(old, field) = child; \ parent = elm = right; \ } else { \ do \ @@ -571,23 +568,31 @@ name##_RB_REMOVE(struct name *head, struct type *elm) while ((child = RB_LEFT(elm, field)) != NULL); \ child = RB_RIGHT(elm, field); \ parent = RB_PARENT(elm, field); \ - RB_LEFT(parent, field) = child; \ + red = RB_RED_LF(parent, field); \ + RB_LF(parent, field) = child; \ RB_PARENT(RB_RIGHT(old, field), field) = elm; \ } \ RB_PARENT(RB_LEFT(old, field), field) = elm; \ - color = RB_COLOR(elm, field); \ elm->field = old->field; \ } \ - if (parent_old == NULL) \ + if (parent_old == NULL) { \ RB_ROOT(head) = elm; \ - else if (RB_LEFT(parent_old, field) == old) \ - RB_LEFT(parent_old, field) = elm; \ - else \ - RB_RIGHT(parent_old, field) = elm; \ - if (child != NULL) { \ + old_red = RB_FALSE; \ + } else if (RB_LEFT(parent_old, field) == old) { \ + old_red = RB_RED_LF(parent_old, field); \ + RB_LF(parent_old, field) = elm; \ + if (old_red && parent != parent_old) \ + RB_FLIP_LF(parent_old, field); \ + } else { \ + old_red = RB_RED_RT(parent_old, field); \ + RB_RT(parent_old, field) = elm; \ + if (old_red && parent != parent_old) \ + RB_FLIP_RT(parent_old, field); \ + } \ + if (child != NULL) \ RB_PARENT(child, field) = parent; \ - RB_COLOR(child, field) = RB_BLACK; \ - } else if (color != RB_RED && parent != NULL) \ + else if (parent != NULL && \ + (parent != parent_old ? !red : !old_red)) \ name##_RB_REMOVE_COLOR(head, parent); \ while (parent != NULL) { \ RB_AUGMENT(parent); \ @@ -615,14 +620,14 @@ name##_RB_INSERT(struct name *head, struct type *elm) else \ return (tmp); \ } \ - RB_SET(elm, parent, field); \ - if (parent != NULL) { \ - if (comp < 0) \ - RB_LEFT(parent, field) = elm; \ - else \ - RB_RIGHT(parent, field) = elm; \ - } else \ + RB_PARENT(elm, field) = parent; \ + RB_LF(elm, field) = RB_RT(elm, field) = NULL; \ + if (parent == NULL) \ RB_ROOT(head) = elm; \ + else if (comp < 0) \ + RB_LF(parent, field) = elm; \ + else \ + RB_RT(parent, field) = elm; \ name##_RB_INSERT_COLOR(head, elm); \ while (elm != NULL) { \ RB_AUGMENT(elm); \ From owner-svn-src-head@freebsd.org Tue Jun 9 20:27:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71B9B33BC4D; Tue, 9 Jun 2020 20:27:36 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hMB029yWz4bg3; Tue, 9 Jun 2020 20:27:36 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45EF01B674; Tue, 9 Jun 2020 20:27:36 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059KRa5R044967; Tue, 9 Jun 2020 20:27:36 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059KRadA044966; Tue, 9 Jun 2020 20:27:36 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <202006092027.059KRadA044966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Tue, 9 Jun 2020 20:27:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361985 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: andreast X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 361985 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 20:27:36 -0000 Author: andreast Date: Tue Jun 9 20:27:35 2020 New Revision: 361985 URL: https://svnweb.freebsd.org/changeset/base/361985 Log: Fix boot of wandquad after DTS update In the recent dts sync the name of the aips-bus@ changed to bus@. Reflect this change and add an additional OF_finddevice in fix_fdt_interrupt_data() and in fix_fdt_iomuxc_data() with bus@ only. Iow, keep the old naming for compatibility. Discussed with: ian@ Modified: head/sys/arm/freescale/imx/imx6_machdep.c Modified: head/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_machdep.c Tue Jun 9 20:19:11 2020 (r361984) +++ head/sys/arm/freescale/imx/imx6_machdep.c Tue Jun 9 20:27:35 2020 (r361985) @@ -134,6 +134,8 @@ fix_fdt_interrupt_data(void) if (gpcnode == -1) gpcnode = OF_finddevice("/soc/aips-bus@2000000/gpc@20dc000"); if (gpcnode == -1) + gpcnode = OF_finddevice("/soc/bus@2000000/gpc@20dc000"); + if (gpcnode == -1) return; result = OF_getencprop(gpcnode, "interrupt-parent", &gpcipar, sizeof(gpcipar)); @@ -172,6 +174,8 @@ fix_fdt_iomuxc_data(void) * uses for register access. */ node = OF_finddevice("/soc/aips-bus@2000000/iomuxc-gpr@20e0000"); + if (node == -1) + node = OF_finddevice("/soc/bus@2000000/iomuxc-gpr@20e0000"); if (node != -1) OF_setprop(node, "status", "disabled", sizeof("disabled")); } From owner-svn-src-head@freebsd.org Tue Jun 9 20:52:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E910233C9F0; Tue, 9 Jun 2020 20:52:39 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hMkv6Cvcz4fVg; Tue, 9 Jun 2020 20:52:39 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D08671B6ED; Tue, 9 Jun 2020 20:52:39 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059KqdNj063705; Tue, 9 Jun 2020 20:52:39 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059KqaeX063687; Tue, 9 Jun 2020 20:52:36 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202006092052.059KqaeX063687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Tue, 9 Jun 2020 20:52:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361986 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head: contrib/bmake contrib/bmake/mk usr.bin/bmake X-SVN-Commit-Revision: 361986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 20:52:40 -0000 Author: sjg Date: Tue Jun 9 20:52:35 2020 New Revision: 361986 URL: https://svnweb.freebsd.org/changeset/base/361986 Log: Merge bmake-20200606 Relevant items from ChangeLog: o dir.c: cached_stats - don't confuse stat and lstat results. o var.c: add :Or for reverse sort. Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/Makefile head/contrib/bmake/VERSION head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 head/contrib/bmake/configure head/contrib/bmake/configure.in head/contrib/bmake/dir.c head/contrib/bmake/dirname.c head/contrib/bmake/make.1 head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/dirdeps-targets.mk head/contrib/bmake/mk/init.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/meta2deps.py head/contrib/bmake/var.c head/usr.bin/bmake/Makefile head/usr.bin/bmake/Makefile.config head/usr.bin/bmake/config.h Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/ChangeLog Tue Jun 9 20:52:35 2020 (r361986) @@ -1,3 +1,25 @@ +2020-06-06 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200606 + Merge with NetBSD make, pick up + o make.1: cleanup + + * Makefile: fix depends for main.o which broke MAKE_VERSION + +2020-06-05 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200605 + Merge with NetBSD make, pick up + o dir.c: cached_stats - don't confuse stat and lstat results. + o var.c: add :Or for reverse sort. + +2020-05-24 Simon J Gerraty + + * configure.in: add AC_PROG_CC_C99 for mipspro compiler + also if --with-filemon= specifies path to filemon.h + set use_filemon=dev + * dirname.c: remove include of namespace.h + 2020-05-17 Simon J Gerraty * VERSION (_MAKE_VERSION): 20200517 Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/Makefile Tue Jun 9 20:52:35 2020 (r361986) @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.104 2020/02/06 01:33:54 sjg Exp $ +# $Id: Makefile,v 1.107 2020/06/07 21:18:46 sjg Exp $ PROG= bmake @@ -82,7 +82,7 @@ COPTS.main.c+= "-DMAKE_VERSION=\"${_MAKE_VERSION}\"" # should be set by now USE_FILEMON ?= no .if ${USE_FILEMON:tl} != "no" -.PATH: ${.CURDIR}/filemon +.PATH: ${srcdir}/filemon SRCS+= filemon_${USE_FILEMON}.c COPTS.meta.c+= -DUSE_FILEMON -DUSE_FILEMON_${USE_FILEMON:tu} COPTS.job.c+= ${COPTS.meta.c} @@ -158,7 +158,7 @@ MAN1= ${MAN} .if (${PROG} != "make") CLEANFILES+= my.history .if make(${MAN}) || !exists(${srcdir}/${MAN}) -my.history: ${MAKEFILE} +my.history: @(echo ".Nm"; \ echo "is derived from NetBSD"; \ echo ".Xr make 1 ."; \ @@ -207,7 +207,7 @@ ${OBJS}: config.h # start-delete2 for bsd.after-import.mk # make sure that MAKE_VERSION gets updated. -main.o: ${SRCS} ${.CURDIR}/VERSION +main.o: ${srcdir}/VERSION .if ${MK_AUTOCONF_MK} == "yes" CONFIGURE_DEPS += ${.CURDIR}/VERSION Modified: head/contrib/bmake/VERSION ============================================================================== --- head/contrib/bmake/VERSION Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/VERSION Tue Jun 9 20:52:35 2020 (r361986) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20200517 +_MAKE_VERSION=20200606 Modified: head/contrib/bmake/bmake.1 ============================================================================== --- head/contrib/bmake/bmake.1 Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/bmake.1 Tue Jun 9 20:52:35 2020 (r361986) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.273 2018/05/27 01:14:51 christos Exp $ +.\" $NetBSD: make.1,v 1.282 2020/06/06 20:28:42 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd May 26, 2018 +.Dd June 5, 2020 .Dt BMAKE 1 .Os .Sh NAME @@ -272,7 +272,7 @@ that do not depend on the target whose creation caused .It Fl m Ar directory Specify a directory in which to search for sys.mk and makefiles included via the -.Ao Ar file Ac Ns -style +.Li \&< Ns Ar file Ns Li \&> Ns -style include statement. The .Fl m @@ -280,7 +280,7 @@ option can be used multiple times to form a search pat This path will override the default system include path: /usr/share/mk. Furthermore the system include path will be appended to the search path used for -.Qo Ar file Qc Ns -style +.Li \*q Ns Ar file Ns Li \*q Ns -style include statements (see the .Fl I option). @@ -1196,10 +1196,8 @@ but selects all words which do not match .Ar pattern . .It Cm \&:O Order every word in variable alphabetically. -To sort words in -reverse order use the -.Ql Cm \&:O:[-1..1] -combination of modifiers. +.It Cm \&:Or +Order every word in variable in reverse alphabetical order. .It Cm \&:Ox Randomize words in variable. The results will be different each time you are referring to the @@ -1234,7 +1232,7 @@ Quotes every shell meta-character in the variable, and characters so that it can be passed safely through recursive invocations of .Nm . -This is equivalent to: +This is equivalent to: .Sq \&:S/\e\&$/&&/g:Q . .It Cm \&:R Replaces each word in the variable with everything but its suffix. @@ -1429,6 +1427,29 @@ is the substring of .Ar old_string to be replaced in .Ar new_string . +If only +.Ar old_string +contains the pattern matching character +.Ar % , +and +.Ar old_string +matches, then the result is the +.Ar new_string . +If only the +.Ar new_string +contains the pattern matching character +.Ar % , +then it is not treated specially and it is printed as a literal +.Ar % +on match. +If there is more than one pattern matching character +.Ar ( % ) +in either the +.Ar new_string +or +.Ar old_string , +only the first instance is treated specially (as the pattern character); +all subsequent instances are treated as regular characters .Pp Variable expansion occurs in the normal fashion inside both .Ar old_string @@ -1591,6 +1612,11 @@ then the words are output in reverse order. For example, .Ql Cm \&:[-1..1] selects all the words from last to first. +If the list is already ordered, then this effectively reverses +the list, but it is more efficient to use +.Ql Cm \&:Or +instead of +.Ql Cm \&:O:[-1..1] . .\" :[*] .It Cm \&* Causes subsequent modifiers to treat the value as a single word @@ -1623,9 +1649,9 @@ dot .Pq Ql \&. character. Files are included with either -.Cm \&.include Aq Ar file +.Cm \&.include \&< Ns Ar file Ns Cm \&> or -.Cm \&.include Pf \*q Ar file Ns \*q . +.Cm \&.include \&\*q Ns Ar file Ns Cm \&\*q . Variables between the angle brackets or double quotes are expanded to form the file name. If angle brackets are used, the included makefile is expected to be in @@ -2409,9 +2435,9 @@ file). .Sh BUGS The make -syntax is difficult to parse without actually acting of the data. -For instance finding the end of a variable use should involve scanning each -the modifiers using the correct terminator for each field. +syntax is difficult to parse without actually acting on the data. +For instance, finding the end of a variable's use should involve scanning +each of the modifiers, using the correct terminator for each field. In many places make just counts {} and () in order to find the end of a variable expansion. Modified: head/contrib/bmake/bmake.cat1 ============================================================================== --- head/contrib/bmake/bmake.cat1 Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/bmake.cat1 Tue Jun 9 20:52:35 2020 (r361986) @@ -779,9 +779,10 @@ BMAKE(1) FreeBSD General Commands Manua This is identical to `:M', but selects all words which do not match pattern. - :O Order every word in variable alphabetically. To sort words in - reverse order use the `:O:[-1..1]' combination of modifiers. + :O Order every word in variable alphabetically. + :Or Order every word in variable in reverse alphabetical order. + :Ox Randomize words in variable. The results will be different each time you are referring to the modified variable; use the assignment with expansion (`:=') to prevent such behavior. For example, @@ -803,8 +804,12 @@ BMAKE(1) FreeBSD General Commands Manua due uno quattro tre :Q Quotes every shell meta-character in the variable, so that it can be - passed safely through recursive invocations of bmake. + passed safely to the shell. + :q Quotes every shell meta-character in the variable, and also doubles + `$' characters so that it can be passed safely through recursive + invocations of bmake. This is equivalent to: `:S/\$/&&/g:Q'. + :R Replaces each word in the variable with everything but its suffix. :range[=count] @@ -903,7 +908,15 @@ BMAKE(1) FreeBSD General Commands Manua contain the pattern matching character % then it is assumed that they are anchored at the end of each word, so only suffixes or entire words may be replaced. Otherwise % is the substring of - old_string to be replaced in new_string. + old_string to be replaced in new_string. If only old_string con- + tains the pattern matching character %, and old_string matches, then + the result is the new_string. If only the new_string contains the + pattern matching character %, then it is not treated specially and + it is printed as a literal % on match. If there is more than one + pattern matching character (%) in either the new_string or + old_string, only the first instance is treated specially (as the + pattern character); all subsequent instances are treated as regular + characters Variable expansion occurs in the normal fashion inside both old_string and new_string with the single exception that a backslash @@ -1003,7 +1016,9 @@ BMAKE(1) FreeBSD General Commands Manua `:[2..-1]' selects all words from the second word to the last word. If start is greater than end, then the words are out- put in reverse order. For example, `:[-1..1]' selects all - the words from last to first. + the words from last to first. If the list is already + ordered, then this effectively reverses the list, but it is + more efficient to use `:Or' instead of `:O:[-1..1]'. * Causes subsequent modifiers to treat the value as a single word (possibly containing embedded white space). Analogous @@ -1021,7 +1036,7 @@ BMAKE(1) FreeBSD General Commands Manua Makefile inclusion, conditional structures and for loops reminiscent of the C programming language are provided in bmake. All such structures are identified by a line beginning with a single dot (`.') character. - Files are included with either .include <file> or .include "file". Vari- + Files are included with either .include <file> or .include "file". Vari- ables between the angle brackets or double quotes are expanded to form the file name. If angle brackets are used, the included makefile is expected to be in the system makefile directory. If double quotes are @@ -1184,7 +1199,7 @@ BMAKE(1) FreeBSD General Commands Manua the ``make'' or ``defined'' expression is applied to it, depending on the form of the conditional. If the form is `.ifdef', `.ifndef', or `.if' the ``defined'' expression is applied. Similarly, if the form is - `.ifmake' or `.ifnmake, the' ``make'' expression is applied. + `.ifmake' or `.ifnmake', the ``make'' expression is applied. If the conditional evaluates to true the parsing of the makefile contin- ues as before. If it evaluates to false, the following lines are @@ -1533,12 +1548,12 @@ BMAKE(1) FreeBSD General Commands Manua creates an ``FRC'' file). BUGS - The make syntax is difficult to parse without actually acting of the - data. For instance finding the end of a variable use should involve - scanning each the modifiers using the correct terminator for each field. - In many places make just counts {} and () in order to find the end of a - variable expansion. + The make syntax is difficult to parse without actually acting on the + data. For instance, finding the end of a variable's use should involve + scanning each of the modifiers, using the correct terminator for each + field. In many places make just counts {} and () in order to find the + end of a variable expansion. There is no way of escaping a space character in a filename. -FreeBSD 11.1 June 22, 2017 FreeBSD 11.1 +FreeBSD 11.3 June 5, 2020 FreeBSD 11.3 Modified: head/contrib/bmake/configure ============================================================================== Binary file (source and/or target). No diff available. Modified: head/contrib/bmake/configure.in ============================================================================== --- head/contrib/bmake/configure.in Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/configure.in Tue Jun 9 20:52:35 2020 (r361986) @@ -1,11 +1,11 @@ dnl dnl RCSid: -dnl $Id: configure.in,v 1.63 2020/04/19 05:17:57 sjg Exp $ +dnl $Id: configure.in,v 1.65 2020/05/25 01:11:40 sjg Exp $ dnl dnl Process this file with autoconf to produce a configure script dnl AC_PREREQ(2.50) -AC_INIT([bmake], [20200418], [sjg@NetBSD.org]) +AC_INIT([bmake], [20200524], [sjg@NetBSD.org]) AC_CONFIG_HEADERS(config.h) dnl make srcdir absolute @@ -60,7 +60,11 @@ AC_ARG_WITH(filemon, */filemon.h) filemon_h="${withval}";; */filemon*) filemon_h="${withval}/filemon.h";; *) AC_MSG_ERROR(bad value ${withval} given for filemon) ;; -esac], +esac +case "$use_filemon,$filemon_h" in +,*.h) use_filemon=dev;; +esac +], [ case "$OS" in NetBSD) filemon_h=no use_filemon=ktrace;; @@ -100,7 +104,8 @@ dnl see _EXTENSIONS_ we use it. AC_USE_SYSTEM_EXTENSIONS dnl Checks for programs. AC_PROG_CC -AC_PROG_GCC_TRADITIONAL +AC_PROG_CC_C99 +dnl AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL dnl Executable suffix - normally empty; .exe on os2. AC_SUBST(ac_exe_suffix)dnl Modified: head/contrib/bmake/dir.c ============================================================================== --- head/contrib/bmake/dir.c Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/dir.c Tue Jun 9 20:52:35 2020 (r361986) @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $ */ +/* $NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $"; +static char rcsid[] = "$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: dir.c,v 1.73 2018/07/12 18:03:31 christos Exp $"); +__RCSID("$NetBSD: dir.c,v 1.74 2020/06/05 18:03:59 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -263,7 +263,8 @@ static char *DirLookupAbs(Path *, const char *, const * mtime and mode are all we care about. */ struct cache_st { - time_t mtime; + time_t lmtime; /* lstat */ + time_t mtime; /* stat */ mode_t mode; }; @@ -287,13 +288,15 @@ cached_stats(Hash_Table *htp, const char *pathname, st cst = entry->clientPtr; memset(st, 0, sizeof(*st)); - st->st_mtime = cst->mtime; st->st_mode = cst->mode; - if (DEBUG(DIR)) { - fprintf(debug_file, "Using cached time %s for %s\n", - Targ_FmtTime(st->st_mtime), pathname); + st->st_mtime = (flags & CST_LSTAT) ? cst->lmtime : cst->mtime; + if (st->st_mtime) { + if (DEBUG(DIR)) { + fprintf(debug_file, "Using cached time %s for %s\n", + Targ_FmtTime(st->st_mtime), pathname); + } + return 0; } - return 0; } rc = (flags & CST_LSTAT) ? lstat(pathname, st) : stat(pathname, st); @@ -305,10 +308,16 @@ cached_stats(Hash_Table *htp, const char *pathname, st if (!entry) entry = Hash_CreateEntry(htp, pathname, NULL); - if (!entry->clientPtr) + if (!entry->clientPtr) { entry->clientPtr = bmake_malloc(sizeof(*cst)); + memset(entry->clientPtr, 0, sizeof(*cst)); + } cst = entry->clientPtr; - cst->mtime = st->st_mtime; + if ((flags & CST_LSTAT)) { + cst->lmtime = st->st_mtime; + } else { + cst->mtime = st->st_mtime; + } cst->mode = st->st_mode; if (DEBUG(DIR)) { fprintf(debug_file, " Caching %s for %s\n", Modified: head/contrib/bmake/dirname.c ============================================================================== --- head/contrib/bmake/dirname.c Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/dirname.c Tue Jun 9 20:52:35 2020 (r361986) @@ -39,7 +39,6 @@ __RCSID("$NetBSD: dirname.c,v 1.14 2018/09/27 00:45:34 kre Exp $"); #endif /* !LIBC_SCCS && !lint */ -#include "namespace.h" #include #ifdef HAVE_LIBGEN_H #include Modified: head/contrib/bmake/make.1 ============================================================================== --- head/contrib/bmake/make.1 Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/make.1 Tue Jun 9 20:52:35 2020 (r361986) @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.280 2020/04/27 20:03:08 christos Exp $ +.\" $NetBSD: make.1,v 1.282 2020/06/06 20:28:42 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd April 27, 2020 +.Dd June 5, 2020 .Dt MAKE 1 .Os .Sh NAME @@ -1207,10 +1207,8 @@ but selects all words which do not match .Ar pattern . .It Cm \&:O Order every word in variable alphabetically. -To sort words in -reverse order use the -.Ql Cm \&:O:[-1..1] -combination of modifiers. +.It Cm \&:Or +Order every word in variable in reverse alphabetical order. .It Cm \&:Ox Randomize words in variable. The results will be different each time you are referring to the @@ -1444,7 +1442,7 @@ If only .Ar old_string contains the pattern matching character .Ar % , -and +and .Ar old_string matches, then the result is the .Ar new_string . @@ -1625,6 +1623,11 @@ then the words are output in reverse order. For example, .Ql Cm \&:[-1..1] selects all the words from last to first. +If the list is already ordered, then this effectively reverses +the list, but it is more efficient to use +.Ql Cm \&:Or +instead of +.Ql Cm \&:O:[-1..1] . .\" :[*] .It Cm \&* Causes subsequent modifiers to treat the value as a single word Modified: head/contrib/bmake/mk/ChangeLog ============================================================================== --- head/contrib/bmake/mk/ChangeLog Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/mk/ChangeLog Tue Jun 9 20:52:35 2020 (r361986) @@ -1,3 +1,20 @@ +2020-06-06 Simon J Gerraty + + * install-mk (MK_VERSION): 20200606 + + * dirdeps-targets.mk: allow for filtering of .TARGETS + + * meta2deps.py: fix bug in processing 'L'ink and 'M'ove + entries - and we don't care about 'W'rite entries. + Also ignore absolute paths that do not exist. + +2020-05-25 Simon J Gerraty + + * install-mk (MK_VERSION): 20200525 + + * init.mk: expand and simplify handling of qualified vars + like CPPFLAGS.${.TARGET:T} + 2020-05-15 Simon J Gerraty * install-mk (MK_VERSION): 20200515 Modified: head/contrib/bmake/mk/dirdeps-targets.mk ============================================================================== --- head/contrib/bmake/mk/dirdeps-targets.mk Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/mk/dirdeps-targets.mk Tue Jun 9 20:52:35 2020 (r361986) @@ -1,7 +1,7 @@ # RCSid: -# $Id: dirdeps-targets.mk,v 1.9 2019/10/06 20:07:50 sjg Exp $ +# $Id: dirdeps-targets.mk,v 1.10 2020/06/06 22:41:02 sjg Exp $ # -# @(#) Copyright (c) 2019 Simon J. Gerraty +# @(#) Copyright (c) 2019-2020 Simon J. Gerraty # # This file is provided in the hope that it will # be of use. There is absolutely NO WARRANTY. @@ -37,8 +37,11 @@ DIRDEPS_TARGETS_DIRS ?= targets targets/pseudo # they need to be stripped when looking for target dirs DIRDEPS_TARGETS_PREFIX_LIST ?= pkg- build- +# some .TARGETS need filtering +DIRDEPS_TARGETS_FILTER += Nall + # matching target dirs if any -tdirs := ${.TARGETS:Nall:${DIRDEPS_TARGETS_PREFIX_LIST:@p@S,^$p,,@:ts:}:@t@${DIRDEPS_TARGETS_DIRS:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@} +tdirs := ${.TARGETS:${DIRDEPS_TARGETS_FILTER:ts:}:${DIRDEPS_TARGETS_PREFIX_LIST:@p@S,^$p,,@:ts:}:@t@${DIRDEPS_TARGETS_DIRS:@d@$d/$t@}@:@d@${exists(${SRCTOP}/$d):?$d:}@} .if !empty(DEBUG_DIRDEPS_TARGETS) .info tdirs=${tdirs} Modified: head/contrib/bmake/mk/init.mk ============================================================================== --- head/contrib/bmake/mk/init.mk Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/mk/init.mk Tue Jun 9 20:52:35 2020 (r361986) @@ -1,4 +1,4 @@ -# $Id: init.mk,v 1.16 2019/09/28 16:54:02 sjg Exp $ +# $Id: init.mk,v 1.17 2020/05/25 20:15:07 sjg Exp $ # # @(#) Copyright (c) 2002, Simon J. Gerraty # @@ -36,8 +36,27 @@ CXX_SUFFIXES?= .cc .cpp .cxx .C .include .endif -.for x in COPTS CPPFLAGS CPUFLAGS LDFLAGS -$x += ${$x.${COMPILER_TYPE}:U} ${$x.${.IMPSRC:T}:U} +# these are applied in order, least specific to most +VAR_QUALIFIER_LIST += \ + ${TARGET_SPEC_VARS:UMACHINE:@v@${$v}@} \ + ${COMPILER_TYPE} \ + ${.TARGET:T:R} \ + ${.TARGET:T} \ + ${.IMPSRC:T} \ + ${VAR_QUALIFIER_XTRA_LIST} + +QUALIFIED_VAR_LIST += \ + CFLAGS \ + COPTS \ + CPPFLAGS \ + CPUFLAGS \ + LDFLAGS \ + +# a final :U avoids errors if someone uses := +.for V in ${QUALIFIED_VAR_LIST:O:u:@q@$q $q_LAST@} +.for Q in ${VAR_QUALIFIER_LIST:u} +$V += ${$V.$Q:U} ${$V.$Q.${COMPILER_TYPE}:U} +.endfor .endfor CC_PG?= -pg Modified: head/contrib/bmake/mk/install-mk ============================================================================== --- head/contrib/bmake/mk/install-mk Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/mk/install-mk Tue Jun 9 20:52:35 2020 (r361986) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.170 2020/05/15 21:40:24 sjg Exp $ +# $Id: install-mk,v 1.172 2020/06/06 22:41:15 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20200515 +MK_VERSION=20200606 OWNER= GROUP= MODE=444 Modified: head/contrib/bmake/mk/meta2deps.py ============================================================================== --- head/contrib/bmake/mk/meta2deps.py Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/mk/meta2deps.py Tue Jun 9 20:52:35 2020 (r361986) @@ -37,7 +37,7 @@ We only pay attention to a subset of the information i """ RCSid: - $Id: meta2deps.py,v 1.28 2020/05/16 23:21:48 sjg Exp $ + $Id: meta2deps.py,v 1.30 2020/06/08 23:05:00 sjg Exp $ Copyright (c) 2011-2019, Simon J. Gerraty Copyright (c) 2011-2017, Juniper Networks, Inc. @@ -81,7 +81,11 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_o if path.endswith('/.'): path = path[0:-2] if len(path) > 0 and path[0] == '/': - return path + if os.path.exists(path): + return path + if debug > 2: + print("skipping non-existent:", path, file=debug_out) + return None if path == '.': return cwd if path.startswith('./'): @@ -139,6 +143,8 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_o rpath = resolve(path, cwd, last_dir, debug, debug_out) if rpath: path = rpath + elif len(path) > 0 and path[0] == '/': + return None if (path.find('/') < 0 or path.find('./') > 0 or path.endswith('/..')): @@ -475,6 +481,10 @@ class MetaFile: continue elif w[0] == 'C': cwd = abspath(w[2], cwd, None, self.debug, self.debug_out) + if not cwd: + cwd = w[2] + if self.debug > 1: + print("missing cwd=", cwd, file=self.debug_out) if cwd.endswith('/.'): cwd = cwd[0:-2] self.last_dir = pid_last_dir[pid] = cwd @@ -491,8 +501,8 @@ class MetaFile: if w[0] in 'ML': # these are special, tread src as read and # target as write - self.parse_path(w[1].strip("'"), cwd, 'R', w) - self.parse_path(w[2].strip("'"), cwd, 'W', w) + self.parse_path(w[2].strip("'"), cwd, 'R', w) + self.parse_path(w[3].strip("'"), cwd, 'W', w) continue elif w[0] in 'ERWS': path = w[2] @@ -563,7 +573,7 @@ class MetaFile: print("ldir=", self.last_dir, file=self.debug_out) return - if op in 'ERW': + if op in 'ER': # finally, we get down to it if dir == self.cwd or dir == self.curdir: return Modified: head/contrib/bmake/var.c ============================================================================== --- head/contrib/bmake/var.c Tue Jun 9 20:27:35 2020 (r361985) +++ head/contrib/bmake/var.c Tue Jun 9 20:52:35 2020 (r361986) @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.223 2020/04/25 18:20:57 christos Exp $ */ +/* $NetBSD: var.c,v 1.224 2020/06/05 19:20:46 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.223 2020/04/25 18:20:57 christos Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.224 2020/06/05 19:20:46 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.223 2020/04/25 18:20:57 christos Exp $"); +__RCSID("$NetBSD: var.c,v 1.224 2020/06/05 19:20:46 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -2027,6 +2027,13 @@ VarWordCompare(const void *a, const void *b) return r; } +static int +VarWordCompareReverse(const void *a, const void *b) +{ + int r = strcmp(*(const char * const *)b, *(const char * const *)a); + return r; +} + /*- *----------------------------------------------------------------------- * VarOrder -- @@ -2058,6 +2065,9 @@ VarOrder(const char *str, const char otype) if (ac > 0) switch (otype) { + case 'r': /* reverse sort alphabetically */ + qsort(av, ac, sizeof(char *), VarWordCompareReverse); + break; case 's': /* sort alphabetically */ qsort(av, ac, sizeof(char *), VarWordCompare); break; @@ -3562,7 +3572,7 @@ ApplyModifiers(char *nstr, const char *tstr, if (tstr[1] == endc || tstr[1] == ':') { otype = 's'; termc = *cp; - } else if ( (tstr[1] == 'x') && + } else if ( (tstr[1] == 'r' || tstr[1] == 'x') && (tstr[2] == endc || tstr[2] == ':') ) { otype = tstr[1]; cp = tstr + 2; Modified: head/usr.bin/bmake/Makefile ============================================================================== --- head/usr.bin/bmake/Makefile Tue Jun 9 20:27:35 2020 (r361985) +++ head/usr.bin/bmake/Makefile Tue Jun 9 20:52:35 2020 (r361986) @@ -12,7 +12,7 @@ CFLAGS+= -I${.CURDIR} CLEANDIRS+= FreeBSD CLEANFILES+= bootstrap -# $Id: Makefile,v 1.104 2020/02/06 01:33:54 sjg Exp $ +# $Id: Makefile,v 1.107 2020/06/07 21:18:46 sjg Exp $ PROG?= ${.CURDIR:T} @@ -123,7 +123,7 @@ MAN1= ${MAN} .if (${PROG} != "make") CLEANFILES+= my.history .if make(${MAN}) || !exists(${srcdir}/${MAN}) -my.history: ${MAKEFILE} +my.history: @(echo ".Nm"; \ echo "is derived from NetBSD"; \ echo ".Xr make 1 ."; \ Modified: head/usr.bin/bmake/Makefile.config ============================================================================== --- head/usr.bin/bmake/Makefile.config Tue Jun 9 20:27:35 2020 (r361985) +++ head/usr.bin/bmake/Makefile.config Tue Jun 9 20:52:35 2020 (r361986) @@ -7,7 +7,7 @@ SRCTOP?= ${.CURDIR:H:H} # things set by configure -_MAKE_VERSION?=20200517 +_MAKE_VERSION?=20200606 prefix?= /usr srcdir= ${SRCTOP}/contrib/bmake Modified: head/usr.bin/bmake/config.h ============================================================================== --- head/usr.bin/bmake/config.h Tue Jun 9 20:27:35 2020 (r361985) +++ head/usr.bin/bmake/config.h Tue Jun 9 20:52:35 2020 (r361986) @@ -245,7 +245,7 @@ #define PACKAGE_NAME "bmake" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "bmake 20200418" +#define PACKAGE_STRING "bmake 20200524" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "bmake" @@ -254,7 +254,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "20200418" +#define PACKAGE_VERSION "20200524" /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void From owner-svn-src-head@freebsd.org Tue Jun 9 21:07:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BB3B33CFA4; Tue, 9 Jun 2020 21:07:59 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hN4Z74dhz3S3Z; Tue, 9 Jun 2020 21:07:58 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E92CB1BD64; Tue, 9 Jun 2020 21:07:58 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059L7wog070121; Tue, 9 Jun 2020 21:07:58 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059L7wmK070120; Tue, 9 Jun 2020 21:07:58 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202006092107.059L7wmK070120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Tue, 9 Jun 2020 21:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361987 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 361987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 21:07:59 -0000 Author: rscheff Date: Tue Jun 9 21:07:58 2020 New Revision: 361987 URL: https://svnweb.freebsd.org/changeset/base/361987 Log: Prevent TCP Cubic to abruptly increase cwnd after slow-start Introducing flags to track the initial Wmax dragging and exit from slow-start in TCP Cubic. This prevents sudden jumps in the caluclated cwnd by cubic, especially when the flow is application limited during slow start (cwnd can not grow as fast as expected). The downside is that cubic may remain slightly longer in the concave region before starting the convex region beyond Wmax again. Reviewed by: chengc_netapp.com, tuexen (mentor) Approved by: tuexen (mentor), rgrimes (mentor, blanket) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D23655 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Tue Jun 9 20:52:35 2020 (r361986) +++ head/sys/netinet/cc/cc_cubic.c Tue Jun 9 21:07:58 2020 (r361987) @@ -90,8 +90,10 @@ struct cubic { unsigned long max_cwnd; /* cwnd at the previous congestion event. */ unsigned long prev_max_cwnd; - /* Number of congestion events. */ - uint32_t num_cong_events; + /* various flags */ + uint32_t flags; +#define CUBICFLAG_CONG_EVENT 0x00000001 /* congestion experienced */ +#define CUBICFLAG_IN_SLOWSTART 0x00000002 /* in slow start */ /* Minimum observed rtt in ticks. */ int min_rtt_ticks; /* Mean observed rtt between congestion epochs. */ @@ -138,9 +140,10 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) (V_tcp_do_rfc3465 && ccv->flags & CCF_ABC_SENTAWND))) { /* Use the logic in NewReno ack_received() for slow start. */ if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) || - cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) + cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) { + cubic_data->flags |= CUBICFLAG_IN_SLOWSTART; newreno_cc_algo.ack_received(ccv, type); - else { + } else { if ((ticks_since_cong = ticks - cubic_data->t_last_cong) < 0) { /* @@ -150,6 +153,11 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) cubic_data->t_last_cong = ticks - INT_MAX; } + if (cubic_data->flags & CUBICFLAG_IN_SLOWSTART) { + cubic_data->flags &= ~CUBICFLAG_IN_SLOWSTART; + cubic_data->t_last_cong = ticks; + cubic_data->K = 0; + } /* * The mean RTT is used to best reflect the equations in * the I-D. Using min_rtt in the tf_cwnd calculation @@ -199,7 +207,7 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) * keep updating our current estimate of the * max_cwnd. */ - if (cubic_data->num_cong_events == 0 && + if (((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) && cubic_data->max_cwnd < CCV(ccv, snd_cwnd)) { cubic_data->max_cwnd = CCV(ccv, snd_cwnd); cubic_data->K = cubic_k(cubic_data->max_cwnd / @@ -270,9 +278,10 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { cubic_ssthresh_update(ccv); - cubic_data->num_cong_events++; + cubic_data->flags |= CUBICFLAG_CONG_EVENT; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; cubic_data->max_cwnd = CCV(ccv, snd_cwnd); + cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); } ENTER_RECOVERY(CCV(ccv, t_flags)); } @@ -281,10 +290,11 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) case CC_ECN: if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { cubic_ssthresh_update(ccv); - cubic_data->num_cong_events++; + cubic_data->flags |= CUBICFLAG_CONG_EVENT; cubic_data->prev_max_cwnd = cubic_data->max_cwnd; cubic_data->max_cwnd = CCV(ccv, snd_cwnd); cubic_data->t_last_cong = ticks; + cubic_data->K = cubic_k(cubic_data->max_cwnd / CCV(ccv, t_maxseg)); CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh); ENTER_CONGRECOVERY(CCV(ccv, t_flags)); } @@ -299,7 +309,7 @@ cubic_cong_signal(struct cc_var *ccv, uint32_t type) * congestion. */ if (CCV(ccv, t_rxtshift) >= 2) { - cubic_data->num_cong_events++; + cubic_data->flags |= CUBICFLAG_CONG_EVENT; cubic_data->t_last_cong = ticks; } break; @@ -442,7 +452,7 @@ cubic_ssthresh_update(struct cc_var *ccv) * On the first congestion event, set ssthresh to cwnd * 0.5, on * subsequent congestion events, set it to cwnd * beta. */ - if (cubic_data->num_cong_events == 0) + if ((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) ssthresh = CCV(ccv, snd_cwnd) >> 1; else ssthresh = ((uint64_t)CCV(ccv, snd_cwnd) * From owner-svn-src-head@freebsd.org Tue Jun 9 21:59:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDBA133E7EE; Tue, 9 Jun 2020 21:59:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hPCj57zLz3Yp7; Tue, 9 Jun 2020 21:59:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABC311C5DA; Tue, 9 Jun 2020 21:59:13 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059LxD9e002149; Tue, 9 Jun 2020 21:59:13 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059LxDSx002148; Tue, 9 Jun 2020 21:59:13 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202006092159.059LxDSx002148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 9 Jun 2020 21:59:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361988 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 361988 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 21:59:13 -0000 Author: jhibbits Date: Tue Jun 9 21:59:13 2020 New Revision: 361988 URL: https://svnweb.freebsd.org/changeset/base/361988 Log: powerpc/pmap: Fix wired memory leak in booke64 page directories Properly handle reference counts in the 64-bit pmap page directories. Otherwise all page table pages would leak due to over-referencing. This would cause a quick enter to swap on a desktop system (AmigaOne X5000) when quitting and rerunning applications, or just building world. Add an INVARIANTS check to validate no leakage at pmap release time. Modified: head/sys/powerpc/booke/pmap_64.c Modified: head/sys/powerpc/booke/pmap_64.c ============================================================================== --- head/sys/powerpc/booke/pmap_64.c Tue Jun 9 21:07:58 2020 (r361987) +++ head/sys/powerpc/booke/pmap_64.c Tue Jun 9 21:59:13 2020 (r361988) @@ -251,9 +251,7 @@ static bool unhold_free_page(pmap_t pmap, vm_page_t m) { - m->ref_count--; - if (m->ref_count == 0) { - vm_wire_sub(1); + if (vm_page_unwire_noq(m)) { vm_page_free_zero(m); return (true); } @@ -262,8 +260,8 @@ unhold_free_page(pmap_t pmap, vm_page_t m) } static vm_offset_t -alloc_or_hold_page(pmap_t pmap, vm_offset_t *ptr_tbl, uint32_t index, - bool nosleep, bool hold, bool *isnew) +get_pgtbl_page(pmap_t pmap, vm_offset_t *ptr_tbl, uint32_t index, + bool nosleep, bool hold_parent, bool *isnew) { vm_offset_t page; vm_page_t m; @@ -276,18 +274,18 @@ alloc_or_hold_page(pmap_t pmap, vm_offset_t *ptr_tbl, if (ptr_tbl[index] == 0) { *isnew = true; ptr_tbl[index] = page; + if (hold_parent) { + m = PHYS_TO_VM_PAGE(pmap_kextract((vm_offset_t)ptr_tbl)); + m->ref_count++; + } return (page); } m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS(page)); page = ptr_tbl[index]; - vm_wire_sub(1); + vm_page_unwire_noq(m); vm_page_free_zero(m); } - if (hold) { - m = PHYS_TO_VM_PAGE(pmap_kextract(page)); - m->ref_count++; - } *isnew = false; return (page); @@ -301,19 +299,18 @@ ptbl_alloc(pmap_t pmap, vm_offset_t va, bool nosleep, unsigned int pdir_l1_idx = PDIR_L1_IDX(va); unsigned int pdir_idx = PDIR_IDX(va); vm_offset_t pdir_l1, pdir, ptbl; - bool hold_page; - hold_page = (pmap != kernel_pmap); - pdir_l1 = alloc_or_hold_page(pmap, (vm_offset_t *)pmap->pm_root, - pg_root_idx, nosleep, hold_page, is_new); + /* When holding a parent, no need to hold the root index pages. */ + pdir_l1 = get_pgtbl_page(pmap, (vm_offset_t *)pmap->pm_root, + pg_root_idx, nosleep, false, is_new); if (pdir_l1 == 0) return (NULL); - pdir = alloc_or_hold_page(pmap, (vm_offset_t *)pdir_l1, pdir_l1_idx, - nosleep, hold_page, is_new); + pdir = get_pgtbl_page(pmap, (vm_offset_t *)pdir_l1, pdir_l1_idx, + nosleep, !*is_new, is_new); if (pdir == 0) return (NULL); - ptbl = alloc_or_hold_page(pmap, (vm_offset_t *)pdir, pdir_idx, - nosleep, false, is_new); + ptbl = get_pgtbl_page(pmap, (vm_offset_t *)pdir, pdir_idx, + nosleep, !*is_new, is_new); return ((pte_t *)ptbl); } @@ -629,6 +626,15 @@ mmu_booke_release(pmap_t pmap) KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); +#ifdef INVARIANTS + /* + * Verify that all page directories are gone. + * Protects against reference count leakage. + */ + for (int i = 0; i < PG_ROOT_NENTRIES; i++) + KASSERT(pmap->pm_root[i] == 0, + ("Index %d on root page %p is non-zero!\n", i, pmap->pm_root)); +#endif uma_zfree(ptbl_root_zone, pmap->pm_root); } From owner-svn-src-head@freebsd.org Tue Jun 9 22:19:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C479533ED65; Tue, 9 Jun 2020 22:19:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hPgF4rgMz3bwv; Tue, 9 Jun 2020 22:19:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CAFC1CDE5; Tue, 9 Jun 2020 22:19:37 +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 059MJb0F014555; Tue, 9 Jun 2020 22:19:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059MJbAK014554; Tue, 9 Jun 2020 22:19:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006092219.059MJbAK014554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 9 Jun 2020 22:19:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361990 - in head/sys: crypto/via mips/cavium/cryptocteon X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: crypto/via mips/cavium/cryptocteon X-SVN-Commit-Revision: 361990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 22:19:37 -0000 Author: jhb Date: Tue Jun 9 22:19:36 2020 New Revision: 361990 URL: https://svnweb.freebsd.org/changeset/base/361990 Log: Mark padlock(4) and cryptocteon(4) as software drivers. Both already return the accelerated software priority from cryptodev_probesession. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D25125 Modified: head/sys/crypto/via/padlock.c head/sys/mips/cavium/cryptocteon/cryptocteon.c Modified: head/sys/crypto/via/padlock.c ============================================================================== --- head/sys/crypto/via/padlock.c Tue Jun 9 22:15:45 2020 (r361989) +++ head/sys/crypto/via/padlock.c Tue Jun 9 22:19:36 2020 (r361990) @@ -119,7 +119,7 @@ padlock_attach(device_t dev) struct padlock_softc *sc = device_get_softc(dev); sc->sc_cid = crypto_get_driverid(dev, sizeof(struct padlock_session), - CRYPTOCAP_F_HARDWARE); + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC); if (sc->sc_cid < 0) { device_printf(dev, "Could not get crypto driver id.\n"); return (ENOMEM); Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c ============================================================================== --- head/sys/mips/cavium/cryptocteon/cryptocteon.c Tue Jun 9 22:15:45 2020 (r361989) +++ head/sys/mips/cavium/cryptocteon/cryptocteon.c Tue Jun 9 22:19:36 2020 (r361990) @@ -86,7 +86,7 @@ cryptocteon_attach(device_t dev) sc = device_get_softc(dev); sc->sc_cid = crypto_get_driverid(dev, sizeof(struct octo_sess), - CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SYNC); + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC); if (sc->sc_cid < 0) { device_printf(dev, "crypto_get_driverid ret %d\n", sc->sc_cid); return (ENXIO); From owner-svn-src-head@freebsd.org Tue Jun 9 22:26:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA41033F236; Tue, 9 Jun 2020 22:26:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hPpn5NtMz3clg; Tue, 9 Jun 2020 22:26:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFCA01CEB2; Tue, 9 Jun 2020 22:26:09 +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 059MQ9gQ020538; Tue, 9 Jun 2020 22:26:09 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059MQ7aH020526; Tue, 9 Jun 2020 22:26:07 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006092226.059MQ7aH020526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 9 Jun 2020 22:26:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361991 - in head: share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/via sys/geom/eli sys/mips/cavium/cryptocteon sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: share/man/man9 sys/crypto/aesni sys/crypto/armv8 sys/crypto/blake2 sys/crypto/via sys/geom/eli sys/mips/cavium/cryptocteon sys/opencrypto X-SVN-Commit-Revision: 361991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 22:26:09 -0000 Author: jhb Date: Tue Jun 9 22:26:07 2020 New Revision: 361991 URL: https://svnweb.freebsd.org/changeset/base/361991 Log: Add a crypto capability flag for accelerated software drivers. Use this in GELI to print out a different message when accelerated software such as AESNI is used vs plain software crypto. While here, simplify the logic in GELI a bit for determing which type of crypto driver was chosen the first time by examining the capabilities of the matched driver after a single call to crypto_newsession rather than making separate calls with different flags. Reviewed by: delphij Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D25126 Modified: head/share/man/man9/crypto_driver.9 head/sys/crypto/aesni/aesni.c head/sys/crypto/armv8/armv8_crypto.c head/sys/crypto/blake2/blake2_cryptodev.c head/sys/crypto/via/padlock.c head/sys/geom/eli/g_eli.c head/sys/geom/eli/g_eli.h head/sys/mips/cavium/cryptocteon/cryptocteon.c head/sys/opencrypto/cryptodev.h Modified: head/share/man/man9/crypto_driver.9 ============================================================================== --- head/share/man/man9/crypto_driver.9 Tue Jun 9 22:19:36 2020 (r361990) +++ head/share/man/man9/crypto_driver.9 Tue Jun 9 22:26:07 2020 (r361991) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 25, 2020 +.Dd June 9, 2020 .Dt CRYPTO_DRIVER 9 .Os .Sh NAME @@ -113,6 +113,8 @@ should be used for drivers which process requests on s .Dv CRYPTOCAP_F_SYNC should be set for drivers which process requests synchronously in .Fn CRYPTODEV_PROCESS . +.Dv CRYPTOCAP_F_ACCEL_SOFTWARE +should be set for software drivers which use accelerated CPU instructions. .Fn crypto_get_driverid returns an opaque driver id. .Pp Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/crypto/aesni/aesni.c Tue Jun 9 22:26:07 2020 (r361991) @@ -167,7 +167,8 @@ aesni_attach(device_t dev) sc = device_get_softc(dev); sc->cid = crypto_get_driverid(dev, sizeof(struct aesni_session), - CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC); + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | + CRYPTOCAP_F_ACCEL_SOFTWARE); if (sc->cid < 0) { device_printf(dev, "Could not get crypto driver id.\n"); return (ENOMEM); Modified: head/sys/crypto/armv8/armv8_crypto.c ============================================================================== --- head/sys/crypto/armv8/armv8_crypto.c Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/crypto/armv8/armv8_crypto.c Tue Jun 9 22:26:07 2020 (r361991) @@ -131,7 +131,7 @@ armv8_crypto_attach(device_t dev) sc->dieing = 0; sc->cid = crypto_get_driverid(dev, sizeof(struct armv8_crypto_session), - CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC); + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | CRYPTOCAP_F_ACCEL_SOFTWARE); if (sc->cid < 0) { device_printf(dev, "Could not get crypto driver id.\n"); return (ENOMEM); Modified: head/sys/crypto/blake2/blake2_cryptodev.c ============================================================================== --- head/sys/crypto/blake2/blake2_cryptodev.c Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/crypto/blake2/blake2_cryptodev.c Tue Jun 9 22:26:07 2020 (r361991) @@ -129,7 +129,8 @@ blake2_attach(device_t dev) sc->dying = false; sc->cid = crypto_get_driverid(dev, sizeof(struct blake2_session), - CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC); + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | + CRYPTOCAP_F_ACCEL_SOFTWARE); if (sc->cid < 0) { device_printf(dev, "Could not get crypto driver id.\n"); return (ENOMEM); Modified: head/sys/crypto/via/padlock.c ============================================================================== --- head/sys/crypto/via/padlock.c Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/crypto/via/padlock.c Tue Jun 9 22:26:07 2020 (r361991) @@ -119,7 +119,8 @@ padlock_attach(device_t dev) struct padlock_softc *sc = device_get_softc(dev); sc->sc_cid = crypto_get_driverid(dev, sizeof(struct padlock_session), - CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC); + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | + CRYPTOCAP_F_ACCEL_SOFTWARE); if (sc->sc_cid < 0) { device_printf(dev, "Could not get crypto driver id.\n"); return (ENOMEM); Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/geom/eli/g_eli.c Tue Jun 9 22:26:07 2020 (r361991) @@ -489,7 +489,8 @@ g_eli_newsession(struct g_eli_worker *wr) { struct g_eli_softc *sc; struct crypto_session_params csp; - int error; + uint32_t caps; + int error, new_crypto; void *key; sc = wr->w_softc; @@ -516,6 +517,7 @@ g_eli_newsession(struct g_eli_worker *wr) } switch (sc->sc_crypto) { + case G_ELI_CRYPTO_SW_ACCEL: case G_ELI_CRYPTO_SW: error = crypto_newsession(&wr->w_sid, &csp, CRYPTOCAP_F_SOFTWARE); @@ -526,19 +528,19 @@ g_eli_newsession(struct g_eli_worker *wr) break; case G_ELI_CRYPTO_UNKNOWN: error = crypto_newsession(&wr->w_sid, &csp, - CRYPTOCAP_F_HARDWARE); + CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE); if (error == 0) { + caps = crypto_ses2caps(wr->w_sid); + if (caps & CRYPTOCAP_F_HARDWARE) + new_crypto = G_ELI_CRYPTO_HW; + else if (caps & CRYPTOCAP_F_ACCEL_SOFTWARE) + new_crypto = G_ELI_CRYPTO_SW_ACCEL; + else + new_crypto = G_ELI_CRYPTO_SW; mtx_lock(&sc->sc_queue_mtx); if (sc->sc_crypto == G_ELI_CRYPTO_UNKNOWN) - sc->sc_crypto = G_ELI_CRYPTO_HW; + sc->sc_crypto = new_crypto; mtx_unlock(&sc->sc_queue_mtx); - } else { - error = crypto_newsession(&wr->w_sid, &csp, - CRYPTOCAP_F_SOFTWARE); - mtx_lock(&sc->sc_queue_mtx); - if (sc->sc_crypto == G_ELI_CRYPTO_UNKNOWN) - sc->sc_crypto = G_ELI_CRYPTO_SW; - mtx_unlock(&sc->sc_queue_mtx); } break; default: @@ -983,6 +985,7 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, if (sc->sc_flags & G_ELI_FLAG_AUTH) G_ELI_DEBUG(0, " Integrity: %s", g_eli_algo2str(sc->sc_aalgo)); G_ELI_DEBUG(0, " Crypto: %s", + sc->sc_crypto == G_ELI_CRYPTO_SW_ACCEL ? "accelerated software" : sc->sc_crypto == G_ELI_CRYPTO_SW ? "software" : "hardware"); return (gp); failed: @@ -1380,6 +1383,9 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st break; case G_ELI_CRYPTO_SW: sbuf_cat(sb, "software"); + break; + case G_ELI_CRYPTO_SW_ACCEL: + sbuf_cat(sb, "accelerated software"); break; default: sbuf_cat(sb, "UNKNOWN"); Modified: head/sys/geom/eli/g_eli.h ============================================================================== --- head/sys/geom/eli/g_eli.h Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/geom/eli/g_eli.h Tue Jun 9 22:26:07 2020 (r361991) @@ -145,6 +145,7 @@ #define G_ELI_CRYPTO_UNKNOWN 0 #define G_ELI_CRYPTO_HW 1 #define G_ELI_CRYPTO_SW 2 +#define G_ELI_CRYPTO_SW_ACCEL 3 #ifdef _KERNEL #if (MAX_KEY_BYTES < G_ELI_DATAIVKEYLEN) Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c ============================================================================== --- head/sys/mips/cavium/cryptocteon/cryptocteon.c Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/mips/cavium/cryptocteon/cryptocteon.c Tue Jun 9 22:26:07 2020 (r361991) @@ -86,7 +86,8 @@ cryptocteon_attach(device_t dev) sc = device_get_softc(dev); sc->sc_cid = crypto_get_driverid(dev, sizeof(struct octo_sess), - CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC); + CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_SYNC | + CRYPTOCAP_F_ACCEL_SOFTWARE); if (sc->sc_cid < 0) { device_printf(dev, "crypto_get_driverid ret %d\n", sc->sc_cid); return (ENXIO); Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Tue Jun 9 22:19:36 2020 (r361990) +++ head/sys/opencrypto/cryptodev.h Tue Jun 9 22:26:07 2020 (r361991) @@ -620,6 +620,7 @@ extern void crypto_freesession(crypto_session_t cses); #define CRYPTOCAP_F_HARDWARE CRYPTO_FLAG_HARDWARE #define CRYPTOCAP_F_SOFTWARE CRYPTO_FLAG_SOFTWARE #define CRYPTOCAP_F_SYNC 0x04000000 /* operates synchronously */ +#define CRYPTOCAP_F_ACCEL_SOFTWARE 0x08000000 extern int32_t crypto_get_driverid(device_t dev, size_t session_size, int flags); extern int crypto_find_driver(const char *); From owner-svn-src-head@freebsd.org Tue Jun 9 22:42:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4123633F1FA; Tue, 9 Jun 2020 22:42:56 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hQB81MZ5z3fct; Tue, 9 Jun 2020 22:42:56 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2990F1D04F; Tue, 9 Jun 2020 22:42:56 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 059Mgudq032689; Tue, 9 Jun 2020 22:42:56 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059Mgt2J032683; Tue, 9 Jun 2020 22:42:55 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202006092242.059Mgt2J032683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 9 Jun 2020 22:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361992 - in head/sys: conf dev/ixl modules/ixl X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in head/sys: conf dev/ixl modules/ixl X-SVN-Commit-Revision: 361992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 22:42:56 -0000 Author: erj Date: Tue Jun 9 22:42:54 2020 New Revision: 361992 URL: https://svnweb.freebsd.org/changeset/base/361992 Log: ixl(4): Add FW recovery mode support and other things Update the iflib version of ixl driver based on the OOT version ixl-1.11.29. Major changes: - Extract iflib specific functions from ixl_pf_main.c to ixl_pf_iflib.c to simplify code sharing between legacy and iflib version of driver - Add support for most recent FW API version (1.10), which extends FW LLDP Agent control by user to X722 devices - Improve handling of device global reset - Add support for the FW recovery mode - Use virtchnl function to validate virtual channel messages instead of using separate checks - Fix MAC/VLAN filters accounting Submitted by: Krzysztof Galazka Reviewed by: erj@ Tested by: Jeffrey Pieper MFC after: 1 week Relnotes: yes Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D24564 Added: head/sys/dev/ixl/ixl_pf_iflib.c (contents, props changed) Modified: head/sys/conf/files.amd64 head/sys/conf/files.powerpc head/sys/dev/ixl/i40e_adminq.c head/sys/dev/ixl/i40e_adminq_cmd.h head/sys/dev/ixl/i40e_common.c head/sys/dev/ixl/i40e_dcb.c head/sys/dev/ixl/i40e_dcb.h head/sys/dev/ixl/i40e_devids.h head/sys/dev/ixl/i40e_lan_hmc.c head/sys/dev/ixl/i40e_nvm.c head/sys/dev/ixl/i40e_osdep.c head/sys/dev/ixl/i40e_prototype.h head/sys/dev/ixl/i40e_register.h head/sys/dev/ixl/i40e_type.h head/sys/dev/ixl/if_iavf.c head/sys/dev/ixl/if_ixl.c head/sys/dev/ixl/ixl.h head/sys/dev/ixl/ixl_pf.h head/sys/dev/ixl/ixl_pf_i2c.c head/sys/dev/ixl/ixl_pf_iov.c head/sys/dev/ixl/ixl_pf_main.c head/sys/dev/ixl/ixl_txrx.c head/sys/modules/ixl/Makefile Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Jun 9 22:26:07 2020 (r361991) +++ head/sys/conf/files.amd64 Tue Jun 9 22:42:54 2020 (r361992) @@ -196,6 +196,8 @@ dev/ixl/if_ixl.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_main.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_iflib.c optional ixl pci \ + compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_qmgr.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_iov.c optional ixl pci pci_iov \ Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Tue Jun 9 22:26:07 2020 (r361991) +++ head/sys/conf/files.powerpc Tue Jun 9 22:42:54 2020 (r361992) @@ -41,6 +41,8 @@ dev/ixl/if_ixl.c optional ixl pci powerpc64 \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_main.c optional ixl pci powerpc64 \ compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_iflib.c optional ixl pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_qmgr.c optional ixl pci powerpc64 \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_iov.c optional ixl pci pci_iov powerpc64 \ Modified: head/sys/dev/ixl/i40e_adminq.c ============================================================================== --- head/sys/dev/ixl/i40e_adminq.c Tue Jun 9 22:26:07 2020 (r361991) +++ head/sys/dev/ixl/i40e_adminq.c Tue Jun 9 22:42:54 2020 (r361992) @@ -125,6 +125,7 @@ enum i40e_status_code i40e_alloc_adminq_arq_ring(struc **/ void i40e_free_adminq_asq(struct i40e_hw *hw) { + i40e_free_virt_mem(hw, &hw->aq.asq.cmd_buf); i40e_free_dma_mem(hw, &hw->aq.asq.desc_buf); } @@ -404,7 +405,7 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw /* initialize base registers */ ret_code = i40e_config_asq_regs(hw); if (ret_code != I40E_SUCCESS) - goto init_adminq_free_rings; + goto init_config_regs; /* success! */ hw->aq.asq.count = hw->aq.num_asq_entries; @@ -412,7 +413,11 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw init_adminq_free_rings: i40e_free_adminq_asq(hw); + return ret_code; +init_config_regs: + i40e_free_asq_bufs(hw); + init_adminq_exit: return ret_code; } @@ -563,6 +568,70 @@ static void i40e_resume_aq(struct i40e_hw *hw) } /** + * i40e_set_hw_flags - set HW flags + * @hw: pointer to the hardware structure + **/ +static void i40e_set_hw_flags(struct i40e_hw *hw) +{ + struct i40e_adminq_info *aq = &hw->aq; + + hw->flags = 0; + + switch (hw->mac.type) { + case I40E_MAC_XL710: + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710)) { + hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE; + hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE; + /* The ability to RX (not drop) 802.1ad frames */ + hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE; + } + break; + case I40E_MAC_X722: + hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE | + I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722)) + hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722)) + hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_FW_REQUEST_FEC_X722)) + hw->flags |= I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE; + + /* fall through */ + default: + break; + } + + /* Newer versions of firmware require lock when reading the NVM */ + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= 5)) + hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= 8)) { + hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT; + hw->flags |= I40E_HW_FLAG_DROP_MODE; + } + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= 9)) + hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED; +} + +/** * i40e_init_adminq - main initialization routine for Admin Queue * @hw: pointer to the hardware structure * @@ -575,21 +644,22 @@ static void i40e_resume_aq(struct i40e_hw *hw) **/ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) { + struct i40e_adminq_info *aq = &hw->aq; + enum i40e_status_code ret_code; u16 cfg_ptr, oem_hi, oem_lo; u16 eetrack_lo, eetrack_hi; - enum i40e_status_code ret_code; int retry = 0; /* verify input for valid configuration */ - if ((hw->aq.num_arq_entries == 0) || - (hw->aq.num_asq_entries == 0) || - (hw->aq.arq_buf_size == 0) || - (hw->aq.asq_buf_size == 0)) { + if (aq->num_arq_entries == 0 || + aq->num_asq_entries == 0 || + aq->arq_buf_size == 0 || + aq->asq_buf_size == 0) { ret_code = I40E_ERR_CONFIG; goto init_adminq_exit; } - i40e_init_spinlock(&hw->aq.asq_spinlock); - i40e_init_spinlock(&hw->aq.arq_spinlock); + i40e_init_spinlock(&aq->asq_spinlock); + i40e_init_spinlock(&aq->arq_spinlock); /* Set up register offsets */ i40e_adminq_init_regs(hw); @@ -616,11 +686,11 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw */ do { ret_code = i40e_aq_get_firmware_version(hw, - &hw->aq.fw_maj_ver, - &hw->aq.fw_min_ver, - &hw->aq.fw_build, - &hw->aq.api_maj_ver, - &hw->aq.api_min_ver, + &aq->fw_maj_ver, + &aq->fw_min_ver, + &aq->fw_build, + &aq->api_maj_ver, + &aq->api_min_ver, NULL); if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT) break; @@ -631,6 +701,12 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw if (ret_code != I40E_SUCCESS) goto init_adminq_free_arq; + /* + * Some features were introduced in different FW API version + * for different MAC type. + */ + i40e_set_hw_flags(hw); + /* get the NVM version info */ i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION, &hw->nvm.version); @@ -644,25 +720,7 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw &oem_lo); hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo; - /* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */ - if ((hw->aq.api_maj_ver > 1) || - ((hw->aq.api_maj_ver == 1) && - (hw->aq.api_min_ver >= 7))) - hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE; - - if (hw->mac.type == I40E_MAC_XL710 && - hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR && - hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) { - hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE; - } - - /* Newer versions of firmware require lock when reading the NVM */ - if ((hw->aq.api_maj_ver > 1) || - ((hw->aq.api_maj_ver == 1) && - (hw->aq.api_min_ver >= 5))) - hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; - - if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { + if (aq->api_maj_ver > I40E_FW_API_VERSION_MAJOR) { ret_code = I40E_ERR_FIRMWARE_API_VERSION; goto init_adminq_free_arq; } @@ -682,8 +740,8 @@ init_adminq_free_arq: init_adminq_free_asq: i40e_shutdown_asq(hw); init_adminq_destroy_spinlocks: - i40e_destroy_spinlock(&hw->aq.asq_spinlock); - i40e_destroy_spinlock(&hw->aq.arq_spinlock); + i40e_destroy_spinlock(&aq->asq_spinlock); + i40e_destroy_spinlock(&aq->arq_spinlock); init_adminq_exit: return ret_code; @@ -728,7 +786,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw) desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); while (rd32(hw, hw->aq.asq.head) != ntc) { - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head)); if (details->callback) { @@ -808,7 +866,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40 if (val >= hw->aq.num_asq_entries) { i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: head overrun at %d\n", val); - status = I40E_ERR_QUEUE_EMPTY; + status = I40E_ERR_ADMIN_QUEUE_FULL; goto asq_send_command_error; } @@ -896,7 +954,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40 } /* bump the tail */ - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n"); + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer:\n"); i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring, buff, buff_size); (hw->aq.asq.next_to_use)++; @@ -942,12 +1000,14 @@ enum i40e_status_code i40e_asq_send_command(struct i40 cmd_completed = TRUE; if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_OK) status = I40E_SUCCESS; + else if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_EBUSY) + status = I40E_ERR_NOT_READY; else status = I40E_ERR_ADMIN_QUEUE_ERROR; hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval; } - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer writeback:\n"); i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size); @@ -1063,7 +1123,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i4 hw->aq.arq.r.arq_bi[desc_idx].va, e->msg_len, I40E_DMA_TO_NONDMA); - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n"); + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQRX: desc and buffer:\n"); i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf, hw->aq.arq_buf_size); Modified: head/sys/dev/ixl/i40e_adminq_cmd.h ============================================================================== --- head/sys/dev/ixl/i40e_adminq_cmd.h Tue Jun 9 22:26:07 2020 (r361991) +++ head/sys/dev/ixl/i40e_adminq_cmd.h Tue Jun 9 22:42:54 2020 (r361992) @@ -43,8 +43,8 @@ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR_X722 0x0005 -#define I40E_FW_API_VERSION_MINOR_X710 0x0007 +#define I40E_FW_API_VERSION_MINOR_X722 0x000A +#define I40E_FW_API_VERSION_MINOR_X710 0x000A #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \ I40E_FW_API_VERSION_MINOR_X710 : \ @@ -52,6 +52,12 @@ /* API version 1.7 implements additional link and PHY-specific APIs */ #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007 +/* API version 1.9 for X722 implements additional link and PHY-specific APIs */ +#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009 +/* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */ +#define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006 +/* API version 1.10 for X722 devices adds ability to request FEC encoding */ +#define I40E_MINOR_VER_FW_REQUEST_FEC_X722 0x000A struct i40e_aq_desc { __le16 flags; @@ -204,6 +210,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_cloud_filters = 0x025C, i40e_aqc_opc_remove_cloud_filters = 0x025D, i40e_aqc_opc_clear_wol_switch_filters = 0x025E, + i40e_aqc_opc_replace_cloud_filters = 0x025F, i40e_aqc_opc_add_mirror_rule = 0x0260, i40e_aqc_opc_delete_mirror_rule = 0x0261, @@ -289,6 +296,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_get_cee_dcb_cfg = 0x0A07, i40e_aqc_opc_lldp_set_local_mib = 0x0A08, i40e_aqc_opc_lldp_stop_start_spec_agent = 0x0A09, + i40e_aqc_opc_lldp_restore = 0x0A0A, /* Tunnel commands */ i40e_aqc_opc_add_udp_tunnel = 0x0B00, @@ -1382,14 +1390,17 @@ struct i40e_aqc_add_remove_cloud_filters { #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT 0 #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_MASK (0x3FF << \ I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT) - u8 reserved2[4]; + u8 big_buffer_flag; +#define I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER 1 +#define I40E_AQC_ADD_CLOUD_CMD_BB 1 + u8 reserved2[3]; __le32 addr_high; __le32 addr_low; }; I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_cloud_filters); -struct i40e_aqc_add_remove_cloud_filters_element_data { +struct i40e_aqc_cloud_filters_element_data { u8 outer_mac[6]; u8 inner_mac[6]; __le16 inner_vlan; @@ -1401,13 +1412,16 @@ struct i40e_aqc_add_remove_cloud_filters_element_data struct { u8 data[16]; } v6; + struct { + __le16 data[8]; + } raw_v6; } ipaddr; __le16 flags; #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0 #define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \ I40E_AQC_ADD_CLOUD_FILTER_SHIFT) /* 0x0000 reserved */ -#define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001 +/* 0x0001 reserved */ /* 0x0002 reserved */ #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN 0x0003 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID 0x0004 @@ -1419,6 +1433,13 @@ struct i40e_aqc_add_remove_cloud_filters_element_data #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C +/* 0x000D reserved */ +/* 0x000E reserved */ +/* 0x000F reserved */ +/* 0x0010 to 0x0017 is for custom filters */ +#define I40E_AQC_ADD_CLOUD_FILTER_IP_PORT 0x0010 /* Dest IP + L4 Port */ +#define I40E_AQC_ADD_CLOUD_FILTER_MAC_PORT 0x0011 /* Dest MAC + L4 Port */ +#define I40E_AQC_ADD_CLOUD_FILTER_MAC_VLAN_PORT 0x0012 /* Dest MAC + VLAN + L4 Port */ #define I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE 0x0080 #define I40E_AQC_ADD_CLOUD_VNK_SHIFT 6 @@ -1453,6 +1474,88 @@ struct i40e_aqc_add_remove_cloud_filters_element_data u8 response_reserved[7]; }; +/* i40e_aqc_add_rm_cloud_filt_elem_ext is used when + * I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER flag is set. + */ +struct i40e_aqc_add_rm_cloud_filt_elem_ext { + struct i40e_aqc_cloud_filters_element_data element; + u16 general_fields[32]; +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD0 0 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD1 1 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD2 2 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD0 3 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD1 4 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD2 5 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD0 6 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD1 7 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD2 8 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD0 9 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD1 10 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD2 11 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD0 12 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD1 13 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD2 14 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD0 15 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD1 16 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD2 17 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD3 18 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD4 19 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD5 20 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD6 21 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD7 22 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD0 23 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD1 24 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD2 25 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD3 26 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD4 27 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD5 28 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD6 29 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD7 30 +}; + +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_cloud_filters_element_data); + +/* i40e_aqc_cloud_filters_element_bb is used when + * I40E_AQC_CLOUD_CMD_BB flag is set. + */ +struct i40e_aqc_cloud_filters_element_bb { + struct i40e_aqc_cloud_filters_element_data element; + u16 general_fields[32]; +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD0 0 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD1 1 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD2 2 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD0 3 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD1 4 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD2 5 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD0 6 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD1 7 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD2 8 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD0 9 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD1 10 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD2 11 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD0 12 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD1 13 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD2 14 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD0 15 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD1 16 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD2 17 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD3 18 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD4 19 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD5 20 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD6 21 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD7 22 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD0 23 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD1 24 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD2 25 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD3 26 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD4 27 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD5 28 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD6 29 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD7 30 +}; + +I40E_CHECK_STRUCT_LEN(0x80, i40e_aqc_cloud_filters_element_bb); + struct i40e_aqc_remove_cloud_filters_completion { __le16 perfect_ovlan_used; __le16 perfect_ovlan_free; @@ -1464,6 +1567,61 @@ struct i40e_aqc_remove_cloud_filters_completion { I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_cloud_filters_completion); +/* Replace filter Command 0x025F + * uses the i40e_aqc_replace_cloud_filters, + * and the generic indirect completion structure + */ +struct i40e_filter_data { + u8 filter_type; + u8 input[3]; +}; + +I40E_CHECK_STRUCT_LEN(4, i40e_filter_data); + +struct i40e_aqc_replace_cloud_filters_cmd { + u8 valid_flags; +#define I40E_AQC_REPLACE_L1_FILTER 0x0 +#define I40E_AQC_REPLACE_CLOUD_FILTER 0x1 +#define I40E_AQC_GET_CLOUD_FILTERS 0x2 +#define I40E_AQC_MIRROR_CLOUD_FILTER 0x4 +#define I40E_AQC_HIGH_PRIORITY_CLOUD_FILTER 0x8 + u8 old_filter_type; + u8 new_filter_type; + u8 tr_bit; + u8 tr_bit2; + u8 reserved[3]; + __le32 addr_high; + __le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_replace_cloud_filters_cmd); + +struct i40e_aqc_replace_cloud_filters_cmd_buf { + u8 data[32]; +/* Filter type INPUT codes*/ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_ENTRIES_MAX 3 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED (1 << 7UL) + +/* Field Vector offsets */ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_MAC_DA 0 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_ETH 6 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG 7 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_VLAN 8 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_OVLAN 9 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_IVLAN 10 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_TUNNLE_KEY 11 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IMAC 12 +/* big FLU */ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IP_DA 14 +/* big FLU */ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_OIP_DA 15 + +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_INNER_VLAN 37 + struct i40e_filter_data filters[8]; +}; + +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_replace_cloud_filters_cmd_buf); + /* Add Mirror Rule (indirect or direct 0x0260) * Delete Mirror Rule (indirect or direct 0x0261) * note: some rule types (4,5) do not use an external buffer. @@ -1865,6 +2023,7 @@ struct i40e_aq_get_phy_abilities_resp { #define I40E_AQ_PHY_FEC_ABILITY_KR 0x40 #define I40E_AQ_PHY_FEC_ABILITY_RS 0x80 __le16 eee_capability; +#define I40E_AQ_EEE_AUTO 0x0001 #define I40E_AQ_EEE_100BASE_TX 0x0002 #define I40E_AQ_EEE_1000BASE_T 0x0004 #define I40E_AQ_EEE_10GBASE_T 0x0008 @@ -1931,20 +2090,21 @@ I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config); struct i40e_aq_set_mac_config { __le16 max_frame_size; u8 params; -#define I40E_AQ_SET_MAC_CONFIG_CRC_EN 0x04 -#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK 0x78 -#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT 3 -#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE 0x0 -#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX 0xF -#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX 0x9 -#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX 0x8 -#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX 0x7 -#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX 0x6 -#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX 0x5 -#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX 0x4 -#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX 0x3 -#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX 0x2 -#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX 0x1 +#define I40E_AQ_SET_MAC_CONFIG_CRC_EN 0x04 +#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK 0x78 +#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT 3 +#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE 0x0 +#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX 0xF +#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX 0x9 +#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX 0x8 +#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX 0x7 +#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX 0x6 +#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX 0x5 +#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX 0x4 +#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX 0x3 +#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX 0x2 +#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX 0x1 +#define I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN 0x80 u8 tx_timer_priority; /* bitmap */ __le16 tx_timer_value; __le16 fc_refresh_threshold; @@ -2077,8 +2237,8 @@ struct i40e_aqc_set_lb_mode { #define I40E_AQ_LB_SERDES 2 #define I40E_AQ_LB_PHY_INT 3 #define I40E_AQ_LB_PHY_EXT 4 -#define I40E_AQ_LB_CPVL_PCS 5 -#define I40E_AQ_LB_CPVL_EXT 6 +#define I40E_AQ_LB_BASE_T_PCS 5 +#define I40E_AQ_LB_BASE_T_EXT 6 #define I40E_AQ_LB_PHY_LOCAL 0x01 #define I40E_AQ_LB_PHY_REMOTE 0x02 #define I40E_AQ_LB_MAC_LOCAL 0x04 @@ -2142,7 +2302,13 @@ struct i40e_aqc_phy_register_access { #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL 1 #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE 2 u8 dev_addres; - u8 reserved1[2]; + u8 cmd_flags; +#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE 0x01 +#define I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER 0x02 +#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT 2 +#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK (0x3 << \ + I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT) + u8 reserved1; __le32 reg_address; __le32 reg_value; u8 reserved2[4]; @@ -2157,6 +2323,8 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_phy_register_access); struct i40e_aqc_nvm_update { u8 command_flags; #define I40E_AQ_NVM_LAST_CMD 0x01 +#define I40E_AQ_NVM_REARRANGE_TO_FLAT 0x20 +#define I40E_AQ_NVM_REARRANGE_TO_STRUCT 0x40 #define I40E_AQ_NVM_FLASH_ONLY 0x80 #define I40E_AQ_NVM_PRESERVATION_FLAGS_SHIFT 1 #define I40E_AQ_NVM_PRESERVATION_FLAGS_MASK 0x03 @@ -2404,18 +2572,19 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv); /* Stop LLDP (direct 0x0A05) */ struct i40e_aqc_lldp_stop { u8 command; -#define I40E_AQ_LLDP_AGENT_STOP 0x0 -#define I40E_AQ_LLDP_AGENT_SHUTDOWN 0x1 +#define I40E_AQ_LLDP_AGENT_STOP 0x0 +#define I40E_AQ_LLDP_AGENT_SHUTDOWN 0x1 +#define I40E_AQ_LLDP_AGENT_STOP_PERSIST 0x2 u8 reserved[15]; }; I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop); /* Start LLDP (direct 0x0A06) */ - struct i40e_aqc_lldp_start { u8 command; -#define I40E_AQ_LLDP_AGENT_START 0x1 +#define I40E_AQ_LLDP_AGENT_START 0x1 +#define I40E_AQ_LLDP_AGENT_START_PERSIST 0x2 u8 reserved[15]; }; @@ -2534,6 +2703,16 @@ struct i40e_aqc_lldp_stop_start_specific_agent { }; I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent); + +/* Restore LLDP Agent factory settings (direct 0x0A0A) */ +struct i40e_aqc_lldp_restore { + u8 command; +#define I40E_AQ_LLDP_AGENT_RESTORE_NOT 0x0 +#define I40E_AQ_LLDP_AGENT_RESTORE 0x1 + u8 reserved[15]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_restore); /* Add Udp Tunnel command and completion (direct 0x0B00) */ struct i40e_aqc_add_udp_tunnel { Modified: head/sys/dev/ixl/i40e_common.c ============================================================================== --- head/sys/dev/ixl/i40e_common.c Tue Jun 9 22:26:07 2020 (r361991) +++ head/sys/dev/ixl/i40e_common.c Tue Jun 9 22:42:54 2020 (r361992) @@ -66,6 +66,8 @@ enum i40e_status_code i40e_set_mac_type(struct i40e_hw case I40E_DEV_ID_20G_KR2_A: case I40E_DEV_ID_25G_B: case I40E_DEV_ID_25G_SFP28: + case I40E_DEV_ID_X710_N3000: + case I40E_DEV_ID_XXV710_N3000: hw->mac.type = I40E_MAC_XL710; break; case I40E_DEV_ID_KX_X722: @@ -319,32 +321,37 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug void *buffer, u16 buf_len) { struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; + u32 effective_mask = hw->debug_mask & mask; u8 *buf = (u8 *)buffer; u16 len; - u16 i = 0; + u16 i; - if ((!(mask & hw->debug_mask)) || (desc == NULL)) + if (!effective_mask || !desc) return; len = LE16_TO_CPU(aq_desc->datalen); - i40e_debug(hw, mask, + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n", LE16_TO_CPU(aq_desc->opcode), LE16_TO_CPU(aq_desc->flags), LE16_TO_CPU(aq_desc->datalen), LE16_TO_CPU(aq_desc->retval)); - i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n", + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, + "\tcookie (h,l) 0x%08X 0x%08X\n", LE32_TO_CPU(aq_desc->cookie_high), LE32_TO_CPU(aq_desc->cookie_low)); - i40e_debug(hw, mask, "\tparam (0,1) 0x%08X 0x%08X\n", + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, + "\tparam (0,1) 0x%08X 0x%08X\n", LE32_TO_CPU(aq_desc->params.internal.param0), LE32_TO_CPU(aq_desc->params.internal.param1)); - i40e_debug(hw, mask, "\taddr (h,l) 0x%08X 0x%08X\n", + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, + "\taddr (h,l) 0x%08X 0x%08X\n", LE32_TO_CPU(aq_desc->params.external.addr_high), LE32_TO_CPU(aq_desc->params.external.addr_low)); - if ((buffer != NULL) && (aq_desc->datalen != 0)) { + if (buffer && (buf_len != 0) && (len != 0) && + (effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) { i40e_debug(hw, mask, "AQ CMD Buffer:\n"); if (buf_len < len) len = buf_len; @@ -1011,10 +1018,18 @@ enum i40e_status_code i40e_init_shared_code(struct i40 else hw->pf_id = (u8)(func_rid & 0x7); - if (hw->mac.type == I40E_MAC_X722) - hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE | - I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; + /* NVMUpdate features structure initialization */ + hw->nvmupd_features.major = I40E_NVMUPD_FEATURES_API_VER_MAJOR; + hw->nvmupd_features.minor = I40E_NVMUPD_FEATURES_API_VER_MINOR; + hw->nvmupd_features.size = sizeof(hw->nvmupd_features); + i40e_memset(hw->nvmupd_features.features, 0x0, + I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN * + sizeof(*hw->nvmupd_features.features), + I40E_NONDMA_MEM); + /* No features supported at the moment */ + hw->nvmupd_features.features[0] = 0; + status = i40e_init_nvm(hw); return status; } @@ -1272,6 +1287,29 @@ static enum i40e_media_type i40e_get_media_type(struct return media; } +/** + * i40e_poll_globr - Poll for Global Reset completion + * @hw: pointer to the hardware structure + * @retry_limit: how many times to retry before failure + **/ +static enum i40e_status_code i40e_poll_globr(struct i40e_hw *hw, + u32 retry_limit) +{ + u32 cnt, reg = 0; + + for (cnt = 0; cnt < retry_limit; cnt++) { + reg = rd32(hw, I40E_GLGEN_RSTAT); + if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) + return I40E_SUCCESS; + i40e_msec_delay(100); + } + + DEBUGOUT("Global reset failed.\n"); + DEBUGOUT1("I40E_GLGEN_RSTAT = 0x%x\n", reg); + + return I40E_ERR_RESET_FAILED; +} + #define I40E_PF_RESET_WAIT_COUNT 200 /** * i40e_pf_reset - Reset the PF @@ -1295,7 +1333,7 @@ enum i40e_status_code i40e_pf_reset(struct i40e_hw *hw I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; - grst_del = grst_del * 20; + grst_del = min(grst_del * 20, 160U); for (cnt = 0; cnt < grst_del; cnt++) { reg = rd32(hw, I40E_GLGEN_RSTAT); @@ -1341,14 +1379,14 @@ enum i40e_status_code i40e_pf_reset(struct i40e_hw *hw if (!(reg & I40E_PFGEN_CTRL_PFSWR_MASK)) break; reg2 = rd32(hw, I40E_GLGEN_RSTAT); - if (reg2 & I40E_GLGEN_RSTAT_DEVSTATE_MASK) { - DEBUGOUT("Core reset upcoming. Skipping PF reset request.\n"); - DEBUGOUT1("I40E_GLGEN_RSTAT = 0x%x\n", reg2); - return I40E_ERR_NOT_READY; - } + if (reg2 & I40E_GLGEN_RSTAT_DEVSTATE_MASK) + break; i40e_msec_delay(1); } - if (reg & I40E_PFGEN_CTRL_PFSWR_MASK) { + if (reg2 & I40E_GLGEN_RSTAT_DEVSTATE_MASK) { + if (i40e_poll_globr(hw, grst_del) != I40E_SUCCESS) + return I40E_ERR_RESET_FAILED; + } else if (reg & I40E_PFGEN_CTRL_PFSWR_MASK) { DEBUGOUT("PF reset polling failed to complete.\n"); return I40E_ERR_RESET_FAILED; } @@ -1480,7 +1518,6 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int id if (!hw->func_caps.led[idx]) return 0; - gpio_val = rd32(hw, I40E_GLGEN_GPIO_CTL(idx)); port = (gpio_val & I40E_GLGEN_GPIO_CTL_PRT_NUM_MASK) >> I40E_GLGEN_GPIO_CTL_PRT_NUM_SHIFT; @@ -1499,8 +1536,15 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int id #define I40E_FILTER_ACTIVITY 0xE #define I40E_LINK_ACTIVITY 0xC #define I40E_MAC_ACTIVITY 0xD +#define I40E_FW_LED BIT(4) +#define I40E_LED_MODE_VALID (I40E_GLGEN_GPIO_CTL_LED_MODE_MASK >> \ + I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) + #define I40E_LED0 22 +#define I40E_PIN_FUNC_SDP 0x0 +#define I40E_PIN_FUNC_LED 0x1 + /** * i40e_led_get - return current on/off mode * @hw: pointer to the hw struct @@ -1562,8 +1606,10 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool b u32 current_mode = 0; int i; - if (mode & 0xfffffff0) + if (mode & ~I40E_LED_MODE_VALID) { DEBUGOUT1("invalid mode passed in %X\n", mode); + return; + } /* as per the documentation GPIO 22-29 are the LED * GPIO pins named LED0..LED7 @@ -1648,20 +1694,23 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(str status = i40e_asq_send_command(hw, &desc, abilities, abilities_size, cmd_details); - if (status != I40E_SUCCESS) - break; - - if (hw->aq.asq_last_status == I40E_AQ_RC_EIO) { + switch (hw->aq.asq_last_status) { + case I40E_AQ_RC_EIO: status = I40E_ERR_UNKNOWN_PHY; break; - } else if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) { + case I40E_AQ_RC_EAGAIN: i40e_msec_delay(1); total_delay++; status = I40E_ERR_TIMEOUT; + break; + /* also covers I40E_AQ_RC_OK */ + default: + break; } - } while ((hw->aq.asq_last_status != I40E_AQ_RC_OK) && - (total_delay < max_delay)); + } while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) && + (total_delay < max_delay)); + if (status != I40E_SUCCESS) return status; @@ -1803,6 +1852,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, * @max_frame_size: Maximum Frame Size to be supported by the port * @crc_en: Tell HW to append a CRC to outgoing frames * @pacing: Pacing configurations + * @auto_drop_blocking_packets: Tell HW to drop packets if TC queue is blocked * @cmd_details: pointer to command details structure or NULL * * Configure MAC settings for frame size, jumbo frame support and the @@ -1811,6 +1861,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw, u16 max_frame_size, bool crc_en, u16 pacing, + bool auto_drop_blocking_packets, struct i40e_asq_cmd_details *cmd_details) { struct i40e_aq_desc desc; @@ -1829,6 +1880,19 @@ enum i40e_status_code i40e_aq_set_mac_config(struct i4 if (crc_en) cmd->params |= I40E_AQ_SET_MAC_CONFIG_CRC_EN; + if (auto_drop_blocking_packets) { + if (hw->flags & I40E_HW_FLAG_DROP_MODE) + cmd->params |= + I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN; + else + i40e_debug(hw, I40E_DEBUG_ALL, + "This FW api version does not support drop mode.\n"); + } + +#define I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD 0x7FFF + cmd->fc_refresh_threshold = + CPU_TO_LE16(I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD); + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); return status; @@ -1969,8 +2033,8 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40 hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE) hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; - if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR && - hw->aq.api_min_ver >= 7) { + if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE && + hw->mac.type != I40E_MAC_X722) { __le32 tmp; i40e_memcpy(&tmp, resp->link_type, sizeof(tmp), @@ -2198,7 +2262,7 @@ enum i40e_status_code i40e_aq_add_vsi(struct i40e_hw * desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); status = i40e_asq_send_command(hw, &desc, &vsi_ctx->info, - sizeof(vsi_ctx->info), cmd_details); + sizeof(vsi_ctx->info), cmd_details); if (status != I40E_SUCCESS) goto aq_add_vsi_exit; @@ -2615,7 +2679,7 @@ enum i40e_status_code i40e_aq_update_vsi_params(struct desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); status = i40e_asq_send_command(hw, &desc, &vsi_ctx->info, - sizeof(vsi_ctx->info), cmd_details); + sizeof(vsi_ctx->info), cmd_details); vsi_ctx->vsis_allocated = LE16_TO_CPU(resp->vsi_used); vsi_ctx->vsis_unallocated = LE16_TO_CPU(resp->vsi_free); @@ -2830,9 +2894,16 @@ enum i40e_status_code i40e_update_link_info(struct i40 if (status) return status; - hw->phy.link_info.req_fec_info = - abilities.fec_cfg_curr_mod_ext_info & - (I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS); + if (abilities.fec_cfg_curr_mod_ext_info & + I40E_AQ_ENABLE_FEC_AUTO) + hw->phy.link_info.req_fec_info = + (I40E_AQ_REQUEST_FEC_KR | + I40E_AQ_REQUEST_FEC_RS); + else + hw->phy.link_info.req_fec_info = + abilities.fec_cfg_curr_mod_ext_info & + (I40E_AQ_REQUEST_FEC_KR | + I40E_AQ_REQUEST_FEC_RS); i40e_memcpy(hw->phy.link_info.module_type, &abilities.module_type, sizeof(hw->phy.link_info.module_type), I40E_NONDMA_TO_NONDMA); @@ -4209,7 +4280,7 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e cmd->type = mib_type; cmd->length = CPU_TO_LE16(buff_size); - cmd->address_high = CPU_TO_LE32(I40E_HI_WORD((u64)buff)); + cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)buff)); cmd->address_low = CPU_TO_LE32(I40E_LO_DWORD((u64)buff)); status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details); @@ -4245,164 +4316,54 @@ enum i40e_status_code i40e_aq_cfg_lldp_mib_change_even } /** - * i40e_aq_add_lldp_tlv + * i40e_aq_restore_lldp * @hw: pointer to the hw struct - * @bridge_type: type of bridge - * @buff: buffer with TLV to add - * @buff_size: length of the buffer - * @tlv_len: length of the TLV to be added - * @mib_len: length of the LLDP MIB returned in response + * @setting: pointer to factory setting variable or NULL + * @restore: True if factory settings should be restored * @cmd_details: pointer to command details structure or NULL * - * Add the specified TLV to LLDP Local MIB for the given bridge type, - * it is responsibility of the caller to make sure that the TLV is not - * already present in the LLDPDU. - * In return firmware will write the complete LLDP MIB with the newly - * added TLV in the response buffer. + * Restore LLDP Agent factory settings if @restore set to True. In other case + * only returns factory setting in AQ response. **/ -enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type, - void *buff, u16 buff_size, u16 tlv_len, - u16 *mib_len, - struct i40e_asq_cmd_details *cmd_details) +enum i40e_status_code +i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore, + struct i40e_asq_cmd_details *cmd_details) { struct i40e_aq_desc desc; - struct i40e_aqc_lldp_add_tlv *cmd = - (struct i40e_aqc_lldp_add_tlv *)&desc.params.raw; + struct i40e_aqc_lldp_restore *cmd = + (struct i40e_aqc_lldp_restore *)&desc.params.raw; enum i40e_status_code status; - if (buff_size == 0 || !buff || tlv_len == 0) - return I40E_ERR_PARAM; - - i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_add_tlv); - - /* Indirect Command */ - desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); - if (buff_size > I40E_AQ_LARGE_BUF) - desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB); - desc.datalen = CPU_TO_LE16(buff_size); - - cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) & - I40E_AQ_LLDP_BRIDGE_TYPE_MASK); - cmd->len = CPU_TO_LE16(tlv_len); - - status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details); - if (!status) { - if (mib_len != NULL) - *mib_len = LE16_TO_CPU(desc.datalen); + if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)) { + i40e_debug(hw, I40E_DEBUG_ALL, + "Restore LLDP not supported by current FW version.\n"); + return I40E_ERR_DEVICE_NOT_SUPPORTED; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Jun 9 22:55:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D62233FAF6; Tue, 9 Jun 2020 22:55:19 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hQSQ5HTcz3grw; Tue, 9 Jun 2020 22:55:18 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x344.google.com with SMTP id y20so105662wmi.2; Tue, 09 Jun 2020 15:55:18 -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=cOjT879WTizIscWWu/SjMAVd02cbXn8keo3wnncJZXc=; b=hhuzOX+HKAIXkGzytXyGUsY+yhVt8rkvNkFPhSCQONit680zZy/4gfXKLVcpiPUGG5 2Nwnpep33eFqJ/wtw2p5bnD6xPvkDlns5hkVe9VRQtaYgmqkPlT87/mg/Akd1t678Ut1 26EkdGqdBoExuDN3cJsRIQCeWgbpYx7xjSfwNy84Mc3RAxPk+Ags3xKbbp9exYQ9tT24 oxYo8Rs///Q2hItEnt6gXG3GBPWIlH9riR3V1on8ho7o6qdKTihfLVSkDCXAieOeQEFv mKndzAL7Ky1muvkDMxVhyvzATE/XeENFfhRgbyofGUXbFVY7EMq4tMtBNAcGp0Lido1T pU6w== 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=cOjT879WTizIscWWu/SjMAVd02cbXn8keo3wnncJZXc=; b=ssNcYGudeSQoYICZ9SAZv/SJ5TxdtMPLy3g32EnGM+4ZTauJowx/PZiVIXUrB6LEsP 9KviZvPJmitzJy3p/+Ty54YOHZvZfbqjVH6QrLbIuYrpHHuGZczx5MKObcpAZ8a1WJKT sSH2un5S1hbp3BVnuKityOSlRWkelauIvudvrr1W43xG3GkqSYRgqIpz9ZvDZRX9FiXf wpO6Un3TfCMBgggCfgTTdkSWbiHBCNVkIxtQ3WB4xG1CW4Py3cd7e2VRnOxXJ9PK4i3l XsBSv0bYSCUyeCdBLXl+compv4YTy2aYr60a6kPlj2RahErQfV0TKoTrXLS7RsbzSQvb WcaQ== X-Gm-Message-State: AOAM530N7n/USGcfeXX+tN1xmTDzf/ZaXUp9d7c8DGWkfZMgXqfA9Tcn M2njBFhVNxGEuIGD++m81u+DvdGOd/50rzuSdyiKGsvB X-Google-Smtp-Source: ABdhPJyNymUkkKgJxq/ZvPYUWvU7k/RdQmO8YNTaFWjMf3EZzsBTdREoj6cDgx9yW4FZW+GFAtByx6tcY8PzWclZvqU= X-Received: by 2002:a1c:7f87:: with SMTP id a129mr310005wmd.10.1591743315532; Tue, 09 Jun 2020 15:55:15 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:fd8f:0:0:0:0:0 with HTTP; Tue, 9 Jun 2020 15:55:14 -0700 (PDT) In-Reply-To: <202006092019.059KJCLG039099@repo.freebsd.org> References: <202006092019.059KJCLG039099@repo.freebsd.org> From: Mateusz Guzik Date: Wed, 10 Jun 2020 00:55:14 +0200 Message-ID: Subject: Re: svn commit: r361984 - in head/sys: compat/linuxkpi/common/include/linux sys To: Doug Moore Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 49hQSQ5HTcz3grw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 22:55:19 -0000 This broke lint kernels as they define DIAGNOSTIC and fail in kern/subr_stat.c: /usr/src/sys/kern/subr_stats.c:3384:9: error: implicit declaration of function 'RB_COLOR' is invalid in C99 [-Werror,-Wimplicit-function-declaration] RB_COLOR(rbctd64, rblnk), ^ /usr/src/sys/kern/subr_stats.c:3384:27: error: use of undeclared identifier 'rblnk' RB_COLOR(rbctd64, rblnk), On 6/9/20, Doug Moore wrote: > Author: dougm > Date: Tue Jun 9 20:19:11 2020 > New Revision: 361984 > URL: https://svnweb.freebsd.org/changeset/base/361984 > > Log: > To reduce the size of an rb_node, drop the color field. Set the least > significant bit in the pointer to the node from its parent to indicate > that the node is red. Have the tree rotation macros leave the > old-parent/new-child node red and the new-parent/old-child node black. > > This change makes RB_LEFT and RB_RIGHT no longer assignable, and > RB_COLOR no longer defined. Any code that modifies the tree or > examines a node color would have to be modified after this change. > > Reviewed by: markj > Tested by: pho > Differential Revision: https://reviews.freebsd.org/D25105 > > Modified: > head/sys/compat/linuxkpi/common/include/linux/rbtree.h > head/sys/sys/tree.h > > Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h Tue Jun 9 > 19:16:49 2020 (r361983) > +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h Tue Jun 9 > 20:19:11 2020 (r361984) > @@ -57,11 +57,7 @@ RB_HEAD(linux_root, rb_node); > RB_PROTOTYPE(linux_root, rb_node, __entry, panic_cmp); > > #define rb_parent(r) RB_PARENT(r, __entry) > -#define rb_color(r) RB_COLOR(r, __entry) > -#define rb_is_red(r) (rb_color(r) == RB_RED) > -#define rb_is_black(r) (rb_color(r) == RB_BLACK) > #define rb_set_parent(r, p) rb_parent((r)) = (p) > -#define rb_set_color(r, c) rb_color((r)) = (c) > #define rb_entry(ptr, type, member) container_of(ptr, type, member) > > #define RB_EMPTY_ROOT(root) RB_EMPTY((struct linux_root *)root) > @@ -82,7 +78,6 @@ rb_link_node(struct rb_node *node, struct rb_node *par > struct rb_node **rb_link) > { > rb_set_parent(node, parent); > - rb_set_color(node, RB_RED); > node->__entry.rbe_left = node->__entry.rbe_right = NULL; > *rb_link = node; > } > > Modified: head/sys/sys/tree.h > ============================================================================== > --- head/sys/sys/tree.h Tue Jun 9 19:16:49 2020 (r361983) > +++ head/sys/sys/tree.h Tue Jun 9 20:19:11 2020 (r361984) > @@ -307,35 +307,32 @@ struct name { \ > (root)->rbh_root = NULL; \ > } while (/*CONSTCOND*/ 0) > > -#define RB_BLACK 0 > -#define RB_RED 1 > #define RB_ENTRY(type) \ > struct { \ > struct type *rbe_left; /* left element */ \ > struct type *rbe_right; /* right element */ \ > struct type *rbe_parent; /* parent element */ \ > - int rbe_color; /* node color */ \ > } > > -#define RB_LEFT(elm, field) (elm)->field.rbe_left > -#define RB_RIGHT(elm, field) (elm)->field.rbe_right > +#define RB_LF(elm, field) (elm)->field.rbe_left > +#define RB_RT(elm, field) (elm)->field.rbe_right > +#define RB_FLIP(elm) (*(__uintptr_t *)&(elm) ^= 1) > +#define RB_FLIP_LF(elm, field) RB_FLIP(RB_LF(elm, field)) > +#define RB_FLIP_RT(elm, field) RB_FLIP(RB_RT(elm, field)) > +#define RB_ISRED(elm) ((*(__uintptr_t *)&(elm) & 1) != 0) > +#define RB_RED_LF(elm, field) RB_ISRED(RB_LF(elm, field)) > +#define RB_RED_RT(elm, field) RB_ISRED(RB_RT(elm, field)) > +#define RB_PTR(elm, field) ((__typeof(elm->field.rbe_parent)) \ > + ((__uintptr_t)(elm) & ~(__uintptr_t)1)) > +#define RB_LEFT(elm, field) RB_PTR(RB_LF(elm, field), field) > +#define RB_RIGHT(elm, field) RB_PTR(RB_RT(elm, field), field) > #define RB_PARENT(elm, field) (elm)->field.rbe_parent > -#define RB_COLOR(elm, field) (elm)->field.rbe_color > -#define RB_ISRED(elm, field) ((elm) != NULL && RB_COLOR(elm, field) == > RB_RED) > #define RB_ROOT(head) (head)->rbh_root > #define RB_EMPTY(head) (RB_ROOT(head) == NULL) > +#define RB_BOOL int > +#define RB_TRUE 1 > +#define RB_FALSE 0 > > -#define RB_SET(elm, parent, field) do { \ > - RB_PARENT(elm, field) = parent; \ > - RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ > - RB_COLOR(elm, field) = RB_RED; \ > -} while (/*CONSTCOND*/ 0) > - > -#define RB_SET_BLACKRED(black, red, field) do { \ > - RB_COLOR(black, field) = RB_BLACK; \ > - RB_COLOR(red, field) = RB_RED; \ > -} while (/*CONSTCOND*/ 0) > - > /* > * Something to be invoked in a loop at the root of every modified > subtree, > * from the bottom up to the root, to update augmented node data. > @@ -344,37 +341,42 @@ struct { \ > #define RB_AUGMENT(x) break > #endif > > +/* > + * Fix pointers to a parent, and from a parent, as part of rotation. > + */ > +#define RB_ROTATE_PARENT(head, elm, tmp, field) do { \ > + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) == NULL) \ > + RB_ROOT(head) = (tmp); \ > + else if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ > + RB_LF(RB_PARENT(elm, field), field) = (tmp); \ > + else \ > + RB_RT(RB_PARENT(elm, field), field) = (tmp); \ > + RB_PARENT(elm, field) = (tmp); \ > +} while (/*CONSTCOND*/ 0) > + > +/* > + * Rotation makes the descending node red, and the ascending > + * node not-red. > + */ > #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ > (tmp) = RB_RIGHT(elm, field); \ > - if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ > + if ((RB_RT(elm, field) = RB_LF(tmp, field)) != NULL) { \ > RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ > } \ > - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ > - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ > - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ > - else \ > - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ > - } else \ > - (head)->rbh_root = (tmp); \ > - RB_LEFT(tmp, field) = (elm); \ > - RB_PARENT(elm, field) = (tmp); \ > + RB_ROTATE_PARENT(head, elm, tmp, field); \ > + RB_LF(tmp, field) = (elm); \ > + RB_FLIP_LF(tmp, field); \ > RB_AUGMENT(elm); \ > } while (/*CONSTCOND*/ 0) > > #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ > (tmp) = RB_LEFT(elm, field); \ > - if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ > + if ((RB_LF(elm, field) = RB_RT(tmp, field)) != NULL) { \ > RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ > } \ > - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ > - if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ > - RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ > - else \ > - RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ > - } else \ > - (head)->rbh_root = (tmp); \ > - RB_RIGHT(tmp, field) = (elm); \ > - RB_PARENT(elm, field) = (tmp); \ > + RB_ROTATE_PARENT(head, elm, tmp, field); \ > + RB_RT(tmp, field) = (elm); \ > + RB_FLIP_RT(tmp, field); \ > RB_AUGMENT(elm); \ > } while (/*CONSTCOND*/ 0) > > @@ -439,110 +441,105 @@ struct { \ > attr void \ > name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ > { \ > - struct type *parent, *gparent, *tmp; \ > - while (RB_ISRED((parent = RB_PARENT(elm, field)), field)) { \ > - gparent = RB_PARENT(parent, field); \ > - if (parent == RB_LEFT(gparent, field)) { \ > - tmp = RB_RIGHT(gparent, field); \ > - if (RB_ISRED(tmp, field)) { \ > - RB_COLOR(tmp, field) = RB_BLACK; \ > - RB_SET_BLACKRED(parent, gparent, field);\ > - elm = gparent; \ > - continue; \ > - } \ > + struct type *gparent, *parent; \ > + while ((parent = RB_PARENT(elm, field)) != NULL) { \ > + if (RB_LEFT(parent, field) == elm) \ > + RB_FLIP_LF(parent, field); \ > + else \ > + RB_FLIP_RT(parent, field); \ > + if ((gparent = RB_PARENT(parent, field)) == NULL) \ > + break; \ > + if (RB_RED_LF(gparent, field) && \ > + RB_RED_RT(gparent, field)) { \ > + RB_FLIP_LF(gparent, field); \ > + RB_FLIP_RT(gparent, field); \ > + elm = gparent; \ > + continue; \ > + } \ > + if (RB_RED_LF(gparent, field) && \ > + parent == RB_LEFT(gparent, field)) { \ > if (RB_RIGHT(parent, field) == elm) { \ > - RB_ROTATE_LEFT(head, parent, tmp, field);\ > - tmp = parent; \ > + RB_ROTATE_LEFT(head, parent, elm, field);\ > parent = elm; \ > - elm = tmp; \ > } \ > - RB_SET_BLACKRED(parent, gparent, field); \ > - RB_ROTATE_RIGHT(head, gparent, tmp, field); \ > - } else { \ > - tmp = RB_LEFT(gparent, field); \ > - if (RB_ISRED(tmp, field)) { \ > - RB_COLOR(tmp, field) = RB_BLACK; \ > - RB_SET_BLACKRED(parent, gparent, field);\ > - elm = gparent; \ > - continue; \ > - } \ > + RB_ROTATE_RIGHT(head, gparent, parent, field); \ > + } else if (RB_RED_RT(gparent, field) && \ > + parent == RB_RIGHT(gparent, field)) { \ > if (RB_LEFT(parent, field) == elm) { \ > - RB_ROTATE_RIGHT(head, parent, tmp, field);\ > - tmp = parent; \ > + RB_ROTATE_RIGHT(head, parent, elm, field);\ > parent = elm; \ > - elm = tmp; \ > } \ > - RB_SET_BLACKRED(parent, gparent, field); \ > - RB_ROTATE_LEFT(head, gparent, tmp, field); \ > + RB_ROTATE_LEFT(head, gparent, parent, field); \ > } \ > + break; \ > } \ > - RB_COLOR(head->rbh_root, field) = RB_BLACK; \ > } > > #define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ > attr void \ > -name##_RB_REMOVE_COLOR(struct name *head, struct type *parent) \ > +name##_RB_REMOVE_COLOR(struct name *head, struct type *elm) \ > { \ > - struct type *elm, *tmp; \ > - elm = NULL; \ > + struct type *par, *sib, *tmp; \ > + RB_BOOL go_left, left_child, red_par; \ > + left_child = (RB_LEFT(elm, field) == NULL); \ > do { \ > - if (RB_LEFT(parent, field) == elm) { \ > - tmp = RB_RIGHT(parent, field); \ > - if (RB_COLOR(tmp, field) == RB_RED) { \ > - RB_SET_BLACKRED(tmp, parent, field); \ > - RB_ROTATE_LEFT(head, parent, tmp, field);\ > - tmp = RB_RIGHT(parent, field); \ > + go_left = left_child; \ > + if (go_left ? \ > + !RB_RED_RT(elm, field) : \ > + !RB_RED_LF(elm, field)) { \ > + par = RB_PARENT(elm, field); \ > + left_child = par != NULL && \ > + RB_LEFT(par, field) == elm; \ > + red_par = left_child ? RB_RED_LF(par, field) : \ > + par == NULL ? RB_TRUE : \ > + RB_RED_RT(par, field); \ > + } \ > + if (go_left) { \ > + if (RB_RED_RT(elm, field)) { \ > + red_par = RB_TRUE; \ > + RB_ROTATE_LEFT(head, elm, par, field); \ > } \ > - if (RB_ISRED(RB_LEFT(tmp, field), field)) { \ > - struct type *oleft; \ > - oleft = RB_LEFT(tmp, field); \ > - RB_COLOR(oleft, field) = RB_BLACK; \ > - RB_COLOR(tmp, field) = RB_RED; \ > - RB_ROTATE_RIGHT(head, tmp, oleft, field); \ > - tmp = RB_RIGHT(parent, field); \ > - } else if (!RB_ISRED(RB_RIGHT(tmp, field), field)) { \ > - RB_COLOR(tmp, field) = RB_RED; \ > - elm = parent; \ > - parent = RB_PARENT(elm, field); \ > + sib = RB_RIGHT(elm, field); \ > + if (RB_RED_LF(sib, field)) { \ > + RB_ROTATE_RIGHT(head, sib, tmp, field); \ > + sib = tmp; \ > + } else if (!RB_RED_RT(sib, field)) { \ > + RB_FLIP_RT(elm, field); \ > + elm = par; \ > continue; \ > } \ > - if (RB_ISRED(RB_RIGHT(tmp, field), field)) \ > - RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ > - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ > - RB_COLOR(parent, field) = RB_BLACK; \ > - RB_ROTATE_LEFT(head, parent, tmp, field); \ > - elm = RB_ROOT(head); \ > + if (RB_RED_RT(sib, field)) \ > + RB_FLIP_RT(sib, field); \ > + RB_ROTATE_LEFT(head, elm, sib, field); \ > + RB_FLIP_LF(sib, field); \ > break; \ > } else { \ > - tmp = RB_LEFT(parent, field); \ > - if (RB_COLOR(tmp, field) == RB_RED) { \ > - RB_SET_BLACKRED(tmp, parent, field); \ > - RB_ROTATE_RIGHT(head, parent, tmp, field);\ > - tmp = RB_LEFT(parent, field); \ > + if (RB_RED_LF(elm, field)) { \ > + red_par = RB_TRUE; \ > + RB_ROTATE_RIGHT(head, elm, par, field); \ > } \ > - if (RB_ISRED(RB_RIGHT(tmp, field), field)) { \ > - struct type *oright; \ > - oright = RB_RIGHT(tmp, field); \ > - RB_COLOR(oright, field) = RB_BLACK; \ > - RB_COLOR(tmp, field) = RB_RED; \ > - RB_ROTATE_LEFT(head, tmp, oright, field); \ > - tmp = RB_LEFT(parent, field); \ > - } else if (!RB_ISRED(RB_LEFT(tmp, field), field)) { \ > - RB_COLOR(tmp, field) = RB_RED; \ > - elm = parent; \ > - parent = RB_PARENT(elm, field); \ > + sib = RB_LEFT(elm, field); \ > + if (RB_RED_RT(sib, field)) { \ > + RB_ROTATE_LEFT(head, sib, tmp, field); \ > + sib = tmp; \ > + } else if (!RB_RED_LF(sib, field)) { \ > + RB_FLIP_LF(elm, field); \ > + elm = par; \ > continue; \ > } \ > - if (RB_ISRED(RB_LEFT(tmp, field), field)) \ > - RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ > - RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ > - RB_COLOR(parent, field) = RB_BLACK; \ > - RB_ROTATE_RIGHT(head, parent, tmp, field); \ > - elm = RB_ROOT(head); \ > + if (RB_RED_LF(sib, field)) \ > + RB_FLIP_LF(sib, field); \ > + RB_ROTATE_RIGHT(head, elm, sib, field); \ > + RB_FLIP_RT(sib, field); \ > break; \ > } \ > - } while (!RB_ISRED(elm, field) && parent != NULL); \ > - RB_COLOR(elm, field) = RB_BLACK; \ > + } while (!red_par); \ > + if (par != NULL && red_par) { \ > + if (left_child) \ > + RB_FLIP_LF(par, field); \ > + else \ > + RB_FLIP_RT(par, field); \ > + } \ > } > > #define RB_GENERATE_REMOVE(name, type, field, attr) \ > @@ -550,12 +547,11 @@ attr struct type * \ > name##_RB_REMOVE(struct name *head, struct type *elm) \ > { \ > struct type *child, *old, *parent, *parent_old, *right; \ > - int color; \ > + RB_BOOL old_red, red; \ > \ > old = elm; \ > parent_old = parent = RB_PARENT(elm, field); \ > right = RB_RIGHT(elm, field); \ > - color = RB_COLOR(elm, field); \ > if (RB_LEFT(elm, field) == NULL) \ > elm = child = right; \ > else if (right == NULL) \ > @@ -563,7 +559,8 @@ name##_RB_REMOVE(struct name *head, struct type *elm) > else { \ > if ((child = RB_LEFT(right, field)) == NULL) { \ > child = RB_RIGHT(right, field); \ > - RB_RIGHT(old, field) = child; \ > + red = RB_RED_RT(old, field); \ > + RB_RT(old, field) = child; \ > parent = elm = right; \ > } else { \ > do \ > @@ -571,23 +568,31 @@ name##_RB_REMOVE(struct name *head, struct type > *elm) > while ((child = RB_LEFT(elm, field)) != NULL); \ > child = RB_RIGHT(elm, field); \ > parent = RB_PARENT(elm, field); \ > - RB_LEFT(parent, field) = child; \ > + red = RB_RED_LF(parent, field); \ > + RB_LF(parent, field) = child; \ > RB_PARENT(RB_RIGHT(old, field), field) = elm; \ > } \ > RB_PARENT(RB_LEFT(old, field), field) = elm; \ > - color = RB_COLOR(elm, field); \ > elm->field = old->field; \ > } \ > - if (parent_old == NULL) \ > + if (parent_old == NULL) { \ > RB_ROOT(head) = elm; \ > - else if (RB_LEFT(parent_old, field) == old) \ > - RB_LEFT(parent_old, field) = elm; \ > - else \ > - RB_RIGHT(parent_old, field) = elm; \ > - if (child != NULL) { \ > + old_red = RB_FALSE; \ > + } else if (RB_LEFT(parent_old, field) == old) { \ > + old_red = RB_RED_LF(parent_old, field); \ > + RB_LF(parent_old, field) = elm; \ > + if (old_red && parent != parent_old) \ > + RB_FLIP_LF(parent_old, field); \ > + } else { \ > + old_red = RB_RED_RT(parent_old, field); \ > + RB_RT(parent_old, field) = elm; \ > + if (old_red && parent != parent_old) \ > + RB_FLIP_RT(parent_old, field); \ > + } \ > + if (child != NULL) \ > RB_PARENT(child, field) = parent; \ > - RB_COLOR(child, field) = RB_BLACK; \ > - } else if (color != RB_RED && parent != NULL) \ > + else if (parent != NULL && \ > + (parent != parent_old ? !red : !old_red)) \ > name##_RB_REMOVE_COLOR(head, parent); \ > while (parent != NULL) { \ > RB_AUGMENT(parent); \ > @@ -615,14 +620,14 @@ name##_RB_INSERT(struct name *head, struct type > *elm) > else \ > return (tmp); \ > } \ > - RB_SET(elm, parent, field); \ > - if (parent != NULL) { \ > - if (comp < 0) \ > - RB_LEFT(parent, field) = elm; \ > - else \ > - RB_RIGHT(parent, field) = elm; \ > - } else \ > + RB_PARENT(elm, field) = parent; \ > + RB_LF(elm, field) = RB_RT(elm, field) = NULL; \ > + if (parent == NULL) \ > RB_ROOT(head) = elm; \ > + else if (comp < 0) \ > + RB_LF(parent, field) = elm; \ > + else \ > + RB_RT(parent, field) = elm; \ > name##_RB_INSERT_COLOR(head, elm); \ > while (elm != NULL) { \ > RB_AUGMENT(elm); \ > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Tue Jun 9 23:03:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CCDA33FEE6; Tue, 9 Jun 2020 23:03:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hQfG34B6z3yqG; Tue, 9 Jun 2020 23:03:50 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 649271D834; Tue, 9 Jun 2020 23:03:50 +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 059N3o1h045263; Tue, 9 Jun 2020 23:03:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 059N3nhE045257; Tue, 9 Jun 2020 23:03:49 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202006092303.059N3nhE045257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 9 Jun 2020 23:03:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361993 - 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: 361993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 09 Jun 2020 23:03:50 -0000 Author: mjg Date: Tue Jun 9 23:03:48 2020 New Revision: 361993 URL: https://svnweb.freebsd.org/changeset/base/361993 Log: cred: distribute reference count per thread This avoids dirtying creds in the common case, see the comment in kern_prot.c for details. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D24007 Modified: head/sys/kern/init_main.c head/sys/kern/kern_fork.c head/sys/kern/kern_prot.c head/sys/kern/kern_thread.c head/sys/sys/proc.h head/sys/sys/ucred.h Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Tue Jun 9 22:42:54 2020 (r361992) +++ head/sys/kern/init_main.c Tue Jun 9 23:03:48 2020 (r361993) @@ -541,7 +541,10 @@ proc0_init(void *dummy __unused) /* End hack. creds get properly set later with thread_cow_get_proc */ curthread->td_ucred = NULL; newcred->cr_prison = &prison0; + newcred->cr_users++; /* avoid assertion failure */ proc_set_cred_init(p, newcred); + newcred->cr_users--; + crfree(newcred); #ifdef AUDIT audit_cred_kproc0(newcred); #endif @@ -810,8 +813,9 @@ create_init(const void *udata __unused) #endif proc_set_cred(initproc, newcred); td = FIRST_THREAD_IN_PROC(initproc); - crfree(td->td_ucred); - td->td_ucred = crhold(initproc->p_ucred); + crcowfree(td); + td->td_realucred = crcowget(initproc->p_ucred); + td->td_ucred = td->td_realucred; PROC_UNLOCK(initproc); sx_xunlock(&proctree_lock); crfree(oldcred); Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Tue Jun 9 22:42:54 2020 (r361992) +++ head/sys/kern/kern_fork.c Tue Jun 9 23:03:48 2020 (r361993) @@ -961,7 +961,7 @@ fork1(struct thread *td, struct fork_req *fr) * XXX: This is ugly; when we copy resource usage, we need to bump * per-cred resource counters. */ - proc_set_cred_init(newproc, crhold(td->td_ucred)); + proc_set_cred_init(newproc, td->td_ucred); /* * Initialize resource accounting for the child process. @@ -998,8 +998,7 @@ fail0: #endif racct_proc_exit(newproc); fail1: - crfree(newproc->p_ucred); - newproc->p_ucred = NULL; + proc_unset_cred(newproc); fail2: if (vm2 != NULL) vmspace_free(vm2); Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Tue Jun 9 22:42:54 2020 (r361992) +++ head/sys/kern/kern_prot.c Tue Jun 9 23:03:48 2020 (r361993) @@ -1841,6 +1841,98 @@ p_canwait(struct thread *td, struct proc *p) } /* + * Credential management. + * + * struct ucred objects are rarely allocated but gain and lose references all + * the time (e.g., on struct file alloc/dealloc) turning refcount updates into + * a significant source of cache-line ping ponging. Common cases are worked + * around by modifying thread-local counter instead if the cred to operate on + * matches td_realucred. + * + * The counter is split into 2 parts: + * - cr_users -- total count of all struct proc and struct thread objects + * which have given cred in p_ucred and td_ucred respectively + * - cr_ref -- the actual ref count, only valid if cr_users == 0 + * + * If users == 0 then cr_ref behaves similarly to refcount(9), in particular if + * the count reaches 0 the object is freeable. + * If users > 0 and curthread->td_realucred == cred, then updates are performed + * against td_ucredref. + * In other cases updates are performed against cr_ref. + * + * Changing td_realucred into something else decrements cr_users and transfers + * accumulated updates. + */ +struct ucred * +crcowget(struct ucred *cr) +{ + + mtx_lock(&cr->cr_mtx); + KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", + __func__, cr->cr_users, cr)); + cr->cr_users++; + cr->cr_ref++; + mtx_unlock(&cr->cr_mtx); + return (cr); +} + +static struct ucred * +crunuse(struct thread *td) +{ + struct ucred *cr, *crold; + + cr = td->td_ucred; + mtx_lock(&cr->cr_mtx); + cr->cr_ref += td->td_ucredref; + td->td_ucredref = 0; + KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", + __func__, cr->cr_users, cr)); + cr->cr_users--; + if (cr->cr_users == 0) { + KASSERT(cr->cr_ref > 0, ("%s: ref %d not > 0 on cred %p", + __func__, cr->cr_ref, cr)); + crold = cr; + } else { + cr->cr_ref--; + crold = NULL; + } + mtx_unlock(&cr->cr_mtx); + return (crold); +} + +void +crcowfree(struct thread *td) +{ + struct ucred *cr; + + cr = crunuse(td); + if (cr != NULL) + crfree(cr); +} + +struct ucred * +crcowsync(void) +{ + struct thread *td; + struct proc *p; + struct ucred *crnew, *crold; + + td = curthread; + p = td->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); + + MPASS(td->td_realucred == td->td_ucred); + if (td->td_realucred == p->p_ucred) + return (NULL); + + crnew = crcowget(p->p_ucred); + crold = crunuse(td); + td->td_realucred = crnew; + td->td_ucred = td->td_realucred; + return (crold); +} + +/* * Allocate a zeroed cred structure. */ struct ucred * @@ -1849,7 +1941,8 @@ crget(void) struct ucred *cr; cr = malloc(sizeof(*cr), M_CRED, M_WAITOK | M_ZERO); - refcount_init(&cr->cr_ref, 1); + mtx_init(&cr->cr_mtx, "cred", NULL, MTX_DEF); + cr->cr_ref = 1; #ifdef AUDIT audit_cred_init(cr); #endif @@ -1868,8 +1961,18 @@ crget(void) struct ucred * crhold(struct ucred *cr) { + struct thread *td; - refcount_acquire(&cr->cr_ref); + td = curthread; + if (__predict_true(td->td_realucred == cr)) { + KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", + __func__, cr->cr_users, cr)); + td->td_ucredref++; + return (cr); + } + mtx_lock(&cr->cr_mtx); + cr->cr_ref++; + mtx_unlock(&cr->cr_mtx); return (cr); } @@ -1879,36 +1982,51 @@ crhold(struct ucred *cr) void crfree(struct ucred *cr) { + struct thread *td; - KASSERT(cr->cr_ref > 0, ("bad ucred refcount: %d", cr->cr_ref)); - KASSERT(cr->cr_ref != 0xdeadc0de, ("dangling reference to ucred")); - if (refcount_release(&cr->cr_ref)) { - /* - * Some callers of crget(), such as nfs_statfs(), - * allocate a temporary credential, but don't - * allocate a uidinfo structure. - */ - if (cr->cr_uidinfo != NULL) - uifree(cr->cr_uidinfo); - if (cr->cr_ruidinfo != NULL) - uifree(cr->cr_ruidinfo); - /* - * Free a prison, if any. - */ - if (cr->cr_prison != NULL) - prison_free(cr->cr_prison); - if (cr->cr_loginclass != NULL) - loginclass_free(cr->cr_loginclass); + td = curthread; + if (td->td_realucred == cr) { + KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", + __func__, cr->cr_users, cr)); + td->td_ucredref--; + return; + } + mtx_lock(&cr->cr_mtx); + KASSERT(cr->cr_users >= 0, ("%s: users %d not >= 0 on cred %p", + __func__, cr->cr_users, cr)); + cr->cr_ref--; + if (cr->cr_users > 0) { + mtx_unlock(&cr->cr_mtx); + return; + } + KASSERT(cr->cr_ref >= 0, ("%s: ref %d not >= 0 on cred %p", + __func__, cr->cr_ref, cr)); + if (cr->cr_ref > 0) { + mtx_unlock(&cr->cr_mtx); + return; + } + /* + * Some callers of crget(), such as nfs_statfs(), allocate a temporary + * credential, but don't allocate a uidinfo structure. + */ + if (cr->cr_uidinfo != NULL) + uifree(cr->cr_uidinfo); + if (cr->cr_ruidinfo != NULL) + uifree(cr->cr_ruidinfo); + if (cr->cr_prison != NULL) + prison_free(cr->cr_prison); + if (cr->cr_loginclass != NULL) + loginclass_free(cr->cr_loginclass); #ifdef AUDIT - audit_cred_destroy(cr); + audit_cred_destroy(cr); #endif #ifdef MAC - mac_cred_destroy(cr); + mac_cred_destroy(cr); #endif - if (cr->cr_groups != cr->cr_smallgroups) - free(cr->cr_groups, M_CRED); - free(cr, M_CRED); - } + mtx_destroy(&cr->cr_mtx); + if (cr->cr_groups != cr->cr_smallgroups) + free(cr->cr_groups, M_CRED); + free(cr, M_CRED); } /* @@ -1982,7 +2100,7 @@ void proc_set_cred_init(struct proc *p, struct ucred *newcred) { - p->p_ucred = newcred; + p->p_ucred = crcowget(newcred); } /* @@ -1998,10 +2116,20 @@ proc_set_cred_init(struct proc *p, struct ucred *newcr void proc_set_cred(struct proc *p, struct ucred *newcred) { + struct ucred *cr; - MPASS(p->p_ucred != NULL); + cr = p->p_ucred; + MPASS(cr != NULL); PROC_LOCK_ASSERT(p, MA_OWNED); + KASSERT(newcred->cr_users == 0, ("%s: users %d not 0 on cred %p", + __func__, newcred->cr_users, newcred)); + mtx_lock(&cr->cr_mtx); + KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", + __func__, cr->cr_users, cr)); + cr->cr_users--; + mtx_unlock(&cr->cr_mtx); p->p_ucred = newcred; + newcred->cr_users = 1; PROC_UPDATE_COW(p); } @@ -2010,9 +2138,17 @@ proc_unset_cred(struct proc *p) { struct ucred *cr; - MPASS(p->p_state == PRS_ZOMBIE); + MPASS(p->p_state == PRS_ZOMBIE || p->p_state == PRS_NEW); cr = p->p_ucred; p->p_ucred = NULL; + KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", + __func__, cr->cr_users, cr)); + mtx_lock(&cr->cr_mtx); + cr->cr_users--; + if (cr->cr_users == 0) + KASSERT(cr->cr_ref > 0, ("%s: ref %d not > 0 on cred %p", + __func__, cr->cr_ref, cr)); + mtx_unlock(&cr->cr_mtx); crfree(cr); } Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Jun 9 22:42:54 2020 (r361992) +++ head/sys/kern/kern_thread.c Tue Jun 9 23:03:48 2020 (r361993) @@ -82,9 +82,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x "struct thread KBI td_flags"); _Static_assert(offsetof(struct thread, td_pflags) == 0x104, "struct thread KBI td_pflags"); -_Static_assert(offsetof(struct thread, td_frame) == 0x498, +_Static_assert(offsetof(struct thread, td_frame) == 0x4a8, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6a0, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb0, "struct proc KBI p_flag"); @@ -102,9 +102,9 @@ _Static_assert(offsetof(struct thread, td_flags) == 0x "struct thread KBI td_flags"); _Static_assert(offsetof(struct thread, td_pflags) == 0xa0, "struct thread KBI td_pflags"); -_Static_assert(offsetof(struct thread, td_frame) == 0x2fc, +_Static_assert(offsetof(struct thread, td_frame) == 0x304, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x340, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x348, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0x68, "struct proc KBI p_flag"); @@ -463,7 +463,8 @@ thread_cow_get_proc(struct thread *newtd, struct proc { PROC_LOCK_ASSERT(p, MA_OWNED); - newtd->td_ucred = crhold(p->p_ucred); + newtd->td_realucred = crcowget(p->p_ucred); + newtd->td_ucred = newtd->td_realucred; newtd->td_limit = lim_hold(p->p_limit); newtd->td_cowgen = p->p_cowgen; } @@ -472,7 +473,9 @@ void thread_cow_get(struct thread *newtd, struct thread *td) { - newtd->td_ucred = crhold(td->td_ucred); + MPASS(td->td_realucred == td->td_ucred); + newtd->td_realucred = crcowget(td->td_realucred); + newtd->td_ucred = newtd->td_realucred; newtd->td_limit = lim_hold(td->td_limit); newtd->td_cowgen = td->td_cowgen; } @@ -481,8 +484,8 @@ void thread_cow_free(struct thread *td) { - if (td->td_ucred != NULL) - crfree(td->td_ucred); + if (td->td_realucred != NULL) + crcowfree(td); if (td->td_limit != NULL) lim_free(td->td_limit); } @@ -495,13 +498,9 @@ thread_cow_update(struct thread *td) struct plimit *oldlimit; p = td->td_proc; - oldcred = NULL; oldlimit = NULL; PROC_LOCK(p); - if (td->td_ucred != p->p_ucred) { - oldcred = td->td_ucred; - td->td_ucred = crhold(p->p_ucred); - } + oldcred = crcowsync(); if (td->td_limit != p->p_limit) { oldlimit = td->td_limit; td->td_limit = lim_hold(p->p_limit); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Jun 9 22:42:54 2020 (r361992) +++ head/sys/sys/proc.h Tue Jun 9 23:03:48 2020 (r361993) @@ -267,7 +267,8 @@ struct thread { struct lock_list_entry *td_sleeplocks; /* (k) Held sleep locks. */ int td_intr_nesting_level; /* (k) Interrupt recursion. */ int td_pinned; /* (k) Temporary cpu pin count. */ - struct ucred *td_ucred; /* (k) Reference to credentials. */ + struct ucred *td_realucred; /* (k) Reference to credentials. */ + struct ucred *td_ucred; /* (k) Used credentials, temporarily switchable. */ struct plimit *td_limit; /* (k) Resource limits. */ int td_slptick; /* (t) Time at sleep. */ int td_blktick; /* (t) Time spent blocked. */ @@ -305,6 +306,7 @@ struct thread { int td_errno; /* (k) Error from last syscall. */ size_t td_vslock_sz; /* (k) amount of vslock-ed space */ struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */ + u_int td_ucredref; /* (k) references on td_realucred */ #define td_endzero td_sigmask /* Copied during fork1() or create_thread(). */ Modified: head/sys/sys/ucred.h ============================================================================== --- head/sys/sys/ucred.h Tue Jun 9 22:42:54 2020 (r361992) +++ head/sys/sys/ucred.h Tue Jun 9 23:03:48 2020 (r361993) @@ -35,6 +35,10 @@ #ifndef _SYS_UCRED_H_ #define _SYS_UCRED_H_ +#if defined(_KERNEL) || defined(_WANT_UCRED) +#include +#include +#endif #include struct loginclass; @@ -46,10 +50,19 @@ struct loginclass; * * Please do not inspect cr_uid directly to determine superuserness. The * priv(9) interface should be used to check for privilege. + * + * Lock reference: + * c - cr_mtx + * + * Unmarked fields are constant after creation. + * + * See "Credential management" comment in kern_prot.c for more information. */ #if defined(_KERNEL) || defined(_WANT_UCRED) struct ucred { - u_int cr_ref; /* reference count */ + struct mtx cr_mtx; + u_int cr_ref; /* (c) reference count */ + u_int cr_users; /* (c) proc + thread using this cred */ #define cr_startcopy cr_uid uid_t cr_uid; /* effective user id */ uid_t cr_ruid; /* real user id */ @@ -115,8 +128,11 @@ void proc_set_cred_init(struct proc *p, struct ucred * void proc_set_cred(struct proc *p, struct ucred *cr); void proc_unset_cred(struct proc *p); void crfree(struct ucred *cr); +struct ucred *crcowsync(void); struct ucred *crget(void); struct ucred *crhold(struct ucred *cr); +struct ucred *crcowget(struct ucred *cr); +void crcowfree(struct thread *td); void cru2x(struct ucred *cr, struct xucred *xcr); void cru2xt(struct thread *td, struct xucred *xcr); void crsetgroups(struct ucred *cr, int n, gid_t *groups); From owner-svn-src-head@freebsd.org Wed Jun 10 00:09:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1265634136C; Wed, 10 Jun 2020 00:09:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hS636nWZz46p5; Wed, 10 Jun 2020 00:09:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E452D1DFA4; Wed, 10 Jun 2020 00:09:31 +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 05A09VVw082753; Wed, 10 Jun 2020 00:09:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A09VkH082752; Wed, 10 Jun 2020 00:09:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006100009.05A09VkH082752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 10 Jun 2020 00:09:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361994 - in head/sys/mips: cavium/cryptocteon nlm/dev/sec X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/mips: cavium/cryptocteon nlm/dev/sec X-SVN-Commit-Revision: 361994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 00:09:32 -0000 Author: jhb Date: Wed Jun 10 00:09:31 2020 New Revision: 361994 URL: https://svnweb.freebsd.org/changeset/base/361994 Log: Add some default cases for unreachable code to silence compiler warnings. This was caused by r361481 when the buffer type was changed from an int to an enum. Reported by: mjg, rpokala Sponsored by: Chelsio Communications Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c head/sys/mips/nlm/dev/sec/nlmseclib.c Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c ============================================================================== --- head/sys/mips/cavium/cryptocteon/cryptocteon.c Tue Jun 9 23:03:48 2020 (r361993) +++ head/sys/mips/cavium/cryptocteon/cryptocteon.c Wed Jun 10 00:09:31 2020 (r361994) @@ -323,6 +323,8 @@ cryptocteon_process(device_t dev, struct cryptop *crp, goto done; } break; + default: + break; } if (csp->csp_cipher_alg != 0) { Modified: head/sys/mips/nlm/dev/sec/nlmseclib.c ============================================================================== --- head/sys/mips/nlm/dev/sec/nlmseclib.c Tue Jun 9 23:03:48 2020 (r361993) +++ head/sys/mips/nlm/dev/sec/nlmseclib.c Wed Jun 10 00:09:31 2020 (r361994) @@ -157,6 +157,8 @@ nlm_crypto_form_srcdst_segs(struct xlp_sec_command *cm crp->crp_buf.cb_buf, crp->crp_buf.cb_buf_len); } break; + default: + __assert_unreachable(); } return (0); } From owner-svn-src-head@freebsd.org Wed Jun 10 00:13:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3FB0341AB3; Wed, 10 Jun 2020 00:13:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hSBM6GFNz47Cy; Wed, 10 Jun 2020 00:13:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id D1E142BA15; Wed, 10 Jun 2020 00:13:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f181.google.com with SMTP id g62so440287qtd.5; Tue, 09 Jun 2020 17:13:15 -0700 (PDT) X-Gm-Message-State: AOAM532LjqKsYkShOtsUg2bji0Ad+zIKjb+xPw+Z/P5vTp460bXWxs+R PrFkuJo9l3H+E6mO+R2HJN+0mUJOfiMtjpZIxMw= X-Google-Smtp-Source: ABdhPJzYF13Chg8vQnIEAvx4cfaOEy5VqgJepNk5YPVkUh7t/GxSQ54vhajDhUFiw+TTJT616eowispOAxIzTLKJKlc= X-Received: by 2002:aed:3169:: with SMTP id 96mr504504qtg.211.1591747995207; Tue, 09 Jun 2020 17:13:15 -0700 (PDT) MIME-Version: 1.0 References: <202006100009.05A09VkH082752@repo.freebsd.org> In-Reply-To: <202006100009.05A09VkH082752@repo.freebsd.org> From: Kyle Evans Date: Tue, 9 Jun 2020 19:13:04 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361994 - in head/sys/mips: cavium/cryptocteon nlm/dev/sec To: John Baldwin Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 00:13:16 -0000 On Tue, Jun 9, 2020 at 7:09 PM John Baldwin wrote: > > Author: jhb > Date: Wed Jun 10 00:09:31 2020 > New Revision: 361994 > URL: https://svnweb.freebsd.org/changeset/base/361994 > > Log: > Add some default cases for unreachable code to silence compiler warnings. > > This was caused by r361481 when the buffer type was changed from an > int to an enum. > > Reported by: mjg, rpokala > Sponsored by: Chelsio Communications > > Modified: > head/sys/mips/cavium/cryptocteon/cryptocteon.c > head/sys/mips/nlm/dev/sec/nlmseclib.c > > Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c > ============================================================================== > --- head/sys/mips/cavium/cryptocteon/cryptocteon.c Tue Jun 9 23:03:48 2020 (r361993) > +++ head/sys/mips/cavium/cryptocteon/cryptocteon.c Wed Jun 10 00:09:31 2020 (r361994) > @@ -323,6 +323,8 @@ cryptocteon_process(device_t dev, struct cryptop *crp, > goto done; > } > break; > + default: > + break; > } > > if (csp->csp_cipher_alg != 0) { > This one could kind of looks like it should also be an __assert_unreachable(), and perhaps this bit not too long later: case CRYPTO_BUF_CONTIG: iovlen = crp->crp_buf.cb_buf_len; od->octo_iov[0].iov_base = crp->crp_buf.cb_buf; od->octo_iov[0].iov_len = crp->crp_buf.cb_buf_len iovcnt = 1; break; default: - panic("can't happen"); + __assert_unreachable(); } From owner-svn-src-head@freebsd.org Wed Jun 10 01:30:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70FA6344221; Wed, 10 Jun 2020 01:30:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hTvf29W7z4HBv; Wed, 10 Jun 2020 01:30:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45BE81EFA9; Wed, 10 Jun 2020 01:30:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A1Ucqc031922; Wed, 10 Jun 2020 01:30:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A1Ubt3031920; Wed, 10 Jun 2020 01:30:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006100130.05A1Ubt3031920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 10 Jun 2020 01:30:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361995 - in head/lib/libc: gen tests/gen X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/lib/libc: gen tests/gen X-SVN-Commit-Revision: 361995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 01:30:38 -0000 Author: kevans Date: Wed Jun 10 01:30:37 2020 New Revision: 361995 URL: https://svnweb.freebsd.org/changeset/base/361995 Log: execvp: fix up the ENOEXEC fallback If execve fails with ENOEXEC, execvp is expected to rebuild the command with /bin/sh instead and try again. The previous version did this, but overlooked two details: argv[0] can conceivably be NULL, in which case memp would never get terminated. We must allocate no less than three * sizeof(char *) so we can properly terminate at all times. For the non-NULL argv standard case, we count all the non-NULL elements and actually skip the first argument, so we end up capturing the NULL terminator in our bcopy(). The second detail is that the spec is actually worded such that we should have been preserving argv[0] as passed to execvp: "[...] executed command shall be as if the process invoked the sh utility using execl() as follows: execl(, arg0, file, arg1, ..., (char *)0); where is an unspecified pathname for the sh utility, file is the process image file, and for execvp(), where arg0, arg1, and so on correspond to the values passed to execvp() in argv[0], argv[1], and so on." So we make this change at this time as well, while we're already touching it. We decidedly can't preserve a NULL argv[0] as this would be incredibly, incredibly fragile, so we retain our legacy behavior of using "sh" for argv[] in this specific instance. Some light tests are added to try and detect some components of handling the ENOEXEC fallback; posix_spawnp_enoexec_fallback_null_argv0 is likely not 100% reliable, but it at least won't raise false-alarms and it did result in useful failures with pre-change libc on my machine. This is a secondary change in D25038. Reported by: Andrew Gierth Reviewed by: jilles, kib, Andrew Gierth MFC after: 1 week Modified: head/lib/libc/gen/exec.c head/lib/libc/tests/gen/Makefile head/lib/libc/tests/gen/posix_spawn_test.c Modified: head/lib/libc/gen/exec.c ============================================================================== --- head/lib/libc/gen/exec.c Wed Jun 10 00:09:31 2020 (r361994) +++ head/lib/libc/gen/exec.c Wed Jun 10 01:30:37 2020 (r361995) @@ -215,14 +215,28 @@ retry: (void)_execve(bp, argv, envp); case ENOEXEC: for (cnt = 0; argv[cnt]; ++cnt) ; - memp = alloca((cnt + 2) * sizeof(char *)); + + /* + * cnt may be 0 above; always allocate at least + * 3 entries so that we can at least fit "sh", bp, and + * the NULL terminator. We can rely on cnt to take into + * account the NULL terminator in all other scenarios, + * as we drop argv[0]. + */ + memp = alloca(MAX(3, cnt + 2) * sizeof(char *)); if (memp == NULL) { /* errno = ENOMEM; XXX override ENOEXEC? */ goto done; } - memp[0] = "sh"; - memp[1] = bp; - bcopy(argv + 1, memp + 2, cnt * sizeof(char *)); + if (cnt > 0) { + memp[0] = argv[0]; + memp[1] = bp; + bcopy(argv + 1, memp + 2, cnt * sizeof(char *)); + } else { + memp[0] = "sh"; + memp[1] = bp; + memp[2] = NULL; + } (void)_execve(_PATH_BSHELL, __DECONST(char **, memp), envp); goto done; Modified: head/lib/libc/tests/gen/Makefile ============================================================================== --- head/lib/libc/tests/gen/Makefile Wed Jun 10 00:09:31 2020 (r361994) +++ head/lib/libc/tests/gen/Makefile Wed Jun 10 01:30:37 2020 (r361995) @@ -24,6 +24,15 @@ ATF_TESTS_C+= wordexp_test # TODO: t_siginfo (fixes require further inspection) # TODO: t_sethostname_test (consistently screws up the hostname) +FILESGROUPS+= posix_spawn_test_FILES + +posix_spawn_test_FILES= spawnp_enoexec.sh +posix_spawn_test_FILESDIR= ${TESTSDIR} +posix_spawn_test_FILESMODE= 0755 +posix_spawn_test_FILESOWN= root +posix_spawn_test_FILESGRP= wheel +posix_spawn_test_FILESPACKAGE= ${PACKAGE} + CFLAGS+= -DTEST_LONG_DOUBLE # Not sure why this isn't defined for all architectures, since most Modified: head/lib/libc/tests/gen/posix_spawn_test.c ============================================================================== --- head/lib/libc/tests/gen/posix_spawn_test.c Wed Jun 10 00:09:31 2020 (r361994) +++ head/lib/libc/tests/gen/posix_spawn_test.c Wed Jun 10 01:30:37 2020 (r361995) @@ -93,11 +93,50 @@ ATF_TC_BODY(posix_spawn_no_such_command_negative_test, } } +ATF_TC_WITHOUT_HEAD(posix_spawnp_enoexec_fallback); +ATF_TC_BODY(posix_spawnp_enoexec_fallback, tc) +{ + char buf[FILENAME_MAX]; + char *myargs[2]; + int error, status; + pid_t pid, waitres; + + snprintf(buf, sizeof(buf), "%s/spawnp_enoexec.sh", + atf_tc_get_config_var(tc, "srcdir")); + myargs[0] = buf; + myargs[1] = NULL; + error = posix_spawnp(&pid, myargs[0], NULL, NULL, myargs, myenv); + ATF_REQUIRE(error == 0); + waitres = waitpid(pid, &status, 0); + ATF_REQUIRE(waitres == pid); + ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 42); +} + +ATF_TC_WITHOUT_HEAD(posix_spawnp_enoexec_fallback_null_argv0); +ATF_TC_BODY(posix_spawnp_enoexec_fallback_null_argv0, tc) +{ + char buf[FILENAME_MAX]; + char *myargs[1]; + int error, status; + pid_t pid, waitres; + + snprintf(buf, sizeof(buf), "%s/spawnp_enoexec.sh", + atf_tc_get_config_var(tc, "srcdir")); + myargs[0] = NULL; + error = posix_spawnp(&pid, buf, NULL, NULL, myargs, myenv); + ATF_REQUIRE(error == 0); + waitres = waitpid(pid, &status, 0); + ATF_REQUIRE(waitres == pid); + ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 42); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, posix_spawn_simple_test); ATF_TP_ADD_TC(tp, posix_spawn_no_such_command_negative_test); + ATF_TP_ADD_TC(tp, posix_spawnp_enoexec_fallback); + ATF_TP_ADD_TC(tp, posix_spawnp_enoexec_fallback_null_argv0); return (atf_no_error()); } From owner-svn-src-head@freebsd.org Wed Jun 10 01:32:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E9343442A5; Wed, 10 Jun 2020 01:32:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hTxV2PyBz4HXd; Wed, 10 Jun 2020 01:32:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DCF81F353; Wed, 10 Jun 2020 01:32:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A1WE5K035982; Wed, 10 Jun 2020 01:32:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A1WDD7035980; Wed, 10 Jun 2020 01:32:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006100132.05A1WDD7035980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 10 Jun 2020 01:32:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361996 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 361996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 01:32:14 -0000 Author: kevans Date: Wed Jun 10 01:32:13 2020 New Revision: 361996 URL: https://svnweb.freebsd.org/changeset/base/361996 Log: execvPe: obviate the need for potentially large stack allocations Some environments in which execvPe may be called have a limited amount of stack available. Currently, it avoidably allocates a segment on the stack large enough to hold PATH so that it may be mutated and use strsep() for easy parsing. This logic is now rewritten to just operate on the immutable string passed in and do the necessary math to extract individual paths, since it will be copying out those segments to another buffer anyways and piecing them together with the name for a full path. Additional size is also needed for the stack in posix_spawnp(), because it may need to push all of argv to the stack and rebuild the command with sh in front of it. We'll make sure it's properly aligned for the new thread, but future work should likely make rfork_thread a little easier to use by ensuring proper alignment. Some trivial cleanup has been done with a couple of error writes, moving strings into char arrays for use with the less fragile sizeof(). Reported by: Andrew Gierth Reviewed by: jilles, kib, Andrew Gierth MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25038 Modified: head/lib/libc/gen/exec.c head/lib/libc/gen/posix_spawn.c Modified: head/lib/libc/gen/exec.c ============================================================================== --- head/lib/libc/gen/exec.c Wed Jun 10 01:30:37 2020 (r361995) +++ head/lib/libc/gen/exec.c Wed Jun 10 01:32:13 2020 (r361996) @@ -49,6 +49,9 @@ __FBSDID("$FreeBSD$"); extern char **environ; +static const char execvPe_err_preamble[] = "execvP: "; +static const char execvPe_err_trailer[] = ": path too long\n"; + int execl(const char *name, const char *arg, ...) { @@ -149,8 +152,8 @@ execvPe(const char *name, const char *path, char * con const char **memp; size_t cnt, lp, ln; int eacces, save_errno; - char *cur, buf[MAXPATHLEN]; - const char *p, *bp; + char buf[MAXPATHLEN]; + const char *bp, *np, *op, *p; struct stat sb; eacces = 0; @@ -158,7 +161,7 @@ execvPe(const char *name, const char *path, char * con /* If it's an absolute or relative path name, it's easy. */ if (strchr(name, '/')) { bp = name; - cur = NULL; + op = NULL; goto retry; } bp = buf; @@ -169,34 +172,42 @@ execvPe(const char *name, const char *path, char * con return (-1); } - cur = alloca(strlen(path) + 1); - if (cur == NULL) { - errno = ENOMEM; - return (-1); - } - strcpy(cur, path); - while ((p = strsep(&cur, ":")) != NULL) { + op = path; + ln = strlen(name); + while (op != NULL) { + np = strchrnul(op, ':'); + /* * It's a SHELL path -- double, leading and trailing colons * mean the current directory. */ - if (*p == '\0') { + if (np == op) { + /* Empty component. */ p = "."; lp = 1; - } else - lp = strlen(p); - ln = strlen(name); + } else { + /* Non-empty component. */ + p = op; + lp = np - op; + } + /* Advance to the next component or terminate after this. */ + if (*np == '\0') + op = NULL; + else + op = np + 1; + /* * If the path is too long complain. This is a possible * security issue; given a way to make the path too long * the user may execute the wrong program. */ if (lp + ln + 2 > sizeof(buf)) { - (void)_write(STDERR_FILENO, "execvP: ", 8); + (void)_write(STDERR_FILENO, execvPe_err_preamble, + sizeof(execvPe_err_preamble) - 1); (void)_write(STDERR_FILENO, p, lp); - (void)_write(STDERR_FILENO, ": path too long\n", - 16); + (void)_write(STDERR_FILENO, execvPe_err_trailer, + sizeof(execvPe_err_trailer) - 1); continue; } bcopy(p, buf, lp); Modified: head/lib/libc/gen/posix_spawn.c ============================================================================== --- head/lib/libc/gen/posix_spawn.c Wed Jun 10 01:30:37 2020 (r361995) +++ head/lib/libc/gen/posix_spawn.c Wed Jun 10 01:32:13 2020 (r361996) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" +#include #include #include @@ -204,8 +205,20 @@ struct posix_spawn_args { volatile int error; }; +#define PSPAWN_STACK_ALIGNMENT 16 +#define PSPAWN_STACK_ALIGNBYTES (PSPAWN_STACK_ALIGNMENT - 1) +#define PSPAWN_STACK_ALIGN(sz) \ + (((sz) + PSPAWN_STACK_ALIGNBYTES) & ~PSPAWN_STACK_ALIGNBYTES) + #if defined(__i386__) || defined(__amd64__) +/* + * Below we'll assume that _RFORK_THREAD_STACK_SIZE is appropriately aligned for + * the posix_spawn() case where we do not end up calling _execvpe and won't ever + * try to allocate space on the stack for argv[]. + */ #define _RFORK_THREAD_STACK_SIZE 4096 +_Static_assert((_RFORK_THREAD_STACK_SIZE % PSPAWN_STACK_ALIGNMENT) == 0, + "Inappropriate stack size alignment"); #endif static int @@ -246,8 +259,24 @@ do_posix_spawn(pid_t *pid, const char *path, pid_t p; #ifdef _RFORK_THREAD_STACK_SIZE char *stack; + size_t cnt, stacksz; - stack = malloc(_RFORK_THREAD_STACK_SIZE); + stacksz = _RFORK_THREAD_STACK_SIZE; + if (use_env_path) { + /* + * We need to make sure we have enough room on the stack for the + * potential alloca() in execvPe if it gets kicked back an + * ENOEXEC from execve(2), plus the original buffer we gave + * ourselves; this protects us in the event that the caller + * intentionally or inadvertently supplies enough arguments to + * make us blow past the stack we've allocated from it. + */ + for (cnt = 0; argv[cnt] != NULL; ++cnt) + ; + stacksz += MAX(3, cnt + 2) * sizeof(char *); + stacksz = PSPAWN_STACK_ALIGN(stacksz); + } + stack = aligned_alloc(PSPAWN_STACK_ALIGNMENT, stacksz); if (stack == NULL) return (ENOMEM); #endif @@ -273,8 +302,7 @@ do_posix_spawn(pid_t *pid, const char *path, * parent. Because of this, we must use rfork_thread instead while * almost every other arch stores the return address in a register. */ - p = rfork_thread(RFSPAWN, stack + _RFORK_THREAD_STACK_SIZE, - _posix_spawn_thr, &psa); + p = rfork_thread(RFSPAWN, stack + stacksz, _posix_spawn_thr, &psa); free(stack); #else p = rfork(RFSPAWN); From owner-svn-src-head@freebsd.org Wed Jun 10 02:50:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C007345706; Wed, 10 Jun 2020 02:50:26 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hWgk2WBcz4QZG; Wed, 10 Jun 2020 02:50:26 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 510B41FE2F; Wed, 10 Jun 2020 02:50:26 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A2oQcE080989; Wed, 10 Jun 2020 02:50:26 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A2oQ4v080988; Wed, 10 Jun 2020 02:50:26 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <202006100250.05A2oQ4v080988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Wed, 10 Jun 2020 02:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361997 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 361997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 02:50:26 -0000 Author: dougm Date: Wed Jun 10 02:50:25 2020 New Revision: 361997 URL: https://svnweb.freebsd.org/changeset/base/361997 Log: Restore an RB_COLOR macro, for the benefit of a bit of DIAGNOSTIC code that depends on it. Reported by: rpokala, mjguzik Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25204 Modified: head/sys/sys/tree.h Modified: head/sys/sys/tree.h ============================================================================== --- head/sys/sys/tree.h Wed Jun 10 01:32:13 2020 (r361996) +++ head/sys/sys/tree.h Wed Jun 10 02:50:25 2020 (r361997) @@ -333,6 +333,12 @@ struct { \ #define RB_TRUE 1 #define RB_FALSE 0 +/* For debugging support */ +#define RB_COLOR(elm, field) (RB_PARENT(elm, field) == NULL ? RB_FALSE : \ + RB_LEFT(RB_PARENT(elm, field), field) == elm ? \ + RB_RED_LF(RB_PARENT(elm, field), field) : \ + RB_RED_RT(RB_PARENT(elm, field), field) + /* * Something to be invoked in a loop at the root of every modified subtree, * from the bottom up to the root, to update augmented node data. From owner-svn-src-head@freebsd.org Wed Jun 10 02:51:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E030534535A; Wed, 10 Jun 2020 02:51:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hWj75hV0z4R8Q; Wed, 10 Jun 2020 02:51:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE9F520119; Wed, 10 Jun 2020 02:51:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A2pdgY082790; Wed, 10 Jun 2020 02:51:39 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A2pdt5082789; Wed, 10 Jun 2020 02:51:39 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202006100251.05A2pdt5082789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 10 Jun 2020 02:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361998 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 361998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 02:51:40 -0000 Author: rmacklem Date: Wed Jun 10 02:51:39 2020 New Revision: 361998 URL: https://svnweb.freebsd.org/changeset/base/361998 Log: Add two functions that create M_EXTPG mbufs with anonymous pages. These two functions are needed by nfs-over-tls, but could also be useful for other purposes. mb_alloc_ext_plus_pages() - Allocates a M_EXTPG mbuf and enough anonymous pages to store "len" data bytes. mb_mapped_to_unmapped() - Copies the data from a list of mapped (non-M_EXTPG) mbufs into a list of M_EXTPG mbufs allocated with anonymous pages. This is roughly the inverse of mb_unmapped_to_ext(). Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D25182 Modified: head/sys/kern/kern_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Wed Jun 10 02:50:25 2020 (r361997) +++ head/sys/kern/kern_mbuf.c Wed Jun 10 02:51:39 2020 (r361998) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1536,4 +1537,105 @@ m_snd_tag_destroy(struct m_snd_tag *mst) ifp->if_snd_tag_free(mst); if_rele(ifp); counter_u64_add(snd_tag_count, -1); +} + +/* + * Allocate an mbuf with anonymous external pages. + */ +struct mbuf * +mb_alloc_ext_plus_pages(int len, int how) +{ + struct mbuf *m; + vm_page_t pg; + int i, npgs; + + m = mb_alloc_ext_pgs(how, mb_free_mext_pgs); + if (m == NULL) + return (NULL); + m->m_epg_flags |= EPG_FLAG_ANON; + npgs = howmany(len, PAGE_SIZE); + for (i = 0; i < npgs; i++) { + do { + pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | + VM_ALLOC_NOOBJ | VM_ALLOC_NODUMP | VM_ALLOC_WIRED); + if (pg == NULL) { + if (how == M_NOWAIT) { + m->m_epg_npgs = i; + m_free(m); + return (NULL); + } + vm_wait(NULL); + } + } while (pg == NULL); + m->m_epg_pa[i] = VM_PAGE_TO_PHYS(pg); + } + m->m_epg_npgs = npgs; + return (m); +} + +/* + * Copy the data in the mbuf chain to a chain of mbufs with anonymous external + * unmapped pages. + * len is the length of data in the input mbuf chain. + * mlen is the maximum number of bytes put into each ext_page mbuf. + */ +struct mbuf * +mb_mapped_to_unmapped(struct mbuf *mp, int len, int mlen, int how, + struct mbuf **mlast) +{ + struct mbuf *m, *mout; + char *pgpos, *mbpos; + int i, mblen, mbufsiz, pglen, xfer; + + if (len == 0) + return (NULL); + mbufsiz = min(mlen, len); + m = mout = mb_alloc_ext_plus_pages(mbufsiz, how); + if (m == NULL) + return (m); + pgpos = (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[0]); + pglen = PAGE_SIZE; + mblen = 0; + i = 0; + do { + if (pglen == 0) { + if (++i == m->m_epg_npgs) { + m->m_epg_last_len = PAGE_SIZE; + mbufsiz = min(mlen, len); + m->m_next = mb_alloc_ext_plus_pages(mbufsiz, + how); + m = m->m_next; + if (m == NULL) { + m_freem(mout); + return (m); + } + i = 0; + } + pgpos = (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[i]); + pglen = PAGE_SIZE; + } + while (mblen == 0) { + if (mp == NULL) { + m_freem(mout); + return (NULL); + } + KASSERT((mp->m_flags & M_EXTPG) == 0, + ("mb_copym_ext_pgs: ext_pgs input mbuf")); + mbpos = mtod(mp, char *); + mblen = mp->m_len; + mp = mp->m_next; + } + xfer = min(mblen, pglen); + memcpy(pgpos, mbpos, xfer); + pgpos += xfer; + mbpos += xfer; + pglen -= xfer; + mblen -= xfer; + len -= xfer; + m->m_len += xfer; + } while (len > 0); + m->m_epg_last_len = PAGE_SIZE - pglen; + if (mlast != NULL) + *mlast = m; + return (mout); } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Wed Jun 10 02:50:25 2020 (r361997) +++ head/sys/sys/mbuf.h Wed Jun 10 02:51:39 2020 (r361998) @@ -741,6 +741,9 @@ void mb_free_ext(struct mbuf *); void mb_free_extpg(struct mbuf *); void mb_free_mext_pgs(struct mbuf *); struct mbuf *mb_alloc_ext_pgs(int, m_ext_free_t); +struct mbuf *mb_alloc_ext_plus_pages(int, int); +struct mbuf *mb_mapped_to_unmapped(struct mbuf *, int, int, int, + struct mbuf **); int mb_unmapped_compress(struct mbuf *m); struct mbuf *mb_unmapped_to_ext(struct mbuf *m); void mb_free_notready(struct mbuf *m, int count); From owner-svn-src-head@freebsd.org Wed Jun 10 03:04:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7411B345B37; Wed, 10 Jun 2020 03:04:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hX052SQkz4SNY; Wed, 10 Jun 2020 03:04:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F9C420334; Wed, 10 Jun 2020 03:04:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A34bq0094207; Wed, 10 Jun 2020 03:04:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A34b0p094206; Wed, 10 Jun 2020 03:04:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006100304.05A34b0p094206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 10 Jun 2020 03:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361999 - head/lib/libc/tests/gen X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/tests/gen X-SVN-Commit-Revision: 361999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 03:04:37 -0000 Author: kevans Date: Wed Jun 10 03:04:36 2020 New Revision: 361999 URL: https://svnweb.freebsd.org/changeset/base/361999 Log: Add missing shell script from r361995 Pointy hat: kevans Reported by: rpokala X-MFC-With: r361995 Added: head/lib/libc/tests/gen/spawnp_enoexec.sh (contents, props changed) Added: head/lib/libc/tests/gen/spawnp_enoexec.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/tests/gen/spawnp_enoexec.sh Wed Jun 10 03:04:36 2020 (r361999) @@ -0,0 +1,4 @@ +# $FreeBSD$ +# Intentionally no interpreter + +exit 42 From owner-svn-src-head@freebsd.org Wed Jun 10 03:25:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F1CF346785; Wed, 10 Jun 2020 03:25:39 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hXSM2qqvz4Vjc; Wed, 10 Jun 2020 03:25:39 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id CB6F42D0D3; Wed, 10 Jun 2020 03:25:38 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.37.20051002 Date: Tue, 09 Jun 2020 20:25:34 -0700 Subject: Re: svn commit: r361997 - head/sys/sys From: Ravi Pokala To: Doug Moore , , , Message-ID: <44549A88-B566-4D5E-AA3E-97CF4C44C8BC@panasas.com> Thread-Topic: svn commit: r361997 - head/sys/sys References: <202006100250.05A2oQ4v080988@repo.freebsd.org> In-Reply-To: <202006100250.05A2oQ4v080988@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 03:25:39 -0000 Hi Doug, Shoot, it's still failing, but in a different way: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D /usr/home/rpokala/freebsd/dev/base/head/sys/kern/subr_stats.c:3385:14: erro= r: expected ')' qstr); ^ /usr/home/rpokala/freebsd/dev/base/head/sys/kern/subr_stats.c:3375:11: note= : to match this '(' printf(" RB ctd=3D%3d p=3D%3d l=3D%3d r=3D%3d c=3D%2d= " ^ 1 error generated. --- subr_stats.o --- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Doug Moore Date: 2020-06-09, Tuesday at 19:50 To: , , Subject: svn commit: r361997 - head/sys/sys Author: dougm Date: Wed Jun 10 02:50:25 2020 New Revision: 361997 URL: https://svnweb.freebsd.org/changeset/base/361997 Log: Restore an RB_COLOR macro, for the benefit of a bit of DIAGNOSTIC cod= e that depends on it. Reported by: rpokala, mjguzik Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25204 Modified: head/sys/sys/tree.h Modified: head/sys/sys/tree.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/tree.h Wed Jun 10 01:32:13 2020 (r361996) +++ head/sys/sys/tree.h Wed Jun 10 02:50:25 2020 (r361997) @@ -333,6 +333,12 @@ struct { \ #define RB_TRUE 1 #define RB_FALSE 0 +/* For debugging support */ +#define RB_COLOR(elm, field) (RB_PARENT(elm, field) =3D=3D NULL ? RB_FALS= E : \ + RB_LEFT(RB_PARENT(elm, field), field) =3D=3D elm ? \ + RB_RED_LF(RB_PARENT(elm, field), field) : \ + RB_RED_RT(RB_PARENT(elm, field), field) + /* * Something to be invoked in a loop at the root of every modified sub= tree, * from the bottom up to the root, to update augmented node data. From owner-svn-src-head@freebsd.org Wed Jun 10 03:36:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9A3334654E; Wed, 10 Jun 2020 03:36:17 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hXhd5vz4z4Wr0; Wed, 10 Jun 2020 03:36:17 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C628820849; Wed, 10 Jun 2020 03:36:17 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A3aHaL013313; Wed, 10 Jun 2020 03:36:17 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A3aHD0013312; Wed, 10 Jun 2020 03:36:17 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <202006100336.05A3aHD0013312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Wed, 10 Jun 2020 03:36:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362000 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 362000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 03:36:18 -0000 Author: dougm Date: Wed Jun 10 03:36:17 2020 New Revision: 362000 URL: https://svnweb.freebsd.org/changeset/base/362000 Log: Fixup r361997 by balancing parens. Duh. Modified: head/sys/sys/tree.h Modified: head/sys/sys/tree.h ============================================================================== --- head/sys/sys/tree.h Wed Jun 10 03:04:36 2020 (r361999) +++ head/sys/sys/tree.h Wed Jun 10 03:36:17 2020 (r362000) @@ -337,7 +337,7 @@ struct { \ #define RB_COLOR(elm, field) (RB_PARENT(elm, field) == NULL ? RB_FALSE : \ RB_LEFT(RB_PARENT(elm, field), field) == elm ? \ RB_RED_LF(RB_PARENT(elm, field), field) : \ - RB_RED_RT(RB_PARENT(elm, field), field) + RB_RED_RT(RB_PARENT(elm, field), field)) /* * Something to be invoked in a loop at the root of every modified subtree, From owner-svn-src-head@freebsd.org Wed Jun 10 04:04:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1B1D34731F; Wed, 10 Jun 2020 04:04:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hYKl4VLcz4Zm8; Wed, 10 Jun 2020 04:04:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9599A20E72; Wed, 10 Jun 2020 04:04:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A44x67031412; Wed, 10 Jun 2020 04:04:59 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A44xam031411; Wed, 10 Jun 2020 04:04:59 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202006100404.05A44xam031411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 10 Jun 2020 04:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362002 - head/sys/powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/mpc85xx X-SVN-Commit-Revision: 362002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 04:04:59 -0000 Author: jhibbits Date: Wed Jun 10 04:04:59 2020 New Revision: 362002 URL: https://svnweb.freebsd.org/changeset/base/362002 Log: powerpc/mpc85xx: Don't use the quantum cache in vmem for MPIC MSIs The qcache is unnecessary for this purpose, it's only needed when there are lots of concurrent allocations. Reported by: markj Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx.c Wed Jun 10 03:57:10 2020 (r362001) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c Wed Jun 10 04:04:59 2020 (r362002) @@ -896,7 +896,7 @@ fsl_msi_attach(device_t dev) sc = device_get_softc(dev); if (msi_vmem == NULL) - msi_vmem = vmem_create("MPIC MSI", 0, 0, 1, 1, M_BESTFIT | M_WAITOK); + msi_vmem = vmem_create("MPIC MSI", 0, 0, 1, 0, M_BESTFIT | M_WAITOK); /* Manually play with resource entries. */ sc->sc_base = bus_get_resource_start(dev, SYS_RES_MEMORY, 0); From owner-svn-src-head@freebsd.org Wed Jun 10 04:08:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03C7C347072; Wed, 10 Jun 2020 04:08:17 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hYPX6Q1yz4bHb; Wed, 10 Jun 2020 04:08:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D75F020EAC; Wed, 10 Jun 2020 04:08:16 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A48GV8031916; Wed, 10 Jun 2020 04:08:16 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A48G6p031915; Wed, 10 Jun 2020 04:08:16 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202006100408.05A48G6p031915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 10 Jun 2020 04:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362003 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 362003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 04:08:17 -0000 Author: jhibbits Date: Wed Jun 10 04:08:16 2020 New Revision: 362003 URL: https://svnweb.freebsd.org/changeset/base/362003 Log: powerpc/powernv: Don't use the vmem quantum cache for OPAL PCI MSI allocations vmem quantum cache is only needed when doing a lot of concurrent allocations, which doesn't happen when allocating MSIs. This wastes memory for the cache zones. Avoid this waste and don't use the quantum cache. Reported by: markj Modified: head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Wed Jun 10 04:04:59 2020 (r362002) +++ head/sys/powerpc/powernv/opal_pci.c Wed Jun 10 04:08:16 2020 (r362003) @@ -427,7 +427,7 @@ opalpci_attach(device_t dev) sc->msi_base = msi_ranges[0]; sc->msi_vmem = vmem_create("OPAL MSI", msi_ranges[0], - msi_ranges[1], 1, 16, M_BESTFIT | M_WAITOK); + msi_ranges[1], 1, 0, M_BESTFIT | M_WAITOK); sc->base_msi_irq = powerpc_register_pic(dev, OF_xref_from_node(node), From owner-svn-src-head@freebsd.org Wed Jun 10 04:54:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD7573285B1; Wed, 10 Jun 2020 04:54:02 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hZQL4TLKz4fq0; Wed, 10 Jun 2020 04:54:02 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94DC721900; Wed, 10 Jun 2020 04:54:02 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A4s2s7062646; Wed, 10 Jun 2020 04:54:02 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A4s2gP062645; Wed, 10 Jun 2020 04:54:02 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202006100454.05A4s2gP062645@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Wed, 10 Jun 2020 04:54:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362004 - head/sys/netgraph/bluetooth/include X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: head/sys/netgraph/bluetooth/include X-SVN-Commit-Revision: 362004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 04:54:02 -0000 Author: takawata Date: Wed Jun 10 04:54:02 2020 New Revision: 362004 URL: https://svnweb.freebsd.org/changeset/base/362004 Log: Add LE events: READ_REMOTE_FEATURES_COMPL LONG_TERM_KEY_REQUEST REMOTE_CONN_PARAM_REQUEST DATA_LENGTH_CHANGE READ_LOCAL_P256_PK_COMPL GEN_DHKEY_COMPL ENH_CONN_COMPL PR: 247050 Submitted by: Marc Veldman marc at bumblingdork.com Modified: head/sys/netgraph/bluetooth/include/ng_hci.h Modified: head/sys/netgraph/bluetooth/include/ng_hci.h ============================================================================== --- head/sys/netgraph/bluetooth/include/ng_hci.h Wed Jun 10 04:08:16 2020 (r362003) +++ head/sys/netgraph/bluetooth/include/ng_hci.h Wed Jun 10 04:54:02 2020 (r362004) @@ -1992,11 +1992,65 @@ typedef struct { u_int16_t conn_latency; u_int16_t supervision_timeout; }__attribute__((packed)) ng_hci_connection_update_complete_ep; + #define NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL 0x04 -//TBD +typedef struct { + u_int8_t status; + u_int16_t connection_handle; + u_int8_t features[NG_HCI_FEATURES_SIZE]; +}__attribute__((packed)) ng_hci_le_read_remote_features_ep; + #define NG_HCI_LEEV_LONG_TERM_KEY_REQUEST 0x05 -//TBD +typedef struct { + u_int16_t connection_handle; + u_int64_t random_number; + u_int16_t encrypted_diversifier; +}__attribute__((packed)) ng_hci_le_long_term_key_request_ep; +#define NG_HCI_LEEV_REMOTE_CONN_PARAM_REQUEST 0x06 +typedef struct { + u_int16_t connection_handle; + u_int16_t interval_min; + u_int16_t interval_max; + u_int16_t latency; + u_int16_t timeout; +}__attribute__((packed)) ng_hci_le_remote_conn_param_ep; + +#define NG_HCI_LEEV_DATA_LENGTH_CHANGE 0x07 +typedef struct { + u_int16_t connection_handle; + u_int16_t min_tx_octets; + u_int16_t max_tx_time; + u_int16_t max_rx_octets; + u_int16_t max_rx_time; +}__attribute__((packed)) ng_hci_le_data_length_change_ep; + +#define NG_HCI_LEEV_READ_LOCAL_P256_PK_COMPL 0x08 +typedef struct { + u_int8_t status; + u_int8_t local_p256_pk[64]; +}__attribute__((packed)) ng_hci_le_read_local_p256_pk_compl_ep; + +#define NG_HCI_LEEV_GEN_DHKEY_COMPL 0x09 +typedef struct { + u_int8_t status; + u_int8_t dh_key[32]; +}__attribute__((packed)) ng_hci_le_gen_dhkey_compl_ep; + +#define NG_HCI_LEEV_ENH_CONN_COMPL 0x0a +typedef struct { + u_int8_t status; + u_int16_t connection_handle; + u_int8_t role; + u_int8_t peer_addr_type; + bdaddr_t peer_addr; + bdaddr_t local_res_private_addr; + bdaddr_t peer_res_private_addr; + u_int16_t conn_interval; + u_int16_t conn_latency; + u_int16_t supervision_timeout; + u_int8_t master_clock_accuracy; +}__attribute__((packed)) ng_hci_le_enh_conn_compl_ep; #define NG_HCI_EVENT_BT_LOGO 0xfe From owner-svn-src-head@freebsd.org Wed Jun 10 05:01:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4D26328830; Wed, 10 Jun 2020 05:01:01 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hZZP4vgGz4gC8; Wed, 10 Jun 2020 05:01:01 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3A7D2155C; Wed, 10 Jun 2020 05:01:01 +0000 (UTC) (envelope-from takawata@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A511fE064725; Wed, 10 Jun 2020 05:01:01 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A510HH064116; Wed, 10 Jun 2020 05:01:00 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202006100501.05A510HH064116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Wed, 10 Jun 2020 05:01:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362005 - head/usr.sbin/bluetooth/hccontrol X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: head/usr.sbin/bluetooth/hccontrol X-SVN-Commit-Revision: 362005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 05:01:01 -0000 Author: takawata Date: Wed Jun 10 05:01:00 2020 New Revision: 362005 URL: https://svnweb.freebsd.org/changeset/base/362005 Log: Add le_read_channel_map and le_read_remote_features command PR: 247051 Submitted by: Marc Veldman marc at bumblingdork.com Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/hccontrol.h head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c head/usr.sbin/bluetooth/hccontrol/le.c head/usr.sbin/bluetooth/hccontrol/util.c Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Wed Jun 10 04:54:02 2020 (r362004) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Wed Jun 10 05:01:00 2020 (r362005) @@ -162,6 +162,8 @@ are: .It Cm LE_Add_Device_To_White_List .It Cm LE_Remove_Device_From_White_List .It Cm LE_Connect +.It Cm LE_Read_Channel_Map +.It Cm LE_Read_Remote_Features .El .Pp The currently supported node commands in Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.h ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/hccontrol.h Wed Jun 10 04:54:02 2020 (r362004) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.h Wed Jun 10 05:01:00 2020 (r362005) @@ -82,6 +82,7 @@ char const * hci_bdaddr2str (bdaddr_t const *); char const * hci_addrtype2str (int type); char const * hci_role2str (int role); char const * hci_mc_accuracy2str (int accuracy); +char const * hci_le_chanmap2str (uint8_t *, char *, int); void dump_adv_data(int len, uint8_t* advdata); void print_adv_data(int len, uint8_t* advdata); Modified: head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c Wed Jun 10 04:54:02 2020 (r362004) +++ head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c Wed Jun 10 05:01:00 2020 (r362005) @@ -1526,14 +1526,14 @@ hci_write_le_host_support(int s, int argc, char **argv switch (argc) { case 2: if (sscanf(argv[1], "%d", &n) != 1 || (n != 0 && n != 1)){ - printf("ARGC2: %d\n", n); + printf("-ARGC2: %d\n", n); return (USAGE); } cp.simultaneous_le_host = (n &1); case 1: if (sscanf(argv[0], "%d", &n) != 1 || (n != 0 && n != 1)){ - printf("ARGC1: %d\n", n); + printf("+ARGC1: %d\n", n); return (USAGE); } Modified: head/usr.sbin/bluetooth/hccontrol/le.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/le.c Wed Jun 10 04:54:02 2020 (r362004) +++ head/usr.sbin/bluetooth/hccontrol/le.c Wed Jun 10 05:01:00 2020 (r362005) @@ -69,6 +69,8 @@ static int le_add_device_to_white_list(int s, int argc static int le_remove_device_from_white_list(int s, int argc, char *argv[]); static int le_connect(int s, int argc, char *argv[]); static void handle_le_connection_event(ng_hci_event_pkt_t* e, bool verbose); +static int le_read_channel_map(int s, int argc, char *argv[]); +static void handle_le_remote_features_event(ng_hci_event_pkt_t* e); static int le_set_scan_param(int s, int argc, char *argv[]) @@ -1086,6 +1088,131 @@ static void handle_le_connection_event(ng_hci_event_pk return; } +static int +le_read_channel_map(int s, int argc, char *argv[]) +{ + ng_hci_le_read_channel_map_cp cp; + ng_hci_le_read_channel_map_rp rp; + int n; + char buffer[2048]; + + /* parse command parameters */ + switch (argc) { + case 1: + /* connection handle */ + if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff) + return (USAGE); + + cp.connection_handle = (uint16_t) (n & 0x0fff); + cp.connection_handle = htole16(cp.connection_handle); + break; + + default: + return (USAGE); + } + + n = sizeof(rp); + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_READ_CHANNEL_MAP), + (void *)&cp, sizeof(cp), (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, + "Read channel map failed. Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + fprintf(stdout, "Connection handle: %d\n", + le16toh(rp.connection_handle)); + fprintf(stdout, "Used channels:\n"); + fprintf(stdout, "\n%s\n", hci_le_chanmap2str(rp.le_channel_map, + buffer, sizeof(buffer))); + + return (OK); +} /* le_read_channel_map */ + +static int +le_read_remote_features(int s, int argc, char *argv[]) +{ + ng_hci_le_read_remote_used_features_cp cp; + ng_hci_status_rp rp; + int n, bufsize; + char b[512]; + + ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b; + + /* parse command parameters */ + switch (argc) { + case 1: + /* connection handle */ + if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff) + return (USAGE); + + cp.connection_handle = (uint16_t) (n & 0x0fff); + cp.connection_handle = htole16(cp.connection_handle); + break; + + default: + return (USAGE); + } + + n = sizeof(rp); + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_READ_REMOTE_USED_FEATURES), + (void *)&cp, sizeof(cp), (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, + "Read remote features failed. Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + /* wait for connection events */ + bufsize = sizeof(b); + if (hci_recv(s, b, &bufsize) == ERROR) { + return (ERROR); + } + + if (bufsize < sizeof(*e)) { + errno = EIO; + return (ERROR); + } + if (e->event == NG_HCI_EVENT_LE) { + handle_le_remote_features_event(e); + } + + return (OK); +} /* le_read_remote_features */ + +static void handle_le_remote_features_event(ng_hci_event_pkt_t* e) +{ + ng_hci_le_ep *ev_pkt; + ng_hci_le_read_remote_features_ep *feat_event; + char buffer[2048]; + + ev_pkt = (ng_hci_le_ep *)(e + 1); + + if (ev_pkt->subevent_code == NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL) { + feat_event =(ng_hci_le_read_remote_features_ep *)(ev_pkt + 1); + fprintf(stdout, "Handle: %d\n", + le16toh(feat_event->connection_handle)); + fprintf(stdout, + "Status: %s\n", + hci_status2str(feat_event->status)); + fprintf(stdout, "Features:\n%s\n", + hci_le_features2str(feat_event->features, + buffer, sizeof(buffer))); + } + + return; +} /* handle_le_remote_features_event */ + + + struct hci_command le_commands[] = { { "le_enable", @@ -1195,5 +1322,18 @@ struct hci_command le_commands[] = { "le_connect -a address [-t public|random] [-v]\n" "Connect to an LE device", &le_connect + }, + { + "le_read_channel_map", + "le_read_channel_map \n" + "Read the channel map for a connection", + &le_read_channel_map + }, + { + "le_read_remote_features", + "le_read_remote_features \n" + "Read supported features for the device\n" + "identified by the connection handle", + &le_read_remote_features }, }; Modified: head/usr.sbin/bluetooth/hccontrol/util.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/util.c Wed Jun 10 04:54:02 2020 (r362004) +++ head/usr.sbin/bluetooth/hccontrol/util.c Wed Jun 10 05:01:00 2020 (r362005) @@ -3322,3 +3322,46 @@ hci_mc_accuracy2str(int accuracy) return (accuracy >= SIZE(acc)? "Unknown accuracy" : acc[accuracy]); } /* hci_mc_accuracy2str */ + +char const * +hci_le_chanmap2str(uint8_t *map, char *buffer, int size) +{ + char chantxt[4]; + if (buffer != NULL && size > 0) { + int n, i, len0, len1; + + memset(buffer, 0, size); + len1 = 0; + size--; + + for (n = 0; n < 5; n++) { + fprintf(stdout, "%02x ", map[n]); + for (i = 0; i < 8; i++) { + len0 = strlen(buffer); + if (len0 >= size) + goto done; + + if (map[n] & (1 << i)) { + if (len1 + 3 > 60) { + len1 = 0; + buffer[len0 - 1] = '\n'; + } + + len1 += 3; + snprintf( + chantxt, + sizeof(chantxt), + "%02d ", + (n * 8 + i)); + strncat( + buffer, + chantxt, + size - len0); + } + } + } + fprintf(stdout, "\n"); + } +done: + return (buffer); +} From owner-svn-src-head@freebsd.org Wed Jun 10 07:32:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B79332BC4E; Wed, 10 Jun 2020 07:32:03 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hdwg1JCvz4pf4; Wed, 10 Jun 2020 07:32:03 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27E1423066; Wed, 10 Jun 2020 07:32:03 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A7W3jT058535; Wed, 10 Jun 2020 07:32:03 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A7W3JB058534; Wed, 10 Jun 2020 07:32:03 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202006100732.05A7W3JB058534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Wed, 10 Jun 2020 07:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362006 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 362006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 07:32:03 -0000 Author: rscheff Date: Wed Jun 10 07:32:02 2020 New Revision: 362006 URL: https://svnweb.freebsd.org/changeset/base/362006 Log: Prevent TCP Cubic to abruptly increase cwnd after app-limited Cubic calculates the new cwnd based on absolute time elapsed since the start of an epoch. A cubic epoch is started on congestion events, or once the congestion avoidance phase is started, after slow-start has completed. When a sender is application limited for an extended amount of time and subsequently a larger volume of data becomes ready for sending, Cubic recalculates cwnd with a lingering cubic epoch. This recalculation of the cwnd can induce a massive increase in cwnd, causing a burst of data to be sent at line rate by the sender. This adds a flag to reset the cubic epoch once a session transitions from app-limited to cwnd-limited to prevent the above effect. Reviewed by: chengc_netapp.com, tuexen (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D25065 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Wed Jun 10 05:01:00 2020 (r362005) +++ head/sys/netinet/cc/cc_cubic.c Wed Jun 10 07:32:02 2020 (r362006) @@ -94,6 +94,7 @@ struct cubic { uint32_t flags; #define CUBICFLAG_CONG_EVENT 0x00000001 /* congestion experienced */ #define CUBICFLAG_IN_SLOWSTART 0x00000002 /* in slow start */ +#define CUBICFLAG_IN_APPLIMIT 0x00000004 /* application limited */ /* Minimum observed rtt in ticks. */ int min_rtt_ticks; /* Mean observed rtt between congestion epochs. */ @@ -153,8 +154,10 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) cubic_data->t_last_cong = ticks - INT_MAX; } - if (cubic_data->flags & CUBICFLAG_IN_SLOWSTART) { - cubic_data->flags &= ~CUBICFLAG_IN_SLOWSTART; + if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART | + CUBICFLAG_IN_APPLIMIT)) { + cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART | + CUBICFLAG_IN_APPLIMIT); cubic_data->t_last_cong = ticks; cubic_data->K = 0; } @@ -214,6 +217,9 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) CCV(ccv, t_maxseg)); } } + } else if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) && + !(ccv->flags & CCF_CWND_LIMITED)) { + cubic_data->flags |= CUBICFLAG_IN_APPLIMIT; } } From owner-svn-src-head@freebsd.org Wed Jun 10 07:46:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 583D132C3FF; Wed, 10 Jun 2020 07:46:23 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hfFC1RTnz4qcv; Wed, 10 Jun 2020 07:46:23 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2869A23733; Wed, 10 Jun 2020 07:46:23 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A7kNBA066951; Wed, 10 Jun 2020 07:46:23 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A7kMdN066948; Wed, 10 Jun 2020 07:46:22 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202006100746.05A7kMdN066948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Wed, 10 Jun 2020 07:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362007 - in head/sys/net: . route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys/net: . route X-SVN-Commit-Revision: 362007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 07:46:23 -0000 Author: melifaro Date: Wed Jun 10 07:46:22 2020 New Revision: 362007 URL: https://svnweb.freebsd.org/changeset/base/362007 Log: Switch rtsock code to using newly-create rib_action() KPI call. This simplifies the code and allows to further split rtentry and nexthop, removing one of the blockers for multipath code introduction, described in D24141. Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D25192 Modified: head/sys/net/route/route_ctl.c head/sys/net/route/route_ctl.h head/sys/net/rtsock.c Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Wed Jun 10 07:32:02 2020 (r362006) +++ head/sys/net/route/route_ctl.c Wed Jun 10 07:46:22 2020 (r362007) @@ -610,6 +610,37 @@ change_route(struct rib_head *rnh, struct rt_addrinfo return (error); } +/* + * Performs modification of routing table specificed by @action. + * Table is specified by @fibnum and sa_family in @info->rti_info[RTAX_DST]. + * Needs to be run in network epoch. + * + * Returns 0 on success and fills in @rc with action result. + */ +int +rib_action(uint32_t fibnum, int action, struct rt_addrinfo *info, + struct rib_cmd_info *rc) +{ + int error; + + switch (action) { + case RTM_ADD: + error = rib_add_route(fibnum, info, rc); + break; + case RTM_DELETE: + error = rib_del_route(fibnum, info, rc); + break; + case RTM_CHANGE: + error = rib_change_route(fibnum, info, rc); + break; + default: + error = ENOTSUP; + } + + return (error); +} + + static void rt_notifydelete(struct rtentry *rt, struct rt_addrinfo *info) { Modified: head/sys/net/route/route_ctl.h ============================================================================== --- head/sys/net/route/route_ctl.h Wed Jun 10 07:32:02 2020 (r362006) +++ head/sys/net/route/route_ctl.h Wed Jun 10 07:46:22 2020 (r362007) @@ -51,6 +51,8 @@ int rib_del_route(uint32_t fibnum, struct rt_addrinfo struct rib_cmd_info *rc); int rib_change_route(uint32_t fibnum, struct rt_addrinfo *info, struct rib_cmd_info *rc); +int rib_action(uint32_t fibnum, int action, struct rt_addrinfo *info, + struct rib_cmd_info *rc); int rib_add_redirect(u_int fibnum, struct sockaddr *dst, struct sockaddr *gateway, struct sockaddr *author, struct ifnet *ifp, Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Wed Jun 10 07:32:02 2020 (r362006) +++ head/sys/net/rtsock.c Wed Jun 10 07:46:22 2020 (r362007) @@ -62,6 +62,7 @@ #include #include #include +#include #include #ifdef RADIX_MPATH #include @@ -181,10 +182,10 @@ static int route_output(struct mbuf *m, struct socket static void rt_getmetrics(const struct rtentry *rt, struct rt_metrics *out); static void rt_dispatch(struct mbuf *, sa_family_t); static int handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, - struct rt_msghdr *rtm, struct rtentry **ret_nrt); + struct rt_msghdr *rtm, struct rib_cmd_info *rc); static int update_rtm_from_rte(struct rt_addrinfo *info, struct rt_msghdr **prtm, int alloc_len, - struct rtentry *rt); + struct rtentry *rt, struct nhop_object *nh); static void send_rtm_reply(struct socket *so, struct rt_msghdr *rtm, struct mbuf *m, sa_family_t saf, u_int fibnum, int rtm_errno); @@ -656,10 +657,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fi */ static int handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, - struct rt_msghdr *rtm, struct rtentry **ret_nrt) + struct rt_msghdr *rtm, struct rib_cmd_info *rc) { RIB_RLOCK_TRACKER; - struct rtentry *rt; struct rib_head *rnh; sa_family_t saf; @@ -677,14 +677,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, * address lookup (no mask). * 'route -n get addr' */ - rt = (struct rtentry *) rnh->rnh_matchaddr( + rc->rc_rt = (struct rtentry *) rnh->rnh_matchaddr( info->rti_info[RTAX_DST], &rnh->head); } else - rt = (struct rtentry *) rnh->rnh_lookup( + rc->rc_rt = (struct rtentry *) rnh->rnh_lookup( info->rti_info[RTAX_DST], info->rti_info[RTAX_NETMASK], &rnh->head); - if (rt == NULL) { + if (rc->rc_rt == NULL) { RIB_RUNLOCK(rnh); return (ESRCH); } @@ -695,8 +695,9 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, * (no need to call rt_mpath_matchgate if gate == NULL) */ if (rt_mpath_capable(rnh) && info->rti_info[RTAX_GATEWAY]) { - rt = rt_mpath_matchgate(rt, info->rti_info[RTAX_GATEWAY]); - if (!rt) { + rc->rc_rt = rt_mpath_matchgate(rc->rc_rt, + info->rti_info[RTAX_GATEWAY]); + if (rc->rc_rt == NULL) { RIB_RUNLOCK(rnh); return (ESRCH); } @@ -713,16 +714,13 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, struct sockaddr laddr; struct nhop_object *nh; - nh = rt->rt_nhop; + nh = rc->rc_rt->rt_nhop; if (nh->nh_ifp != NULL && nh->nh_ifp->if_type == IFT_PROPVIRTUAL) { - struct epoch_tracker et; struct ifaddr *ifa; - NET_EPOCH_ENTER(et); ifa = ifa_ifwithnet(info->rti_info[RTAX_DST], 1, RT_ALL_FIBS); - NET_EPOCH_EXIT(et); if (ifa != NULL) rt_maskedcopy(ifa->ifa_addr, &laddr, @@ -734,24 +732,21 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, /* * refactor rt and no lock operation necessary */ - rt = (struct rtentry *)rnh->rnh_matchaddr(&laddr, + rc->rc_rt = (struct rtentry *)rnh->rnh_matchaddr(&laddr, &rnh->head); - if (rt == NULL) { + if (rc->rc_rt == NULL) { RIB_RUNLOCK(rnh); return (ESRCH); } } - RT_LOCK(rt); + rc->rc_nh_new = rc->rc_rt->rt_nhop; RIB_RUNLOCK(rnh); - *ret_nrt = rt; - return (0); } /* * Update sockaddrs, flags, etc in @prtm based on @rt data. - * Assumes @rt is locked. * rtm can be reallocated. * * Returns 0 on success, along with pointer to (potentially reallocated) @@ -760,21 +755,17 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, */ static int update_rtm_from_rte(struct rt_addrinfo *info, struct rt_msghdr **prtm, - int alloc_len, struct rtentry *rt) + int alloc_len, struct rtentry *rt, struct nhop_object *nh) { struct sockaddr_storage netmask_ss; struct walkarg w; union sockaddr_union saun; struct rt_msghdr *rtm, *orig_rtm = NULL; - struct nhop_object *nh; struct ifnet *ifp; int error, len; - RT_LOCK_ASSERT(rt); - rtm = *prtm; - nh = rt->rt_nhop; info->rti_info[RTAX_DST] = rt_key(rt); info->rti_info[RTAX_GATEWAY] = &nh->gw_sa; info->rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), @@ -854,6 +845,8 @@ route_output(struct mbuf *m, struct socket *so, ...) int alloc_len = 0, len, error = 0, fibnum; sa_family_t saf = AF_UNSPEC; struct walkarg w; + struct rib_cmd_info rc; + struct nhop_object *nh; fibnum = so->so_fibnum; @@ -881,6 +874,7 @@ route_output(struct mbuf *m, struct socket *so, ...) m_copydata(m, 0, len, (caddr_t)rtm); bzero(&info, sizeof(info)); bzero(&w, sizeof(w)); + nh = NULL; if (rtm->rtm_version != RTM_VERSION) { /* Do not touch message since format is unknown */ @@ -912,33 +906,26 @@ route_output(struct mbuf *m, struct socket *so, ...) } switch (rtm->rtm_type) { - struct rtentry *saved_nrt; - case RTM_ADD: case RTM_CHANGE: if (rtm->rtm_type == RTM_ADD) { if (info.rti_info[RTAX_GATEWAY] == NULL) senderr(EINVAL); } - saved_nrt = NULL; - error = rtrequest1_fib(rtm->rtm_type, &info, &saved_nrt, - fibnum); - if (error == 0 && saved_nrt != NULL) { + error = rib_action(fibnum, rtm->rtm_type, &info, &rc); + if (error == 0) { #ifdef INET6 rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; #endif - RT_LOCK(saved_nrt); - rtm->rtm_index = saved_nrt->rt_nhop->nh_ifp->if_index; - RT_UNLOCK(saved_nrt); + rtm->rtm_index = rc.rc_nh_new->nh_ifp->if_index; + nh = rc.rc_nh_new; } break; case RTM_DELETE: - saved_nrt = NULL; - error = rtrequest1_fib(RTM_DELETE, &info, &saved_nrt, fibnum); + error = rib_action(fibnum, RTM_DELETE, &info, &rc); if (error == 0) { - RT_LOCK(saved_nrt); - rt = saved_nrt; + nh = rc.rc_nh_old; goto report; } #ifdef INET6 @@ -948,17 +935,17 @@ route_output(struct mbuf *m, struct socket *so, ...) break; case RTM_GET: - error = handle_rtm_get(&info, fibnum, rtm, &rt); + error = handle_rtm_get(&info, fibnum, rtm, &rc); if (error != 0) senderr(error); + nh = rc.rc_nh_new; report: - RT_LOCK_ASSERT(rt); - if (!can_export_rte(curthread->td_ucred, rt)) { - RT_UNLOCK(rt); + if (!can_export_rte(curthread->td_ucred, rc.rc_rt)) { senderr(ESRCH); } - error = update_rtm_from_rte(&info, &rtm, alloc_len, rt); + + error = update_rtm_from_rte(&info, &rtm, alloc_len, rc.rc_rt, nh); /* * Note that some sockaddr pointers may have changed to * point to memory outsize @rtm. Some may be pointing @@ -974,7 +961,6 @@ report: #ifdef INET6 rti_need_deembed = 0; #endif - RT_UNLOCK(rt); if (error != 0) senderr(error); break; From owner-svn-src-head@freebsd.org Wed Jun 10 09:31:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E08132E8BC; Wed, 10 Jun 2020 09:31:38 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hhZf2sGXz3Rw2; Wed, 10 Jun 2020 09:31:38 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D6882496F; Wed, 10 Jun 2020 09:31:38 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05A9VcZ5031695; Wed, 10 Jun 2020 09:31:38 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05A9Vclw031694; Wed, 10 Jun 2020 09:31:38 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202006100931.05A9Vclw031694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 10 Jun 2020 09:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362008 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 362008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 09:31:38 -0000 Author: andrew Date: Wed Jun 10 09:31:37 2020 New Revision: 362008 URL: https://svnweb.freebsd.org/changeset/base/362008 Log: Fix the efi serial console in the Arm models. On some UEFI implementations the ConsOut EFI variable is not a device path end type so we never move to the next node. Fix this by always incrementing the device path node pointer, with a sanity check that the node length is large enough so no two nodes overlap. While here return failure on malloc failure rather than a NULL pointer dereference. Reviewed by: tsoome, imp (previous version) Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D25202 Modified: head/stand/efi/loader/efiserialio.c Modified: head/stand/efi/loader/efiserialio.c ============================================================================== --- head/stand/efi/loader/efiserialio.c Wed Jun 10 07:46:22 2020 (r362007) +++ head/stand/efi/loader/efiserialio.c Wed Jun 10 09:31:37 2020 (r362008) @@ -216,8 +216,9 @@ comc_get_con_serial_handle(const char *name) status = efi_global_getenv(name, buf, &sz); if (status == EFI_BUFFER_TOO_SMALL) { buf = malloc(sz); - if (buf != NULL) - status = efi_global_getenv(name, buf, &sz); + if (buf == NULL) + return (NULL); + status = efi_global_getenv(name, buf, &sz); } if (status != EFI_SUCCESS) { free(buf); @@ -232,17 +233,13 @@ comc_get_con_serial_handle(const char *name) free(buf); return (handle); } - if (IsDevicePathEndType(node) && - DevicePathSubType(node) == - END_INSTANCE_DEVICE_PATH_SUBTYPE) { - /* - * Start of next device path in list. - */ - node = NextDevicePathNode(node); - continue; - } - if (IsDevicePathEnd(node)) + + /* Sanity check the node before moving to the next node. */ + if (DevicePathNodeLength(node) < sizeof(*node)) break; + + /* Start of next device path in list. */ + node = NextDevicePathNode(node); } free(buf); return (NULL); From owner-svn-src-head@freebsd.org Wed Jun 10 14:10:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9B5933569D; Wed, 10 Jun 2020 14:10:48 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hpmm54fFz431P; Wed, 10 Jun 2020 14:10:48 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9C2A27D2F; Wed, 10 Jun 2020 14:10:48 +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 05AEAmbI001354; Wed, 10 Jun 2020 14:10:48 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AEAmTR001353; Wed, 10 Jun 2020 14:10:48 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202006101410.05AEAmTR001353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 10 Jun 2020 14:10:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362010 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 362010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 14:10:49 -0000 Author: manu Date: Wed Jun 10 14:10:48 2020 New Revision: 362010 URL: https://svnweb.freebsd.org/changeset/base/362010 Log: release: Fix arm GPT image msdosfs labels are capitalized, use EFI instead of efi. MFC after: 3 days Modified: head/release/tools/arm.subr Modified: head/release/tools/arm.subr ============================================================================== --- head/release/tools/arm.subr Wed Jun 10 13:06:13 2020 (r362009) +++ head/release/tools/arm.subr Wed Jun 10 14:10:48 2020 (r362010) @@ -194,7 +194,7 @@ arm_install_base() { if [ "${PART_SCHEME}" == "GPT" ]; then echo "/dev/ufs/rootfs / ufs rw 1 1" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "/dev/msdosfs/efi /boot/efi msdosfs rw,noatime 0 0" \ + echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab fi if [ "${PART_SCHEME}" == "MBR" ]; then From owner-svn-src-head@freebsd.org Wed Jun 10 14:28:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 514F0335D7E; Wed, 10 Jun 2020 14:28:38 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hq9L1VmCz44MJ; Wed, 10 Jun 2020 14:28:38 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2ECCA82AC; Wed, 10 Jun 2020 14:28:38 +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 05AEScG1013440; Wed, 10 Jun 2020 14:28:38 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AESbkw013436; Wed, 10 Jun 2020 14:28:37 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006101428.05AESbkw013436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 10 Jun 2020 14:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362011 - in head/sys: arm64/coresight conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/coresight conf X-SVN-Commit-Revision: 362011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 14:28:38 -0000 Author: br Date: Wed Jun 10 14:28:36 2020 New Revision: 362011 URL: https://svnweb.freebsd.org/changeset/base/362011 Log: ARM Coresight Funnel device: o Split-out FDT attachment to a separate file; o Add ACPI attachment; o Add support for the Static Funnel device. Sponsored by: DARPA, AFRL Added: head/sys/arm64/coresight/coresight_funnel_acpi.c (contents, props changed) head/sys/arm64/coresight/coresight_funnel_fdt.c (contents, props changed) Modified: head/sys/arm64/coresight/coresight_funnel.c head/sys/arm64/coresight/coresight_funnel.h head/sys/conf/files.arm64 Modified: head/sys/arm64/coresight/coresight_funnel.c ============================================================================== --- head/sys/arm64/coresight/coresight_funnel.c Wed Jun 10 14:10:48 2020 (r362010) +++ head/sys/arm64/coresight/coresight_funnel.c Wed Jun 10 14:28:36 2020 (r362011) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Ruslan Bukin + * Copyright (c) 2018-2020 Ruslan Bukin * All rights reserved. * * This software was developed by BAE Systems, the University of Cambridge @@ -43,9 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include "coresight_if.h" #define FUNNEL_DEBUG @@ -57,16 +54,6 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, ...) #endif -static struct ofw_compat_data compat_data[] = { - { "arm,coresight-funnel", 1 }, - { NULL, 0 } -}; - -struct funnel_softc { - struct resource *res; - struct coresight_platform_data *pdata; -}; - static struct resource_spec funnel_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { -1, 0 } @@ -78,10 +65,11 @@ funnel_init(device_t dev) struct funnel_softc *sc; sc = device_get_softc(dev); + if (sc->hwtype == HWTYPE_STATIC_FUNNEL) + return (0); /* Unlock Coresight */ bus_write_4(sc->res, CORESIGHT_LAR, CORESIGHT_UNLOCK); - dprintf("Device ID: %x\n", bus_read_4(sc->res, FUNNEL_DEVICEID)); return (0); @@ -95,6 +83,8 @@ funnel_enable(device_t dev, struct endpoint *endp, uint32_t reg; sc = device_get_softc(dev); + if (sc->hwtype == HWTYPE_STATIC_FUNNEL) + return (0); reg = bus_read_4(sc->res, FUNNEL_FUNCTL); reg &= ~(FUNCTL_HOLDTIME_MASK); @@ -113,6 +103,8 @@ funnel_disable(device_t dev, struct endpoint *endp, uint32_t reg; sc = device_get_softc(dev); + if (sc->hwtype == HWTYPE_STATIC_FUNNEL) + return; reg = bus_read_4(sc->res, FUNNEL_FUNCTL); reg &= ~(1 << endp->reg); @@ -120,29 +112,14 @@ funnel_disable(device_t dev, struct endpoint *endp, } static int -funnel_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) - return (ENXIO); - - device_set_desc(dev, "Coresight Funnel"); - - return (BUS_PROBE_DEFAULT); -} - -static int funnel_attach(device_t dev) { struct coresight_desc desc; struct funnel_softc *sc; sc = device_get_softc(dev); - - if (bus_alloc_resources(dev, funnel_spec, &sc->res) != 0) { + if (sc->hwtype == HWTYPE_FUNNEL && + bus_alloc_resources(dev, funnel_spec, &sc->res) != 0) { device_printf(dev, "cannot allocate resources for device\n"); return (ENXIO); } @@ -158,7 +135,6 @@ funnel_attach(device_t dev) static device_method_t funnel_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, funnel_probe), DEVMETHOD(device_attach, funnel_attach), /* Coresight interface */ @@ -168,13 +144,5 @@ static device_method_t funnel_methods[] = { DEVMETHOD_END }; -static driver_t funnel_driver = { - "funnel", - funnel_methods, - sizeof(struct funnel_softc), -}; - -static devclass_t funnel_devclass; - -DRIVER_MODULE(funnel, simplebus, funnel_driver, funnel_devclass, 0, 0); -MODULE_VERSION(funnel, 1); +DEFINE_CLASS_0(funnel, funnel_driver, funnel_methods, + sizeof(struct funnel_softc)); Modified: head/sys/arm64/coresight/coresight_funnel.h ============================================================================== --- head/sys/arm64/coresight/coresight_funnel.h Wed Jun 10 14:10:48 2020 (r362010) +++ head/sys/arm64/coresight/coresight_funnel.h Wed Jun 10 14:28:36 2020 (r362011) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 Ruslan Bukin + * Copyright (c) 2018-2020 Ruslan Bukin * All rights reserved. * * This software was developed by BAE Systems, the University of Cambridge @@ -62,5 +62,17 @@ #define FUNNEL_COMP1 0xFF4 /* Component ID1 */ #define FUNNEL_COMP2 0xFF8 /* Component ID2 */ #define FUNNEL_COMP3 0xFFC /* Component ID3 */ + +#define HWTYPE_NONE 0 +#define HWTYPE_FUNNEL 1 +#define HWTYPE_STATIC_FUNNEL 2 + +DECLARE_CLASS(funnel_driver); + +struct funnel_softc { + struct resource *res; + struct coresight_platform_data *pdata; + int hwtype; +}; #endif /* !_ARM64_CORESIGHT_CORESIGHT_FUNNEL_H_ */ Added: head/sys/arm64/coresight/coresight_funnel_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_funnel_acpi.c Wed Jun 10 14:28:36 2020 (r362011) @@ -0,0 +1,95 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_acpi.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +static int +funnel_acpi_probe(device_t dev) +{ + struct funnel_softc *sc; + static char *static_funnel_ids[] = { "ARMHC9FE", NULL }; + static char *funnel_ids[] = { "ARMHC9FF", NULL }; + int error; + + sc = device_get_softc(dev); + + error = ACPI_ID_PROBE(device_get_parent(dev), dev, + static_funnel_ids, NULL); + if (error <= 0) { + sc->hwtype = HWTYPE_STATIC_FUNNEL; + device_set_desc(dev, "ARM Coresight Static Funnel"); + return (error); + } + + error = ACPI_ID_PROBE(device_get_parent(dev), dev, + funnel_ids, NULL); + if (error <= 0) { + sc->hwtype = HWTYPE_FUNNEL; + device_set_desc(dev, "ARM Coresight Funnel"); + return (error); + } + + return (ENXIO); +} + +static device_method_t funnel_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, funnel_acpi_probe), + + /* End */ + DEVMETHOD_END +}; + +DEFINE_CLASS_1(funnel, funnel_acpi_driver, funnel_acpi_methods, + sizeof(struct funnel_softc), funnel_driver); + +static devclass_t funnel_acpi_devclass; + +EARLY_DRIVER_MODULE(funnel, acpi, funnel_acpi_driver, funnel_acpi_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Added: head/sys/arm64/coresight/coresight_funnel_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_funnel_fdt.c Wed Jun 10 14:28:36 2020 (r362011) @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 2018-2020 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 "coresight_if.h" + +static struct ofw_compat_data compat_data[] = { + { "arm,coresight-funnel", HWTYPE_FUNNEL }, + { "arm,coresight-static-funnel", HWTYPE_STATIC_FUNNEL }, + { NULL, HWTYPE_NONE } +}; + +static int +funnel_fdt_probe(device_t dev) +{ + struct funnel_softc *sc; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + sc = device_get_softc(dev); + + sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + switch (sc->hwtype) { + case HWTYPE_FUNNEL: + device_set_desc(dev, "Coresight Funnel"); + break; + case HWTYPE_STATIC_FUNNEL: + device_set_desc(dev, "Coresight Static Funnel"); + break; + default: + return (ENXIO); + }; + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t funnel_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, funnel_fdt_probe), + DEVMETHOD_END +}; + +DEFINE_CLASS_1(funnel, funnel_fdt_driver, funnel_fdt_methods, + sizeof(struct funnel_softc), funnel_driver); + +static devclass_t funnel_fdt_devclass; + +EARLY_DRIVER_MODULE(funnel, simplebus, funnel_fdt_driver, funnel_fdt_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Wed Jun 10 14:10:48 2020 (r362010) +++ head/sys/conf/files.arm64 Wed Jun 10 14:28:36 2020 (r362011) @@ -194,6 +194,8 @@ arm64/coresight/coresight_etm4x.c standard arm64/coresight/coresight_etm4x_acpi.c optional acpi arm64/coresight/coresight_etm4x_fdt.c optional fdt arm64/coresight/coresight_funnel.c standard +arm64/coresight/coresight_funnel_acpi.c optional acpi +arm64/coresight/coresight_funnel_fdt.c optional fdt arm64/coresight/coresight_tmc.c standard arm64/intel/firmware.c optional soc_intel_stratix10 arm64/intel/stratix10-soc-fpga-mgr.c optional soc_intel_stratix10 From owner-svn-src-head@freebsd.org Wed Jun 10 14:39:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05CAA3364A8; Wed, 10 Jun 2020 14:39:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hqQL6QPwz45K1; Wed, 10 Jun 2020 14:39:54 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2E9427EF2; Wed, 10 Jun 2020 14:39:54 +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 05AEdsmh019710; Wed, 10 Jun 2020 14:39:54 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AEdsd6019709; Wed, 10 Jun 2020 14:39:54 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006101439.05AEdsd6019709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 10 Jun 2020 14:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362012 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 362012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 14:39:55 -0000 Author: br Date: Wed Jun 10 14:39:54 2020 New Revision: 362012 URL: https://svnweb.freebsd.org/changeset/base/362012 Log: All the ARM Coresight interconnect devices set ResourceProducer on memory resources, ignore it. The devices found in the ARM Neoverse N1 System Development Platform (N1SDP). Sponsored by: DARPA, AFRL Modified: head/sys/dev/acpica/acpi_resource.c Modified: head/sys/dev/acpica/acpi_resource.c ============================================================================== --- head/sys/dev/acpica/acpi_resource.c Wed Jun 10 14:28:36 2020 (r362011) +++ head/sys/dev/acpica/acpi_resource.c Wed Jun 10 14:39:54 2020 (r362012) @@ -484,8 +484,16 @@ acpi_parse_resources(device_t dev, ACPI_HANDLE handle, if (acpi_MatchHid(handle, "ARMH0011") != ACPI_MATCHHID_NOMATCH) arc.ignore_producer_flag = true; - /* ARM Coresight on N1SDP set ResourceProducer on memory resources. */ - if (acpi_MatchHid(handle, "ARMHC500") != ACPI_MATCHHID_NOMATCH) + /* + * ARM Coresight on N1SDP set ResourceProducer on memory resources. + * Coresight devices: ETM, STM, TPIU, ETF/ETR, REP, FUN. + */ + if (acpi_MatchHid(handle, "ARMHC500") != ACPI_MATCHHID_NOMATCH || + acpi_MatchHid(handle, "ARMHC502") != ACPI_MATCHHID_NOMATCH || + acpi_MatchHid(handle, "ARMHC979") != ACPI_MATCHHID_NOMATCH || + acpi_MatchHid(handle, "ARMHC97C") != ACPI_MATCHHID_NOMATCH || + acpi_MatchHid(handle, "ARMHC98D") != ACPI_MATCHHID_NOMATCH || + acpi_MatchHid(handle, "ARMHC9FF") != ACPI_MATCHHID_NOMATCH) arc.ignore_producer_flag = true; status = AcpiWalkResources(handle, "_CRS", acpi_parse_resource, &arc); From owner-svn-src-head@freebsd.org Wed Jun 10 15:21:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D92A233742D; Wed, 10 Jun 2020 15:21:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hrL058tFz48TV; Wed, 10 Jun 2020 15:21:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-274.local (unknown [IPv6:2601:648:8203:2990:e58b:3cc3:e9ef:5d92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 3D9BB12176; Wed, 10 Jun 2020 15:21:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r361994 - in head/sys/mips: cavium/cryptocteon nlm/dev/sec To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head References: <202006100009.05A09VkH082752@repo.freebsd.org> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <2c7d50d4-1f5d-fad5-75b6-3c0e3a62d560@FreeBSD.org> Date: Wed, 10 Jun 2020 08:21:10 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 15:21:12 -0000 On 6/9/20 5:13 PM, Kyle Evans wrote: > On Tue, Jun 9, 2020 at 7:09 PM John Baldwin wrote: >> >> Author: jhb >> Date: Wed Jun 10 00:09:31 2020 >> New Revision: 361994 >> URL: https://svnweb.freebsd.org/changeset/base/361994 >> >> Log: >> Add some default cases for unreachable code to silence compiler warnings. >> >> This was caused by r361481 when the buffer type was changed from an >> int to an enum. >> >> Reported by: mjg, rpokala >> Sponsored by: Chelsio Communications >> >> Modified: >> head/sys/mips/cavium/cryptocteon/cryptocteon.c >> head/sys/mips/nlm/dev/sec/nlmseclib.c >> >> Modified: head/sys/mips/cavium/cryptocteon/cryptocteon.c >> ============================================================================== >> --- head/sys/mips/cavium/cryptocteon/cryptocteon.c Tue Jun 9 23:03:48 2020 (r361993) >> +++ head/sys/mips/cavium/cryptocteon/cryptocteon.c Wed Jun 10 00:09:31 2020 (r361994) >> @@ -323,6 +323,8 @@ cryptocteon_process(device_t dev, struct cryptop *crp, >> goto done; >> } >> break; >> + default: >> + break; >> } >> >> if (csp->csp_cipher_alg != 0) { >> > > This one could kind of looks like it should also be an > __assert_unreachable(), and perhaps this bit not too long later: This one is not. It doesn't handle CRYPTO_BUF_CONTIG as there is nothing to do for that case. > case CRYPTO_BUF_CONTIG: > iovlen = crp->crp_buf.cb_buf_len; > od->octo_iov[0].iov_base = crp->crp_buf.cb_buf; > od->octo_iov[0].iov_len = crp->crp_buf.cb_buf_len > iovcnt = 1; > break; > default: > - panic("can't happen"); > + __assert_unreachable(); This could. I don't think we had __assert_unreachable() yet when I committed this. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jun 10 15:29:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97C1D33747E; Wed, 10 Jun 2020 15:29:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hrX33Vxqz48wD; Wed, 10 Jun 2020 15:29:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-274.local (unknown [IPv6:2601:648:8203:2990:e58b:3cc3:e9ef:5d92]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 001D21249B; Wed, 10 Jun 2020 15:29:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r362012 - head/sys/dev/acpica To: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006101439.05AEdsd6019709@repo.freebsd.org> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <905025d5-2459-085a-696d-658dfdf5f8cd@FreeBSD.org> Date: Wed, 10 Jun 2020 08:29:54 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <202006101439.05AEdsd6019709@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.33 Precedence: list List-Id: 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, 10 Jun 2020 15:29:55 -0000 On 6/10/20 7:39 AM, Ruslan Bukin wrote: > Author: br > Date: Wed Jun 10 14:39:54 2020 > New Revision: 362012 > URL: https://svnweb.freebsd.org/changeset/base/362012 > > Log: > All the ARM Coresight interconnect devices set ResourceProducer on memory > resources, ignore it. > > The devices found in the ARM Neoverse N1 System Development Platform > (N1SDP). > > Sponsored by: DARPA, AFRL 1) We should perhaps think about adding a quirk table or at least just adding an array of ACPI handles which need this quirk as a separate variable perhaps? 2) Given that ARM is a frequent offender here, perhaps we should provide them some feedback to see if they can fix this in future ROMs? -- John Baldwin From owner-svn-src-head@freebsd.org Wed Jun 10 16:00:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00EC233878B; Wed, 10 Jun 2020 16:00:44 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hsCb6HtFz4BLg; Wed, 10 Jun 2020 16:00:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D365E95A4; Wed, 10 Jun 2020 16:00:43 +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 05AG0hsW069886; Wed, 10 Jun 2020 16:00:43 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AG0hTJ069885; Wed, 10 Jun 2020 16:00:43 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202006101600.05AG0hTJ069885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 10 Jun 2020 16:00:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362013 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 16:00:44 -0000 Author: emaste Date: Wed Jun 10 16:00:43 2020 New Revision: 362013 URL: https://svnweb.freebsd.org/changeset/base/362013 Log: Fix arm64 kernel build with DEBUG on Submitted by: Greg V , andrew Differential Revision: https://reviews.freebsd.org/D24986 Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Wed Jun 10 14:39:54 2020 (r362012) +++ head/sys/kern/subr_intr.c Wed Jun 10 16:00:43 2020 (r362013) @@ -797,8 +797,8 @@ intr_pic_register(device_t dev, intptr_t xref) if (pic == NULL) return (NULL); - debugf("PIC %p registered for %s \n", pic, - device_get_nameunit(dev), dev, xref); + debugf("PIC %p registered for %s \n", pic, + device_get_nameunit(dev), dev, (uintmax_t)xref); return (pic); } From owner-svn-src-head@freebsd.org Wed Jun 10 18:43:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68B0E33C5A2; Wed, 10 Jun 2020 18:43:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hwqh1xFcz4P8C; Wed, 10 Jun 2020 18:43:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DC32B5E8; Wed, 10 Jun 2020 18:43:44 +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 05AIhiEB080913; Wed, 10 Jun 2020 18:43:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AIhhAl080911; Wed, 10 Jun 2020 18:43:43 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006101843.05AIhhAl080911@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 10 Jun 2020 18:43:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362014 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362014 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 18:43:44 -0000 Author: trasz Date: Wed Jun 10 18:43:43 2020 New Revision: 362014 URL: https://svnweb.freebsd.org/changeset/base/362014 Log: Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to the standard SO_SNDBUF/SO_RCVBUF. Mostly cosmetics, to get rid of the warning during 'apt upgrade'. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25173 Modified: head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Wed Jun 10 16:00:43 2020 (r362013) +++ head/sys/compat/linux/linux_socket.c Wed Jun 10 18:43:43 2020 (r362014) @@ -212,8 +212,10 @@ linux_to_bsd_so_sockopt(int opt) case LINUX_SO_BROADCAST: return (SO_BROADCAST); case LINUX_SO_SNDBUF: + case LINUX_SO_SNDBUFFORCE: return (SO_SNDBUF); case LINUX_SO_RCVBUF: + case LINUX_SO_RCVBUFFORCE: return (SO_RCVBUF); case LINUX_SO_KEEPALIVE: return (SO_KEEPALIVE); Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Wed Jun 10 16:00:43 2020 (r362013) +++ head/sys/compat/linux/linux_socket.h Wed Jun 10 18:43:43 2020 (r362014) @@ -200,6 +200,8 @@ int linux_accept(struct thread *td, struct linux_accep #endif #define LINUX_SO_TIMESTAMP 29 #define LINUX_SO_ACCEPTCONN 30 +#define LINUX_SO_SNDBUFFORCE 32 +#define LINUX_SO_RCVBUFFORCE 33 /* Socket options */ #define LINUX_IP_TOS 1 From owner-svn-src-head@freebsd.org Wed Jun 10 18:44:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABB7A33C632; Wed, 10 Jun 2020 18:44:49 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hwrw5QKkz4P91; Wed, 10 Jun 2020 18:44:48 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x431.google.com with SMTP id p5so3450605wrw.9; Wed, 10 Jun 2020 11:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=bhq7PajBy+C1o5t/PzgDPUWvO1bZV+vvELjdrW3N7qY=; b=NlIoWtfzqEb0yKxJSIOqIcVEPTYtZbJgvStiIOpZCmGQeZKugNltKhER1n4Y4opRHw CLccEexOEMcLs0Es3uowI8uQCvPa6YSlFQpHNZoBmZq3V/JH3ahfuCWZLPACeNaC4dqx MdJhWFeSIhxZiXEYaBuHKrDkYoxjUrw9nIpdjrUdByoaOBsrKhsKJdO/GhPoo9331tp9 VP1MHGiA70lNWyA25EqzJyyl1kt/1XErVpbVPBUFdTA91e+jbJknDbhY9T43Imf1UYWG nsHSk4Dh2klCCpwlyFqF26iXhkRtBJH9eJiQsEVMj+SZWHpBXcmoeFQ3DLXqkfvEtkAm Jx3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=bhq7PajBy+C1o5t/PzgDPUWvO1bZV+vvELjdrW3N7qY=; b=CWhWLlElGeZ/FsSx/wTDFk3kW5VdW8HeN4i4XvXF1O/zfPQbzdJhh3C01zHOcIX22E Rvp4aAqGo/9KZp74Mo9WQfXiJTy7YfO1JAmFPmkh3ZEqeFucnrEo8hJWbJ/wR0rMTrIN K9rWjKMXZqyQqYeHWIINx8/K7kZTeCSVjlW6kFyVBLB48BCIMtIQgBWTPwGdimvuEcA7 EQ+SOxE3V2ff1prdN+4QaLun8mwrr/sy5N3qUBibSzB2+vV0tSh1gYWMz5INWClDk7fv 3Wwv+/CP7YU4puoobdXvcHvkXXc+V0+p084lAAgLEEI+/9pgqyE9ZPA6djXK8kTVOQHH FgeA== X-Gm-Message-State: AOAM532ZiqHuFLgZUWqXqANsmnyuqXDZT+mSf2QmSxylCAH9oG34EzjF PF4ShJGyWfeARM9G4zlU906IwqYp X-Google-Smtp-Source: ABdhPJz5JO/Y5v3yehtwXYbz84DpqS4OMewd5zAt7R1KqyjKMy3I8HjwnuWCIwwgCoKxAS2xqahtuw== X-Received: by 2002:a5d:4701:: with SMTP id y1mr5152577wrq.310.1591814685845; Wed, 10 Jun 2020 11:44:45 -0700 (PDT) Received: from brick (cpc92302-cmbg19-2-0-cust461.5-4.cable.virginm.net. [82.1.209.206]) by smtp.gmail.com with ESMTPSA id y14sm671168wma.25.2020.06.10.11.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 11:44:45 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Wed, 10 Jun 2020 19:44:43 +0100 From: Edward Tomasz Napierala To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362014 - head/sys/compat/linux Message-ID: <20200610184443.GA38135@brick> Mail-Followup-To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006101843.05AIhhAl080911@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202006101843.05AIhhAl080911@repo.freebsd.org> X-Rspamd-Queue-Id: 49hwrw5QKkz4P91 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=NlIoWtfz; dmarc=none; spf=pass (mx1.freebsd.org: domain of etnapierala@gmail.com designates 2a00:1450:4864:20::431 as permitted sender) smtp.mailfrom=etnapierala@gmail.com X-Spamd-Result: default: False [-2.15 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-0.87)[-0.873]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-0.95)[-0.954]; RCVD_COUNT_THREE(0.00)[3]; MID_RHS_NOT_FQDN(0.50)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.62)[-0.619]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::431:from]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[82.1.209.206:received]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[trasz@freebsd.org,etnapierala@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 18:44:49 -0000 On 0610T1843, Edward Tomasz Napierala wrote: > Author: trasz > Date: Wed Jun 10 18:43:43 2020 > New Revision: 362014 > URL: https://svnweb.freebsd.org/changeset/base/362014 > > Log: > Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to the > standard SO_SNDBUF/SO_RCVBUF. Mostly cosmetics, to get rid > of the warning during 'apt upgrade'. > > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation Reviewed by: emaste@ From owner-svn-src-head@freebsd.org Wed Jun 10 18:50:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 248CB33C65D; Wed, 10 Jun 2020 18:50:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hwzr0F9Cz4PRb; Wed, 10 Jun 2020 18:50:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03863B710; Wed, 10 Jun 2020 18:50:48 +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 05AIolsS083741; Wed, 10 Jun 2020 18:50:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AIol9K083738; Wed, 10 Jun 2020 18:50:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006101850.05AIol9K083738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 10 Jun 2020 18:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362015 - in head: share/man/man4 sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: share/man/man4 sys/compat/linux X-SVN-Commit-Revision: 362015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 18:50:48 -0000 Author: trasz Date: Wed Jun 10 18:50:46 2020 New Revision: 362015 URL: https://svnweb.freebsd.org/changeset/base/362015 Log: Make linux(4) set the openfiles soft resource limit to 1024 for Linux applications, which often depend on this being the case. There's a new sysctl, compat.linux.default_openfiles, to control this behaviour. Reviewed by: kevans, emaste, bcr (manpages) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25177 Modified: head/share/man/man4/linux.4 head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Wed Jun 10 18:43:43 2020 (r362014) +++ head/share/man/man4/linux.4 Wed Jun 10 18:50:46 2020 (r362015) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2019 +.Dd June 10, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -95,6 +95,10 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va compat.linux.default_openfiles +Default soft openfiles resource limit for Linux applications. +Set to -1 to disable the limit. +Defaults to 1024. .It Va compat.linux.emul_path Path to the Linux run-time environment. Defaults to Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Wed Jun 10 18:43:43 2020 (r362014) +++ head/sys/compat/linux/linux_emul.c Wed Jun 10 18:50:46 2020 (r362015) @@ -42,10 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -87,6 +89,32 @@ pem_find(struct proc *p) return (pem); } +/* + * Linux apps generally expect the soft open file limit to be set + * to 1024, often iterating over all the file descriptors up to that + * limit instead of using closefrom(2). Give them what they want, + * unless there already is a resource limit in place. + */ +static void +linux_set_default_openfiles(struct thread *td, struct proc *p) +{ + struct rlimit rlim; + int error; + + if (linux_default_openfiles < 0) + return; + + PROC_LOCK(p); + lim_rlimit_proc(p, RLIMIT_NOFILE, &rlim); + PROC_UNLOCK(p); + if (rlim.rlim_cur != rlim.rlim_max || + rlim.rlim_cur <= linux_default_openfiles) + return; + rlim.rlim_cur = linux_default_openfiles; + error = kern_proc_setrlimit(td, p, RLIMIT_NOFILE, &rlim); + KASSERT(error == 0, ("kern_proc_setrlimit failed")); +} + void linux_proc_init(struct thread *td, struct thread *newtd, int flags) { @@ -115,6 +143,8 @@ linux_proc_init(struct thread *td, struct thread *newt p->p_emuldata = pem; } newtd->td_emuldata = em; + + linux_set_default_openfiles(td, p); } else { p = td->td_proc; Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Wed Jun 10 18:43:43 2020 (r362014) +++ head/sys/compat/linux/linux_mib.c Wed Jun 10 18:50:46 2020 (r362015) @@ -63,6 +63,11 @@ static unsigned linux_osd_jail_slot; SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Linux mode"); +int linux_default_openfiles = 1024; +SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles, CTLFLAG_RWTUN, + &linux_default_openfiles, 0, + "Default soft openfiles resource limit, or -1 for unlimited"); + int linux_ignore_ip_recverr = 1; SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN, &linux_ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR"); Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Wed Jun 10 18:43:43 2020 (r362014) +++ head/sys/compat/linux/linux_mib.h Wed Jun 10 18:50:46 2020 (r362015) @@ -62,6 +62,7 @@ int linux_kernver(struct thread *td); #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) +extern int linux_default_openfiles; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; extern bool linux_map_sched_prio; From owner-svn-src-head@freebsd.org Wed Jun 10 18:59:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF76733CB84; Wed, 10 Jun 2020 18:59:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hxBB49wJz4Q06; Wed, 10 Jun 2020 18:59:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AB85B989; Wed, 10 Jun 2020 18:59:46 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05AIxkkQ087606; Wed, 10 Jun 2020 18:59:46 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AIxk7l087601; Wed, 10 Jun 2020 18:59:46 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006101859.05AIxk7l087601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 10 Jun 2020 18:59:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362016 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 18:59:46 -0000 Author: adrian Date: Wed Jun 10 18:59:46 2020 New Revision: 362016 URL: https://svnweb.freebsd.org/changeset/base/362016 Log: [net80211] ok ok if_xname won't ever be NULL. Somewhere in net80211 if_xname is checked against NULL but it doesn't trigger a compiler warning, but this does. So DTRT for FreeBSD and the other if_xname derefences can be converted to this function at a later time. Modified: head/sys/net80211/ieee80211_freebsd.c Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Wed Jun 10 18:50:46 2020 (r362015) +++ head/sys/net80211/ieee80211_freebsd.c Wed Jun 10 18:59:46 2020 (r362016) @@ -1042,7 +1042,7 @@ wlan_iflladdr(void *arg __unused, struct ifnet *ifp) const char * ieee80211_get_vap_ifname(struct ieee80211vap *vap) { - if ((vap->iv_ifp == NULL) || (vap->iv_ifp->if_xname == NULL)) + if (vap->iv_ifp == NULL) return "(none)"; return vap->iv_ifp->if_xname; } From owner-svn-src-head@freebsd.org Wed Jun 10 19:23:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4926933D5AA; Wed, 10 Jun 2020 19:23:59 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hxk71Hprz4Rrh; Wed, 10 Jun 2020 19:23:59 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2794EBE27; Wed, 10 Jun 2020 19:23:59 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05AJNxC5006605; Wed, 10 Jun 2020 19:23:59 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AJNwPt006602; Wed, 10 Jun 2020 19:23:58 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006101923.05AJNwPt006602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Wed, 10 Jun 2020 19:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362017 - in head/usr.bin/sed: . tests X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: in head/usr.bin/sed: . tests X-SVN-Commit-Revision: 362017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 19:23:59 -0000 Author: 0mp (doc,ports committer) Date: Wed Jun 10 19:23:58 2020 New Revision: 362017 URL: https://svnweb.freebsd.org/changeset/base/362017 Log: Read commands from stdin when -f - is passed to sed(1) This patch teaches sed to interpret a "-" in a special way when given as an argument to the -f flag. This behavior is also present in GNU sed. PR: 244872 Tested by: antoine (exp-run) Reviewed by: pfg, tobik (older version) Approved by: pfg (src) Relnotes: yes MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24079 Modified: head/usr.bin/sed/main.c head/usr.bin/sed/sed.1 head/usr.bin/sed/tests/sed2_test.sh Modified: head/usr.bin/sed/main.c ============================================================================== --- head/usr.bin/sed/main.c Wed Jun 10 18:59:46 2020 (r362016) +++ head/usr.bin/sed/main.c Wed Jun 10 19:23:58 2020 (r362017) @@ -126,12 +126,13 @@ static void usage(void); int main(int argc, char *argv[]) { - int c, fflag; + int c, fflag, fflagstdin; char *temp_arg; (void) setlocale(LC_ALL, ""); fflag = 0; + fflagstdin = 0; inplace = NULL; while ((c = getopt(argc, argv, "EI:ae:f:i:lnru")) != -1) @@ -157,6 +158,8 @@ main(int argc, char *argv[]) break; case 'f': fflag = 1; + if (strcmp(optarg, "-") == 0) + fflagstdin = 1; add_compunit(CU_FILE, optarg); break; case 'i': @@ -193,6 +196,8 @@ main(int argc, char *argv[]) if (*argv) for (; *argv; argv++) add_file(*argv); + else if (fflagstdin) + exit(rval); else add_file(NULL); process(); @@ -236,9 +241,14 @@ again: linenum = 0; switch (script->type) { case CU_FILE: - if ((f = fopen(script->s, "r")) == NULL) - err(1, "%s", script->s); - fname = script->s; + if (strcmp(script->s, "-") == 0) { + f = stdin; + fname = "stdin"; + } else { + if ((f = fopen(script->s, "r")) == NULL) + err(1, "%s", script->s); + fname = script->s; + } state = ST_FILE; goto again; case CU_STRING: Modified: head/usr.bin/sed/sed.1 ============================================================================== --- head/usr.bin/sed/sed.1 Wed Jun 10 18:59:46 2020 (r362016) +++ head/usr.bin/sed/sed.1 Wed Jun 10 19:23:58 2020 (r362017) @@ -31,7 +31,7 @@ .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd May 19, 2020 +.Dd June 10, 2020 .Dt SED 1 .Os .Sh NAME @@ -98,6 +98,10 @@ Append the editing commands found in the file .Ar command_file to the list of commands. The editing commands should each be listed on a separate line. +The commands are read from the standard input if +.Ar command_file +is +.Dq Li - . .It Fl I Ar extension Edit files in-place, saving backups with the specified .Ar extension . @@ -636,7 +640,9 @@ The .Fl E , I , a and .Fl i -options, the prefixing +options, the special meaning of +.Fl f Cm - , +the prefixing .Dq \&+ in the second member of an address range, as well as the Modified: head/usr.bin/sed/tests/sed2_test.sh ============================================================================== --- head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 18:59:46 2020 (r362016) +++ head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 19:23:58 2020 (r362017) @@ -116,11 +116,68 @@ hex_subst_body() atf_check -o "inline:" sed 's/\xx//' d } +atf_test_case commands_on_stdin +commands_on_stdin_head() +{ + atf_set "descr" "Verify -f -" +} +commands_on_stdin_body() +{ + printf "a\n" > a + printf "s/a/b/\n" > a_to_b + printf "s/b/c/\n" > b_to_c + printf "s/c/d/\n" > ./- + atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c + + # Verify that nothing is printed if there are no input files provided. + printf 'i\\\nx' > insert_x + atf_check -o 'empty' sed -f - < insert_x +} + +atf_test_case commands_on_stdin +commands_on_stdin_head() +{ + atf_set "descr" "Verify -f -" +} +commands_on_stdin_body() +{ + printf "a\n" > a + printf "s/a/b/\n" > a_to_b + printf "s/b/c/\n" > b_to_c + printf "s/c/d/\n" > ./- + atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c + + # Verify that nothing is printed if there are no input files provided. + printf 'i\\\nx' > insert_x + atf_check -o 'empty' sed -f - < insert_x +} + +atf_test_case commands_on_stdin +commands_on_stdin_head() +{ + atf_set "descr" "Verify -f -" +} +commands_on_stdin_body() +{ + printf "a\n" > a + printf "s/a/b/\n" > a_to_b + printf "s/b/c/\n" > b_to_c + printf "s/c/d/\n" > ./- + atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c + + # Verify that nothing is printed if there are no input files provided. + printf 'i\\\nx' > insert_x + atf_check -o 'empty' sed -f - < insert_x +} + atf_init_test_cases() { atf_add_test_case inplace_command_q atf_add_test_case inplace_hardlink_src atf_add_test_case inplace_symlink_src atf_add_test_case escape_subst + atf_add_test_case commands_on_stdin + atf_add_test_case commands_on_stdin + atf_add_test_case commands_on_stdin atf_add_test_case hex_subst } From owner-svn-src-head@freebsd.org Wed Jun 10 20:12:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DB9033E4EB; Wed, 10 Jun 2020 20:12:46 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49hypP6gfZz4WDP; Wed, 10 Jun 2020 20:12:45 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E062EC7B9; Wed, 10 Jun 2020 20:12:45 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05AKCjmV038169; Wed, 10 Jun 2020 20:12:45 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AKCjQf038168; Wed, 10 Jun 2020 20:12:45 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006102012.05AKCjQf038168@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Wed, 10 Jun 2020 20:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362027 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 362027 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 20:12:46 -0000 Author: chuck Date: Wed Jun 10 20:12:45 2020 New Revision: 362027 URL: https://svnweb.freebsd.org/changeset/base/362027 Log: pci: loosen PCIe hot-plug requirements The original PCIe hot-plug code required a couple of things which cause PCI probing errors on the QEMU Q35 system and possibly physical systems (Dell R6515). Allocate the hot-plug interrupt as shared to support INTx interrupts. The hot-plug interrupt mechanism should normally be MSI as PCIe mandates MSI support, but QEMU's Q35 bridge only provides INTx interrupts. Second, the code required the Electromechanical Interlock (Slot Status EIS) to be engaged if present (Slot Capability EIP). Some platforms including QEMU Q35 set EIP but not EIS. Fix by deleting the check. Reviewed by: imp, mav, jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24877 Modified: head/sys/dev/pci/pci_pci.c Modified: head/sys/dev/pci/pci_pci.c ============================================================================== --- head/sys/dev/pci/pci_pci.c Wed Jun 10 20:05:53 2020 (r362026) +++ head/sys/dev/pci/pci_pci.c Wed Jun 10 20:12:45 2020 (r362027) @@ -1073,14 +1073,6 @@ pcib_hotplug_present(struct pcib_softc *sc) if (!pcib_hotplug_inserted(sc)) return (0); - /* - * Require the Electromechanical Interlock to be engaged if - * present. - */ - if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP && - (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) == 0) - return (0); - /* Require the Data Link Layer to be active. */ if (!(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE)) return (0); @@ -1338,7 +1330,7 @@ pcib_alloc_pcie_irq(struct pcib_softc *sc) rid = 0; sc->pcie_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (sc->pcie_irq == NULL) { device_printf(dev, "Failed to allocate interrupt for PCI-e events\n"); From owner-svn-src-head@freebsd.org Wed Jun 10 21:18:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B98B633F6F9; Wed, 10 Jun 2020 21:18:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j0G84rfKz4Zk4; Wed, 10 Jun 2020 21:18:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1776CFEA; Wed, 10 Jun 2020 21:18:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05ALIOkR075529; Wed, 10 Jun 2020 21:18:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ALIKSI075506; Wed, 10 Jun 2020 21:18:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006102118.05ALIKSI075506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 10 Jun 2020 21:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362028 - in head/sys: crypto/aesni crypto/blake2 crypto/via dev/glxsb opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: crypto/aesni crypto/blake2 crypto/via dev/glxsb opencrypto X-SVN-Commit-Revision: 362028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 21:18:24 -0000 Author: jhb Date: Wed Jun 10 21:18:19 2020 New Revision: 362028 URL: https://svnweb.freebsd.org/changeset/base/362028 Log: Adjust crypto_apply function callbacks for OCF. - crypto_apply() is only used for reading a buffer to compute a digest, so change the data pointer to a const pointer. - To better match m_apply(), change the data pointer type to void * and the length from uint16_t to u_int. The length field in particular matters as none of the apply logic was splitting requests larger than UINT16_MAX. - Adjust the auth_xform Update callback to match the function prototype passed to crypto_apply() and crypto_apply_buf(). This removes the needs for casts when using the Update callback. - Change the Reinit and Setkey callbacks to also use a u_int length instead of uint16_t. - Update auth transforms for the changes. While here, use C99 initializers for auth_hash structures and avoid casts on callbacks. Reviewed by: cem Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D25171 Modified: head/sys/crypto/aesni/aesni.c head/sys/crypto/aesni/aesni.h head/sys/crypto/blake2/blake2-sw.c head/sys/crypto/blake2/blake2_cryptodev.c head/sys/crypto/via/padlock_hash.c head/sys/dev/glxsb/glxsb_hash.c head/sys/opencrypto/cbc_mac.c head/sys/opencrypto/cbc_mac.h head/sys/opencrypto/criov.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/gmac.c head/sys/opencrypto/gmac.h head/sys/opencrypto/xform_auth.h head/sys/opencrypto/xform_cbc_mac.c head/sys/opencrypto/xform_gmac.c head/sys/opencrypto/xform_null.c head/sys/opencrypto/xform_poly1305.c head/sys/opencrypto/xform_poly1305.h head/sys/opencrypto/xform_rmd160.c head/sys/opencrypto/xform_sha1.c head/sys/opencrypto/xform_sha2.c Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/crypto/aesni/aesni.c Wed Jun 10 21:18:19 2020 (r362028) @@ -388,7 +388,7 @@ MODULE_VERSION(aesni, 1); MODULE_DEPEND(aesni, crypto, 1, 1, 1); static int -intel_sha1_update(void *vctx, void *vdata, u_int datalen) +intel_sha1_update(void *vctx, const void *vdata, u_int datalen) { struct sha1_ctxt *ctx = vctx; const char *data = vdata; @@ -437,7 +437,7 @@ SHA1_Finalize_fn(void *digest, void *ctx) } static int -intel_sha256_update(void *vctx, void *vdata, u_int len) +intel_sha256_update(void *vctx, const void *vdata, u_int len) { SHA256_CTX *ctx = vctx; uint64_t bitlen; Modified: head/sys/crypto/aesni/aesni.h ============================================================================== --- head/sys/crypto/aesni/aesni.h Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/crypto/aesni/aesni.h Wed Jun 10 21:18:19 2020 (r362028) @@ -63,7 +63,7 @@ struct aesni_session { int mlen; int hash_len; void (*hash_init)(void *); - int (*hash_update)(void *, void *, unsigned); + int (*hash_update)(void *, const void *, u_int); void (*hash_finalize)(void *, void *); bool hmac; }; Modified: head/sys/crypto/blake2/blake2-sw.c ============================================================================== --- head/sys/crypto/blake2/blake2-sw.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/crypto/blake2/blake2-sw.c Wed Jun 10 21:18:19 2020 (r362028) @@ -49,7 +49,7 @@ blake2b_xform_init(void *vctx) } static void -blake2b_xform_setkey(void *vctx, const uint8_t *key, uint16_t klen) +blake2b_xform_setkey(void *vctx, const uint8_t *key, u_int klen) { struct blake2b_xform_ctx *ctx = vctx; @@ -60,7 +60,7 @@ blake2b_xform_setkey(void *vctx, const uint8_t *key, u } static int -blake2b_xform_update(void *vctx, const uint8_t *data, uint16_t len) +blake2b_xform_update(void *vctx, const void *data, u_int len) { struct blake2b_xform_ctx *ctx = vctx; int rc; @@ -117,7 +117,7 @@ blake2s_xform_init(void *vctx) } static void -blake2s_xform_setkey(void *vctx, const uint8_t *key, uint16_t klen) +blake2s_xform_setkey(void *vctx, const uint8_t *key, u_int klen) { struct blake2s_xform_ctx *ctx = vctx; @@ -128,7 +128,7 @@ blake2s_xform_setkey(void *vctx, const uint8_t *key, u } static int -blake2s_xform_update(void *vctx, const uint8_t *data, uint16_t len) +blake2s_xform_update(void *vctx, const void *data, u_int len) { struct blake2s_xform_ctx *ctx = vctx; int rc; Modified: head/sys/crypto/blake2/blake2_cryptodev.c ============================================================================== --- head/sys/crypto/blake2/blake2_cryptodev.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/crypto/blake2/blake2_cryptodev.c Wed Jun 10 21:18:19 2020 (r362028) @@ -304,7 +304,7 @@ blake2_cipher_setup(struct blake2_session *ses, } static int -blake2b_applicator(void *state, void *buf, u_int len) +blake2b_applicator(void *state, const void *buf, u_int len) { int rc; @@ -315,7 +315,7 @@ blake2b_applicator(void *state, void *buf, u_int len) } static int -blake2s_applicator(void *state, void *buf, u_int len) +blake2s_applicator(void *state, const void *buf, u_int len) { int rc; Modified: head/sys/crypto/via/padlock_hash.c ============================================================================== --- head/sys/crypto/via/padlock_hash.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/crypto/via/padlock_hash.c Wed Jun 10 21:18:19 2020 (r362028) @@ -73,11 +73,10 @@ struct padlock_sha_ctx { }; CTASSERT(sizeof(struct padlock_sha_ctx) <= sizeof(union authctx)); -static void padlock_sha_init(struct padlock_sha_ctx *ctx); -static int padlock_sha_update(struct padlock_sha_ctx *ctx, const uint8_t *buf, - uint16_t bufsize); -static void padlock_sha1_final(uint8_t *hash, struct padlock_sha_ctx *ctx); -static void padlock_sha256_final(uint8_t *hash, struct padlock_sha_ctx *ctx); +static void padlock_sha_init(void *vctx); +static int padlock_sha_update(void *vctx, const void *buf, u_int bufsize); +static void padlock_sha1_final(uint8_t *hash, void *vctx); +static void padlock_sha256_final(uint8_t *hash, void *vctx); static struct auth_hash padlock_hmac_sha1 = { .type = CRYPTO_SHA1_HMAC, @@ -86,9 +85,9 @@ static struct auth_hash padlock_hmac_sha1 = { .hashsize = SHA1_HASH_LEN, .ctxsize = sizeof(struct padlock_sha_ctx), .blocksize = SHA1_BLOCK_LEN, - .Init = (void (*)(void *))padlock_sha_init, - .Update = (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, - .Final = (void (*)(uint8_t *, void *))padlock_sha1_final, + .Init = padlock_sha_init, + .Update = padlock_sha_update, + .Final = padlock_sha1_final, }; static struct auth_hash padlock_hmac_sha256 = { @@ -98,9 +97,9 @@ static struct auth_hash padlock_hmac_sha256 = { .hashsize = SHA2_256_HASH_LEN, .ctxsize = sizeof(struct padlock_sha_ctx), .blocksize = SHA2_256_BLOCK_LEN, - .Init = (void (*)(void *))padlock_sha_init, - .Update = (int (*)(void *, const uint8_t *, uint16_t))padlock_sha_update, - .Final = (void (*)(uint8_t *, void *))padlock_sha256_final, + .Init = padlock_sha_init, + .Update = padlock_sha_update, + .Final = padlock_sha256_final, }; MALLOC_DECLARE(M_PADLOCK); @@ -165,18 +164,22 @@ padlock_do_sha256(const char *in, char *out, int count } static void -padlock_sha_init(struct padlock_sha_ctx *ctx) +padlock_sha_init(void *vctx) { + struct padlock_sha_ctx *ctx; + ctx = vctx; ctx->psc_buf = NULL; ctx->psc_offset = 0; ctx->psc_size = 0; } static int -padlock_sha_update(struct padlock_sha_ctx *ctx, const uint8_t *buf, uint16_t bufsize) +padlock_sha_update(void *vctx, const void *buf, u_int bufsize) { + struct padlock_sha_ctx *ctx; + ctx = vctx; if (ctx->psc_size - ctx->psc_offset < bufsize) { ctx->psc_size = MAX(ctx->psc_size * 2, ctx->psc_size + bufsize); ctx->psc_buf = realloc(ctx->psc_buf, ctx->psc_size, M_PADLOCK, @@ -190,9 +193,11 @@ padlock_sha_update(struct padlock_sha_ctx *ctx, const } static void -padlock_sha_free(struct padlock_sha_ctx *ctx) +padlock_sha_free(void *vctx) { + struct padlock_sha_ctx *ctx; + ctx = vctx; if (ctx->psc_buf != NULL) { //bzero(ctx->psc_buf, ctx->psc_size); free(ctx->psc_buf, M_PADLOCK); @@ -203,17 +208,21 @@ padlock_sha_free(struct padlock_sha_ctx *ctx) } static void -padlock_sha1_final(uint8_t *hash, struct padlock_sha_ctx *ctx) +padlock_sha1_final(uint8_t *hash, void *vctx) { + struct padlock_sha_ctx *ctx; + ctx = vctx; padlock_do_sha1(ctx->psc_buf, hash, ctx->psc_offset); padlock_sha_free(ctx); } static void -padlock_sha256_final(uint8_t *hash, struct padlock_sha_ctx *ctx) +padlock_sha256_final(uint8_t *hash, void *vctx) { + struct padlock_sha_ctx *ctx; + ctx = vctx; padlock_do_sha256(ctx->psc_buf, hash, ctx->psc_offset); padlock_sha_free(ctx); } @@ -282,14 +291,13 @@ padlock_authcompute(struct padlock_session *ses, struc padlock_copy_ctx(axf, ses->ses_ictx, &ctx); error = crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length, - (int (*)(void *, void *, unsigned int))axf->Update, (caddr_t)&ctx); + axf->Update, &ctx); if (error != 0) { padlock_free_ctx(axf, &ctx); return (error); } error = crypto_apply(crp, crp->crp_payload_start, - crp->crp_payload_length, - (int (*)(void *, void *, unsigned int))axf->Update, (caddr_t)&ctx); + crp->crp_payload_length, axf->Update, &ctx); if (error != 0) { padlock_free_ctx(axf, &ctx); return (error); Modified: head/sys/dev/glxsb/glxsb_hash.c ============================================================================== --- head/sys/dev/glxsb/glxsb_hash.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/dev/glxsb/glxsb_hash.c Wed Jun 10 21:18:19 2020 (r362028) @@ -73,12 +73,11 @@ glxsb_authcompute(struct glxsb_session *ses, struct cr axf = ses->ses_axf; bcopy(ses->ses_ictx, &ctx, axf->ctxsize); error = crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length, - (int (*)(void *, void *, unsigned int))axf->Update, (caddr_t)&ctx); + axf->Update, &ctx); if (error != 0) return (error); error = crypto_apply(crp, crp->crp_payload_start, - crp->crp_payload_length, - (int (*)(void *, void *, unsigned int))axf->Update, (caddr_t)&ctx); + crp->crp_payload_length, axf->Update, &ctx); if (error != 0) return (error); Modified: head/sys/opencrypto/cbc_mac.c ============================================================================== --- head/sys/opencrypto/cbc_mac.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/cbc_mac.c Wed Jun 10 21:18:19 2020 (r362028) @@ -56,14 +56,20 @@ xor_and_encrypt(struct aes_cbc_mac_ctx *ctx, } void -AES_CBC_MAC_Init(struct aes_cbc_mac_ctx *ctx) +AES_CBC_MAC_Init(void *vctx) { + struct aes_cbc_mac_ctx *ctx; + + ctx = vctx; bzero(ctx, sizeof(*ctx)); } void -AES_CBC_MAC_Setkey(struct aes_cbc_mac_ctx *ctx, const uint8_t *key, uint16_t klen) +AES_CBC_MAC_Setkey(void *vctx, const uint8_t *key, u_int klen) { + struct aes_cbc_mac_ctx *ctx; + + ctx = vctx; ctx->rounds = rijndaelKeySetupEnc(ctx->keysched, key, klen * 8); } @@ -76,8 +82,9 @@ AES_CBC_MAC_Setkey(struct aes_cbc_mac_ctx *ctx, const * nonce, as well as information about the sizes and lengths involved. */ void -AES_CBC_MAC_Reinit(struct aes_cbc_mac_ctx *ctx, const uint8_t *nonce, uint16_t nonceLen) +AES_CBC_MAC_Reinit(void *vctx, const uint8_t *nonce, u_int nonceLen) { + struct aes_cbc_mac_ctx *ctx = vctx; uint8_t b0[CCM_CBC_BLOCK_LEN]; uint8_t *bp = b0, flags = 0; uint8_t L = 0; @@ -150,11 +157,15 @@ AES_CBC_MAC_Reinit(struct aes_cbc_mac_ctx *ctx, const } int -AES_CBC_MAC_Update(struct aes_cbc_mac_ctx *ctx, const uint8_t *data, - uint16_t length) +AES_CBC_MAC_Update(void *vctx, const void *vdata, u_int length) { + struct aes_cbc_mac_ctx *ctx; + const uint8_t *data; size_t copy_amt; + ctx = vctx; + data = vdata; + /* * This will be called in one of two phases: * (1) Applying authentication data, or @@ -241,10 +252,13 @@ AES_CBC_MAC_Update(struct aes_cbc_mac_ctx *ctx, const } void -AES_CBC_MAC_Final(uint8_t *buf, struct aes_cbc_mac_ctx *ctx) +AES_CBC_MAC_Final(uint8_t *buf, void *vctx) { + struct aes_cbc_mac_ctx *ctx; uint8_t s0[CCM_CBC_BLOCK_LEN]; - + + ctx = vctx; + /* * We first need to check to see if we've got any data * left over to encrypt. Modified: head/sys/opencrypto/cbc_mac.h ============================================================================== --- head/sys/opencrypto/cbc_mac.h Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/cbc_mac.h Wed Jun 10 21:18:19 2020 (r362028) @@ -58,10 +58,10 @@ struct aes_cbc_mac_ctx { uint32_t keysched[4*(RIJNDAEL_MAXNR+1)]; }; -void AES_CBC_MAC_Init(struct aes_cbc_mac_ctx *); -void AES_CBC_MAC_Setkey(struct aes_cbc_mac_ctx *, const uint8_t *, uint16_t); -void AES_CBC_MAC_Reinit(struct aes_cbc_mac_ctx *, const uint8_t *, uint16_t); -int AES_CBC_MAC_Update(struct aes_cbc_mac_ctx *, const uint8_t *, uint16_t); -void AES_CBC_MAC_Final(uint8_t *, struct aes_cbc_mac_ctx *); +void AES_CBC_MAC_Init(void *); +void AES_CBC_MAC_Setkey(void *, const uint8_t *, u_int); +void AES_CBC_MAC_Reinit(void *, const uint8_t *, u_int); +int AES_CBC_MAC_Update(void *, const void *, u_int); +void AES_CBC_MAC_Final(uint8_t *, void *); #endif /* _CBC_CCM_H */ Modified: head/sys/opencrypto/criov.c ============================================================================== --- head/sys/opencrypto/criov.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/criov.c Wed Jun 10 21:18:19 2020 (r362028) @@ -385,8 +385,8 @@ crypto_cursor_copydata_noadv(struct crypto_buffer_curs * the beginning, continuing for "len" bytes. */ static int -cuio_apply(struct uio *uio, int off, int len, int (*f)(void *, void *, u_int), - void *arg) +cuio_apply(struct uio *uio, int off, int len, + int (*f)(void *, const void *, u_int), void *arg) { struct iovec *iov = uio->uio_iov; int iol = uio->uio_iovcnt; @@ -461,13 +461,14 @@ crypto_copydata(struct cryptop *crp, int off, int size int crypto_apply_buf(struct crypto_buffer *cb, int off, int len, - int (*f)(void *, void *, u_int), void *arg) + int (*f)(void *, const void *, u_int), void *arg) { int error; switch (cb->cb_type) { case CRYPTO_BUF_MBUF: - error = m_apply(cb->cb_mbuf, off, len, f, arg); + error = m_apply(cb->cb_mbuf, off, len, + (int (*)(void *, void *, u_int))f, arg); break; case CRYPTO_BUF_UIO: error = cuio_apply(cb->cb_uio, off, len, f, arg); @@ -488,7 +489,7 @@ crypto_apply_buf(struct crypto_buffer *cb, int off, in int crypto_apply(struct cryptop *crp, int off, int len, - int (*f)(void *, void *, u_int), void *arg) + int (*f)(void *, const void *, u_int), void *arg) { return (crypto_apply_buf(&crp->crp_buf, off, len, f, arg)); } Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/cryptodev.h Wed Jun 10 21:18:19 2020 (r362028) @@ -668,12 +668,12 @@ void crypto_copyback(struct cryptop *crp, int off, int const void *src); void crypto_copydata(struct cryptop *crp, int off, int size, void *dst); int crypto_apply(struct cryptop *crp, int off, int len, - int (*f)(void *, void *, u_int), void *arg); + int (*f)(void *, const void *, u_int), void *arg); void *crypto_contiguous_subsegment(struct cryptop *crp, size_t skip, size_t len); int crypto_apply_buf(struct crypto_buffer *cb, int off, int len, - int (*f)(void *, void *, u_int), void *arg); + int (*f)(void *, const void *, u_int), void *arg); void *crypto_buffer_contiguous_subsegment(struct crypto_buffer *cb, size_t skip, size_t len); size_t crypto_buffer_len(struct crypto_buffer *cb); Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/cryptosoft.c Wed Jun 10 21:18:19 2020 (r362028) @@ -336,7 +336,7 @@ swcr_authcompute(struct swcr_session *ses, struct cryp bcopy(sw->sw_ictx, &ctx, axf->ctxsize); err = crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length, - (int (*)(void *, void *, unsigned int))axf->Update, &ctx); + axf->Update, &ctx); if (err) return err; @@ -344,11 +344,10 @@ swcr_authcompute(struct swcr_session *ses, struct cryp CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) err = crypto_apply_buf(&crp->crp_obuf, crp->crp_payload_output_start, crp->crp_payload_length, - (int (*)(void *, void *, unsigned int))axf->Update, &ctx); + axf->Update, &ctx); else err = crypto_apply(crp, crp->crp_payload_start, - crp->crp_payload_length, - (int (*)(void *, void *, unsigned int))axf->Update, &ctx); + crp->crp_payload_length, axf->Update, &ctx); if (err) return err; Modified: head/sys/opencrypto/gmac.c ============================================================================== --- head/sys/opencrypto/gmac.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/gmac.c Wed Jun 10 21:18:19 2020 (r362028) @@ -36,19 +36,23 @@ #include void -AES_GMAC_Init(struct aes_gmac_ctx *agc) +AES_GMAC_Init(void *ctx) { + struct aes_gmac_ctx *agc; + agc = ctx; bzero(agc, sizeof *agc); } void -AES_GMAC_Setkey(struct aes_gmac_ctx *agc, const uint8_t *key, uint16_t klen) +AES_GMAC_Setkey(void *ctx, const uint8_t *key, u_int klen) { + struct aes_gmac_ctx *agc; const uint8_t zeros[GMAC_BLOCK_LEN] = {}; struct gf128 h; uint8_t hbuf[GMAC_BLOCK_LEN]; + agc = ctx; agc->rounds = rijndaelKeySetupEnc(agc->keysched, key, klen * 8); rijndaelEncrypt(agc->keysched, agc->rounds, zeros, hbuf); @@ -61,20 +65,26 @@ AES_GMAC_Setkey(struct aes_gmac_ctx *agc, const uint8_ } void -AES_GMAC_Reinit(struct aes_gmac_ctx *agc, const uint8_t *iv, uint16_t ivlen) +AES_GMAC_Reinit(void *ctx, const uint8_t *iv, u_int ivlen) { + struct aes_gmac_ctx *agc; + agc = ctx; KASSERT(ivlen <= sizeof agc->counter, ("passed ivlen too large!")); bcopy(iv, agc->counter, ivlen); } int -AES_GMAC_Update(struct aes_gmac_ctx *agc, const uint8_t *data, uint16_t len) +AES_GMAC_Update(void *ctx, const void *vdata, u_int len) { + struct aes_gmac_ctx *agc; + const uint8_t *data; struct gf128 v; uint8_t buf[GMAC_BLOCK_LEN] = {}; int i; + agc = ctx; + data = vdata; v = agc->hash; while (len > 0) { @@ -103,12 +113,14 @@ AES_GMAC_Update(struct aes_gmac_ctx *agc, const uint8_ } void -AES_GMAC_Final(uint8_t digest[GMAC_DIGEST_LEN], struct aes_gmac_ctx *agc) +AES_GMAC_Final(uint8_t *digest, void *ctx) { + struct aes_gmac_ctx *agc; uint8_t enccntr[GMAC_BLOCK_LEN]; struct gf128 a; /* XXX - zero additional bytes? */ + agc = ctx; agc->counter[GMAC_BLOCK_LEN - 1] = 1; rijndaelEncrypt(agc->keysched, agc->rounds, agc->counter, enccntr); Modified: head/sys/opencrypto/gmac.h ============================================================================== --- head/sys/opencrypto/gmac.h Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/gmac.h Wed Jun 10 21:18:19 2020 (r362028) @@ -47,10 +47,10 @@ struct aes_gmac_ctx { int rounds; }; -void AES_GMAC_Init(struct aes_gmac_ctx *); -void AES_GMAC_Setkey(struct aes_gmac_ctx *, const uint8_t *, uint16_t); -void AES_GMAC_Reinit(struct aes_gmac_ctx *, const uint8_t *, uint16_t); -int AES_GMAC_Update(struct aes_gmac_ctx *, const uint8_t *, uint16_t); -void AES_GMAC_Final(uint8_t [GMAC_DIGEST_LEN], struct aes_gmac_ctx *); +void AES_GMAC_Init(void *); +void AES_GMAC_Setkey(void *, const uint8_t *, u_int); +void AES_GMAC_Reinit(void *, const uint8_t *, u_int); +int AES_GMAC_Update(void *, const void *, u_int); +void AES_GMAC_Final(uint8_t *, void *); #endif /* _GMAC_H_ */ Modified: head/sys/opencrypto/xform_auth.h ============================================================================== --- head/sys/opencrypto/xform_auth.h Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_auth.h Wed Jun 10 21:18:19 2020 (r362028) @@ -57,9 +57,9 @@ struct auth_hash { u_int16_t ctxsize; u_int16_t blocksize; void (*Init) (void *); - void (*Setkey) (void *, const u_int8_t *, u_int16_t); - void (*Reinit) (void *, const u_int8_t *, u_int16_t); - int (*Update) (void *, const u_int8_t *, u_int16_t); + void (*Setkey) (void *, const uint8_t *, u_int); + void (*Reinit) (void *, const uint8_t *, u_int); + int (*Update) (void *, const void *, u_int); void (*Final) (u_int8_t *, void *); }; Modified: head/sys/opencrypto/xform_cbc_mac.c ============================================================================== --- head/sys/opencrypto/xform_cbc_mac.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_cbc_mac.c Wed Jun 10 21:18:19 2020 (r362028) @@ -12,14 +12,11 @@ struct auth_hash auth_hash_ccm_cbc_mac_128 = { .hashsize = AES_CBC_MAC_HASH_LEN, .ctxsize = sizeof(struct aes_cbc_mac_ctx), .blocksize = CCM_CBC_BLOCK_LEN, - .Init = (void (*)(void *)) AES_CBC_MAC_Init, - .Setkey = - (void (*)(void *, const u_int8_t *, u_int16_t))AES_CBC_MAC_Setkey, - .Reinit = - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Reinit, - .Update = - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Update, - .Final = (void (*)(u_int8_t *, void *)) AES_CBC_MAC_Final, + .Init = AES_CBC_MAC_Init, + .Setkey = AES_CBC_MAC_Setkey, + .Reinit = AES_CBC_MAC_Reinit, + .Update = AES_CBC_MAC_Update, + .Final = AES_CBC_MAC_Final, }; struct auth_hash auth_hash_ccm_cbc_mac_192 = { .type = CRYPTO_AES_CCM_CBC_MAC, @@ -28,14 +25,11 @@ struct auth_hash auth_hash_ccm_cbc_mac_192 = { .hashsize = AES_CBC_MAC_HASH_LEN, .ctxsize = sizeof(struct aes_cbc_mac_ctx), .blocksize = CCM_CBC_BLOCK_LEN, - .Init = (void (*)(void *)) AES_CBC_MAC_Init, - .Setkey = - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Setkey, - .Reinit = - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Reinit, - .Update = - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Update, - .Final = (void (*)(u_int8_t *, void *)) AES_CBC_MAC_Final, + .Init = AES_CBC_MAC_Init, + .Setkey = AES_CBC_MAC_Setkey, + .Reinit = AES_CBC_MAC_Reinit, + .Update = AES_CBC_MAC_Update, + .Final = AES_CBC_MAC_Final, }; struct auth_hash auth_hash_ccm_cbc_mac_256 = { .type = CRYPTO_AES_CCM_CBC_MAC, @@ -44,12 +38,9 @@ struct auth_hash auth_hash_ccm_cbc_mac_256 = { .hashsize = AES_CBC_MAC_HASH_LEN, .ctxsize = sizeof(struct aes_cbc_mac_ctx), .blocksize = CCM_CBC_BLOCK_LEN, - .Init = (void (*)(void *)) AES_CBC_MAC_Init, - .Setkey = - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Setkey, - .Reinit = - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Reinit, - .Update = - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_CBC_MAC_Update, - .Final = (void (*)(u_int8_t *, void *)) AES_CBC_MAC_Final, + .Init = AES_CBC_MAC_Init, + .Setkey = AES_CBC_MAC_Setkey, + .Reinit = AES_CBC_MAC_Reinit, + .Update = AES_CBC_MAC_Update, + .Final = AES_CBC_MAC_Final, }; Modified: head/sys/opencrypto/xform_gmac.c ============================================================================== --- head/sys/opencrypto/xform_gmac.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_gmac.c Wed Jun 10 21:18:19 2020 (r362028) @@ -65,34 +65,43 @@ struct enc_xform enc_xform_aes_nist_gmac = { /* Authentication instances */ struct auth_hash auth_hash_nist_gmac_aes_128 = { - CRYPTO_AES_NIST_GMAC, "GMAC-AES-128", - AES_128_GMAC_KEY_LEN, AES_GMAC_HASH_LEN, sizeof(struct aes_gmac_ctx), - GMAC_BLOCK_LEN, - (void (*)(void *)) AES_GMAC_Init, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Setkey, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Reinit, - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Update, - (void (*)(u_int8_t *, void *)) AES_GMAC_Final + .type = CRYPTO_AES_NIST_GMAC, + .name = "GMAC-AES-128", + .keysize = AES_128_GMAC_KEY_LEN, + .hashsize = AES_GMAC_HASH_LEN, + .ctxsize = sizeof(struct aes_gmac_ctx), + .blocksize = GMAC_BLOCK_LEN, + .Init = AES_GMAC_Init, + .Setkey = AES_GMAC_Setkey, + .Reinit = AES_GMAC_Reinit, + .Update = AES_GMAC_Update, + .Final = AES_GMAC_Final, }; struct auth_hash auth_hash_nist_gmac_aes_192 = { - CRYPTO_AES_NIST_GMAC, "GMAC-AES-192", - AES_192_GMAC_KEY_LEN, AES_GMAC_HASH_LEN, sizeof(struct aes_gmac_ctx), - GMAC_BLOCK_LEN, - (void (*)(void *)) AES_GMAC_Init, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Setkey, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Reinit, - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Update, - (void (*)(u_int8_t *, void *)) AES_GMAC_Final + .type = CRYPTO_AES_NIST_GMAC, + .name = "GMAC-AES-192", + .keysize = AES_192_GMAC_KEY_LEN, + .hashsize = AES_GMAC_HASH_LEN, + .ctxsize = sizeof(struct aes_gmac_ctx), + .blocksize = GMAC_BLOCK_LEN, + .Init = AES_GMAC_Init, + .Setkey = AES_GMAC_Setkey, + .Reinit = AES_GMAC_Reinit, + .Update = AES_GMAC_Update, + .Final = AES_GMAC_Final, }; struct auth_hash auth_hash_nist_gmac_aes_256 = { - CRYPTO_AES_NIST_GMAC, "GMAC-AES-256", - AES_256_GMAC_KEY_LEN, AES_GMAC_HASH_LEN, sizeof(struct aes_gmac_ctx), - GMAC_BLOCK_LEN, - (void (*)(void *)) AES_GMAC_Init, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Setkey, - (void (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Reinit, - (int (*)(void *, const u_int8_t *, u_int16_t)) AES_GMAC_Update, - (void (*)(u_int8_t *, void *)) AES_GMAC_Final + .type = CRYPTO_AES_NIST_GMAC, + .name = "GMAC-AES-256", + .keysize = AES_256_GMAC_KEY_LEN, + .hashsize = AES_GMAC_HASH_LEN, + .ctxsize = sizeof(struct aes_gmac_ctx), + .blocksize = GMAC_BLOCK_LEN, + .Init = AES_GMAC_Init, + .Setkey = AES_GMAC_Setkey, + .Reinit = AES_GMAC_Reinit, + .Update = AES_GMAC_Update, + .Final = AES_GMAC_Final, }; Modified: head/sys/opencrypto/xform_null.c ============================================================================== --- head/sys/opencrypto/xform_null.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_null.c Wed Jun 10 21:18:19 2020 (r362028) @@ -57,8 +57,8 @@ static int null_setkey(void *, const u_int8_t *, int); static void null_crypt(void *, const uint8_t *, uint8_t *); static void null_init(void *); -static void null_reinit(void *ctx, const u_int8_t *buf, u_int16_t len); -static int null_update(void *, const u_int8_t *, u_int16_t); +static void null_reinit(void *ctx, const uint8_t *buf, u_int len); +static int null_update(void *, const void *, u_int); static void null_final(u_int8_t *, void *); /* Encryption instances */ @@ -114,12 +114,12 @@ null_init(void *ctx) } static void -null_reinit(void *ctx, const u_int8_t *buf, u_int16_t len) +null_reinit(void *ctx, const uint8_t *buf, u_int len) { } static int -null_update(void *ctx, const u_int8_t *buf, u_int16_t len) +null_update(void *ctx, const void *buf, u_int len) { return 0; } Modified: head/sys/opencrypto/xform_poly1305.c ============================================================================== --- head/sys/opencrypto/xform_poly1305.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_poly1305.c Wed Jun 10 21:18:19 2020 (r362028) @@ -17,7 +17,7 @@ CTASSERT(POLY1305_KEY_LEN == crypto_onetimeauth_poly13 CTASSERT(POLY1305_HASH_LEN == crypto_onetimeauth_poly1305_BYTES); void -Poly1305_Init(struct poly1305_xform_ctx *polyctx) +Poly1305_Init(void *polyctx) { /* Nop */ } @@ -37,7 +37,7 @@ Poly1305_Setkey(struct poly1305_xform_ctx *polyctx, } static void -xform_Poly1305_Setkey(void *ctx, const uint8_t *key, uint16_t klen) +xform_Poly1305_Setkey(void *ctx, const uint8_t *key, u_int klen) { Poly1305_Setkey(ctx, key, klen); } @@ -55,7 +55,7 @@ Poly1305_Update(struct poly1305_xform_ctx *polyctx, co } static int -xform_Poly1305_Update(void *ctx, const uint8_t *data, uint16_t len) +xform_Poly1305_Update(void *ctx, const void *data, u_int len) { return (Poly1305_Update(ctx, data, len)); } @@ -84,7 +84,7 @@ struct auth_hash auth_hash_poly1305 = { .hashsize = POLY1305_HASH_LEN, .ctxsize = sizeof(struct poly1305_xform_ctx), .blocksize = crypto_onetimeauth_poly1305_BYTES, - .Init = (void *)Poly1305_Init, + .Init = Poly1305_Init, .Setkey = xform_Poly1305_Setkey, .Update = xform_Poly1305_Update, .Final = xform_Poly1305_Final, Modified: head/sys/opencrypto/xform_poly1305.h ============================================================================== --- head/sys/opencrypto/xform_poly1305.h Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_poly1305.h Wed Jun 10 21:18:19 2020 (r362028) @@ -6,7 +6,7 @@ struct poly1305_xform_ctx; -void Poly1305_Init(struct poly1305_xform_ctx *); +void Poly1305_Init(void *); void Poly1305_Setkey(struct poly1305_xform_ctx *, const uint8_t [__min_size(32)], size_t); Modified: head/sys/opencrypto/xform_rmd160.c ============================================================================== --- head/sys/opencrypto/xform_rmd160.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_rmd160.c Wed Jun 10 21:18:19 2020 (r362028) @@ -53,7 +53,9 @@ __FBSDID("$FreeBSD$"); #include #include -static int RMD160Update_int(void *, const u_int8_t *, u_int16_t); +static void RMD160Init_int(void *); +static int RMD160Update_int(void *, const void *, u_int); +static void RMD160Final_int(uint8_t *, void *); /* Authentication instances */ struct auth_hash auth_hash_hmac_ripemd_160 = { @@ -63,17 +65,26 @@ struct auth_hash auth_hash_hmac_ripemd_160 = { .hashsize = RIPEMD160_HASH_LEN, .ctxsize = sizeof(RMD160_CTX), .blocksize = RIPEMD160_BLOCK_LEN, - .Init = (void (*)(void *)) RMD160Init, + .Init = RMD160Init_int, .Update = RMD160Update_int, - .Final = (void (*)(u_int8_t *, void *)) RMD160Final, + .Final = RMD160Final_int, }; -/* - * And now for auth. - */ +static void +RMD160Init_int(void *ctx) +{ + RMD160Init(ctx); +} + static int -RMD160Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) +RMD160Update_int(void *ctx, const void *buf, u_int len) { RMD160Update(ctx, buf, len); return 0; +} + +static void +RMD160Final_int(uint8_t *digest, void *ctx) +{ + RMD160Final(digest, ctx); } Modified: head/sys/opencrypto/xform_sha1.c ============================================================================== --- head/sys/opencrypto/xform_sha1.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_sha1.c Wed Jun 10 21:18:19 2020 (r362028) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include static void SHA1Init_int(void *); -static int SHA1Update_int(void *, const u_int8_t *, u_int16_t); +static int SHA1Update_int(void *, const void *, u_int); static void SHA1Final_int(u_int8_t *, void *); /* Plain hash */ @@ -92,7 +92,7 @@ SHA1Init_int(void *ctx) } static int -SHA1Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) +SHA1Update_int(void *ctx, const void *buf, u_int len) { SHA1Update(ctx, buf, len); return 0; Modified: head/sys/opencrypto/xform_sha2.c ============================================================================== --- head/sys/opencrypto/xform_sha2.c Wed Jun 10 20:12:45 2020 (r362027) +++ head/sys/opencrypto/xform_sha2.c Wed Jun 10 21:18:19 2020 (r362028) @@ -56,10 +56,10 @@ __FBSDID("$FreeBSD$"); #include #include -static int SHA224Update_int(void *, const u_int8_t *, u_int16_t); -static int SHA256Update_int(void *, const u_int8_t *, u_int16_t); -static int SHA384Update_int(void *, const u_int8_t *, u_int16_t); -static int SHA512Update_int(void *, const u_int8_t *, u_int16_t); +static int SHA224Update_int(void *, const void *, u_int); +static int SHA256Update_int(void *, const void *, u_int); +static int SHA384Update_int(void *, const void *, u_int); +static int SHA512Update_int(void *, const void *, u_int); /* Plain hashes */ struct auth_hash auth_hash_sha2_224 = { @@ -162,28 +162,28 @@ struct auth_hash auth_hash_hmac_sha2_512 = { * And now for auth. */ static int -SHA224Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) +SHA224Update_int(void *ctx, const void *buf, u_int len) { SHA224_Update(ctx, buf, len); return 0; } static int -SHA256Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) +SHA256Update_int(void *ctx, const void *buf, u_int len) { SHA256_Update(ctx, buf, len); return 0; } static int -SHA384Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) +SHA384Update_int(void *ctx, const void *buf, u_int len) { SHA384_Update(ctx, buf, len); return 0; } static int -SHA512Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) +SHA512Update_int(void *ctx, const void *buf, u_int len) { SHA512_Update(ctx, buf, len); return 0; From owner-svn-src-head@freebsd.org Wed Jun 10 21:38:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FC493401A8; Wed, 10 Jun 2020 21:38:36 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j0jR6cQBz4bX1; Wed, 10 Jun 2020 21:38:35 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9D1DD7A3; Wed, 10 Jun 2020 21:38:35 +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 05ALcZIE087864; Wed, 10 Jun 2020 21:38:35 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ALcZZV087863; Wed, 10 Jun 2020 21:38:35 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202006102138.05ALcZZV087863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 10 Jun 2020 21:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362029 - head/sys/dev/hdmi X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/dev/hdmi X-SVN-Commit-Revision: 362029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 21:38:36 -0000 Author: gonzo Date: Wed Jun 10 21:38:35 2020 New Revision: 362029 URL: https://svnweb.freebsd.org/changeset/base/362029 Log: Fix reading EDID on TVs/monitors without E-DCC support Writing segment id to I2C device 0x30 only required if the segment is non-zero. On the devices without E-DCC support writing to that address fails and whole transaction then fails too. To avoid this do not attempt write to the segment selection device unless required. MFC after: 2 weeks Modified: head/sys/dev/hdmi/dwc_hdmi.c Modified: head/sys/dev/hdmi/dwc_hdmi.c ============================================================================== --- head/sys/dev/hdmi/dwc_hdmi.c Wed Jun 10 21:18:19 2020 (r362028) +++ head/sys/dev/hdmi/dwc_hdmi.c Wed Jun 10 21:38:35 2020 (r362029) @@ -658,6 +658,11 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u int result; uint8_t addr = block & 1 ? EDID_LENGTH : 0; uint8_t segment = block >> 1; + /* + * Some devices do not support E-DDC so attempt + * writing segment address only if it's neccessary + */ + unsigned char xfers = segment ? 3 : 2; struct iic_msg msg[] = { { I2C_DDC_SEGADDR, IIC_M_WR, 1, &segment }, { I2C_DDC_ADDR, IIC_M_WR, 1, &addr }, @@ -687,7 +692,7 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u return (result); } - result = iicbus_transfer(i2c_dev, msg, 3); + result = iicbus_transfer(i2c_dev, &msg[3 - xfers], xfers); iicbus_release_bus(i2c_dev, sc->sc_dev); if (result) { From owner-svn-src-head@freebsd.org Wed Jun 10 21:44:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20B003404F1; Wed, 10 Jun 2020 21:44:43 +0000 (UTC) (envelope-from yuripv@yuripv.dev) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49j0rV5YT7z4cCN; Wed, 10 Jun 2020 21:44:42 +0000 (UTC) (envelope-from yuripv@yuripv.dev) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id C8ECB5C0067; Wed, 10 Jun 2020 17:44:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 10 Jun 2020 17:44:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuripv.dev; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=s sgp7VRWmxt0LedH+0WDiT3JTN2knEVhe77+y+IvMt8=; b=gOTYIJiqs8a2dYWXY 3LxFW114ldSgJVFG8/EzQ+xj0SvW8RCdXDYZMAwAp0hklPcV6KpO42+PwUU0qzDH n3EjT+eEObud+I6/dNrioXvWPeI94f6EFjksdBf0eWPPdxQrQgY862W55kzpmy8q wqd7kYEndylJ1SjHcRo9peooZA8Rfv8EtifJiP9ReZ+rMZ/QeSSWVNoH7rAkJ5Mt 3LXw0fHHMGKXfOTM+OC6rqb8+DAHB42aO/vXUHbJgIkNEP2RxurWtg4Hdl61+RPR 6RZuaUMC+D3qvzIYe68kb6DQvKVf24rKF/O6XGLK1dN9JR8kSE55alWBYCwf3BRR 7y91Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=ssgp7VRWmxt0LedH+0WDiT3JTN2knEVhe77+y+IvM t8=; b=Qt5dWOMHSGJccSvitjbs++GHslDWJSHg4BBWEsmWBkcEvURLRRxuNiYpx Y/KeSPhx7P0W3JyBzI+Esv/51/Ax+GOjznnlMXncW2daEPqysjuPpQG0vYSvugJd 0XGVK5IexTOgYTShF1ZHg3VvOzovUIcj+x0GkrNs3bNM8x6MvC9SD/qd42HGqn5n whk3JjxdUNaV5sbEPr51+IfpUUNPUzcDSGTcgpE8b4PwSSvtdwRFAYOcGFCBpJ5Z P/oGH4rVvvSHopKH5HDHT/cp2Ez2HPyNOTfoLw1OK6QBCDk3vvayYSNqdc+kIA8c v6+Po7myurQ8AGIkyNrEX/HL7J88A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehjedgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpegjuhhrihcurfgrnhhkohhvuceohihurhhiphhvseihuhhr ihhpvhdruggvvheqnecuggftrfgrthhtvghrnhepieekteeftdeftdekhfffueeljeefff fgffffuefhhefgheejvdegfeehieevudfgnecuffhomhgrihhnpehfrhgvvggsshgurdho rhhgnecukfhppeeluddrvdegtddruddvgedrudefkeenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpeihuhhrihhpvheshihurhhiphhvrdguvghv X-ME-Proxy: Received: from mercury.yuripv.dev (unknown [91.240.124.138]) by mail.messagingengine.com (Postfix) with ESMTPA id AB0783280064; Wed, 10 Jun 2020 17:44:40 -0400 (EDT) Subject: Re: svn commit: r362017 - in head/usr.bin/sed: . tests To: Mateusz Piotrowski <0mp@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006101923.05AJNwPt006602@repo.freebsd.org> From: Yuri Pankov Message-ID: Date: Thu, 11 Jun 2020 00:44:38 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <202006101923.05AJNwPt006602@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49j0rV5YT7z4cCN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 21:44:43 -0000 Mateusz Piotrowski wrote: > Author: 0mp (doc,ports committer) > Date: Wed Jun 10 19:23:58 2020 > New Revision: 362017 > URL: https://svnweb.freebsd.org/changeset/base/362017 > > Log: > Read commands from stdin when -f - is passed to sed(1) > > This patch teaches sed to interpret a "-" in a special way when given > as an argument to the -f flag. > > This behavior is also present in GNU sed. > > PR: 244872 > Tested by: antoine (exp-run) > Reviewed by: pfg, tobik (older version) > Approved by: pfg (src) > Relnotes: yes > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D24079 > > Modified: > head/usr.bin/sed/main.c > head/usr.bin/sed/sed.1 > head/usr.bin/sed/tests/sed2_test.sh [...] > Modified: head/usr.bin/sed/tests/sed2_test.sh > ============================================================================== > --- head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 18:59:46 2020 (r362016) > +++ head/usr.bin/sed/tests/sed2_test.sh Wed Jun 10 19:23:58 2020 (r362017) > @@ -116,11 +116,68 @@ hex_subst_body() > atf_check -o "inline:" sed 's/\xx//' d > } > > +atf_test_case commands_on_stdin > +commands_on_stdin_head() > +{ > + atf_set "descr" "Verify -f -" > +} > +commands_on_stdin_body() > +{ > + printf "a\n" > a > + printf "s/a/b/\n" > a_to_b > + printf "s/b/c/\n" > b_to_c > + printf "s/c/d/\n" > ./- > + atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c > + > + # Verify that nothing is printed if there are no input files provided. > + printf 'i\\\nx' > insert_x > + atf_check -o 'empty' sed -f - < insert_x > +} > + > +atf_test_case commands_on_stdin > +commands_on_stdin_head() > +{ > + atf_set "descr" "Verify -f -" > +} > +commands_on_stdin_body() > +{ > + printf "a\n" > a > + printf "s/a/b/\n" > a_to_b > + printf "s/b/c/\n" > b_to_c > + printf "s/c/d/\n" > ./- > + atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c > + > + # Verify that nothing is printed if there are no input files provided. > + printf 'i\\\nx' > insert_x > + atf_check -o 'empty' sed -f - < insert_x > +} > + > +atf_test_case commands_on_stdin > +commands_on_stdin_head() > +{ > + atf_set "descr" "Verify -f -" > +} > +commands_on_stdin_body() > +{ > + printf "a\n" > a > + printf "s/a/b/\n" > a_to_b > + printf "s/b/c/\n" > b_to_c > + printf "s/c/d/\n" > ./- > + atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c > + > + # Verify that nothing is printed if there are no input files provided. > + printf 'i\\\nx' > insert_x > + atf_check -o 'empty' sed -f - < insert_x > +} > + > atf_init_test_cases() > { > atf_add_test_case inplace_command_q > atf_add_test_case inplace_hardlink_src > atf_add_test_case inplace_symlink_src > atf_add_test_case escape_subst > + atf_add_test_case commands_on_stdin > + atf_add_test_case commands_on_stdin > + atf_add_test_case commands_on_stdin > atf_add_test_case hex_subst > } > Am I reading it wrong, or is it the same test case added 3 times? From owner-svn-src-head@freebsd.org Wed Jun 10 22:00:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85098340813; Wed, 10 Jun 2020 22:00:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j1Bm2x59z4cWH; Wed, 10 Jun 2020 22:00:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FC95DB84; Wed, 10 Jun 2020 22:00:32 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05AM0Wv3000310; Wed, 10 Jun 2020 22:00:32 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AM0VUB000306; Wed, 10 Jun 2020 22:00:31 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202006102200.05AM0VUB000306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 10 Jun 2020 22:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362030 - head/sys/arm/freescale/imx X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm/freescale/imx X-SVN-Commit-Revision: 362030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 22:00:32 -0000 Author: gonzo Date: Wed Jun 10 22:00:31 2020 New Revision: 362030 URL: https://svnweb.freebsd.org/changeset/base/362030 Log: Add mode selection to iMX6 IPU driver - Configure ipu1_di0 tob e sourced from the VIDEO_PLL(PLL5) and hardcode frequency to (455000000/3)Mhz. This value, further divided, can yield frequencies close enough to support 1080p, 720p, 1024x768, and 640x480 modes. This is not ideal but it's an improvement comparing to the only hardcoded 1024x768 mode. - Fix memory leaks if attach method failed - Print EDID when -v passed to the kernel Modified: head/sys/arm/freescale/imx/imx6_ccm.c head/sys/arm/freescale/imx/imx6_ccmreg.h head/sys/arm/freescale/imx/imx6_ipu.c head/sys/arm/freescale/imx/imx_ccmvar.h Modified: head/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ccm.c Wed Jun 10 21:38:35 2020 (r362029) +++ head/sys/arm/freescale/imx/imx6_ccm.c Wed Jun 10 22:00:31 2020 (r362030) @@ -393,6 +393,53 @@ imx_ccm_ahb_hz(void) return (132000000); } +int +imx_ccm_pll_video_enable(void) +{ + uint32_t reg; + int timeout; + + /* Power down PLL */ + reg = RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO); + reg &= ~CCM_ANALOG_PLL_VIDEO_POWERDOWN; + WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg); + + /* + * Fvideo = Fref * (37 + 11/12) / 2 + * Fref = 24MHz, Fvideo = 455MHz + */ + reg &= ~CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK; + reg |= CCM_ANALOG_PLL_VIDEO_POST_DIV_2; + reg &= ~CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK; + reg |= 37 << CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT; + WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg); + + WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO_NUM, 11); + WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO_DENOM, 12); + + /* Power up and wait for PLL lock down */ + reg = RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO); + reg &= ~CCM_ANALOG_PLL_VIDEO_POWERDOWN; + WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg); + + for (timeout = 100000; timeout > 0; timeout--) { + if (RD4(ccm_sc, CCM_ANALOG_PLL_VIDEO) & + CCM_ANALOG_PLL_VIDEO_LOCK) { + break; + } + } + if (timeout <= 0) { + return ETIMEDOUT; + } + + /* Enable the PLL */ + reg |= CCM_ANALOG_PLL_VIDEO_ENABLE; + reg &= ~CCM_ANALOG_PLL_VIDEO_BYPASS; + WR4(ccm_sc, CCM_ANALOG_PLL_VIDEO, reg); + + return (0); +} + void imx_ccm_ipu_enable(int ipu) { @@ -406,8 +453,26 @@ imx_ccm_ipu_enable(int ipu) else reg |= CCGR3_IPU2_IPU | CCGR3_IPU2_DI0; WR4(sc, CCM_CCGR3, reg); + + /* Set IPU1_DI0 clock to source from PLL5 and divide it by 3 */ + reg = RD4(sc, CCM_CHSCCDR); + reg &= ~(CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK | + CHSCCDR_IPU1_DI0_PODF_MASK | CHSCCDR_IPU1_DI0_CLK_SEL_MASK); + reg |= (CHSCCDR_PODF_DIVIDE_BY_3 << CHSCCDR_IPU1_DI0_PODF_SHIFT); + reg |= (CHSCCDR_IPU_PRE_CLK_PLL5 << CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT); + WR4(sc, CCM_CHSCCDR, reg); + + reg |= (CHSCCDR_CLK_SEL_PREMUXED << CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT); + WR4(sc, CCM_CHSCCDR, reg); } +uint32_t +imx_ccm_ipu_hz(void) +{ + + return (455000000 / 3); +} + void imx_ccm_hdmi_enable(void) { @@ -418,16 +483,6 @@ imx_ccm_hdmi_enable(void) reg = RD4(sc, CCM_CCGR2); reg |= CCGR2_HDMI_TX | CCGR2_HDMI_TX_ISFR; WR4(sc, CCM_CCGR2, reg); - - /* Set HDMI clock to 280MHz */ - reg = RD4(sc, CCM_CHSCCDR); - reg &= ~(CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK | - CHSCCDR_IPU1_DI0_PODF_MASK | CHSCCDR_IPU1_DI0_CLK_SEL_MASK); - reg |= (CHSCCDR_PODF_DIVIDE_BY_3 << CHSCCDR_IPU1_DI0_PODF_SHIFT); - reg |= (CHSCCDR_IPU_PRE_CLK_540M_PFD << CHSCCDR_IPU1_DI0_PRE_CLK_SEL_SHIFT); - WR4(sc, CCM_CHSCCDR, reg); - reg |= (CHSCCDR_CLK_SEL_LDB_DI0 << CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT); - WR4(sc, CCM_CHSCCDR, reg); } uint32_t Modified: head/sys/arm/freescale/imx/imx6_ccmreg.h ============================================================================== --- head/sys/arm/freescale/imx/imx6_ccmreg.h Wed Jun 10 21:38:35 2020 (r362029) +++ head/sys/arm/freescale/imx/imx6_ccmreg.h Wed Jun 10 22:00:31 2020 (r362030) @@ -64,9 +64,12 @@ #define CHSCCDR_IPU1_DI0_PODF_SHIFT 3 #define CHSCCDR_IPU1_DI0_CLK_SEL_MASK (0x7) #define CHSCCDR_IPU1_DI0_CLK_SEL_SHIFT 0 +#define CHSCCDR_CLK_SEL_PREMUXED 0 #define CHSCCDR_CLK_SEL_LDB_DI0 3 #define CHSCCDR_PODF_DIVIDE_BY_3 2 +#define CHSCCDR_PODF_DIVIDE_BY_1 0 #define CHSCCDR_IPU_PRE_CLK_540M_PFD 5 +#define CHSCCDR_IPU_PRE_CLK_PLL5 2 #define CCM_CSCDR2 0x038 #define CCM_CLPCR 0x054 #define CCM_CLPCR_LPM_MASK 0x03 @@ -138,6 +141,19 @@ #define CCGR6_USDHC3 (0x3 << 6) #define CCGR6_USDHC4 (0x3 << 8) #define CCM_CMEOR 0x088 + +#define CCM_ANALOG_PLL_VIDEO 0x000040a0 +#define CCM_ANALOG_PLL_VIDEO_LOCK (1u << 31) +#define CCM_ANALOG_PLL_VIDEO_BYPASS (1u << 16) +#define CCM_ANALOG_PLL_VIDEO_ENABLE (1u << 13) +#define CCM_ANALOG_PLL_VIDEO_POWERDOWN (1u << 12) +#define CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK (3u << 19) +#define CCM_ANALOG_PLL_VIDEO_POST_DIV_2 (1u << 19) +#define CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK (0x7f << 0) +#define CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT 0 + +#define CCM_ANALOG_PLL_VIDEO_NUM 0x000040b0 +#define CCM_ANALOG_PLL_VIDEO_DENOM 0x000040c0 #define CCM_ANALOG_PLL_ENET 0x000040e0 #define CCM_ANALOG_PLL_ENET_LOCK (1u << 31) Modified: head/sys/arm/freescale/imx/imx6_ipu.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ipu.c Wed Jun 10 21:38:35 2020 (r362029) +++ head/sys/arm/freescale/imx/imx6_ipu.c Wed Jun 10 22:00:31 2020 (r362030) @@ -61,12 +61,8 @@ __FBSDID("$FreeBSD$"); #include "fb_if.h" #include "hdmi_if.h" -#define EDID_DEBUG_not - static int have_ipu = 0; -#define LDB_CLOCK_RATE 280000000 - #define MODE_HBP(mode) ((mode)->htotal - (mode)->hsync_end) #define MODE_HFP(mode) ((mode)->hsync_start - (mode)->hdisplay) #define MODE_HSW(mode) ((mode)->hsync_end - (mode)->hsync_start) @@ -77,11 +73,6 @@ static int have_ipu = 0; #define MODE_BPP 16 #define MODE_PIXEL_CLOCK_INVERT 1 -#define M(nm,hr,vr,clk,hs,he,ht,vs,ve,vt,f) \ - { clk, hr, hs, he, ht, vr, vs, ve, vt, f, nm } - -static struct videomode mode1024x768 = M("1024x768x60",1024,768,65000,1048,1184,1344,771,777,806,VID_NHSYNC|VID_PHSYNC); - #define DMA_CHANNEL 23 #define DC_CHAN5 5 #define DI_PORT 0 @@ -384,7 +375,7 @@ struct ipu_softc { void *sc_intr_hl; struct mtx sc_mtx; struct fb_info sc_fb_info; - struct videomode *sc_mode; + const struct videomode *sc_mode; /* Framebuffer */ bus_dma_tag_t sc_dma_tag; @@ -634,10 +625,30 @@ ipu_init_microcode_template(struct ipu_softc *sc, int } } +static uint32_t +ipu_calc_divisor(uint32_t reference, uint32_t freq) +{ + uint32_t div, i; + uint32_t delta, min_delta; + + min_delta = freq; + div = 255; + + for (i = 1; i < 255; i++) { + delta = abs(reference/i - freq); + if (delta < min_delta) { + div = i; + min_delta = delta; + } + } + + return (div); +} + static void ipu_config_timing(struct ipu_softc *sc, int di) { - int div; + uint32_t div; uint32_t di_scr_conf; uint32_t gen_offset, gen; uint32_t as_gen_offset, as_gen; @@ -645,10 +656,11 @@ ipu_config_timing(struct ipu_softc *sc, int di) uint32_t dw_set_offset, dw_set; uint32_t bs_clkgen_offset; int map; + uint32_t freq; - /* TODO: check mode restrictions / fixup */ - /* TODO: enable timers, get divisors */ - div = 1; + freq = sc->sc_mode->dot_clock * 1000; + + div = ipu_calc_divisor(imx_ccm_ipu_hz(), freq); map = 0; bs_clkgen_offset = di ? IPU_DI1_BS_CLKGEN0 : IPU_DI0_BS_CLKGEN0; @@ -656,14 +668,6 @@ ipu_config_timing(struct ipu_softc *sc, int di) /* half of the divider */ IPU_WRITE4(sc, bs_clkgen_offset + 4, DI_BS_CLKGEN1_DOWN(div / 2, div % 2)); - /* - * TODO: Configure LLDB clock by changing following fields - * in CCM fields: - * CS2CDR_LDB_DI0_CLK_SEL - * CSCMR2_LDB_DI0_IPU_DIV - * CBCDR_MMDC_CH1_AXI_PODF - */ - /* Setup wave generator */ dw_gen_offset = di ? IPU_DI1_DW_GEN_0 : IPU_DI0_DW_GEN_0; dw_gen = DW_GEN_DI_ACCESS_SIZE(div - 1) | DW_GEN_DI_COMPONENT_SIZE(div - 1); @@ -768,8 +772,6 @@ ipu_dc_enable(struct ipu_softc *sc) conf &= ~WRITE_CH_CONF_PROG_CHAN_TYP_MASK; conf |= WRITE_CH_CONF_PROG_CHAN_NORMAL; IPU_WRITE4(sc, DC_WRITE_CH_CONF_5, conf); - - /* TODO: enable clock */ } static void @@ -1063,15 +1065,55 @@ fail: return (err); } +static int +ipu_mode_is_valid(const struct videomode *mode) +{ + if ((mode->dot_clock < 13500) || (mode->dot_clock > 216000)) + return (0); + + return (1); +} + +static const struct videomode * +ipu_pick_mode(struct edid_info *ei) +{ + const struct videomode *videomode; + const struct videomode *m; + int n; + + videomode = NULL; + + /* + * Pick a mode. + */ + if (ei->edid_preferred_mode != NULL) { + if (ipu_mode_is_valid(ei->edid_preferred_mode)) + videomode = ei->edid_preferred_mode; + } + + if (videomode == NULL) { + m = ei->edid_modes; + + sort_modes(ei->edid_modes, + &ei->edid_preferred_mode, + ei->edid_nmodes); + for (n = 0; n < ei->edid_nmodes; n++) + if (ipu_mode_is_valid(&m[n])) { + videomode = &m[n]; + break; + } + } + + return videomode; +} + static void ipu_hdmi_event(void *arg, device_t hdmi_dev) { struct ipu_softc *sc; uint8_t *edid; uint32_t edid_len; -#ifdef EDID_DEBUG struct edid_info ei; -#endif const struct videomode *videomode; sc = arg; @@ -1084,14 +1126,28 @@ ipu_hdmi_event(void *arg, device_t hdmi_dev) videomode = NULL; -#ifdef EDID_DEBUG if ( edid && (edid_parse(edid, &ei) == 0)) { - edid_print(&ei); + if (bootverbose) + edid_print(&ei); + videomode = ipu_pick_mode(&ei); } else device_printf(sc->sc_dev, "failed to parse EDID\n"); -#endif - sc->sc_mode = &mode1024x768; + /* Use standard VGA as fallback */ + if (videomode == NULL) + videomode = pick_mode_by_ref(640, 480, 60); + + if (videomode == NULL) { + device_printf(sc->sc_dev, "failed to find usable videomode\n"); + return; + } + + sc->sc_mode = videomode; + + if (bootverbose) + device_printf(sc->sc_dev, "detected videomode: %dx%d\n", + videomode->hdisplay, videomode->vdisplay); + ipu_init(sc); HDMI_SET_VIDEOMODE(hdmi_dev, sc->sc_mode); @@ -1145,9 +1201,22 @@ ipu_attach(device_t dev) } /* Enable IPU1 */ + if (imx_ccm_pll_video_enable() != 0) { + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_irq_rid, sc->sc_irq_res); + device_printf(dev, "failed to set up video PLL\n"); + return (ENXIO); + } + imx_ccm_ipu_enable(1); if (src_reset_ipu() != 0) { + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + bus_release_resource(dev, SYS_RES_IRQ, + sc->sc_irq_rid, sc->sc_irq_res); device_printf(dev, "failed to reset IPU\n"); return (ENXIO); } Modified: head/sys/arm/freescale/imx/imx_ccmvar.h ============================================================================== --- head/sys/arm/freescale/imx/imx_ccmvar.h Wed Jun 10 21:38:35 2020 (r362029) +++ head/sys/arm/freescale/imx/imx_ccmvar.h Wed Jun 10 22:00:31 2020 (r362030) @@ -49,10 +49,12 @@ uint32_t imx_ccm_perclk_hz(void); uint32_t imx_ccm_sdhci_hz(void); uint32_t imx_ccm_uart_hz(void); uint32_t imx_ccm_ahb_hz(void); +uint32_t imx_ccm_ipu_hz(void); void imx_ccm_usb_enable(device_t _usbdev); void imx_ccm_usbphy_enable(device_t _phydev); void imx_ccm_ssi_configure(device_t _ssidev); +int imx_ccm_pll_video_enable(void); void imx_ccm_hdmi_enable(void); void imx_ccm_ipu_enable(int ipu); int imx6_ccm_sata_enable(void); From owner-svn-src-head@freebsd.org Wed Jun 10 22:07:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D8E463407D7; Wed, 10 Jun 2020 22:07:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j1ML5LNDz4cxH; Wed, 10 Jun 2020 22:07:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95682DC23; Wed, 10 Jun 2020 22:07:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05AM7wMr006280; Wed, 10 Jun 2020 22:07:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AM7vY8006276; Wed, 10 Jun 2020 22:07:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006102207.05AM7vY8006276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 10 Jun 2020 22:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362031 - in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 x86/include x86/x86 X-SVN-Commit-Revision: 362031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 22:07:58 -0000 Author: kib Date: Wed Jun 10 22:07:57 2020 New Revision: 362031 URL: https://svnweb.freebsd.org/changeset/base/362031 Log: amd64 pmap: reorder IPI send and local TLB flush in TLB invalidations. Right now code first flushes all local TLB entries that needs to be flushed, then signals IPI to remote cores, and then waits for acknowledgements while spinning idle. In the VMWare article 'Don’t shoot down TLB shootdowns!' it was noted that the time spent spinning is lost, and can be more usefully used doing local TLB invalidation. We could use the same invalidation handler for local TLB as for remote, but typically for pmap == curpmap we can use INVLPG for locals instead of INVPCID on remotes, since we cannot control context switches on them. Due to that, keep the local code and provide the callbacks to be called from smp_targeted_tlb_shootdown() after IPIs are fired but before spin wait starts. Reviewed by: alc, cem, markj, Anton Rang Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D25188 Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/i386/i386/vm_machdep.c head/sys/x86/include/x86_smp.h head/sys/x86/x86/mp_x86.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Jun 10 22:00:31 2020 (r362030) +++ head/sys/amd64/amd64/pmap.c Wed Jun 10 22:07:57 2020 (r362031) @@ -2591,6 +2591,20 @@ DEFINE_IFUNC(static, void, pmap_invalidate_page_mode, return (pmap_invalidate_page_nopcid); } +static void +pmap_invalidate_page_curcpu_cb(pmap_t pmap, vm_offset_t va, + vm_offset_t addr2 __unused) +{ + + if (pmap == kernel_pmap) { + invlpg(va); + } else { + if (pmap == PCPU_GET(curpmap)) + invlpg(va); + pmap_invalidate_page_mode(pmap, va); + } +} + void pmap_invalidate_page(pmap_t pmap, vm_offset_t va) { @@ -2603,16 +2617,8 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) KASSERT(pmap->pm_type == PT_X86, ("pmap_invalidate_page: invalid type %d", pmap->pm_type)); - sched_pin(); - if (pmap == kernel_pmap) { - invlpg(va); - } else { - if (pmap == PCPU_GET(curpmap)) - invlpg(va); - pmap_invalidate_page_mode(pmap, va); - } - smp_masked_invlpg(pmap_invalidate_cpu_mask(pmap), va, pmap); - sched_unpin(); + smp_masked_invlpg(pmap_invalidate_cpu_mask(pmap), va, pmap, + pmap_invalidate_page_curcpu_cb); } /* 4k PTEs -- Chosen to exceed the total size of Broadwell L2 TLB */ @@ -2688,10 +2694,26 @@ DEFINE_IFUNC(static, void, pmap_invalidate_range_mode, return (pmap_invalidate_range_nopcid); } +static void +pmap_invalidate_range_curcpu_cb(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + vm_offset_t addr; + + if (pmap == kernel_pmap) { + for (addr = sva; addr < eva; addr += PAGE_SIZE) + invlpg(addr); + } else { + if (pmap == PCPU_GET(curpmap)) { + for (addr = sva; addr < eva; addr += PAGE_SIZE) + invlpg(addr); + } + pmap_invalidate_range_mode(pmap, sva, eva); + } +} + void pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - vm_offset_t addr; if (eva - sva >= PMAP_INVLPG_THRESHOLD) { pmap_invalidate_all(pmap); @@ -2706,19 +2728,8 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm KASSERT(pmap->pm_type == PT_X86, ("pmap_invalidate_range: invalid type %d", pmap->pm_type)); - sched_pin(); - if (pmap == kernel_pmap) { - for (addr = sva; addr < eva; addr += PAGE_SIZE) - invlpg(addr); - } else { - if (pmap == PCPU_GET(curpmap)) { - for (addr = sva; addr < eva; addr += PAGE_SIZE) - invlpg(addr); - } - pmap_invalidate_range_mode(pmap, sva, eva); - } - smp_masked_invlpg_range(pmap_invalidate_cpu_mask(pmap), sva, eva, pmap); - sched_unpin(); + smp_masked_invlpg_range(pmap_invalidate_cpu_mask(pmap), sva, eva, pmap, + pmap_invalidate_range_curcpu_cb); } static inline void @@ -2805,6 +2816,14 @@ DEFINE_IFUNC(static, void, pmap_invalidate_all_mode, ( return (pmap_invalidate_all_nopcid); } +static void +pmap_invalidate_all_curcpu_cb(pmap_t pmap, vm_offset_t addr1 __unused, + vm_offset_t addr2 __unused) +{ + + pmap_invalidate_all_mode(pmap); +} + void pmap_invalidate_all(pmap_t pmap) { @@ -2817,20 +2836,23 @@ pmap_invalidate_all(pmap_t pmap) KASSERT(pmap->pm_type == PT_X86, ("pmap_invalidate_all: invalid type %d", pmap->pm_type)); - sched_pin(); - pmap_invalidate_all_mode(pmap); - smp_masked_invltlb(pmap_invalidate_cpu_mask(pmap), pmap); - sched_unpin(); + smp_masked_invltlb(pmap_invalidate_cpu_mask(pmap), pmap, + pmap_invalidate_all_curcpu_cb); } +static void +pmap_invalidate_cache_curcpu_cb(pmap_t pmap __unused, vm_offset_t va __unused, + vm_offset_t addr2 __unused) +{ + + wbinvd(); +} + void pmap_invalidate_cache(void) { - sched_pin(); - wbinvd(); - smp_cache_flush(); - sched_unpin(); + smp_cache_flush(pmap_invalidate_cache_curcpu_cb); } struct pde_action { Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Jun 10 22:00:31 2020 (r362030) +++ head/sys/i386/i386/pmap.c Wed Jun 10 22:07:57 2020 (r362031) @@ -1203,6 +1203,13 @@ pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t } #ifdef SMP + +static void +pmap_curcpu_cb_dummy(pmap_t pmap __unused, vm_offset_t addr1 __unused, + vm_offset_t addr2 __unused) +{ +} + /* * For SMP, these functions have to use the IPI mechanism for coherence. * @@ -1241,7 +1248,7 @@ pmap_invalidate_page_int(pmap_t pmap, vm_offset_t va) CPU_AND(&other_cpus, &pmap->pm_active); mask = &other_cpus; } - smp_masked_invlpg(*mask, va, pmap); + smp_masked_invlpg(*mask, va, pmap, pmap_curcpu_cb_dummy); sched_unpin(); } @@ -1274,7 +1281,7 @@ pmap_invalidate_range_int(pmap_t pmap, vm_offset_t sva CPU_AND(&other_cpus, &pmap->pm_active); mask = &other_cpus; } - smp_masked_invlpg_range(*mask, sva, eva, pmap); + smp_masked_invlpg_range(*mask, sva, eva, pmap, pmap_curcpu_cb_dummy); sched_unpin(); } @@ -1297,18 +1304,21 @@ pmap_invalidate_all_int(pmap_t pmap) CPU_AND(&other_cpus, &pmap->pm_active); mask = &other_cpus; } - smp_masked_invltlb(*mask, pmap); + smp_masked_invltlb(*mask, pmap, pmap_curcpu_cb_dummy); sched_unpin(); } static void -__CONCAT(PMTYPE, invalidate_cache)(void) +pmap_invalidate_cache_curcpu_cb(pmap_t pmap __unused, + vm_offset_t addr1 __unused, vm_offset_t addr2 __unused) { - - sched_pin(); wbinvd(); - smp_cache_flush(); - sched_unpin(); +} + +static void +__CONCAT(PMTYPE, invalidate_cache)(void) +{ + smp_cache_flush(pmap_invalidate_cache_curcpu_cb); } struct pde_action { Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Wed Jun 10 22:00:31 2020 (r362030) +++ head/sys/i386/i386/vm_machdep.c Wed Jun 10 22:07:57 2020 (r362031) @@ -578,6 +578,12 @@ sf_buf_map(struct sf_buf *sf, int flags) } #ifdef SMP +static void +sf_buf_shootdown_curcpu_cb(pmap_t pmap __unused, + vm_offset_t addr1 __unused, vm_offset_t addr2 __unused) +{ +} + void sf_buf_shootdown(struct sf_buf *sf, int flags) { @@ -596,7 +602,8 @@ sf_buf_shootdown(struct sf_buf *sf, int flags) CPU_ANDNOT(&other_cpus, &sf->cpumask); if (!CPU_EMPTY(&other_cpus)) { CPU_OR(&sf->cpumask, &other_cpus); - smp_masked_invlpg(other_cpus, sf->kva, kernel_pmap); + smp_masked_invlpg(other_cpus, sf->kva, kernel_pmap, + sf_buf_shootdown_curcpu_cb); } } sched_unpin(); Modified: head/sys/x86/include/x86_smp.h ============================================================================== --- head/sys/x86/include/x86_smp.h Wed Jun 10 22:00:31 2020 (r362030) +++ head/sys/x86/include/x86_smp.h Wed Jun 10 22:07:57 2020 (r362031) @@ -84,6 +84,9 @@ inthand_t IDTVEC(cpususpend), /* CPU suspends & waits to be resumed */ IDTVEC(rendezvous); /* handle CPU rendezvous */ +typedef void (*smp_invl_cb_t)(struct pmap *, vm_offset_t addr1, + vm_offset_t addr2); + /* functions in x86_mp.c */ void assign_cpu_ids(void); void cpu_add(u_int apic_id, char boot_cpu); @@ -103,11 +106,13 @@ void ipi_cpu(int cpu, u_int ipi); int ipi_nmi_handler(void); void ipi_selected(cpuset_t cpus, u_int ipi); void set_interrupt_apic_ids(void); -void smp_cache_flush(void); -void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap); +void smp_cache_flush(smp_invl_cb_t curcpu_cb); +void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap, + smp_invl_cb_t curcpu_cb); void smp_masked_invlpg_range(cpuset_t mask, vm_offset_t startva, - vm_offset_t endva, struct pmap *pmap); -void smp_masked_invltlb(cpuset_t mask, struct pmap *pmap); + vm_offset_t endva, struct pmap *pmap, smp_invl_cb_t curcpu_cb); +void smp_masked_invltlb(cpuset_t mask, struct pmap *pmap, + smp_invl_cb_t curcpu_cb); void mem_range_AP_init(void); void topo_probe(void); void ipi_send_cpu(int cpu, u_int ipi); Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Wed Jun 10 22:00:31 2020 (r362030) +++ head/sys/x86/x86/mp_x86.c Wed Jun 10 22:07:57 2020 (r362031) @@ -1676,9 +1676,21 @@ volatile uint32_t smp_tlb_generation; #define read_eflags() read_rflags() #endif +/* + * Used by pmap to request invalidation of TLB or cache on local and + * remote processors. Mask provides the set of remote CPUs which are + * to be signalled with the IPI specified by vector. The curcpu_cb + * callback is invoked on the calling CPU while waiting for remote + * CPUs to complete the operation. + * + * The callback function is called unconditionally on the caller's + * underlying processor, even when this processor is not set in the + * mask. So, the callback function must be prepared to handle such + * spurious invocations. + */ static void smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector, pmap_t pmap, - vm_offset_t addr1, vm_offset_t addr2) + vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb) { cpuset_t other_cpus; volatile uint32_t *p_cpudone; @@ -1686,19 +1698,23 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector int cpu; /* It is not necessary to signal other CPUs while in the debugger. */ - if (kdb_active || KERNEL_PANICKED()) + if (kdb_active || KERNEL_PANICKED()) { + curcpu_cb(pmap, addr1, addr2); return; + } + sched_pin(); + /* * Check for other cpus. Return if none. */ if (CPU_ISFULLSET(&mask)) { if (mp_ncpus <= 1) - return; + goto nospinexit; } else { CPU_CLR(PCPU_GET(cpuid), &mask); if (CPU_EMPTY(&mask)) - return; + goto nospinexit; } if (!(read_eflags() & PSL_I)) @@ -1722,6 +1738,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector ipi_send_cpu(cpu, vector); } } + curcpu_cb(pmap, addr1, addr2); while ((cpu = CPU_FFS(&other_cpus)) != 0) { cpu--; CPU_CLR(cpu, &other_cpus); @@ -1730,14 +1747,21 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector ia32_pause(); } mtx_unlock_spin(&smp_ipi_mtx); + sched_unpin(); + return; + +nospinexit: + curcpu_cb(pmap, addr1, addr2); + sched_unpin(); } void -smp_masked_invltlb(cpuset_t mask, pmap_t pmap) +smp_masked_invltlb(cpuset_t mask, pmap_t pmap, smp_invl_cb_t curcpu_cb) { if (smp_started) { - smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0); + smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0, + curcpu_cb); #ifdef COUNT_XINVLTLB_HITS ipi_global++; #endif @@ -1745,11 +1769,13 @@ smp_masked_invltlb(cpuset_t mask, pmap_t pmap) } void -smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pmap_t pmap) +smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pmap_t pmap, + smp_invl_cb_t curcpu_cb) { if (smp_started) { - smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0); + smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0, + curcpu_cb); #ifdef COUNT_XINVLTLB_HITS ipi_page++; #endif @@ -1758,12 +1784,12 @@ smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pma void smp_masked_invlpg_range(cpuset_t mask, vm_offset_t addr1, vm_offset_t addr2, - pmap_t pmap) + pmap_t pmap, smp_invl_cb_t curcpu_cb) { if (smp_started) { smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap, - addr1, addr2); + addr1, addr2, curcpu_cb); #ifdef COUNT_XINVLTLB_HITS ipi_range++; ipi_range_size += (addr2 - addr1) / PAGE_SIZE; @@ -1772,12 +1798,12 @@ smp_masked_invlpg_range(cpuset_t mask, vm_offset_t add } void -smp_cache_flush(void) +smp_cache_flush(smp_invl_cb_t curcpu_cb) { if (smp_started) { smp_targeted_tlb_shootdown(all_cpus, IPI_INVLCACHE, NULL, - 0, 0); + 0, 0, curcpu_cb); } } From owner-svn-src-head@freebsd.org Wed Jun 10 22:13:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CCB0340C29; Wed, 10 Jun 2020 22:13:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j1Tf0pw6z4dcs; Wed, 10 Jun 2020 22:13:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16E08DB33; Wed, 10 Jun 2020 22:13:26 +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 05AMDPXf012078; Wed, 10 Jun 2020 22:13:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AMDOfl012072; Wed, 10 Jun 2020 22:13:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006102213.05AMDOfl012072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 10 Jun 2020 22:13:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362032 - in head: include lib/libc/include lib/libthr lib/libthr/thread share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: include lib/libc/include lib/libthr lib/libthr/thread share/man/man3 X-SVN-Commit-Revision: 362032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 22:13:26 -0000 Author: kib Date: Wed Jun 10 22:13:24 2020 New Revision: 362032 URL: https://svnweb.freebsd.org/changeset/base/362032 Log: Add pthread_getname_np() and pthread_setname_np() aliases for pthread_get_name_np() and pthread_set_name_np(). This re-applies r361770 after compatibility fixes. Reviewed by: antoine, jkim, markj Tested by: antoine (exp-run) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25117 Modified: head/include/pthread.h head/lib/libc/include/namespace.h head/lib/libc/include/un-namespace.h head/lib/libthr/pthread.map head/lib/libthr/thread/thr_info.c head/share/man/man3/Makefile head/share/man/man3/pthread_set_name_np.3 Modified: head/include/pthread.h ============================================================================== --- head/include/pthread.h Wed Jun 10 22:07:57 2020 (r362031) +++ head/include/pthread.h Wed Jun 10 22:13:24 2020 (r362032) @@ -301,6 +301,9 @@ void pthread_testcancel(void); int pthread_getprio(pthread_t); int pthread_setprio(pthread_t, int); void pthread_yield(void); + +int pthread_getname_np(pthread_t, char *, size_t); +int pthread_setname_np(pthread_t, const char *); #endif int pthread_mutexattr_getprioceiling( Modified: head/lib/libc/include/namespace.h ============================================================================== --- head/lib/libc/include/namespace.h Wed Jun 10 22:07:57 2020 (r362031) +++ head/lib/libc/include/namespace.h Wed Jun 10 22:13:24 2020 (r362032) @@ -138,6 +138,7 @@ #define pthread_getaffinity_np _pthread_getaffinity_np #define pthread_getconcurrency _pthread_getconcurrency #define pthread_getcpuclockid _pthread_getcpuclockid +#define pthread_getname_np _pthread_getname_np #define pthread_getprio _pthread_getprio #define pthread_getschedparam _pthread_getschedparam #define pthread_getspecific _pthread_getspecific @@ -191,6 +192,7 @@ #define pthread_setcancelstate _pthread_setcancelstate #define pthread_setcanceltype _pthread_setcanceltype #define pthread_setconcurrency _pthread_setconcurrency +#define pthread_setname_np _pthread_setname_np #define pthread_setprio _pthread_setprio #define pthread_setschedparam _pthread_setschedparam #define pthread_setspecific _pthread_setspecific Modified: head/lib/libc/include/un-namespace.h ============================================================================== --- head/lib/libc/include/un-namespace.h Wed Jun 10 22:07:57 2020 (r362031) +++ head/lib/libc/include/un-namespace.h Wed Jun 10 22:13:24 2020 (r362032) @@ -119,6 +119,7 @@ #undef pthread_getaffinity_np #undef pthread_getconcurrency #undef pthread_getcpuclockid +#undef pthread_getname_np #undef pthread_getprio #undef pthread_getschedparam #undef pthread_getspecific @@ -172,6 +173,7 @@ #undef pthread_setcancelstate #undef pthread_setcanceltype #undef pthread_setconcurrency +#undef pthread_setname_np #undef pthread_setprio #undef pthread_setschedparam #undef pthread_setspecific Modified: head/lib/libthr/pthread.map ============================================================================== --- head/lib/libthr/pthread.map Wed Jun 10 22:07:57 2020 (r362031) +++ head/lib/libthr/pthread.map Wed Jun 10 22:13:24 2020 (r362032) @@ -328,5 +328,7 @@ FBSD_1.5 { }; FBSD_1.6 { + pthread_getname_np; pthread_peekjoin_np; + pthread_setname_np; }; Modified: head/lib/libthr/thread/thr_info.c ============================================================================== --- head/lib/libthr/thread/thr_info.c Wed Jun 10 22:07:57 2020 (r362031) +++ head/lib/libthr/thread/thr_info.c Wed Jun 10 22:13:24 2020 (r362032) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" +#include #include #include #include @@ -45,39 +46,66 @@ __FBSDID("$FreeBSD$"); #include "thr_private.h" -__weak_reference(_pthread_set_name_np, pthread_set_name_np); - static void -thr_set_name_np(struct pthread *thread, const char *name) +thr_set_name_np(struct pthread *thread, char **tmp_name) { free(thread->name); - thread->name = name != NULL ? strdup(name) : NULL; + thread->name = *tmp_name; + *tmp_name = NULL; } -/* Set the thread name for debug. */ -void -_pthread_set_name_np(pthread_t thread, const char *name) +/* Set the thread name. */ +__weak_reference(_pthread_setname_np, pthread_setname_np); +int +_pthread_setname_np(pthread_t thread, const char *name) { struct pthread *curthread; + char *tmp_name; + int res; + if (name != NULL) { + tmp_name = strdup(name); + if (tmp_name == NULL) + return (ENOMEM); + } else { + tmp_name = NULL; + } curthread = _get_curthread(); if (curthread == thread) { + res = 0; THR_THREAD_LOCK(curthread, thread); - thr_set_name(thread->tid, name); - thr_set_name_np(thread, name); + if (thr_set_name(thread->tid, name) == -1) + res = errno; + else + thr_set_name_np(thread, &tmp_name); THR_THREAD_UNLOCK(curthread, thread); } else { + res = ESRCH; if (_thr_find_thread(curthread, thread, 0) == 0) { if (thread->state != PS_DEAD) { - thr_set_name(thread->tid, name); - thr_set_name_np(thread, name); + if (thr_set_name(thread->tid, name) == -1) { + res = errno; + } else { + thr_set_name_np(thread, &tmp_name); + res = 0; + } } THR_THREAD_UNLOCK(curthread, thread); } } + free(tmp_name); + return (res); } +/* Set the thread name for debug. */ +__weak_reference(_pthread_set_name_np, pthread_set_name_np); +void +_pthread_set_name_np(pthread_t thread, const char *name) +{ + (void)_pthread_setname_np(thread, name); +} + static void thr_get_name_np(struct pthread *thread, char *buf, size_t len) { @@ -88,13 +116,14 @@ thr_get_name_np(struct pthread *thread, char *buf, siz buf[0] = '\0'; } -__weak_reference(_pthread_get_name_np, pthread_get_name_np); - -void -_pthread_get_name_np(pthread_t thread, char *buf, size_t len) +__weak_reference(_pthread_getname_np, pthread_getname_np); +int +_pthread_getname_np(pthread_t thread, char *buf, size_t len) { struct pthread *curthread; + int res; + res = 0; curthread = _get_curthread(); if (curthread == thread) { THR_THREAD_LOCK(curthread, thread); @@ -104,8 +133,21 @@ _pthread_get_name_np(pthread_t thread, char *buf, size if (_thr_find_thread(curthread, thread, 0) == 0) { if (thread->state != PS_DEAD) thr_get_name_np(thread, buf, len); + else + res = ESRCH; THR_THREAD_UNLOCK(curthread, thread); - } else if (len > 0) - buf[0] = '\0'; + } else { + res = ESRCH; + if (len > 0) + buf[0] = '\0'; + } } + return (res); +} + +__weak_reference(_pthread_get_name_np, pthread_get_name_np); +void +_pthread_get_name_np(pthread_t thread, char *buf, size_t len) +{ + (void)_pthread_getname_np(thread, buf, len); } Modified: head/share/man/man3/Makefile ============================================================================== --- head/share/man/man3/Makefile Wed Jun 10 22:07:57 2020 (r362031) +++ head/share/man/man3/Makefile Wed Jun 10 22:13:24 2020 (r362032) @@ -493,7 +493,9 @@ PTHREAD_MLINKS+=pthread_rwlock_rdlock.3 pthread_rwlock PTHREAD_MLINKS+=pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 PTHREAD_MLINKS+=pthread_schedparam.3 pthread_getschedparam.3 \ pthread_schedparam.3 pthread_setschedparam.3 -PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3 +PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3 \ + pthread_set_name_np.3 pthread_getname_np.3 \ + pthread_set_name_np.3 pthread_setname_np.3 PTHREAD_MLINKS+=pthread_spin_init.3 pthread_spin_destroy.3 \ pthread_spin_lock.3 pthread_spin_trylock.3 \ pthread_spin_lock.3 pthread_spin_unlock.3 Modified: head/share/man/man3/pthread_set_name_np.3 ============================================================================== --- head/share/man/man3/pthread_set_name_np.3 Wed Jun 10 22:07:57 2020 (r362031) +++ head/share/man/man3/pthread_set_name_np.3 Wed Jun 10 22:13:24 2020 (r362032) @@ -24,12 +24,14 @@ .\" .\" $FreeBSD$ .\" -.Dd August 12, 2018 +.Dd June 3, 2020 .Dt PTHREAD_SET_NAME_NP 3 .Os .Sh NAME .Nm pthread_get_name_np , +.Nm pthread_getname_np , .Nm pthread_set_name_np +.Nm pthread_setname_np .Nd set and retrieve the thread name .Sh LIBRARY .Lb libpthread @@ -37,19 +39,27 @@ .In pthread_np.h .Ft void .Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len" +.Ft int +.Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len" .Ft void .Fn pthread_set_name_np "pthread_t thread" "const char *name" +.Ft int +.Fn pthread_setname_np "pthread_t thread" "const char *name" .Sh DESCRIPTION The .Fn pthread_set_name_np -function applies a copy of the given +and +.Fn pthread_setname_np +functions apply a copy of the given .Fa name to the given .Fa thread . .Pp The .Fn pthread_get_name_np -function retrieves the +and +.Fn pthread_getname_np +functions retrieve the .Fa name associated with .Fa thread . @@ -61,7 +71,23 @@ the buffer pointed to by .Fa name will be empty. .Sh ERRORS -Because of the debugging nature of these functions, all errors that may +The +.Nm pthread_getname_np +and +.Nm pthread_setname_np +will fail if +.Bl -tag -width Er +.It Bq Er ESRCH +No thread could be found in the current process corresponding to that +specified by the given thread ID +.Fa thread . +.El +.Pp +Because of the debugging nature of +.Nm pthread_get_name_np +and +.Nm pthread_set_name_np +functions, all errors that may appear inside are silently ignored. .Sh SEE ALSO .Xr thr_set_name 2 @@ -70,6 +96,11 @@ appear inside are silently ignored. and .Fn pthread_get_name_np are non-standard extensions. +.Fn pthread_setname_np +and +.Fn pthread_getname_np +are also non-standard, but are implemented by larger number of operating +systems so they are in fact more portable. .Sh AUTHORS This manual page was written by .An Alexey Zelkin Aq Mt phantom@FreeBSD.org From owner-svn-src-head@freebsd.org Wed Jun 10 22:16:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDA23340CC4; Wed, 10 Jun 2020 22:16:11 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49j1Xq1T25z4dbc; Wed, 10 Jun 2020 22:16:11 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: by sdaoden.eu (Postfix, from userid 1000) id 62D9516054; Thu, 11 Jun 2020 00:06:20 +0200 (CEST) Date: Thu, 11 Jun 2020 00:06:19 +0200 From: Steffen Nurpmeso To: Yuri Pankov Cc: Mateusz Piotrowski <0mp@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362017 - in head/usr.bin/sed: . tests Message-ID: <20200610220619.Iup5c%steffen@sdaoden.eu> In-Reply-To: References: <202006101923.05AJNwPt006602@repo.freebsd.org> Mail-Followup-To: Yuri Pankov , Mateusz Piotrowski <0mp@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org User-Agent: s-nail v14.9.19-56-g9975bde7 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 49j1Xq1T25z4dbc X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of steffen@sdaoden.eu designates 217.144.132.164 as permitted sender) smtp.mailfrom=steffen@sdaoden.eu X-Spamd-Result: default: False [5.36 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+a:c]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sdaoden.eu]; SEM_URIBL_FRESH15(3.00)[yuripv.dev:email]; RCPT_COUNT_FIVE(0.00)[5]; BAD_REP_POLICIES(0.10)[]; NEURAL_SPAM_MEDIUM(0.58)[0.582]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.12)[-0.122]; NEURAL_SPAM_LONG(0.90)[0.897]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15987, ipnet:217.144.128.0/20, country:DE]; GREYLIST(0.00)[pass,body] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 22:16:11 -0000 Yuri Pankov wrote in : |Mateusz Piotrowski wrote: |> Author: 0mp (doc,ports committer) |> Date: Wed Jun 10 19:23:58 2020 |> New Revision: 362017 |> URL: https://svnweb.freebsd.org/changeset/base/362017 |> |> Log: |> Read commands from stdin when -f - is passed to sed(1) .. |Am I reading it wrong, or is it the same test case added 3 times? It also used "Fl f Cm -" instead of "Fl f Ar -". Just saying.. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) From owner-svn-src-head@freebsd.org Wed Jun 10 22:30:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B40D340E3D; Wed, 10 Jun 2020 22:30:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j1sP73NLz4fDw; Wed, 10 Jun 2020 22:30:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E8925DB48; Wed, 10 Jun 2020 22:30:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05AMUXrb018570; Wed, 10 Jun 2020 22:30:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AMUW2Z018566; Wed, 10 Jun 2020 22:30:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006102230.05AMUW2Z018566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 10 Jun 2020 22:30:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362033 - in head/sys: dev/acpica dev/xen/control kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: dev/acpica dev/xen/control kern X-SVN-Commit-Revision: 362033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 22:30:34 -0000 Author: kib Date: Wed Jun 10 22:30:32 2020 New Revision: 362033 URL: https://svnweb.freebsd.org/changeset/base/362033 Log: Remove double-calls to tc_get_timecount() to warm timecounters. It seems that second call does not add any useful state change for all implemented timecounters. Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Modified: head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_timer.c head/sys/dev/xen/control/control.c head/sys/kern/kern_tc.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Wed Jun 10 22:13:24 2020 (r362032) +++ head/sys/dev/acpica/acpi.c Wed Jun 10 22:30:32 2020 (r362033) @@ -3220,7 +3220,6 @@ acpi_resync_clock(struct acpi_softc *sc) * Warm up timecounter again and reset system clock. */ (void)timecounter->tc_get_timecount(timecounter); - (void)timecounter->tc_get_timecount(timecounter); inittodr(time_second + sc->acpi_sleep_delay); } Modified: head/sys/dev/acpica/acpi_timer.c ============================================================================== --- head/sys/dev/acpica/acpi_timer.c Wed Jun 10 22:13:24 2020 (r362032) +++ head/sys/dev/acpica/acpi_timer.c Wed Jun 10 22:30:32 2020 (r362033) @@ -274,7 +274,6 @@ acpi_timer_resume_handler(struct timecounter *newtc) "restoring timecounter, %s -> %s\n", tc->tc_name, newtc->tc_name); (void)newtc->tc_get_timecount(newtc); - (void)newtc->tc_get_timecount(newtc); timecounter = newtc; } } Modified: head/sys/dev/xen/control/control.c ============================================================================== --- head/sys/dev/xen/control/control.c Wed Jun 10 22:13:24 2020 (r362032) +++ head/sys/dev/xen/control/control.c Wed Jun 10 22:30:32 2020 (r362033) @@ -303,7 +303,6 @@ xctrl_suspend() * Warm up timecounter again and reset system clock. */ timecounter->tc_get_timecount(timecounter); - timecounter->tc_get_timecount(timecounter); inittodr(time_second); #ifdef EARLY_AP_STARTUP Modified: head/sys/kern/kern_tc.c ============================================================================== --- head/sys/kern/kern_tc.c Wed Jun 10 22:13:24 2020 (r362032) +++ head/sys/kern/kern_tc.c Wed Jun 10 22:30:32 2020 (r362033) @@ -1206,7 +1206,6 @@ tc_init(struct timecounter *tc) tc->tc_frequency < timecounter->tc_frequency) return; (void)tc->tc_get_timecount(tc); - (void)tc->tc_get_timecount(tc); timecounter = tc; } @@ -1469,7 +1468,6 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) /* Warm up new timecounter. */ (void)newtc->tc_get_timecount(newtc); - (void)newtc->tc_get_timecount(newtc); timecounter = newtc; @@ -1962,7 +1960,6 @@ inittimecounter(void *dummy) #endif /* warm up new timecounter (again) and get rolling. */ - (void)timecounter->tc_get_timecount(timecounter); (void)timecounter->tc_get_timecount(timecounter); mtx_lock_spin(&tc_setclock_mtx); tc_windup(NULL); From owner-svn-src-head@freebsd.org Wed Jun 10 23:03:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23D34341BAA; Wed, 10 Jun 2020 23:03:36 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j2bW74LGz3RZN; Wed, 10 Jun 2020 23:03:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE01BE797; Wed, 10 Jun 2020 23:03:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05AN3ZBS042898; Wed, 10 Jun 2020 23:03:35 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05AN3Zdh042897; Wed, 10 Jun 2020 23:03:35 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202006102303.05AN3Zdh042897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 10 Jun 2020 23:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362034 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 362034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 23:03:36 -0000 Author: jhibbits Date: Wed Jun 10 23:03:35 2020 New Revision: 362034 URL: https://svnweb.freebsd.org/changeset/base/362034 Log: powerpc/pmap: Fix pte_find_next() iterators for booke64 pmap After r361988 fixed the reference count leak on booke64, it became possible for an iteration somewhere in the middle of a page to become stale, with the page vanishing (correctly) due to all PTEs on that page going away. pte_find_next() would start at that iterator, and move along 'higher' order directory pages until it finds a valid one, without zeroing out the lower order pages. For instance: /* Find next pte at or above 0x10002000. */ pte = pte_find_next(pmap, &(0x10002000)); pte_remove(pmap, pte); /* This pte was the last reference in the page table page, page is * gone. */ pte = pte_find_next(pmap, 0x10002000); /* pte_find_next will see 0x10002000's page is gone, and jump to the * next one, but starting iteration at the '0x2000' slot, skipping * 0x0000 and 0x1000. */ This caused some processes, like git, to trip the KASSERT() in pmap_release(). Fix this by zeroing all lower order iterators at each level. Modified: head/sys/powerpc/booke/pmap_64.c Modified: head/sys/powerpc/booke/pmap_64.c ============================================================================== --- head/sys/powerpc/booke/pmap_64.c Wed Jun 10 22:30:32 2020 (r362033) +++ head/sys/powerpc/booke/pmap_64.c Wed Jun 10 23:03:35 2020 (r362034) @@ -220,12 +220,13 @@ pte_find_next(pmap_t pmap, vm_offset_t *pva) k = PDIR_IDX(va); l = PTBL_IDX(va); pm_root = pmap->pm_root; + /* truncate the VA for later. */ va &= ~((1UL << (PG_ROOT_H + 1)) - 1); - for (; i < PG_ROOT_NENTRIES; i++, j = 0) { + for (; i < PG_ROOT_NENTRIES; i++, j = 0, k = 0, l = 0) { if (pm_root[i] == 0) continue; - for (; j < PDIR_L1_NENTRIES; j++, k = 0) { + for (; j < PDIR_L1_NENTRIES; j++, k = 0, l = 0) { if (pm_root[i][j] == 0) continue; for (; k < PDIR_NENTRIES; k++, l = 0) { From owner-svn-src-head@freebsd.org Wed Jun 10 23:40:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 772AE3422C2; Wed, 10 Jun 2020 23:40:45 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j3QN2s02z3SgP; Wed, 10 Jun 2020 23:40:44 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ej1-f48.google.com with SMTP id l27so4554914ejc.1; Wed, 10 Jun 2020 16:40:44 -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-transfer-encoding :content-language; bh=yzqkC2RdcqCZm9Wo0+tJ27rzdFy2B015W5u7mudjSW8=; b=jIosJKhYWPd9vJWVjxejfyUAsKVB7fgJeHr46etSW8cexet4imc/8O/j250t0+o9jI fnXpfnEkmr2sgAgIiHdSSzKeFLZmV7C8su/eFqbviYyeZsYMWsnKSAF776scfoGBdm7B wrFkjG/C6aWOlJbZomqJ7WtVGvPBJPPBAjQOozh83rFpJHxAgBJiI5UxBDyZ80hFkmk2 GsFlxbwWhzI0iLYbS1nisYhrspbNM9AbzvwvBaGg3+NwNLzcwjrR6stwlOUUhGEZkaSl 0nXn6rC11caKCd8gDFExBKsPalRQhjMb3SlnhQg2ixHA97MkqEM1FzvyZiBh2rhqKtPS xwcQ== X-Gm-Message-State: AOAM533EOwEklZ9q7pKfxBUc20eCEUOppXsBfNaHBpzzn4XAkU+Q4iyb i4MfYI0Kl7kKZx4J9EGl5Ll1URSrink= X-Google-Smtp-Source: ABdhPJyYLBiT/atyCqOyXmLHpztfNcIhAYE7wneJ/4KV0dCloo0Ne9H8pDFpXYlm73mmaoPAaZQ4EA== X-Received: by 2002:a17:906:5203:: with SMTP id g3mr5609609ejm.58.1591832442553; Wed, 10 Jun 2020 16:40:42 -0700 (PDT) Received: from ?IPv6:2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8? ([2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8]) by smtp.gmail.com with ESMTPSA id n16sm835736ejl.70.2020.06.10.16.40.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jun 2020 16:40:41 -0700 (PDT) Subject: Re: svn commit: r362017 - in head/usr.bin/sed: . tests To: Yuri Pankov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006101923.05AJNwPt006602@repo.freebsd.org> <20200610220619.Iup5c%steffen@sdaoden.eu> From: Mateusz Piotrowski <0mp@FreeBSD.org> Message-ID: <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org> Date: Thu, 11 Jun 2020 01:40:39 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200610220619.Iup5c%steffen@sdaoden.eu> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 49j3QN2s02z3SgP X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mpp302@gmail.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=mpp302@gmail.com X-Spamd-Result: default: False [4.80 / 15.00]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; ARC_NA(0.00)[]; SEM_URIBL_FRESH15(3.00)[yuripv.dev:email]; BAD_REP_POLICIES(0.10)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.22)[0.223]; NEURAL_SPAM_MEDIUM(0.35)[0.353]; NEURAL_SPAM_LONG(0.93)[0.928]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.48:from]; FORGED_SENDER(0.30)[0mp@FreeBSD.org,mpp302@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.218.48:from]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; RCVD_TLS_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[0mp@FreeBSD.org,mpp302@gmail.com] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 23:40:45 -0000 Hi, On 6/11/20 12:06 AM, Steffen Nurpmeso wrote: > Yuri Pankov wrote in > : > |Mateusz Piotrowski wrote: > |> Author: 0mp (doc,ports committer) > |> Date: Wed Jun 10 19:23:58 2020 > |> New Revision: 362017 > |> URL: https://svnweb.freebsd.org/changeset/base/362017 > |> > |> Log: > |> Read commands from stdin when -f - is passed to sed(1) > .. > |Am I reading it wrong, or is it the same test case added 3 times? > > It also used "Fl f Cm -" instead of "Fl f Ar -". Just saying.. Which is correct. "-" is not a variable here. It is a fixed string hence the use of Cm. From owner-svn-src-head@freebsd.org Wed Jun 10 23:44:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A608E34257F; Wed, 10 Jun 2020 23:44:26 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j3Vd504tz3TFV; Wed, 10 Jun 2020 23:44:25 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ed1-f49.google.com with SMTP id k8so2653296edq.4; Wed, 10 Jun 2020 16:44:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=bxsynl9UOgnLB83v82NU0Z40ADvTm2JpqmAJCj2jFjQ=; b=SXojiuUKZHjxhdwyqk/wVdWEXU5I39QqNv/ts87jJWIx5s2P2teMzL6VBF/C9SzUgV ZO2LHF85fWOT2zgB+b5kiBQG51kC/CdyzcSUpdV2a/MuU2abGKNEIWlYPEpZcvcZkXwR w9aozBHYPHEW5EiWlBm7sL0pGABmHlg4AoY9HF6AEw6Eo2bNAMrGPZuF0zpnygN4XHBb Syww1tvsKEbr4sOLdOJojlkqIkXOSwKO0RjXj9a0Qg+qAlAo31lkmBK7fTJzcydmd3iZ m1HTU23QZyQ4d+UtgLffEvyj/9SaKlmvbxhvh/LFrzuM27lI92C4TuCUCUVks5OnYC0j 5WSg== X-Gm-Message-State: AOAM531NOurzIOW5XD4UVjH9J1qfe9gHgi5erG+1cka303oVLRpTYkby 7D/b8unaTJHlVaOskkFLWqBdX4tPg7Q= X-Google-Smtp-Source: ABdhPJzODnwezNxIAQ0ZwBXC+h8ctAdGbNWIOvIpmoEChvM3cQ8tJFruEf/TqobjCCEtriRSpj7pCg== X-Received: by 2002:aa7:dc4e:: with SMTP id g14mr4513438edu.346.1591832663740; Wed, 10 Jun 2020 16:44:23 -0700 (PDT) Received: from ?IPv6:2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8? ([2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8]) by smtp.gmail.com with ESMTPSA id ws10sm772278ejb.24.2020.06.10.16.44.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Jun 2020 16:44:23 -0700 (PDT) Subject: Re: svn commit: r362017 - in head/usr.bin/sed: . tests To: Yuri Pankov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006101923.05AJNwPt006602@repo.freebsd.org> From: Mateusz Piotrowski <0mp@FreeBSD.org> Message-ID: <52a575ff-73aa-68a4-c3e7-5b518233ffc7@FreeBSD.org> Date: Thu, 11 Jun 2020 01:44:21 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 49j3Vd504tz3TFV X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mpp302@gmail.com designates 209.85.208.49 as permitted sender) smtp.mailfrom=mpp302@gmail.com X-Spamd-Result: default: False [-2.13 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-0.90)[-0.896]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.21)[-0.209]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.49:from]; NEURAL_HAM_MEDIUM(-1.02)[-1.025]; FORGED_SENDER(0.30)[0mp@FreeBSD.org,mpp302@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.208.49:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[0mp@FreeBSD.org,mpp302@gmail.com]; FREEMAIL_ENVFROM(0.00)[gmail.com] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 23:44:26 -0000 On 6/10/20 11:44 PM, Yuri Pankov wrote: > Mateusz Piotrowski wrote: >> Author: 0mp (doc,ports committer) >> Date: Wed Jun 10 19:23:58 2020 >> New Revision: 362017 >> URL: https://svnweb.freebsd.org/changeset/base/362017 >> >> Log: >>    Read commands from stdin when -f - is passed to sed(1) [...] >> Modified: head/usr.bin/sed/tests/sed2_test.sh [...] >>   atf_init_test_cases() >>   { >>       atf_add_test_case inplace_command_q >>       atf_add_test_case inplace_hardlink_src >>       atf_add_test_case inplace_symlink_src >>       atf_add_test_case escape_subst >> +    atf_add_test_case commands_on_stdin >> +    atf_add_test_case commands_on_stdin >> +    atf_add_test_case commands_on_stdin >>       atf_add_test_case hex_subst >>   } >> > > Am I reading it wrong, or is it the same test case added 3 times? Sigh, yes, it does not make any sense. Thanks for spotting. Removing those 2 extra lines should do, right? Can I commit it? From owner-svn-src-head@freebsd.org Wed Jun 10 23:52:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B57803425A8; Wed, 10 Jun 2020 23:52:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j3gx4Hppz3TPp; Wed, 10 Jun 2020 23:52:29 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E810EDBC; Wed, 10 Jun 2020 23:52: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 05ANqTqw073313; Wed, 10 Jun 2020 23:52:29 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ANqToJ073312; Wed, 10 Jun 2020 23:52:29 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006102352.05ANqToJ073312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jun 2020 23:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362035 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 23:52:29 -0000 Author: markj Date: Wed Jun 10 23:52:29 2020 New Revision: 362035 URL: https://svnweb.freebsd.org/changeset/base/362035 Log: Remove the FIRMWARE_MAX limit. The firmware module arbitrarily limits us to at most 50 images. It is possible to hit this limit on platforms that preload many firmware images, or link all of the firmware images for a set of devices into the kernel. Convert the table into a linked list, removing the limit. Reported by: Steve Wheeler Reviewed by: rpokala MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D25161 Modified: head/sys/kern/subr_firmware.c Modified: head/sys/kern/subr_firmware.c ============================================================================== --- head/sys/kern/subr_firmware.c Wed Jun 10 23:03:35 2020 (r362034) +++ head/sys/kern/subr_firmware.c Wed Jun 10 23:52:29 2020 (r362035) @@ -53,12 +53,10 @@ __FBSDID("$FreeBSD$"); * form more details on the subsystem. * * 'struct firmware' is the user-visible part of the firmware table. - * Additional internal information is stored in a 'struct priv_fw' - * (currently a static array). A slot is in use if FW_INUSE is true: + * Additional internal information is stored in a 'struct priv_fw', + * which embeds the public firmware structure. */ -#define FW_INUSE(p) ((p)->file != NULL || (p)->fw.name != NULL) - /* * fw.name != NULL when an image is registered; file != NULL for * autoloaded images whose handling has not been completed. @@ -82,6 +80,7 @@ __FBSDID("$FreeBSD$"); struct priv_fw { int refcnt; /* reference count */ + LIST_ENTRY(priv_fw) link; /* table linkage */ /* * parent entry, see above. Set on firmware_register(), @@ -118,13 +117,9 @@ struct priv_fw { ((intptr_t)(x) - offsetof(struct priv_fw, fw)) ) /* - * At the moment we use a static array as backing store for the registry. - * Should we move to a dynamic structure, keep in mind that we cannot - * reallocate the array because pointers are held externally. - * A list may work, though. + * Global firmware image registry. */ -#define FIRMWARE_MAX 50 -static struct priv_fw firmware_table[FIRMWARE_MAX]; +static LIST_HEAD(, priv_fw) firmware_table; /* * Firmware module operations are handled in a separate task as they @@ -139,6 +134,8 @@ static struct task firmware_unload_task; static struct mtx firmware_mtx; MTX_SYSINIT(firmware, &firmware_mtx, "firmware table", MTX_DEF); +static MALLOC_DEFINE(M_FIRMWARE, "firmware", "device firmware images"); + /* * Helper function to lookup a name. * As a side effect, it sets the pointer to a free slot, if any. @@ -147,23 +144,17 @@ MTX_SYSINIT(firmware, &firmware_mtx, "firmware table", * with some other data structure. */ static struct priv_fw * -lookup(const char *name, struct priv_fw **empty_slot) +lookup(const char *name) { - struct priv_fw *fp = NULL; - struct priv_fw *dummy; - int i; + struct priv_fw *fp; - if (empty_slot == NULL) - empty_slot = &dummy; - *empty_slot = NULL; - for (i = 0; i < FIRMWARE_MAX; i++) { - fp = &firmware_table[i]; + mtx_assert(&firmware_mtx, MA_OWNED); + + LIST_FOREACH(fp, &firmware_table, link) { if (fp->fw.name != NULL && strcasecmp(name, fp->fw.name) == 0) break; - else if (!FW_INUSE(fp)) - *empty_slot = fp; } - return (i < FIRMWARE_MAX ) ? fp : NULL; + return (fp); } /* @@ -176,42 +167,42 @@ const struct firmware * firmware_register(const char *imagename, const void *data, size_t datasize, unsigned int version, const struct firmware *parent) { - struct priv_fw *match, *frp; - char *str; + struct priv_fw *frp; + char *name; - str = strdup(imagename, M_TEMP); - mtx_lock(&firmware_mtx); - /* - * Do a lookup to make sure the name is unique or find a free slot. - */ - match = lookup(imagename, &frp); - if (match != NULL) { + frp = lookup(imagename); + if (frp != NULL) { mtx_unlock(&firmware_mtx); printf("%s: image %s already registered!\n", - __func__, imagename); - free(str, M_TEMP); - return NULL; + __func__, imagename); + return (NULL); } - if (frp == NULL) { + mtx_unlock(&firmware_mtx); + + frp = malloc(sizeof(*frp), M_FIRMWARE, M_WAITOK | M_ZERO); + name = strdup(imagename, M_FIRMWARE); + + mtx_lock(&firmware_mtx); + if (lookup(imagename) != NULL) { + /* We lost a race. */ mtx_unlock(&firmware_mtx); - printf("%s: cannot register image %s, firmware table full!\n", - __func__, imagename); - free(str, M_TEMP); - return NULL; + free(name, M_FIRMWARE); + free(frp, M_FIRMWARE); + return (NULL); } - bzero(frp, sizeof(*frp)); /* start from a clean record */ - frp->fw.name = str; + frp->fw.name = name; frp->fw.data = data; frp->fw.datasize = datasize; frp->fw.version = version; if (parent != NULL) frp->parent = PRIV_FW(parent); + LIST_INSERT_HEAD(&firmware_table, frp, link); mtx_unlock(&firmware_mtx); if (bootverbose) printf("firmware: '%s' version %u: %zu bytes loaded at %p\n", imagename, version, datasize, data); - return &frp->fw; + return (&frp->fw); } /* @@ -226,7 +217,7 @@ firmware_unregister(const char *imagename) int err; mtx_lock(&firmware_mtx); - fp = lookup(imagename, NULL); + fp = lookup(imagename); if (fp == NULL) { /* * It is ok for the lookup to fail; this can happen @@ -238,20 +229,13 @@ firmware_unregister(const char *imagename) } else if (fp->refcnt != 0) { /* cannot unregister */ err = EBUSY; } else { - linker_file_t x = fp->file; /* save value */ - - /* - * Clear the whole entry with bzero to make sure we - * do not forget anything. Then restore 'file' which is - * non-null for autoloaded images. - */ - free((void *) (uintptr_t) fp->fw.name, M_TEMP); - bzero(fp, sizeof(struct priv_fw)); - fp->file = x; + LIST_REMOVE(fp, link); + free(__DECONST(char *, fp->fw.name), M_FIRMWARE); + free(fp, M_FIRMWARE); err = 0; } mtx_unlock(&firmware_mtx); - return err; + return (err); } static void @@ -262,31 +246,29 @@ loadimage(void *arg, int npending) linker_file_t result; int error; - /* synchronize with the thread that dispatched us */ - mtx_lock(&firmware_mtx); - mtx_unlock(&firmware_mtx); - error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n", imagename, error); + mtx_lock(&firmware_mtx); goto done; } mtx_lock(&firmware_mtx); - fp = lookup(imagename, NULL); + fp = lookup(imagename); if (fp == NULL || fp->file != NULL) { mtx_unlock(&firmware_mtx); if (fp == NULL) printf("%s: firmware image loaded, " "but did not register\n", imagename); (void) linker_release_module(imagename, NULL, NULL); + mtx_lock(&firmware_mtx); goto done; } fp->file = result; /* record the module identity */ - mtx_unlock(&firmware_mtx); done: - wakeup_one(imagename); /* we're done */ + wakeup_one(imagename); + mtx_unlock(&firmware_mtx); } /* @@ -304,7 +286,7 @@ firmware_get(const char *imagename) struct priv_fw *fp; mtx_lock(&firmware_mtx); - fp = lookup(imagename, NULL); + fp = lookup(imagename); if (fp != NULL) goto found; /* @@ -318,7 +300,7 @@ firmware_get(const char *imagename) "load firmware image %s\n", __func__, imagename); return NULL; } - /* + /* * Defer load to a thread with known context. linker_reference_module * may do filesystem i/o which requires root & current dirs, etc. * Also we must not hold any mtx's over this call which is problematic. @@ -333,7 +315,7 @@ firmware_get(const char *imagename) /* * After attempting to load the module, see if the image is registered. */ - fp = lookup(imagename, NULL); + fp = lookup(imagename); if (fp == NULL) { mtx_unlock(&firmware_mtx); return NULL; @@ -381,7 +363,6 @@ set_rootvnode(void *arg, int npending) { pwd_ensure_dirs(); - free(arg, M_TEMP); } @@ -413,50 +394,39 @@ EVENTHANDLER_DEFINE(mountroot, firmware_mountroot, NUL static void unloadentry(void *unused1, int unused2) { - int limit = FIRMWARE_MAX; - int i; /* current cycle */ + struct priv_fw *fp, *tmp; + int err; + bool changed; mtx_lock(&firmware_mtx); - /* - * Scan the table. limit is set to make sure we make another - * full sweep after matching an entry that requires unloading. - */ - for (i = 0; i < limit; i++) { - struct priv_fw *fp; - int err; - - fp = &firmware_table[i % FIRMWARE_MAX]; - if (fp->fw.name == NULL || fp->file == NULL || - fp->refcnt != 0 || (fp->flags & FW_UNLOAD) == 0) + changed = false; +restart: + LIST_FOREACH_SAFE(fp, &firmware_table, link, tmp) { + if (fp->file == NULL || fp->refcnt != 0 || + (fp->flags & FW_UNLOAD) == 0) continue; /* * Found an entry. Now: - * 1. bump up limit to make sure we make another full round; + * 1. make sure we scan the table again * 2. clear FW_UNLOAD so we don't try this entry again. * 3. release the lock while trying to unload the module. - * 'file' remains set so that the entry cannot be reused - * in the meantime (it also means that fp->file will - * not change while we release the lock). */ - limit = i + FIRMWARE_MAX; /* make another full round */ + changed = true; fp->flags &= ~FW_UNLOAD; /* do not try again */ - mtx_unlock(&firmware_mtx); - err = linker_release_module(NULL, NULL, fp->file); - mtx_lock(&firmware_mtx); - /* * We rely on the module to call firmware_unregister() - * on unload to actually release the entry. - * If err = 0 we can drop our reference as the system - * accepted it. Otherwise unloading failed (e.g. the - * module itself gave an error) so our reference is - * still valid. + * on unload to actually free the entry. */ - if (err == 0) - fp->file = NULL; + mtx_unlock(&firmware_mtx); + err = linker_release_module(NULL, NULL, fp->file); + mtx_lock(&firmware_mtx); } + if (changed) { + changed = false; + goto restart; + } mtx_unlock(&firmware_mtx); } @@ -467,8 +437,9 @@ static int firmware_modevent(module_t mod, int type, void *unused) { struct priv_fw *fp; - int i, err; + int err; + err = 0; switch (type) { case MOD_LOAD: TASK_INIT(&firmware_unload_task, 0, unloadentry, NULL); @@ -478,39 +449,39 @@ firmware_modevent(module_t mod, int type, void *unused (void) taskqueue_start_threads(&firmware_tq, 1, PWAIT, "firmware taskq"); if (rootvnode != NULL) { - /* + /* * Root is already mounted so we won't get an event; * simulate one here. */ firmware_mountroot(NULL); } - return 0; + break; case MOD_UNLOAD: /* request all autoloaded modules to be released */ mtx_lock(&firmware_mtx); - for (i = 0; i < FIRMWARE_MAX; i++) { - fp = &firmware_table[i]; + LIST_FOREACH(fp, &firmware_table, link) fp->flags |= FW_UNLOAD; - } mtx_unlock(&firmware_mtx); taskqueue_enqueue(firmware_tq, &firmware_unload_task); taskqueue_drain(firmware_tq, &firmware_unload_task); - err = 0; - for (i = 0; i < FIRMWARE_MAX; i++) { - fp = &firmware_table[i]; + + LIST_FOREACH(fp, &firmware_table, link) { if (fp->fw.name != NULL) { - printf("%s: image %p ref %d still active slot %d\n", - __func__, fp->fw.name, - fp->refcnt, i); + printf("%s: image %s still active, %d refs\n", + __func__, fp->fw.name, fp->refcnt); err = EINVAL; } } if (err == 0) taskqueue_free(firmware_tq); - return err; + break; + + default: + err = EOPNOTSUPP; + break; } - return EINVAL; + return (err); } static moduledata_t firmware_mod = { From owner-svn-src-head@freebsd.org Wed Jun 10 23:52:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 847F8342685; Wed, 10 Jun 2020 23:52:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j3h80Z01z3TyG; Wed, 10 Jun 2020 23:52:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1048EDBD; Wed, 10 Jun 2020 23:52:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05ANqdkC073366; Wed, 10 Jun 2020 23:52:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ANqde3073365; Wed, 10 Jun 2020 23:52:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006102352.05ANqde3073365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jun 2020 23:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362036 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362036 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 23:52:40 -0000 Author: markj Date: Wed Jun 10 23:52:39 2020 New Revision: 362036 URL: https://svnweb.freebsd.org/changeset/base/362036 Log: Add a comment reflecting the commit log for r361945. Suggested by: alc Reviewed by: alc MFC with: r361945 Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Wed Jun 10 23:52:29 2020 (r362035) +++ head/sys/compat/linux/linux_misc.c Wed Jun 10 23:52:39 2020 (r362036) @@ -167,6 +167,12 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_ sysinfo.totalram = physmem * PAGE_SIZE; sysinfo.freeram = sysinfo.totalram - vm_wire_count() * PAGE_SIZE; + /* + * sharedram counts pages allocated to named, swap-backed objects such + * as shared memory segments and tmpfs files. There is no cheap way to + * compute this, so just leave the field unpopulated. Linux itself only + * started setting this field in the 3.x timeframe. + */ sysinfo.sharedram = 0; sysinfo.bufferram = 0; From owner-svn-src-head@freebsd.org Wed Jun 10 23:52:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 215C2342985; Wed, 10 Jun 2020 23:52:51 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j3hL6Mpgz3Tfs; Wed, 10 Jun 2020 23:52:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2309EE36; Wed, 10 Jun 2020 23:52:50 +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 05ANqoJ0073419; Wed, 10 Jun 2020 23:52:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ANqoYs073418; Wed, 10 Jun 2020 23:52:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006102352.05ANqoYs073418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 10 Jun 2020 23:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362037 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362037 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 10 Jun 2020 23:52:51 -0000 Author: markj Date: Wed Jun 10 23:52:50 2020 New Revision: 362037 URL: https://svnweb.freebsd.org/changeset/base/362037 Log: Fix a couple of nits in Linux sysinfo(2) emulation. - Use the same definition of free memory as Linux. - Rename the totalbig and freebig fields to match the corresponding names on Linux. Discussed with: alc MFC after: 1 week Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Wed Jun 10 23:52:39 2020 (r362036) +++ head/sys/compat/linux/linux_misc.c Wed Jun 10 23:52:50 2020 (r362037) @@ -132,8 +132,8 @@ struct l_sysinfo { l_ulong freeswap; /* swap space still available */ l_ushort procs; /* Number of current processes */ l_ushort pads; - l_ulong totalbig; - l_ulong freebig; + l_ulong totalhigh; + l_ulong freehigh; l_uint mem_unit; char _f[20-2*sizeof(l_long)-sizeof(l_int)]; /* padding */ }; @@ -165,7 +165,7 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_ LINUX_SYSINFO_LOADS_SCALE / averunnable.fscale; sysinfo.totalram = physmem * PAGE_SIZE; - sysinfo.freeram = sysinfo.totalram - vm_wire_count() * PAGE_SIZE; + sysinfo.freeram = (u_long)vm_free_count() * PAGE_SIZE; /* * sharedram counts pages allocated to named, swap-backed objects such @@ -182,9 +182,13 @@ linux_sysinfo(struct thread *td, struct linux_sysinfo_ sysinfo.procs = nprocs; - /* The following are only present in newer Linux kernels. */ - sysinfo.totalbig = 0; - sysinfo.freebig = 0; + /* + * Platforms supported by the emulation layer do not have a notion of + * high memory. + */ + sysinfo.totalhigh = 0; + sysinfo.freehigh = 0; + sysinfo.mem_unit = 1; return (copyout(&sysinfo, args->info, sizeof(sysinfo))); From owner-svn-src-head@freebsd.org Thu Jun 11 00:36:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35F5D343816; Thu, 11 Jun 2020 00:36:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j4fr0g65z3Wqr; Thu, 11 Jun 2020 00:36:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11CF3F6B4; Thu, 11 Jun 2020 00:36:36 +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 05B0aZnE098305; Thu, 11 Jun 2020 00:36:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05B0aZpi098304; Thu, 11 Jun 2020 00:36:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006110036.05B0aZpi098304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 11 Jun 2020 00:36:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362038 - head/sys/modules/ice_ddp X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/modules/ice_ddp X-SVN-Commit-Revision: 362038 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 00:36:36 -0000 Author: markj Date: Thu Jun 11 00:36:35 2020 New Revision: 362038 URL: https://svnweb.freebsd.org/changeset/base/362038 Log: Hard-code the ice_ddp firmware version. Like every other firmware image in the tree, the makefile will need to be updated to point to the newest import. Reviewed by: erj, imp (previous version) Differential Revision: https://reviews.freebsd.org/D25222 Modified: head/sys/modules/ice_ddp/Makefile Modified: head/sys/modules/ice_ddp/Makefile ============================================================================== --- head/sys/modules/ice_ddp/Makefile Wed Jun 10 23:52:50 2020 (r362037) +++ head/sys/modules/ice_ddp/Makefile Thu Jun 11 00:36:35 2020 (r362038) @@ -1,24 +1,6 @@ # $FreeBSD$ -# Find the highest version DDP package file and build a .ko for it -PKG_FILE != find ${SRCTOP}/sys/contrib/dev/ice -name 'ice-*.pkg' | sort -V | tail -1 +KMOD= ice_ddp +FIRMWS= ${SRCTOP}/sys/contrib/dev/ice/ice-1.3.9.0.pkg:ice_ddp:0x01030900 -.if empty(PKG_FILE) -.error Unable to locate the DDP package binary file -.endif - -.info Found ${PKG_FILE} - -PKG_NAME != basename ${PKG_FILE} -PKG_VER_STR != basename -s .pkg ${PKG_NAME} -PKG_VER_STR := ${PKG_VER_STR:S/^ice-//} -PKG_VER_STR := ${PKG_VER_STR:S/-signed$//} -PKG_VER_MAJ != echo ${PKG_VER_STR} | cut -d. -f1 -PKG_VER_MIN != echo ${PKG_VER_STR} | cut -d. -f2 -PKG_VER_UPD != echo ${PKG_VER_STR} | cut -d. -f3 -PKG_VER_DFT != echo ${PKG_VER_STR} | cut -d. -f4 -PKG_VERSION != printf "0x%02x%02x%02x%02x" "${PKG_VER_MAJ}" "${PKG_VER_MIN}" "${PKG_VER_UPD}" "${PKG_VER_DFT}" - -KMOD := ice_ddp -FIRMWS := ${PKG_FILE}:ice_ddp:${PKG_VERSION} .include From owner-svn-src-head@freebsd.org Thu Jun 11 01:57:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0787344929 for ; Thu, 11 Jun 2020 01:57:05 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic312-25.consmr.mail.gq1.yahoo.com (sonic312-25.consmr.mail.gq1.yahoo.com [98.137.69.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49j6Rh5QgCz3b2x for ; Thu, 11 Jun 2020 01:57:04 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: EcYWCd8VM1mhPmWkBvPeNWsfCnelVPAeJfxYido6r5Q_2soHJB4lG8t0wILngZk ye9pqxVUx9zwz09dyfJ3P9EYJGgc4ytH4BceyfHk4hwnAyyKxQWlM2yIg96z4D0F8a01rykHKiog KMLdIfZHurDZCWn_Pjsej.VOidxZfTQoy_1Bt6hk8rZ62bB2h41cus_xwAsVHv664fshMWlw0Qbq d8KtbdMdRbN3BolSLp6P1ZecRM212r7w_SEKqRbW3yoZ1HQnk8FHZsxJXjsDJYFmd4eA1ZhMTKpA ZnmZAepncte_uEMMLk2J.qtE.zOwiwTrlt2ZRBB_gNBy2pAw9YEYif2wq25ZfXJi9fSNKn0rLHfi s7H9Suy89bm8VmUSliw03WBBHipLMy0ozMXnV9qkG7wksCFvLSlWClwcqh.GHk6UCt9m5ODJ.VAV tntWg3cXR1zR6wiXtnz2ttSjUTZuM5lA2GYzfOTDeX2rN6F70YtXUhrSiRrEX4njbgO3uz0nxxKe BWSNcJbUD7r80K7oKtbVsOL8AcKAHiJ_f3_EhtXseajEk0OaTeM9jKoQXjglsI6d..LmdZKhZ7S4 4oVLU5QgRrL._176furakeDlbcIOKcPUSBJkf82HsuD5jLKLANz4qyBz8wS5e6S1qHGhP_46O.rG w3GnF1VWLXvvp3uNnDeRDddCxWib9KFJDatOALRf7whI2vu6yql8yBYQZwBE0hddqCRZyONQ8JDc x8BTvZWw.9FS.RF5hfm_EyucxbUS9YNEkPWUiz2iEtCyv5xtmhvT222pZsbB7JT1wv6h9S5zMY8x atG6MSvNDkzrWdZK7SX4PzJRvegFWoabyVG3KOdoH.z_1hSlz3dgFZI7v.fc4yePdIq.126N77Y2 VzmsaYm3azMxU3YppO1eiXCx5_0IpQ0WCmX42JGrA6XTUHQDz0Hf_0ATHakqWQ8ZJfE4IYVueD.L zmD__lR3va3Lbzy_dRQ61eHByN7PvntVjeXpcrcjMmdUVIYS4Fk7H_FPrJnpYFGnr3CuOMWdO9wL divaKmYUKDx36okSLvbsvGMb_JmJn08ueU6xtdcwAl6WqCKxA6Nlfh7QT.zmJFK14Ho2lTHcW70C sNXZhA5YFQjpLTz.Xzrj9HH278ZzTpmHpVhvgwAV7T3kMCpHgyScn9REMhJX89W0brsKcoBZuCGo pmhULcAv6pLS7NXyYtKl_Tnvke4LoJKehtBYe9Va.sLAnkn_bTtn7k33Utg_KJJuSkOy5T66d0uQ SPgTROrzIbUcCPaYBfmZc4VEp0B86uw2czQCX_Zdds0lmzLYdqE3MjhZJZRdgMOeyPZvTVQ2zRbH 40W83C7fag4tqceICToJATPPi5he3fidNPxh13roTdt70kCcZB4LnJKLCAs95BiK9SgTvtq4snzT 2zbv6Tl_osVCl6VH.VQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.gq1.yahoo.com with HTTP; Thu, 11 Jun 2020 01:57:01 +0000 Received: by smtp419.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 54c6ff5e13356fd16977b52c6a38d5c8; Thu, 11 Jun 2020 01:56:58 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: <20200513105632.06db9e21@titan.knownspace> Date: Wed, 10 Jun 2020 18:56:57 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: quoted-printable Message-Id: References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49j6Rh5QgCz3b2x X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.02 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.47)[-0.466]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.06)[-1.064]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.985]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.69.206:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.69.206:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 01:57:05 -0000 On 2020-May-13, at 08:56, Justin Hibbits wrote: > Hi Mark, Hello Justin. > On Wed, 13 May 2020 01:43:23 -0700 > Mark Millard wrote: >=20 >> [I'm adding a reference to an old arm64/aarch64 bug that had >> pages turning to zero, in case this 32-bit powerpc issue is >> somewhat analogous.] >>=20 >>> . . . > ... >> . . . >>=20 >> (Note: dsl-only.net closed down, so the E-mail >> address reference is no longer valid.) >>=20 >> Author: kib >> Date: Mon Apr 10 15:32:26 2017 >> New Revision: 316679 >> URL:=20 >> https://svnweb.freebsd.org/changeset/base/316679 >>=20 >>=20 >> Log: >> Do not lose dirty bits for removing PROT_WRITE on arm64. >>=20 >> Arm64 pmap interprets accessed writable ptes as modified, since >> ARMv8.0 does not track Dirty Bit Modifier in hardware. If writable >> bit is removed, page must be marked as dirty for MI VM. >>=20 >> This change is most important for COW, where fork caused losing >> content of the dirty pages which were not yet scanned by pagedaemon. >>=20 >> Reviewed by: alc, andrew >> Reported and tested by: Mark Millard >> PR: 217138, 217239 >> Sponsored by: The FreeBSD Foundation >> MFC after: 2 weeks >>=20 >> Modified: >> head/sys/arm64/arm64/pmap.c >>=20 >> Modified: head/sys/arm64/arm64/pmap.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/arm64/arm64/pmap.c Mon Apr 10 12:35:58 >> 2017 (r316678) +++ head/sys/arm64/arm64/pmap.c Mon Apr >> 10 15:32:26 2017 (r316679) @@ -2481,6 +2481,11 @@ >> pmap_protect(pmap_t pmap, vm_offset_t sv sva +=3D L3_SIZE) { >> l3 =3D pmap_load(l3p); >> if (pmap_l3_valid(l3)) { >> + if ((l3 & ATTR_SW_MANAGED) && >> + pmap_page_dirty(l3)) { >> + >> vm_page_dirty(PHYS_TO_VM_PAGE(l3 & >> + ~ATTR_MASK)); >> + } >> pmap_set(l3p, ATTR_AP(ATTR_AP_RO)); >> PTE_SYNC(l3p); >> /* XXX: Use pmap_invalidate_range */ >>=20 >> . . . >>=20 >=20 > Thanks for this reference. I took a quick look at the 3 pmap > implementations we have (haven't check the new radix pmap yet), and it > looks like only mmu_oea.c (32-bit AIM pmap, for G3 and G4) is missing > vm_page_dirty() calls in its pmap_protect() implementation, analogous > to the change you posted right above. Given this, I think it's safe to > say that this missing piece is necessary. We'll work on a fix for > this; looking at moea64_protect(), there may be additional work needed > to support this as well, so it may take a few days. Ping? Any clue when the above might happen? I've been avoiding the old PowerMacs and leaving them at head -r360311 , pending an update that would avoid the kernel zeroing pages that it should not zero. But I've seen that you were busy with more modern contexts this last about a month. And, clearly, my own context has left pending (for much longer) other more involved activities (compared to just periodically updating to more recent FreeBSD vintages). =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Thu Jun 11 03:03:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3FB4348FD9; Thu, 11 Jun 2020 03:03:52 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49j7wm5LlXz3yBL; Thu, 11 Jun 2020 03:03:52 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2F411145A; Thu, 11 Jun 2020 03:03:52 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05B33qCW091638; Thu, 11 Jun 2020 03:03:52 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05B33qcO091637; Thu, 11 Jun 2020 03:03:52 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006110303.05B33qcO091637@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Thu, 11 Jun 2020 03:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362039 - head/usr.bin/sed/tests X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.bin/sed/tests X-SVN-Commit-Revision: 362039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 03:03:52 -0000 Author: 0mp (doc,ports committer) Date: Thu Jun 11 03:03:52 2020 New Revision: 362039 URL: https://svnweb.freebsd.org/changeset/base/362039 Log: Remove duplicate lines from sed tests Reported by: yuripv Approved by: pfg (src) MFC after: 2 weeks X-MFC-With: 362017 Modified: head/usr.bin/sed/tests/sed2_test.sh Modified: head/usr.bin/sed/tests/sed2_test.sh ============================================================================== --- head/usr.bin/sed/tests/sed2_test.sh Thu Jun 11 00:36:35 2020 (r362038) +++ head/usr.bin/sed/tests/sed2_test.sh Thu Jun 11 03:03:52 2020 (r362039) @@ -177,7 +177,5 @@ atf_init_test_cases() atf_add_test_case inplace_symlink_src atf_add_test_case escape_subst atf_add_test_case commands_on_stdin - atf_add_test_case commands_on_stdin - atf_add_test_case commands_on_stdin atf_add_test_case hex_subst } From owner-svn-src-head@freebsd.org Thu Jun 11 05:34:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B118E34BA2F; Thu, 11 Jun 2020 05:34:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jCGb4hBMz456x; Thu, 11 Jun 2020 05:34:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9BE8512CFA; Thu, 11 Jun 2020 05:34:31 +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 05B5YVtK083403; Thu, 11 Jun 2020 05:34:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05B5YV3P083402; Thu, 11 Jun 2020 05:34:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202006110534.05B5YV3P083402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 11 Jun 2020 05:34:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362042 - head/sys/dev/iicbus X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/iicbus X-SVN-Commit-Revision: 362042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 05:34:31 -0000 Author: avg Date: Thu Jun 11 05:34:31 2020 New Revision: 362042 URL: https://svnweb.freebsd.org/changeset/base/362042 Log: iicbb: rebuild the bit-banging algorithms using different primitives I2C_SET was quite inflexible, it used too long delays as well as some unnecessary delays. The new building blocks are iicbb_clockin and iicbb_clockout. The former sets SDA and starts the high period of SCL, the latter executes the low period of SCL. What happens during the high phase depends on the operation. For writes we just hold both lines, for reads we poll SDA. S, Sr and P change SDA in the middle of the high period. Also, the calculation of udelay has been updated, so that the resulting period more closely corresponds the requested bus frequency. There is a new knob, io_delay, that allows to further adjust udelay based on the estimated latency of pin toggling operations. Finally, I slightly changed debug tracing and added error indicators to it. The debug prints are compiled in but disabled by default. This can be of use if there is any fallout from this change. Some ideas for further improvements: - add a function for sub-microsecond delays (e.g., in units of 1/10th of a microsecond) and use it for more precise timing of short delays; - account for the actual time spent in the pin I/O. Some sample debug output with the new code follows. Reading temperature and humidity from HTU21 in the bus hold mode: <> <> where '<<' is S, '<' is Sr, '>>' is P, '.' is one millisecond of clock stretching by the slave. Reading temperature and humidity in the no-hold mode: <> <> <> <> <> <> where '+' is Ack and '-' is NoAck. We see that first read attempts are not acknowledged. MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D22206 Modified: head/sys/dev/iicbus/iicbb.c Modified: head/sys/dev/iicbus/iicbb.c ============================================================================== --- head/sys/dev/iicbus/iicbb.c Thu Jun 11 05:28:08 2020 (r362041) +++ head/sys/dev/iicbus/iicbb.c Thu Jun 11 05:34:31 2020 (r362042) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); struct iicbb_softc { device_t iicbus; u_int udelay; /* signal toggle delay in usec */ + u_int io_latency; /* approximate pin toggling latency */ u_int scl_low_timeout; }; @@ -86,6 +87,7 @@ static int iicbb_probe(device_t); static int iicbb_callback(device_t, int, caddr_t); static int iicbb_start(device_t, u_char, int); +static int iicbb_repstart(device_t, u_char, int); static int iicbb_stop(device_t); static int iicbb_write(device_t, const char *, int, int *, int); static int iicbb_read(device_t, char *, int, int *, int, int); @@ -109,7 +111,7 @@ static device_method_t iicbb_methods[] = { /* iicbus interface */ DEVMETHOD(iicbus_callback, iicbb_callback), DEVMETHOD(iicbus_start, iicbb_start), - DEVMETHOD(iicbus_repeated_start, iicbb_start), + DEVMETHOD(iicbus_repeated_start, iicbb_repstart), DEVMETHOD(iicbus_stop, iicbb_stop), DEVMETHOD(iicbus_write, iicbb_write), DEVMETHOD(iicbus_read, iicbb_read), @@ -160,6 +162,11 @@ iicbb_attach(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "scl_low_timeout", CTLFLAG_RWTUN, &sc->scl_low_timeout, 0, "SCL low timeout, microseconds"); + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "io_latency", CTLFLAG_RWTUN, &sc->io_latency, + 0, "Estimate of pin toggling latency, microseconds"); + bus_generic_attach(dev); return (0); } @@ -217,80 +224,105 @@ iicbb_print_child(device_t bus, device_t dev) return (retval); } +#define IICBB_DEBUG +#ifdef IICBB_DEBUG +static int i2c_debug = 0; + +static SYSCTL_NODE(_hw, OID_AUTO, i2c, CTLFLAG_RW, 0, "i2c debug"); +SYSCTL_INT(_hw_i2c, OID_AUTO, iicbb_debug, CTLFLAG_RWTUN, + &i2c_debug, 0, "Enable i2c bit-banging driver debug"); + +#define I2C_DEBUG(x) do { \ + if (i2c_debug) (x); \ + } while (0) +#else +#define I2C_DEBUG(x) +#endif + #define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) #define I2C_SETSDA(dev, x) (IICBB_SETSDA(device_get_parent(dev), x)) #define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) #define I2C_SETSCL(dev, x) (IICBB_SETSCL(device_get_parent(dev), x)) -#define I2C_SET(sc, dev, ctrl, val) do { \ - iicbb_setscl(dev, ctrl); \ - I2C_SETSDA(dev, val); \ - DELAY(sc->udelay); \ - } while (0) - -static int i2c_debug = 0; -#define I2C_DEBUG(x) do { \ - if (i2c_debug) (x); \ - } while (0) - -#define I2C_LOG(format,args...) do { \ - printf(format, args); \ - } while (0) - -static void -iicbb_setscl(device_t dev, int val) +static int +iicbb_waitforscl(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); - sbintime_t now, end; - int fast_timeout; + sbintime_t fast_timeout; + sbintime_t now, timeout; - I2C_SETSCL(dev, val); - DELAY(sc->udelay); - - /* Pulling low cannot fail. */ - if (!val) - return; - - /* Use DELAY for up to 1 ms, then switch to pause. */ - end = sbinuptime() + sc->scl_low_timeout * SBT_1US; - fast_timeout = MIN(sc->scl_low_timeout, 1000); - while (fast_timeout > 0) { + /* Spin for up to 1 ms, then switch to pause. */ + now = sbinuptime(); + fast_timeout = now + SBT_1MS; + timeout = now + sc->scl_low_timeout * SBT_1US; + do { if (I2C_GETSCL(dev)) - return; - I2C_SETSCL(dev, 1); /* redundant ? */ - DELAY(sc->udelay); - fast_timeout -= sc->udelay; - } - - while (!I2C_GETSCL(dev)) { + return (0); now = sbinuptime(); - if (now >= end) - break; + } while (now < fast_timeout); + do { + I2C_DEBUG(printf(".")); pause_sbt("iicbb-scl-low", SBT_1MS, C_PREL(8), 0); - } + if (I2C_GETSCL(dev)) + return (0); + now = sbinuptime(); + } while (now < timeout); + I2C_DEBUG(printf("*")); + return (IIC_ETIMEOUT); } +/* Start the high phase of the clock. */ +static int +iicbb_clockin(device_t dev, int sda) +{ + + /* + * Precondition: SCL is low. + * Action: + * - set SDA to the value; + * - release SCL and wait until it's high. + * The caller is responsible for keeping SCL high for udelay. + * + * There should be a data set-up time, 250 ns minimum, between setting + * SDA and raising SCL. It's expected that the I/O access latency will + * naturally provide that delay. + */ + I2C_SETSDA(dev, sda); + I2C_SETSCL(dev, 1); + return (iicbb_waitforscl(dev)); +} + +/* + * End the high phase of the clock and wait out the low phase + * as nothing interesting happens during it anyway. + */ static void -iicbb_one(device_t dev, int timeout) +iicbb_clockout(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); - I2C_SET(sc,dev,0,1); - I2C_SET(sc,dev,1,1); - I2C_SET(sc,dev,0,1); - return; + /* + * Precondition: SCL is high. + * Action: + * - pull SCL low and hold for udelay. + */ + I2C_SETSCL(dev, 0); + DELAY(sc->udelay); } -static void -iicbb_zero(device_t dev, int timeout) +static int +iicbb_sendbit(device_t dev, int bit) { struct iicbb_softc *sc = device_get_softc(dev); + int err; - I2C_SET(sc,dev,0,0); - I2C_SET(sc,dev,1,0); - I2C_SET(sc,dev,0,0); - return; + err = iicbb_clockin(dev, bit); + if (err != 0) + return (err); + DELAY(sc->udelay); + iicbb_clockout(dev); + return (0); } /* @@ -308,71 +340,84 @@ iicbb_zero(device_t dev, int timeout) * line low and then the SLAVE will release the SDA (data) line. */ static int -iicbb_ack(device_t dev, int timeout) +iicbb_getack(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); - int noack; - int k = 0; + int noack, err; + int t; - I2C_SET(sc,dev,0,1); - I2C_SET(sc,dev,1,1); + /* Release SDA so that the slave can drive it. */ + err = iicbb_clockin(dev, 1); + if (err != 0) { + I2C_DEBUG(printf("! ")); + return (err); + } - /* SCL must be high now. */ - if (!I2C_GETSCL(dev)) - return (IIC_ETIMEOUT); - - do { + /* Sample SDA until ACK (low) or udelay runs out. */ + for (t = 0; t < sc->udelay; t++) { noack = I2C_GETSDA(dev); if (!noack) break; DELAY(1); - k++; - } while (k < timeout); + } - I2C_SET(sc,dev,0,1); - I2C_DEBUG(printf("%c ",noack?'-':'+')); + DELAY(sc->udelay - t); + iicbb_clockout(dev); + I2C_DEBUG(printf("%c ", noack ? '-' : '+')); return (noack ? IIC_ENOACK : 0); } -static void -iicbb_sendbyte(device_t dev, u_char data, int timeout) +static int +iicbb_sendbyte(device_t dev, uint8_t data) { - int i; + int err, i; - for (i=7; i>=0; i--) { - if (data&(1<= 0; i--) { + err = iicbb_sendbit(dev, (data & (1 << i)) != 0); + if (err != 0) { + I2C_DEBUG(printf("w!")); + return (err); } } - I2C_DEBUG(printf("w%02x",(int)data)); - return; + I2C_DEBUG(printf("w%02x", data)); + return (0); } -static u_char -iicbb_readbyte(device_t dev, int last, int timeout) +static int +iicbb_readbyte(device_t dev, bool last, uint8_t *data) { struct iicbb_softc *sc = device_get_softc(dev); - int i; - unsigned char data=0; + int i, err; - I2C_SET(sc,dev,0,1); - for (i=7; i>=0; i--) - { - I2C_SET(sc,dev,1,1); + /* + * Release SDA so that the slave can drive it. + * We do not use iicbb_clockin() here because we need to release SDA + * only once and then we just pulse the SCL. + */ + *data = 0; + I2C_SETSDA(dev, 1); + for (i = 7; i >= 0; i--) { + I2C_SETSCL(dev, 1); + err = iicbb_waitforscl(dev); + if (err != 0) { + I2C_DEBUG(printf("r! ")); + return (err); + } + DELAY((sc->udelay + 1) / 2); if (I2C_GETSDA(dev)) - data |= (1<udelay + 1) / 2); + iicbb_clockout(dev); } - if (last) { - iicbb_one(dev, timeout); - } else { - iicbb_zero(dev, timeout); - } - I2C_DEBUG(printf("r%02x%c ",(int)data,last?'-':'+')); - return (data); + + /* + * Send master->slave ACK (low) for more data, + * NoACK (high) otherwise. + */ + iicbb_sendbit(dev, last); + I2C_DEBUG(printf("r%02x%c ", *data, last ? '-' : '+')); + return (0); } static int @@ -389,63 +434,106 @@ iicbb_reset(device_t dev, u_char speed, u_char addr, u } static int -iicbb_start(device_t dev, u_char slave, int timeout) +iicbb_start_impl(device_t dev, u_char slave, bool repstart) { struct iicbb_softc *sc = device_get_softc(dev); int error; - I2C_DEBUG(printf("<")); + if (!repstart) { + I2C_DEBUG(printf("<<")); - I2C_SET(sc,dev,1,1); + /* SCL must be high on the idle bus. */ + if (iicbb_waitforscl(dev) != 0) { + I2C_DEBUG(printf("C!\n")); + return (IIC_EBUSERR); + } + } else { + I2C_DEBUG(printf("<")); + error = iicbb_clockin(dev, 1); + if (error != 0) + return (error); - /* SCL must be high now. */ - if (!I2C_GETSCL(dev)) - return (IIC_ETIMEOUT); + /* SDA will go low in the middle of the SCL high phase. */ + DELAY((sc->udelay + 1) / 2); + } - I2C_SET(sc,dev,1,0); - I2C_SET(sc,dev,0,0); + /* + * SDA must be high after the earlier stop condition or the end + * of Ack/NoAck pulse. + */ + if (!I2C_GETSDA(dev)) { + I2C_DEBUG(printf("D!\n")); + return (IIC_EBUSERR); + } + /* Start: SDA high->low. */ + I2C_SETSDA(dev, 0); + + /* Wait the second half of the SCL high phase. */ + DELAY((sc->udelay + 1) / 2); + + /* Pull SCL low to keep the bus reserved. */ + iicbb_clockout(dev); + /* send address */ - iicbb_sendbyte(dev, slave, timeout); + error = iicbb_sendbyte(dev, slave); /* check for ack */ - error = iicbb_ack(dev, timeout); if (error == 0) - return (0); - - iicbb_stop(dev); + error = iicbb_getack(dev); + if (error != 0) + (void)iicbb_stop(dev); return (error); } +/* NB: the timeout is ignored. */ static int +iicbb_start(device_t dev, u_char slave, int timeout) +{ + return (iicbb_start_impl(dev, slave, false)); +} + +/* NB: the timeout is ignored. */ +static int +iicbb_repstart(device_t dev, u_char slave, int timeout) +{ + return (iicbb_start_impl(dev, slave, true)); +} + +static int iicbb_stop(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); + int err = 0; - I2C_SET(sc,dev,0,0); - I2C_SET(sc,dev,1,0); - I2C_SET(sc,dev,1,1); - I2C_DEBUG(printf(">")); - I2C_DEBUG(printf("\n")); + /* + * Stop: SDA goes from low to high in the middle of the SCL high phase. + */ + err = iicbb_clockin(dev, 0); + if (err != 0) + return (err); + DELAY((sc->udelay + 1) / 2); + I2C_SETSDA(dev, 1); + DELAY((sc->udelay + 1) / 2); - /* SCL must be high now. */ - if (!I2C_GETSCL(dev)) - return (IIC_ETIMEOUT); - return (0); + I2C_DEBUG(printf("%s>>", err != 0 ? "!" : "")); + I2C_DEBUG(printf("\n")); + return (err); } +/* NB: the timeout is ignored. */ static int iicbb_write(device_t dev, const char *buf, int len, int *sent, int timeout) { int bytes, error = 0; bytes = 0; - while (len) { + while (len > 0) { /* send byte */ - iicbb_sendbyte(dev,(u_char)*buf++, timeout); + iicbb_sendbyte(dev, (uint8_t)*buf++); /* check for ack */ - error = iicbb_ack(dev, timeout); + error = iicbb_getack(dev); if (error != 0) break; bytes++; @@ -456,22 +544,25 @@ iicbb_write(device_t dev, const char *buf, int len, in return (error); } +/* NB: whatever delay is, it's ignored. */ static int -iicbb_read(device_t dev, char * buf, int len, int *read, int last, int delay) +iicbb_read(device_t dev, char *buf, int len, int *read, int last, int delay) { - int bytes; + int bytes = 0; + int err = 0; - bytes = 0; - while (len) { - /* XXX should insert delay here */ - *buf++ = (char)iicbb_readbyte(dev, (len == 1) ? last : 0, delay); - - bytes ++; - len --; + while (len > 0) { + err = iicbb_readbyte(dev, (len == 1) ? last : 0, + (uint8_t *)buf); + if (err != 0) + break; + buf++; + bytes++; + len--; } *read = bytes; - return (0); + return (err); } static int @@ -492,18 +583,15 @@ iicbb_transfer(device_t dev, struct iic_msg *msgs, uin static void iicbb_set_speed(struct iicbb_softc *sc, u_char speed) { - u_int busfreq, period; + u_int busfreq; + int period; /* - * NB: the resulting frequency will be a quarter (even less) of the - * configured bus frequency. This is for historic reasons. The default - * bus frequency is 100 kHz. And the historic default udelay is 10 - * microseconds. The cycle of sending a bit takes four udelay-s plus - * SCL is kept low for extra two udelay-s. The actual I/O toggling also - * has an overhead. + * udelay is half a period, the clock is held high or low for this long. */ busfreq = IICBUS_GET_FREQUENCY(sc->iicbus, speed); - period = 1000000 / busfreq; /* Hz -> uS */ + period = 1000000 / 2 / busfreq; /* Hz -> uS */ + period -= sc->io_latency; sc->udelay = MAX(period, 1); } From owner-svn-src-head@freebsd.org Thu Jun 11 09:36:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCE29328920; Thu, 11 Jun 2020 09:36:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jJdy5bHmz4K0w; Thu, 11 Jun 2020 09:36:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB144160A0; Thu, 11 Jun 2020 09:36:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05B9acDg031022; Thu, 11 Jun 2020 09:36:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05B9acM4031019; Thu, 11 Jun 2020 09:36:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202006110936.05B9acM4031019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Jun 2020 09:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362043 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 362043 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 09:36:38 -0000 Author: hselasky Date: Thu Jun 11 09:36:37 2020 New Revision: 362043 URL: https://svnweb.freebsd.org/changeset/base/362043 Log: Use const keyword when parsing the TCP/IP header in the fast path in mlx5en(4). When parsing the TCP/IP header in the fast path, make it clear by using the const keyword, no fields are to be modified inside the transmitted packet. No functional change. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Thu Jun 11 05:34:31 2020 (r362042) +++ head/sys/dev/mlx5/mlx5_en/en.h Thu Jun 11 09:36:37 2020 (r362043) @@ -1105,7 +1105,7 @@ struct mlx5e_eeprom { #define MLX5E_FLD_MAX(typ, fld) ((1ULL << __mlx5_bit_sz(typ, fld)) - 1ULL) bool mlx5e_do_send_cqe(struct mlx5e_sq *); -int mlx5e_get_full_header_size(struct mbuf *, struct tcphdr **); +int mlx5e_get_full_header_size(const struct mbuf *, const struct tcphdr **); int mlx5e_xmit(struct ifnet *, struct mbuf *); int mlx5e_open_locked(struct ifnet *); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Thu Jun 11 05:34:31 2020 (r362042) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Thu Jun 11 09:36:37 2020 (r362043) @@ -689,7 +689,7 @@ mlx5e_sq_tls_xmit(struct mlx5e_sq *sq, struct mlx5e_xm { struct mlx5e_tls_tag *ptls_tag; struct mlx5e_snd_tag *ptag; - struct tcphdr *th; + const struct tcphdr *th; struct mbuf *mb = *ppmb; u64 rcd_sn; u32 header_size; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 05:34:31 2020 (r362042) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 09:36:37 2020 (r362043) @@ -245,17 +245,17 @@ max_inline: * this function returns zero, the parsing failed. */ int -mlx5e_get_full_header_size(struct mbuf *mb, struct tcphdr **ppth) +mlx5e_get_full_header_size(const struct mbuf *mb, const struct tcphdr **ppth) { - struct ether_vlan_header *eh; - struct tcphdr *th; - struct ip *ip; + const struct ether_vlan_header *eh; + const struct tcphdr *th; + const struct ip *ip; int ip_hlen, tcp_hlen; - struct ip6_hdr *ip6; + const struct ip6_hdr *ip6; uint16_t eth_type; int eth_hdr_len; - eh = mtod(mb, struct ether_vlan_header *); + eh = mtod(mb, const struct ether_vlan_header *); if (mb->m_len < ETHER_HDR_LEN) goto failure; if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { @@ -270,7 +270,7 @@ mlx5e_get_full_header_size(struct mbuf *mb, struct tcp switch (eth_type) { case ETHERTYPE_IP: - ip = (struct ip *)(mb->m_data + eth_hdr_len); + ip = (const struct ip *)(mb->m_data + eth_hdr_len); if (mb->m_len < eth_hdr_len + sizeof(*ip)) goto failure; switch (ip->ip_p) { @@ -288,7 +288,7 @@ mlx5e_get_full_header_size(struct mbuf *mb, struct tcp } break; case ETHERTYPE_IPV6: - ip6 = (struct ip6_hdr *)(mb->m_data + eth_hdr_len); + ip6 = (const struct ip6_hdr *)(mb->m_data + eth_hdr_len); if (mb->m_len < eth_hdr_len + sizeof(*ip6)) goto failure; switch (ip6->ip6_nxt) { @@ -309,7 +309,7 @@ mlx5e_get_full_header_size(struct mbuf *mb, struct tcp tcp_packet: if (mb->m_len < eth_hdr_len + sizeof(*th)) goto failure; - th = (struct tcphdr *)(mb->m_data + eth_hdr_len); + th = (const struct tcphdr *)(mb->m_data + eth_hdr_len); tcp_hlen = th->th_off << 2; eth_hdr_len += tcp_hlen; udp_packet: From owner-svn-src-head@freebsd.org Thu Jun 11 09:38:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E744F328753; Thu, 11 Jun 2020 09:38:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jJhW5pjzz4K8w; Thu, 11 Jun 2020 09:38:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2C9B16026; Thu, 11 Jun 2020 09:38:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05B9cpqB031156; Thu, 11 Jun 2020 09:38:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05B9cpdE031155; Thu, 11 Jun 2020 09:38:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202006110938.05B9cpdE031155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Jun 2020 09:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362044 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 362044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 09:38:52 -0000 Author: hselasky Date: Thu Jun 11 09:38:51 2020 New Revision: 362044 URL: https://svnweb.freebsd.org/changeset/base/362044 Log: Extend use of unlikely() in the fast path, in mlx5en(4). Typically the TCP/IP headers fit within the first mbuf and should not trigger any of the error cases. Use unlikely() for these cases. No functional change. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 09:36:37 2020 (r362043) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 09:38:51 2020 (r362044) @@ -256,10 +256,10 @@ mlx5e_get_full_header_size(const struct mbuf *mb, cons int eth_hdr_len; eh = mtod(mb, const struct ether_vlan_header *); - if (mb->m_len < ETHER_HDR_LEN) + if (unlikely(mb->m_len < ETHER_HDR_LEN)) goto failure; if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { - if (mb->m_len < (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN)) + if (unlikely(mb->m_len < (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN))) goto failure; eth_type = ntohs(eh->evl_proto); eth_hdr_len = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; @@ -271,7 +271,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, cons switch (eth_type) { case ETHERTYPE_IP: ip = (const struct ip *)(mb->m_data + eth_hdr_len); - if (mb->m_len < eth_hdr_len + sizeof(*ip)) + if (unlikely(mb->m_len < eth_hdr_len + sizeof(*ip))) goto failure; switch (ip->ip_p) { case IPPROTO_TCP: @@ -289,7 +289,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, cons break; case ETHERTYPE_IPV6: ip6 = (const struct ip6_hdr *)(mb->m_data + eth_hdr_len); - if (mb->m_len < eth_hdr_len + sizeof(*ip6)) + if (unlikely(mb->m_len < eth_hdr_len + sizeof(*ip6))) goto failure; switch (ip6->ip6_nxt) { case IPPROTO_TCP: @@ -307,7 +307,7 @@ mlx5e_get_full_header_size(const struct mbuf *mb, cons goto failure; } tcp_packet: - if (mb->m_len < eth_hdr_len + sizeof(*th)) + if (unlikely(mb->m_len < eth_hdr_len + sizeof(*th))) goto failure; th = (const struct tcphdr *)(mb->m_data + eth_hdr_len); tcp_hlen = th->th_off << 2; @@ -318,7 +318,7 @@ udp_packet: * does not need to reside within the first m_len bytes of * data: */ - if (mb->m_pkthdr.len < eth_hdr_len) + if (unlikely(mb->m_pkthdr.len < eth_hdr_len)) goto failure; if (ppth != NULL) *ppth = th; From owner-svn-src-head@freebsd.org Thu Jun 11 09:41:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2919A328ADF; Thu, 11 Jun 2020 09:41:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jJm30Mjnz4KBQ; Thu, 11 Jun 2020 09:41:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07E5C16298; Thu, 11 Jun 2020 09:41:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05B9fsxl036983; Thu, 11 Jun 2020 09:41:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05B9fskO036982; Thu, 11 Jun 2020 09:41:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202006110941.05B9fskO036982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Jun 2020 09:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362045 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 362045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 09:41:55 -0000 Author: hselasky Date: Thu Jun 11 09:41:54 2020 New Revision: 362045 URL: https://svnweb.freebsd.org/changeset/base/362045 Log: Make sure packets generated by raw IP code is let through by mlx5en(4). Allow the TCP header to reside in the mbuf following the IP header. Else such packets will get dropped. Backtrace: mlx5e_sq_xmit() mlx5e_xmit() ether_output_frame() ether_output() ip_output_send() ip_output() rip_output() sosend_generic() sosend() kern_sendit() sendit() sys_sendto() amd64_syscall() fast_syscall_common() MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 09:38:51 2020 (r362044) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Jun 11 09:41:54 2020 (r362045) @@ -307,9 +307,15 @@ mlx5e_get_full_header_size(const struct mbuf *mb, cons goto failure; } tcp_packet: - if (unlikely(mb->m_len < eth_hdr_len + sizeof(*th))) - goto failure; - th = (const struct tcphdr *)(mb->m_data + eth_hdr_len); + if (unlikely(mb->m_len < eth_hdr_len + sizeof(*th))) { + const struct mbuf *m_th = mb->m_next; + if (unlikely(mb->m_len != eth_hdr_len || + m_th == NULL || m_th->m_len < sizeof(*th))) + goto failure; + th = (const struct tcphdr *)(m_th->m_data); + } else { + th = (const struct tcphdr *)(mb->m_data + eth_hdr_len); + } tcp_hlen = th->th_off << 2; eth_hdr_len += tcp_hlen; udp_packet: From owner-svn-src-head@freebsd.org Thu Jun 11 10:41:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B39A32A6A7; Thu, 11 Jun 2020 10:41:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jL4t32brz4NTD; Thu, 11 Jun 2020 10:41:34 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 635F216A6D; Thu, 11 Jun 2020 10:41:34 +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 05BAfYjd071240; Thu, 11 Jun 2020 10:41:34 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BAfW32071230; Thu, 11 Jun 2020 10:41:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202006111041.05BAfW32071230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 11 Jun 2020 10:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362047 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 362047 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 10:41:34 -0000 Author: avg Date: Thu Jun 11 10:41:31 2020 New Revision: 362047 URL: https://svnweb.freebsd.org/changeset/base/362047 Log: rework how ZVOLs are updated in response to DSL operations With this change all ZVOL updates are initiated from the SPA sync context instead of a mix of the sync and open contexts. The updates are queued to be applied by a dedicated thread in the original order. This should ensure that ZVOLs always accurately reflect the corresponding datasets. ZFS ioctl operations wait on the mentioned thread to complete its work. Thus, the illusion of the synchronous ZVOL update is preserved. At the same time, the SPA sync thread never blocks on ZVOL related operations avoiding problems like reported in bug 203864. This change is based on earlier work in the same direction: D7179 and D14669 by Anthoine Bourgeois. D7179 tried to perform ZVOL operations in the open context and that opened races between them. D14669 uses a design very similar to this change but with different implementation details. This change also heavily borrows from similar code in ZoL, but there are many differences too. See: - https://github.com/zfsonlinux/zfs/commit/a0bd735adb1b1eb81fef10b4db102ee051c4d4ff - https://github.com/zfsonlinux/zfs/issues/3681 - https://github.com/zfsonlinux/zfs/issues/2217 PR: 203864 MFC after: 5 weeks Sponsored by: CyberSecure Differential Revision: https://reviews.freebsd.org/D23478 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c Thu Jun 11 10:41:31 2020 (r362047) @@ -1053,6 +1053,9 @@ dmu_objset_create_sync(void *arg, dmu_tx_t *tx) doca->doca_cred, tx); } +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, doca->doca_name); +#endif spa_history_log_internal_ds(ds, "create", tx, ""); dsl_dataset_rele(ds, FTAG); dsl_dir_rele(pdd, FTAG); @@ -1148,6 +1151,9 @@ dmu_objset_clone_sync(void *arg, dmu_tx_t *tx) VERIFY0(dsl_dataset_hold_obj(pdd->dd_pool, obj, FTAG, &ds)); dsl_dataset_name(origin, namebuf); +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, doca->doca_clone); +#endif spa_history_log_internal_ds(ds, "clone", tx, "origin=%s (%llu)", namebuf, origin->ds_object); dsl_dataset_rele(ds, FTAG); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Thu Jun 11 10:41:31 2020 (r362047) @@ -57,6 +57,9 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#endif #ifdef __FreeBSD__ #undef dump_write @@ -3445,6 +3448,11 @@ dmu_recv_end_sync(void *arg, dmu_tx_t *tx) drc->drc_newsnapobj = dsl_dataset_phys(drc->drc_ds)->ds_prev_snap_obj; } + +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, drc->drc_tofs); +#endif + /* * Release the hold from dmu_recv_begin. This must be done before * we return to open context, so that when we free the dataset's dnode, Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jun 11 10:41:31 2020 (r362047) @@ -1572,6 +1572,9 @@ dsl_dataset_snapshot_sync(void *arg, dmu_tx_t *tx) dsl_props_set_sync_impl(ds->ds_prev, ZPROP_SRC_LOCAL, ddsa->ddsa_props, tx); } +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_create_minors(dp->dp_spa, name); +#endif dsl_dataset_rele(ds, FTAG); } } @@ -1646,17 +1649,6 @@ dsl_dataset_snapshot(nvlist_t *snaps, nvlist_t *props, fnvlist_free(suspended); } -#ifdef __FreeBSD__ -#ifdef _KERNEL - if (error == 0) { - for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL; - pair = nvlist_next_nvpair(snaps, pair)) { - char *snapname = nvpair_name(pair); - zvol_create_minors(snapname); - } - } -#endif -#endif return (error); } @@ -2535,7 +2527,7 @@ dsl_dataset_rename_snapshot_sync_impl(dsl_pool_t *dp, snprintf(newname, ZFS_MAX_DATASET_NAME_LEN, "%s@%s", ddrsa->ddrsa_fsname, ddrsa->ddrsa_newsnapname); zfsvfs_update_fromname(oldname, newname); - zvol_rename_minors(oldname, newname); + zvol_rename_minors(dp->dp_spa, oldname, newname); kmem_free(newname, ZFS_MAX_DATASET_NAME_LEN); kmem_free(oldname, ZFS_MAX_DATASET_NAME_LEN); #endif @@ -3087,9 +3079,6 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx) } #if defined(__FreeBSD__) && defined(_KERNEL) - /* Take the spa_namespace_lock early so zvol renames don't deadlock. */ - mutex_enter(&spa_namespace_lock); - oldname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); newname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP); #endif @@ -3135,7 +3124,7 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx) #if defined(__FreeBSD__) && defined(_KERNEL) dsl_dataset_name(ds, newname); zfsvfs_update_fromname(oldname, newname); - zvol_rename_minors(oldname, newname); + zvol_rename_minors(dp->dp_spa, oldname, newname); #endif /* move any clone references */ @@ -3177,8 +3166,6 @@ dsl_dataset_promote_sync(void *arg, dmu_tx_t *tx) } #if defined(__FreeBSD__) && defined(_KERNEL) - mutex_exit(&spa_namespace_lock); - kmem_free(newname, ZFS_MAX_DATASET_NAME_LEN); kmem_free(oldname, ZFS_MAX_DATASET_NAME_LEN); #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c Thu Jun 11 10:41:31 2020 (r362047) @@ -43,7 +43,11 @@ #include #include #include +#if defined(__FreeBSD__) && defined(_KERNEL) +#include +#endif + int dsl_destroy_snapshot_check_impl(dsl_dataset_t *ds, boolean_t defer) { @@ -489,6 +493,14 @@ dsl_destroy_snapshot_sync_impl(dsl_dataset_t *ds, bool if (dsl_dataset_phys(ds)->ds_userrefs_obj != 0) VERIFY0(zap_destroy(mos, dsl_dataset_phys(ds)->ds_userrefs_obj, tx)); + +#if defined(__FreeBSD__) && defined(_KERNEL) + char dsname[ZFS_MAX_DATASET_NAME_LEN]; + + dsl_dataset_name(ds, dsname); + zvol_remove_minors(dp->dp_spa, dsname); +#endif + dsl_dir_rele(ds->ds_dir, ds); ds->ds_dir = NULL; dmu_object_free_zapified(mos, obj, tx); @@ -979,6 +991,9 @@ dsl_destroy_head_sync(void *arg, dmu_tx_t *tx) VERIFY0(dsl_dataset_hold(dp, ddha->ddha_name, FTAG, &ds)); dsl_destroy_head_sync_impl(ds, tx); +#if defined(__FreeBSD__) && defined(_KERNEL) + zvol_remove_minors(dp->dp_spa, ddha->ddha_name); +#endif dsl_dataset_rele(ds, FTAG); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jun 11 10:41:31 2020 (r362047) @@ -2093,7 +2093,7 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx) #ifdef __FreeBSD__ #ifdef _KERNEL zfsvfs_update_fromname(ddra->ddra_oldname, ddra->ddra_newname); - zvol_rename_minors(ddra->ddra_oldname, ddra->ddra_newname); + zvol_rename_minors(dp->dp_spa, ddra->ddra_oldname, ddra->ddra_newname); #endif #endif Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jun 11 10:41:31 2020 (r362047) @@ -32,6 +32,7 @@ * Copyright (c) 2017, Intel Corporation. * Copyright (c) 2017 Datto Inc. * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ /* @@ -1280,6 +1281,24 @@ spa_activate(spa_t *spa, int mode) */ trim_thread_create(spa); + /* + * This taskq is used to perform zvol-minor-related tasks + * asynchronously. This has several advantages, including easy + * resolution of various deadlocks (zfsonlinux bug #3681). + * + * The taskq must be single threaded to ensure tasks are always + * processed in the order in which they were dispatched. + * + * A taskq per pool allows one to keep the pools independent. + * This way if one pool is suspended, it will not impact another. + * + * The preferred location to dispatch a zvol minor task is a sync + * task. In this context, there is easy access to the spa_t and minimal + * error handling is required because the sync task must succeed. + */ + spa->spa_zvol_taskq = taskq_create("z_zvol", 1, minclsyspri, + 1, INT_MAX, 0); + for (size_t i = 0; i < TXG_SIZE; i++) { spa->spa_txg_zio[i] = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); @@ -1323,6 +1342,11 @@ spa_deactivate(spa_t *spa) spa_evicting_os_wait(spa); + if (spa->spa_zvol_taskq) { + taskq_destroy(spa->spa_zvol_taskq); + spa->spa_zvol_taskq = NULL; + } + txg_list_destroy(&spa->spa_vdev_txg_list); list_destroy(&spa->spa_config_dirty_list); @@ -4614,7 +4638,7 @@ spa_open_common(const char *pool, spa_t **spapp, void #ifdef __FreeBSD__ #ifdef _KERNEL if (firstopen) - zvol_create_minors(spa->spa_name); + zvol_create_minors(spa, spa->spa_name); #endif #endif } @@ -5970,7 +5994,7 @@ spa_import(const char *pool, nvlist_t *config, nvlist_ #ifdef __FreeBSD__ #ifdef _KERNEL - zvol_create_minors(pool); + zvol_create_minors(spa, pool); #endif #endif return (0); @@ -6119,6 +6143,10 @@ spa_export_common(char *pool, int new_state, nvlist_t spa_open_ref(spa, FTAG); mutex_exit(&spa_namespace_lock); spa_async_suspend(spa); + if (spa->spa_zvol_taskq) { + zvol_remove_minors(spa, spa_name(spa)); + taskq_wait(spa->spa_zvol_taskq); + } mutex_enter(&spa_namespace_lock); spa_close(spa, FTAG); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Thu Jun 11 10:41:31 2020 (r362047) @@ -27,6 +27,7 @@ * Copyright 2013 Saso Kiselkov. All rights reserved. * Copyright (c) 2017 Datto Inc. * Copyright (c) 2017, Intel Corporation. + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ #ifndef _SYS_SPA_IMPL_H @@ -398,6 +399,8 @@ struct spa { uint64_t spa_lowmem_last_txg; /* txg window start */ hrtime_t spa_ccw_fail_time; /* Conf cache write fail time */ + + taskq_t *spa_zvol_taskq; /* Taskq for minor management */ uint64_t spa_multihost; /* multihost aware (mmp) */ mmp_thread_t spa_mmp; /* multihost mmp thread */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h Thu Jun 11 10:41:31 2020 (r362047) @@ -21,6 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ #ifndef _SYS_ZVOL_H @@ -40,9 +41,6 @@ extern int zvol_check_volsize(uint64_t volsize, uint64 extern int zvol_check_volblocksize(uint64_t volblocksize); extern int zvol_get_stats(objset_t *os, nvlist_t *nv); extern void zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx); -extern int zvol_create_minor(const char *); -extern int zvol_remove_minor(const char *); -extern void zvol_remove_minors(const char *); extern int zvol_set_volsize(const char *, uint64_t); #ifdef illumos @@ -72,8 +70,10 @@ extern void zvol_log_write_minor(void *minor_hdl, dmu_ #endif /* illumos */ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -extern int zvol_create_minors(const char *name); -extern void zvol_rename_minors(const char *oldname, const char *newname); +extern void zvol_create_minors(spa_t *spa, const char *name); +extern void zvol_remove_minors(spa_t *spa, const char *name); +extern void zvol_rename_minors(spa_t *spa, const char *oldname, + const char *newname); #endif #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jun 11 10:41:31 2020 (r362047) @@ -1642,8 +1642,10 @@ zfs_ioc_pool_destroy(zfs_cmd_t *zc) int error; zfs_log_history(zc); error = spa_destroy(zc->zc_name); +#ifndef __FreeBSD__ if (error == 0) zvol_remove_minors(zc->zc_name); +#endif return (error); } @@ -1694,8 +1696,10 @@ zfs_ioc_pool_export(zfs_cmd_t *zc) zfs_log_history(zc); error = spa_export(zc->zc_name, NULL, force, hardforce); +#ifndef __FreeBSD__ if (error == 0) zvol_remove_minors(zc->zc_name); +#endif return (error); } @@ -3395,13 +3399,23 @@ zfs_ioc_create(const char *fsname, nvlist_t *innvl, nv if (error == 0) { error = zfs_set_prop_nvlist(fsname, ZPROP_SRC_LOCAL, nvprops, outnvl); +#if defined(__FreeBSD__) && defined(_KERNEL) + /* + * Wait for ZVOL operations to settle down before destroying. + */ + if (error != 0) { + spa_t *spa; + + if (spa_open(fsname, &spa, FTAG) == 0) { + taskqueue_drain_all( + spa->spa_zvol_taskq->tq_queue); + spa_close(spa, FTAG); + } + } +#endif if (error != 0) (void) dsl_destroy_head(fsname); } -#ifdef __FreeBSD__ - if (error == 0 && type == DMU_OST_ZVOL) - zvol_create_minors(fsname); -#endif return (error); } @@ -3443,10 +3457,6 @@ zfs_ioc_clone(const char *fsname, nvlist_t *innvl, nvl if (error != 0) (void) dsl_destroy_head(fsname); } -#ifdef __FreeBSD__ - if (error == 0) - zvol_create_minors(fsname); -#endif return (error); } @@ -3738,9 +3748,6 @@ zfs_ioc_destroy_snaps(const char *poolname, nvlist_t * return (SET_ERROR(EXDEV)); zfs_unmount_snap(nvpair_name(pair)); -#if defined(__FreeBSD__) - zvol_remove_minors(name); -#endif } return (dsl_destroy_snapshots_nvl(snaps, defer, outnvl)); @@ -3924,10 +3931,8 @@ zfs_ioc_destroy(zfs_cmd_t *zc) err = dsl_destroy_snapshot(zc->zc_name, zc->zc_defer_destroy); else err = dsl_destroy_head(zc->zc_name); +#ifndef __FreeBSD__ if (ost == DMU_OST_ZVOL && err == 0) -#ifdef __FreeBSD__ - zvol_remove_minors(zc->zc_name); -#else (void) zvol_remove_minor(zc->zc_name); #endif return (err); @@ -4822,11 +4827,6 @@ zfs_ioc_recv(zfs_cmd_t *zc) } #endif -#ifdef __FreeBSD__ - if (error == 0) - zvol_create_minors(tofs); -#endif - /* * On error, restore the original props. */ @@ -6967,6 +6967,24 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar out: nvlist_free(innvl); + +#if defined(__FreeBSD__) && defined(_KERNEL) + /* + * Wait for ZVOL changes to get applied. + * NB: taskqueue_drain_all() does less than taskq_wait(), + * but enough for what we want. + * And there is no equivalent illumos API. + */ + if (error == 0) { + spa_t *spa; + + if (spa_open(saved_poolname, &spa, FTAG) == 0) { + taskqueue_drain_all( + spa->spa_zvol_taskq->tq_queue); + spa_close(spa, FTAG); + } + } +#endif #ifdef illumos rc = ddi_copyout(zc, (void *)arg, sizeof (zfs_cmd_t), flag); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Jun 11 10:00:56 2020 (r362046) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Jun 11 10:41:31 2020 (r362047) @@ -30,6 +30,7 @@ * Copyright (c) 2012, 2017 by Delphix. All rights reserved. * Copyright (c) 2013, Joyent, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2016 Actifio, Inc. All rights reserved. */ /* Portions Copyright 2011 Martin Matuska */ @@ -185,6 +186,20 @@ typedef struct zvol_state { #endif } zvol_state_t; +typedef enum { + ZVOL_ASYNC_CREATE_MINORS, + ZVOL_ASYNC_REMOVE_MINORS, + ZVOL_ASYNC_RENAME_MINORS, + ZVOL_ASYNC_MAX +} zvol_async_op_t; + +typedef struct { + zvol_async_op_t op; + char pool[ZFS_MAX_DATASET_NAME_LEN]; + char name1[ZFS_MAX_DATASET_NAME_LEN]; + char name2[ZFS_MAX_DATASET_NAME_LEN]; +} zvol_task_t; + #ifndef illumos static LIST_HEAD(, zvol_state) all_zvols; #endif @@ -607,7 +622,7 @@ zvol_name2minor(const char *name, minor_t *minor) /* * Create a minor node (plus a whole lot more) for the specified volume. */ -int +static int zvol_create_minor(const char *name) { zfs_soft_state_t *zs; @@ -691,7 +706,6 @@ zvol_create_minor(const char *name) if (error != 0 || mode == ZFS_VOLMODE_DEFAULT) mode = volmode; - DROP_GIANT(); zv->zv_volmode = mode; if (zv->zv_volmode == ZFS_VOLMODE_GEOM) { g_topology_lock(); @@ -766,7 +780,6 @@ zvol_create_minor(const char *name) zvol_geom_run(zv); g_topology_unlock(); } - PICKUP_GIANT(); ZFS_LOG(1, "ZVOL %s created.", name); #endif @@ -820,22 +833,6 @@ zvol_remove_zv(zvol_state_t *zv) } int -zvol_remove_minor(const char *name) -{ - zvol_state_t *zv; - int rc; - - mutex_enter(&zfsdev_state_lock); - if ((zv = zvol_minor_lookup(name)) == NULL) { - mutex_exit(&zfsdev_state_lock); - return (SET_ERROR(ENXIO)); - } - rc = zvol_remove_zv(zv); - mutex_exit(&zfsdev_state_lock); - return (rc); -} - -int zvol_first_open(zvol_state_t *zv) { dmu_object_info_t doi; @@ -976,7 +973,7 @@ zvol_update_volsize(objset_t *os, uint64_t volsize) } void -zvol_remove_minors(const char *name) +zvol_remove_minors_impl(const char *name) { #ifdef illumos zvol_state_t *zv; @@ -1004,7 +1001,6 @@ zvol_remove_minors(const char *name) namelen = strlen(name); - DROP_GIANT(); mutex_enter(&zfsdev_state_lock); LIST_FOREACH_SAFE(zv, &all_zvols, zv_links, tzv) { @@ -1017,7 +1013,6 @@ zvol_remove_minors(const char *name) } mutex_exit(&zfsdev_state_lock); - PICKUP_GIANT(); #endif /* illumos */ } @@ -2920,7 +2915,7 @@ zvol_create_snapshots(objset_t *os, const char *name) } int -zvol_create_minors(const char *name) +zvol_create_minors_impl(const char *name) { uint64_t cookie; objset_t *os; @@ -2976,7 +2971,7 @@ zvol_create_minors(const char *name) while (dmu_dir_list_next(os, MAXPATHLEN - (p - osname), p, NULL, &cookie) == 0) { dmu_objset_rele(os, FTAG); - (void)zvol_create_minors(osname); + (void)zvol_create_minors_impl(osname); if ((error = dmu_objset_hold(name, FTAG, &os)) != 0) { printf("ZFS WARNING: Unable to put hold on %s (error=%d).\n", name, error); @@ -3045,7 +3040,7 @@ zvol_rename_minor(zvol_state_t *zv, const char *newnam } void -zvol_rename_minors(const char *oldname, const char *newname) +zvol_rename_minors_impl(const char *oldname, const char *newname) { char name[MAXPATHLEN]; struct g_provider *pp; @@ -3058,7 +3053,6 @@ zvol_rename_minors(const char *oldname, const char *ne oldnamelen = strlen(oldname); newnamelen = strlen(newname); - DROP_GIANT(); /* See comment in zvol_open(). */ if (!MUTEX_HELD(&zfsdev_state_lock)) { mutex_enter(&zfsdev_state_lock); @@ -3080,7 +3074,88 @@ zvol_rename_minors(const char *oldname, const char *ne if (locked) mutex_exit(&zfsdev_state_lock); - PICKUP_GIANT(); +} + +static zvol_task_t * +zvol_task_alloc(zvol_async_op_t op, const char *name1, const char *name2) +{ + zvol_task_t *task; + char *delim; + + task = kmem_zalloc(sizeof (zvol_task_t), KM_SLEEP); + task->op = op; + delim = strchr(name1, '/'); + strlcpy(task->pool, name1, delim ? (delim - name1 + 1) : MAXNAMELEN); + + strlcpy(task->name1, name1, MAXNAMELEN); + if (name2 != NULL) + strlcpy(task->name2, name2, MAXNAMELEN); + + return (task); +} + +static void +zvol_task_free(zvol_task_t *task) +{ + kmem_free(task, sizeof (zvol_task_t)); +} + +/* + * The worker thread function performed asynchronously. + */ +static void +zvol_task_cb(void *param) +{ + zvol_task_t *task = (zvol_task_t *)param; + + switch (task->op) { + case ZVOL_ASYNC_CREATE_MINORS: + (void) zvol_create_minors_impl(task->name1); + break; + case ZVOL_ASYNC_REMOVE_MINORS: + zvol_remove_minors_impl(task->name1); + break; + case ZVOL_ASYNC_RENAME_MINORS: + zvol_rename_minors_impl(task->name1, task->name2); + break; + default: + VERIFY(0); + break; + } + + zvol_task_free(task); +} + +static void +zvol_minors_helper(spa_t *spa, zvol_async_op_t op, const char *name1, + const char *name2) +{ + zvol_task_t *task; + + if (dataset_name_hidden(name1)) + return; + if (name2 != NULL && dataset_name_hidden(name2)) + return; + task = zvol_task_alloc(op, name1, name2); + (void)taskq_dispatch(spa->spa_zvol_taskq, zvol_task_cb, task, TQ_SLEEP); +} + +void +zvol_create_minors(spa_t *spa, const char *name) +{ + zvol_minors_helper(spa, ZVOL_ASYNC_CREATE_MINORS, name, NULL); +} + +void +zvol_remove_minors(spa_t *spa, const char *name) +{ + zvol_minors_helper(spa, ZVOL_ASYNC_REMOVE_MINORS, name, NULL); +} + +void +zvol_rename_minors(spa_t *spa, const char *oldname, const char *newname) +{ + zvol_minors_helper(spa, ZVOL_ASYNC_RENAME_MINORS, oldname, newname); } static int From owner-svn-src-head@freebsd.org Thu Jun 11 11:35:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9BFB32B9A2; Thu, 11 Jun 2020 11:35:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jMH651qYz4Rhn; Thu, 11 Jun 2020 11:35:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A7A78175AA; Thu, 11 Jun 2020 11:35:30 +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 05BBZUje005244; Thu, 11 Jun 2020 11:35:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BBZUVe005243; Thu, 11 Jun 2020 11:35:30 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202006111135.05BBZUVe005243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 11 Jun 2020 11:35:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362048 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 362048 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 11:35:30 -0000 Author: avg Date: Thu Jun 11 11:35:30 2020 New Revision: 362048 URL: https://svnweb.freebsd.org/changeset/base/362048 Log: fix up r362047: a call to zvol_*_minors() was not hidden from userland Reported by: CI/FreeBSD-head-powerpc64-build MFC after: 5 weeks X-MFC with: r362047 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jun 11 10:41:31 2020 (r362047) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Jun 11 11:35:30 2020 (r362048) @@ -6144,7 +6144,9 @@ spa_export_common(char *pool, int new_state, nvlist_t mutex_exit(&spa_namespace_lock); spa_async_suspend(spa); if (spa->spa_zvol_taskq) { +#ifdef _KERNEL zvol_remove_minors(spa, spa_name(spa)); +#endif taskq_wait(spa->spa_zvol_taskq); } mutex_enter(&spa_namespace_lock); From owner-svn-src-head@freebsd.org Thu Jun 11 12:25:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E637B32DD45; Thu, 11 Jun 2020 12:25:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jNP95XzXz4WXC; Thu, 11 Jun 2020 12:25:49 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B7BC1181D6; Thu, 11 Jun 2020 12:25:49 +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 05BCPnT2036829; Thu, 11 Jun 2020 12:25:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BCPnC4036827; Thu, 11 Jun 2020 12:25:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006111225.05BCPnC4036827@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 11 Jun 2020 12:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362051 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 12:25:50 -0000 Author: trasz Date: Thu Jun 11 12:25:49 2020 New Revision: 362051 URL: https://svnweb.freebsd.org/changeset/base/362051 Log: Make linux(4) handle SO_REUSEPORT. Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25216 Modified: head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Thu Jun 11 11:45:30 2020 (r362050) +++ head/sys/compat/linux/linux_socket.c Thu Jun 11 12:25:49 2020 (r362051) @@ -223,6 +223,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_OOBINLINE); case LINUX_SO_LINGER: return (SO_LINGER); + case LINUX_SO_REUSEPORT: + return (SO_REUSEPORT_LB); case LINUX_SO_PEERCRED: return (LOCAL_PEERCRED); case LINUX_SO_RCVLOWAT: Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Thu Jun 11 11:45:30 2020 (r362050) +++ head/sys/compat/linux/linux_socket.h Thu Jun 11 12:25:49 2020 (r362051) @@ -190,6 +190,7 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_SO_NO_CHECK 11 #define LINUX_SO_PRIORITY 12 #define LINUX_SO_LINGER 13 +#define LINUX_SO_REUSEPORT 15 #ifndef LINUX_SO_PASSCRED /* powerpc differs */ #define LINUX_SO_PASSCRED 16 #define LINUX_SO_PEERCRED 17 From owner-svn-src-head@freebsd.org Thu Jun 11 12:35:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 354E532E54A; Thu, 11 Jun 2020 12:35:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jNbn0hLnz4XMx; Thu, 11 Jun 2020 12:35:01 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10BED1840F; Thu, 11 Jun 2020 12:35:01 +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 05BCZ0c2043327; Thu, 11 Jun 2020 12:35:00 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BCZ0sk043326; Thu, 11 Jun 2020 12:35:00 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006111235.05BCZ0sk043326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 11 Jun 2020 12:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362052 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 12:35:01 -0000 Author: trasz Date: Thu Jun 11 12:35:00 2020 New Revision: 362052 URL: https://svnweb.freebsd.org/changeset/base/362052 Log: Improve the warnings. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Thu Jun 11 12:25:49 2020 (r362051) +++ head/sys/compat/linux/linux_futex.c Thu Jun 11 12:35:00 2020 (r362052) @@ -1010,9 +1010,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_LOCK_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_lock_pi); @@ -1024,9 +1022,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_UNLOCK_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_unlock_pi); @@ -1038,9 +1034,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_TRYLOCK_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_trylock_pi); @@ -1057,9 +1051,7 @@ retry2: */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XDEPR_REQUEUEOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_requeue op\n"); + linux_msg(td, "unsupported FUTEX_REQUEUE"); pem->flags |= LINUX_XDEPR_REQUEUEOP; LIN_SDT_PROBE0(futex, linux_sys_futex, deprecated_requeue); @@ -1072,9 +1064,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_WAIT_REQUEUE_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_wait_requeue_pi); @@ -1086,9 +1076,7 @@ retry2: /* not yet implemented */ pem = pem_find(td->td_proc); if ((pem->flags & LINUX_XUNSUP_FUTEXPIOP) == 0) { - linux_msg(td, - "linux_sys_futex: " - "unsupported futex_pi op\n"); + linux_msg(td, "unsupported FUTEX_CMP_REQUEUE_PI"); pem->flags |= LINUX_XUNSUP_FUTEXPIOP; LIN_SDT_PROBE0(futex, linux_sys_futex, unimplemented_cmp_requeue_pi); @@ -1097,8 +1085,7 @@ retry2: return (ENOSYS); default: - linux_msg(td, - "linux_sys_futex: unknown op %d\n", args->op); + linux_msg(td, "unsupported futex op %d\n", args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, unknown_operation, args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); From owner-svn-src-head@freebsd.org Thu Jun 11 12:53:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9295432F0B4; Thu, 11 Jun 2020 12:53:22 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jP0y3JxZz4Yds; Thu, 11 Jun 2020 12:53:22 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C92C185C9; Thu, 11 Jun 2020 12:53:22 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BCrMKg055683; Thu, 11 Jun 2020 12:53:22 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BCrMn7055682; Thu, 11 Jun 2020 12:53:22 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202006111253.05BCrMn7055682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Thu, 11 Jun 2020 12:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362053 - head/sys/arm/nvidia X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/nvidia X-SVN-Commit-Revision: 362053 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 12:53:22 -0000 Author: mmel Date: Thu Jun 11 12:53:22 2020 New Revision: 362053 URL: https://svnweb.freebsd.org/changeset/base/362053 Log: Fix grabbing of tegra uart. An attempt to write to FCR register may corrupt transmit FIFO, so we should wait for the FIFO to be empty before we can modify it. MFC after: 1 week Modified: head/sys/arm/nvidia/tegra_uart.c Modified: head/sys/arm/nvidia/tegra_uart.c ============================================================================== --- head/sys/arm/nvidia/tegra_uart.c Thu Jun 11 12:35:00 2020 (r362052) +++ head/sys/arm/nvidia/tegra_uart.c Thu Jun 11 12:53:22 2020 (r362053) @@ -102,6 +102,10 @@ tegra_uart_grab(struct uart_softc *sc) uart_lock(sc->sc_hwmtx); ier = uart_getreg(bas, REG_IER); uart_setreg(bas, REG_IER, ier & ns8250->ier_mask); + + while ((uart_getreg(bas, REG_LSR) & LSR_TEMT) == 0) + ; + uart_setreg(bas, REG_FCR, 0); uart_barrier(bas); uart_unlock(sc->sc_hwmtx); From owner-svn-src-head@freebsd.org Thu Jun 11 13:34:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA3D933104C; Thu, 11 Jun 2020 13:34:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jPw35vddz4djX; Thu, 11 Jun 2020 13:34:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C5CBE18EAD; Thu, 11 Jun 2020 13:34:11 +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 05BDYB7u081056; Thu, 11 Jun 2020 13:34:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BDY9pd081046; Thu, 11 Jun 2020 13:34:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006111334.05BDY9pd081046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 11 Jun 2020 13:34:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362054 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 13:34:11 -0000 Author: tuexen Date: Thu Jun 11 13:34:09 2020 New Revision: 362054 URL: https://svnweb.freebsd.org/changeset/base/362054 Log: Non-functional changes due to upstream cleanup. MFC after: 1 week Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_auth.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_peeloff.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_asconf.c Thu Jun 11 13:34:09 2020 (r362054) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); * SCTP_DEBUG_ASCONF2: detailed info */ - /* * RFC 5061 * Modified: head/sys/netinet/sctp_auth.c ============================================================================== --- head/sys/netinet/sctp_auth.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_auth.c Thu Jun 11 13:34:09 2020 (r362054) @@ -565,9 +565,7 @@ sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t } void -sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked - SCTP_UNUSED -) +sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked) { sctp_sharedkey_t *skey; @@ -1718,9 +1716,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_au */ void sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, - uint16_t keyid, uint16_t alt_keyid, int so_locked - SCTP_UNUSED -) + uint16_t keyid, uint16_t alt_keyid, int so_locked) { struct mbuf *m_notify; struct sctp_authkey_event *auth; Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_input.c Thu Jun 11 13:34:09 2020 (r362054) @@ -55,8 +55,6 @@ __FBSDID("$FreeBSD$"); #endif #include - - static void sctp_stop_all_cookie_timers(struct sctp_tcb *stcb) { @@ -213,9 +211,7 @@ outnow: */ int -sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked - SCTP_UNUSED -) +sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked) { int unsent_data; unsigned int i; Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_output.c Thu Jun 11 13:34:09 2020 (r362054) @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include - #define SCTP_MAX_GAPS_INARRAY 4 struct sack_track { uint8_t right_edge; /* mergable on the right edge */ @@ -3990,8 +3989,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, uint16_t port, union sctp_sockstore *over_addr, uint8_t mflowtype, uint32_t mflowid, - int so_locked SCTP_UNUSED -) + int so_locked) { /* nofragment_flag to tell if IP_DF should be set (IPv4 only) */ /** @@ -4636,9 +4634,7 @@ sctp_lowlevel_chunk_output(struct sctp_inpcb *inp, void -sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked - SCTP_UNUSED -) +sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int so_locked) { struct mbuf *m, *m_last; struct sctp_nets *net; @@ -6572,9 +6568,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *num_out, int *reason_code, int control_only, int from_where, - struct timeval *now, int *now_filled, int frag_point, int so_locked - SCTP_UNUSED -); + struct timeval *now, int *now_filled, int frag_point, int so_locked); static void sctp_sendall_iterator(struct sctp_inpcb *inp, struct sctp_tcb *stcb, void *ptr, @@ -7034,9 +7028,7 @@ all_done: } static void -sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked - SCTP_UNUSED -) +sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked) { struct sctp_tmit_chunk *chk, *nchk; @@ -7141,9 +7133,7 @@ sctp_move_to_outqueue(struct sctp_tcb *stcb, int *giveup, int eeor_mode, int *bail, - int so_locked - SCTP_UNUSED -) + int so_locked) { /* Move from the stream to the send_queue keeping track of the total */ struct sctp_association *asoc; @@ -7670,9 +7660,7 @@ out_of: static void sctp_fill_outqueue(struct sctp_tcb *stcb, - struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked - SCTP_UNUSED -) + struct sctp_nets *net, int frag_point, int eeor_mode, int *quit_now, int so_locked) { struct sctp_association *asoc; struct sctp_stream_out *strq; @@ -7791,9 +7779,7 @@ sctp_med_chunk_output(struct sctp_inpcb *inp, int *num_out, int *reason_code, int control_only, int from_where, - struct timeval *now, int *now_filled, int frag_point, int so_locked - SCTP_UNUSED -) + struct timeval *now, int *now_filled, int frag_point, int so_locked) { /** * Ok this is the generic chunk service queue. we must do the @@ -9408,9 +9394,7 @@ static int sctp_chunk_retransmission(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_association *asoc, - int *cnt_out, struct timeval *now, int *now_filled, int *fr_done, int so_locked - SCTP_UNUSED -) + int *cnt_out, struct timeval *now, int *now_filled, int *fr_done, int so_locked) { /*- * send out one MTU of retransmission. If fast_retransmit is @@ -9959,9 +9943,7 @@ void sctp_chunk_output(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_where, - int so_locked - SCTP_UNUSED -) + int so_locked) { /*- * Ok this is the generic chunk service queue. we must do the @@ -10478,9 +10460,7 @@ sctp_fill_in_rest: } void -sctp_send_sack(struct sctp_tcb *stcb, int so_locked - SCTP_UNUSED -) +sctp_send_sack(struct sctp_tcb *stcb, int so_locked) { /*- * Queue up a SACK or NR-SACK in the control queue. @@ -10874,9 +10854,7 @@ sctp_send_sack(struct sctp_tcb *stcb, int so_locked } void -sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked - SCTP_UNUSED -) +sctp_send_abort_tcb(struct sctp_tcb *stcb, struct mbuf *operr, int so_locked) { struct mbuf *m_abort, *m, *m_last; struct mbuf *m_out, *m_end = NULL; @@ -11292,9 +11270,7 @@ sctp_send_shutdown_complete2(struct sockaddr *src, str } void -sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked - SCTP_UNUSED -) +sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked) { struct sctp_tmit_chunk *chk; struct sctp_heartbeat_chunk *hb; Modified: head/sys/netinet/sctp_output.h ============================================================================== --- head/sys/netinet/sctp_output.h Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_output.h Thu Jun 11 13:34:09 2020 (r362054) @@ -74,10 +74,7 @@ int int sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t *ro); -void -sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int - SCTP_UNUSED -); +void sctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int); void sctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *, @@ -144,15 +141,10 @@ int sctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *, struct mbuf *, struct thread *, int); -void -sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int - SCTP_UNUSED -); -void -sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int - SCTP_UNUSED -); +void sctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int); +void sctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int); + void send_forward_tsn(struct sctp_tcb *, struct sctp_association *); void sctp_send_sack(struct sctp_tcb *, int); @@ -160,7 +152,6 @@ void sctp_send_sack(struct sctp_tcb *, int); void sctp_send_hb(struct sctp_tcb *, struct sctp_nets *, int); void sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t); - void sctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *, Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_pcb.c Thu Jun 11 13:34:09 2020 (r362054) @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); #include #include - VNET_DEFINE(struct sctp_base_info, system_base_info); /* FIX: we don't handle multiple link local scopes */ Modified: head/sys/netinet/sctp_peeloff.c ============================================================================== --- head/sys/netinet/sctp_peeloff.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_peeloff.c Thu Jun 11 13:34:09 2020 (r362054) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include - int sctp_can_peel_off(struct socket *head, sctp_assoc_t assoc_id) { Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_timer.c Thu Jun 11 13:34:09 2020 (r362054) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include #endif - void sctp_audit_retranmission_queue(struct sctp_association *asoc) { Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctp_usrreq.c Thu Jun 11 13:34:09 2020 (r362054) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include - extern const struct sctp_cc_functions sctp_cc_functions[]; extern const struct sctp_ss_functions sctp_ss_functions[]; Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctputil.c Thu Jun 11 13:34:09 2020 (r362054) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include #endif - #ifndef KTR_SCTP #define KTR_SCTP KTR_SUBSYS #endif @@ -3117,9 +3116,7 @@ sctp_pad_lastmbuf(struct mbuf *m, int padval, struct m static void sctp_notify_assoc_change(uint16_t state, struct sctp_tcb *stcb, - uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked - SCTP_UNUSED -) + uint16_t error, struct sctp_abort_chunk *abort, uint8_t from_peer, int so_locked) { struct mbuf *m_notify; struct sctp_assoc_change *sac; @@ -3254,9 +3251,7 @@ set_error: static void sctp_notify_peer_addr_change(struct sctp_tcb *stcb, uint32_t state, - struct sockaddr *sa, uint32_t error, int so_locked - SCTP_UNUSED -) + struct sockaddr *sa, uint32_t error, int so_locked) { struct mbuf *m_notify; struct sctp_paddr_change *spc; @@ -3345,9 +3340,7 @@ sctp_notify_peer_addr_change(struct sctp_tcb *stcb, ui static void sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t sent, uint32_t error, - struct sctp_tmit_chunk *chk, int so_locked - SCTP_UNUSED -) + struct sctp_tmit_chunk *chk, int so_locked) { struct mbuf *m_notify; struct sctp_send_failed *ssf; @@ -3479,9 +3472,7 @@ sctp_notify_send_failed(struct sctp_tcb *stcb, uint8_t static void sctp_notify_send_failed2(struct sctp_tcb *stcb, uint32_t error, - struct sctp_stream_queue_pending *sp, int so_locked - SCTP_UNUSED -) + struct sctp_stream_queue_pending *sp, int so_locked) { struct mbuf *m_notify; struct sctp_send_failed *ssf; @@ -3627,9 +3618,7 @@ sctp_notify_adaptation_layer(struct sctp_tcb *stcb) /* This always must be called with the read-queue LOCKED in the INP */ static void sctp_notify_partial_delivery_indication(struct sctp_tcb *stcb, uint32_t error, - uint32_t val, int so_locked - SCTP_UNUSED -) + uint32_t val, int so_locked) { struct mbuf *m_notify; struct sctp_pdapi_event *pdapi; @@ -3750,9 +3739,7 @@ sctp_notify_shutdown_event(struct sctp_tcb *stcb) static void sctp_notify_sender_dry_event(struct sctp_tcb *stcb, - int so_locked - SCTP_UNUSED -) + int so_locked) { struct mbuf *m_notify; struct sctp_sender_dry_event *event; @@ -4039,9 +4026,7 @@ sctp_notify_remote_error(struct sctp_tcb *stcb, uint16 void sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, - uint32_t error, void *data, int so_locked - SCTP_UNUSED -) + uint32_t error, void *data, int so_locked) { if ((stcb == NULL) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || @@ -4216,9 +4201,7 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb } void -sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked - SCTP_UNUSED -) +sctp_report_all_outbound(struct sctp_tcb *stcb, uint16_t error, int holds_lock, int so_locked) { struct sctp_association *asoc; struct sctp_stream_out *outs; @@ -4327,9 +4310,7 @@ sctp_report_all_outbound(struct sctp_tcb *stcb, uint16 void sctp_abort_notification(struct sctp_tcb *stcb, uint8_t from_peer, uint16_t error, - struct sctp_abort_chunk *abort, int so_locked - SCTP_UNUSED -) + struct sctp_abort_chunk *abort, int so_locked) { if (stcb == NULL) { return; @@ -4451,9 +4432,7 @@ none_in: void sctp_abort_an_association(struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct mbuf *op_err, - int so_locked - SCTP_UNUSED -) + int so_locked) { if (stcb == NULL) { @@ -4831,9 +4810,7 @@ sctp_add_to_readq(struct sctp_inpcb *inp, struct sockbuf *sb, int end, int inp_read_lock_held, - int so_locked - SCTP_UNUSED -) + int so_locked) { /* * Here we must place the control on the end of the socket read @@ -5015,9 +4992,7 @@ sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_ int sctp_release_pr_sctp_chunk(struct sctp_tcb *stcb, struct sctp_tmit_chunk *tp1, - uint8_t sent, int so_locked - SCTP_UNUSED -) + uint8_t sent, int so_locked) { struct sctp_stream_out *strq; struct sctp_tmit_chunk *chk = NULL, *tp2; Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Thu Jun 11 12:53:22 2020 (r362053) +++ head/sys/netinet/sctputil.h Thu Jun 11 13:34:09 2020 (r362054) @@ -117,9 +117,7 @@ sctp_add_to_readq(struct sctp_inpcb *inp, struct sockbuf *sb, int end, int inpread_locked, - int so_locked - SCTP_UNUSED -); + int so_locked); void sctp_iterator_worker(void); @@ -145,10 +143,7 @@ struct mbuf *sctp_add_pad_tombuf(struct mbuf *, int); struct mbuf *sctp_pad_lastmbuf(struct mbuf *, int, struct mbuf *); -void -sctp_ulp_notify(uint32_t, struct sctp_tcb *, uint32_t, void *, int - SCTP_UNUSED -); +void sctp_ulp_notify(uint32_t, struct sctp_tcb *, uint32_t, void *, int); void sctp_pull_off_control_to_new_inp(struct sctp_inpcb *old_inp, @@ -161,18 +156,13 @@ void sctp_stop_timers_for_shutdown(struct sctp_tcb *); /* Stop all timers for association and remote addresses. */ void sctp_stop_association_timers(struct sctp_tcb *, bool); -void -sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int - SCTP_UNUSED -); +void sctp_report_all_outbound(struct sctp_tcb *, uint16_t, int, int); int sctp_expand_mapping_array(struct sctp_association *, uint32_t); void sctp_abort_notification(struct sctp_tcb *, uint8_t, uint16_t, - struct sctp_abort_chunk *, int - SCTP_UNUSED -); + struct sctp_abort_chunk *, int); /* We abort responding to an IP packet for some reason */ void @@ -186,9 +176,7 @@ sctp_abort_association(struct sctp_inpcb *, struct sct /* We choose to abort via user input */ void sctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, - struct mbuf *, int - SCTP_UNUSED -); + struct mbuf *, int); void sctp_handle_ootb(struct mbuf *, int, int, @@ -234,9 +222,7 @@ void sctp_print_address(struct sockaddr *); int sctp_release_pr_sctp_chunk(struct sctp_tcb *, struct sctp_tmit_chunk *, - uint8_t, int - SCTP_UNUSED -); + uint8_t, int); struct mbuf *sctp_generate_cause(uint16_t, char *); struct mbuf *sctp_generate_no_user_data_cause(uint32_t); From owner-svn-src-head@freebsd.org Thu Jun 11 13:45:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B1C03317BE; Thu, 11 Jun 2020 13:45:06 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jQ8d6TSYz4fXr; Thu, 11 Jun 2020 13:45:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 05BDiwGe060075; Thu, 11 Jun 2020 06:44:58 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 05BDiwc4060074; Thu, 11 Jun 2020 06:44:58 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202006111344.05BDiwc4060074@gndrsh.dnsmgr.net> Subject: Re: svn commit: r362029 - head/sys/dev/hdmi In-Reply-To: <202006102138.05ALcZZV087863@repo.freebsd.org> To: Oleksandr Tymoshenko Date: Thu, 11 Jun 2020 06:44:58 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49jQ8d6TSYz4fXr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 13:45:06 -0000 > Author: gonzo > Date: Wed Jun 10 21:38:35 2020 > New Revision: 362029 > URL: https://svnweb.freebsd.org/changeset/base/362029 > > Log: > Fix reading EDID on TVs/monitors without E-DCC support > > Writing segment id to I2C device 0x30 only required if the segment is > non-zero. On the devices without E-DCC support writing to that address > fails and whole transaction then fails too. To avoid this do > not attempt write to the segment selection device unless required. > > MFC after: 2 weeks Is it possible that this bad write is what has caused me to corrupt the EDID of 3 monitors over the last year while using a Display Port to HDMI cable on them? > Modified: > head/sys/dev/hdmi/dwc_hdmi.c > > Modified: head/sys/dev/hdmi/dwc_hdmi.c > ============================================================================== > --- head/sys/dev/hdmi/dwc_hdmi.c Wed Jun 10 21:18:19 2020 (r362028) > +++ head/sys/dev/hdmi/dwc_hdmi.c Wed Jun 10 21:38:35 2020 (r362029) > @@ -658,6 +658,11 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u > int result; > uint8_t addr = block & 1 ? EDID_LENGTH : 0; > uint8_t segment = block >> 1; > + /* > + * Some devices do not support E-DDC so attempt > + * writing segment address only if it's neccessary > + */ > + unsigned char xfers = segment ? 3 : 2; > struct iic_msg msg[] = { > { I2C_DDC_SEGADDR, IIC_M_WR, 1, &segment }, > { I2C_DDC_ADDR, IIC_M_WR, 1, &addr }, > @@ -687,7 +692,7 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u > return (result); > } > > - result = iicbus_transfer(i2c_dev, msg, 3); > + result = iicbus_transfer(i2c_dev, &msg[3 - xfers], xfers); > iicbus_release_bus(i2c_dev, sc->sc_dev); > > if (result) { > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu Jun 11 14:09:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C25A332810; Thu, 11 Jun 2020 14:09:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jQj36m2Cz3SjZ; Thu, 11 Jun 2020 14:09:43 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E336B195B2; Thu, 11 Jun 2020 14:09:43 +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 05BE9hxY000873; Thu, 11 Jun 2020 14:09:43 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BE9hLR000872; Thu, 11 Jun 2020 14:09:43 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006111409.05BE9hLR000872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 11 Jun 2020 14:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362055 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 14:09:44 -0000 Author: trasz Date: Thu Jun 11 14:09:43 2020 New Revision: 362055 URL: https://svnweb.freebsd.org/changeset/base/362055 Log: Replace LINUX_FASYNC with LINUX_O_ASYNC; no functional changes. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25218 Modified: head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_file.h Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Thu Jun 11 13:34:09 2020 (r362054) +++ head/sys/compat/linux/linux_file.c Thu Jun 11 14:09:43 2020 (r362055) @@ -113,7 +113,7 @@ linux_common_open(struct thread *td, int dirfd, char * bsd_flags |= O_CLOEXEC; if (l_flags & LINUX_O_NONBLOCK) bsd_flags |= O_NONBLOCK; - if (l_flags & LINUX_FASYNC) + if (l_flags & LINUX_O_ASYNC) bsd_flags |= O_ASYNC; if (l_flags & LINUX_O_CREAT) bsd_flags |= O_CREAT; @@ -1286,7 +1286,7 @@ fcntl_common(struct thread *td, struct linux_fcntl_arg if (result & O_FSYNC) td->td_retval[0] |= LINUX_O_SYNC; if (result & O_ASYNC) - td->td_retval[0] |= LINUX_FASYNC; + td->td_retval[0] |= LINUX_O_ASYNC; #ifdef LINUX_O_NOFOLLOW if (result & O_NOFOLLOW) td->td_retval[0] |= LINUX_O_NOFOLLOW; @@ -1305,7 +1305,7 @@ fcntl_common(struct thread *td, struct linux_fcntl_arg arg |= O_APPEND; if (args->arg & LINUX_O_SYNC) arg |= O_FSYNC; - if (args->arg & LINUX_FASYNC) + if (args->arg & LINUX_O_ASYNC) arg |= O_ASYNC; #ifdef LINUX_O_NOFOLLOW if (args->arg & LINUX_O_NOFOLLOW) Modified: head/sys/compat/linux/linux_file.h ============================================================================== --- head/sys/compat/linux/linux_file.h Thu Jun 11 13:34:09 2020 (r362054) +++ head/sys/compat/linux/linux_file.h Thu Jun 11 14:09:43 2020 (r362055) @@ -76,7 +76,7 @@ #define LINUX_O_NONBLOCK 00004000 #define LINUX_O_NDELAY LINUX_O_NONBLOCK #define LINUX_O_SYNC 00010000 -#define LINUX_FASYNC 00020000 +#define LINUX_O_ASYNC 00020000 #define LINUX_O_DIRECT 00040000 /* Direct disk access hint */ #define LINUX_O_LARGEFILE 00100000 #define LINUX_O_DIRECTORY 00200000 /* Must be a directory */ From owner-svn-src-head@freebsd.org Thu Jun 11 14:29:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A654D3331BA; Thu, 11 Jun 2020 14:29:11 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jR7W2FjDz3V6W; Thu, 11 Jun 2020 14:29:11 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: by sdaoden.eu (Postfix, from userid 1000) id 5DF4716054; Thu, 11 Jun 2020 16:29:09 +0200 (CEST) Date: Thu, 11 Jun 2020 16:29:08 +0200 From: Steffen Nurpmeso To: Mateusz Piotrowski <0mp@FreeBSD.org> Cc: Yuri Pankov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362017 - in head/usr.bin/sed: . tests Message-ID: <20200611142908.z3_Ao%steffen@sdaoden.eu> In-Reply-To: <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org> References: <202006101923.05AJNwPt006602@repo.freebsd.org> <20200610220619.Iup5c%steffen@sdaoden.eu> <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org> Mail-Followup-To: Mateusz Piotrowski <0mp@FreeBSD.org>, Yuri Pankov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org User-Agent: s-nail v14.9.19-56-g9975bde7 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 49jR7W2FjDz3V6W X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15987, ipnet:217.144.128.0/20, country:DE] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 14:29:11 -0000 Hello. Mateusz Piotrowski wrote in <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org>: |On 6/11/20 12:06 AM, Steffen Nurpmeso wrote: |> Yuri Pankov wrote in |> : |>|Mateusz Piotrowski wrote: |>|> Author: 0mp (doc,ports committer) |>|> Date: Wed Jun 10 19:23:58 2020 |>|> New Revision: 362017 |>|> URL: https://svnweb.freebsd.org/changeset/base/362017 |>|> |>|> Log: |>|> Read commands from stdin when -f - is passed to sed(1) |> .. |>|Am I reading it wrong, or is it the same test case added 3 times? |> |> It also used "Fl f Cm -" instead of "Fl f Ar -". Just saying.. |Which is correct. "-" is not a variable here. It is a fixed string hence |the use of Cm. I would rather say no, .Ar is an argument (to the ".Fl"ag f), whereas .Cm is a command modifier: Command Modifiers The command modifier is identical to the '.Fl' (flag) command with the exception that the '.Cm' macro does not assert a dash in front of every argument. Traditionally flags are marked by the preceding dash, however, some commands or subsets of commands do not use them. Command modifiers may also be specified in conjunction with interactive commands such as editor commands. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) From owner-svn-src-head@freebsd.org Thu Jun 11 14:31:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4071D3332D3; Thu, 11 Jun 2020 14:31:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jRBc0zGdz3VVQ; Thu, 11 Jun 2020 14:31:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CB0C19A31; Thu, 11 Jun 2020 14:31:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BEVp08015288; Thu, 11 Jun 2020 14:31:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BEVpb9015286; Thu, 11 Jun 2020 14:31:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202006111431.05BEVpb9015286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 11 Jun 2020 14:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362056 - head/sys/dev/usb/net X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/usb/net X-SVN-Commit-Revision: 362056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 14:31:52 -0000 Author: hselasky Date: Thu Jun 11 14:31:51 2020 New Revision: 362056 URL: https://svnweb.freebsd.org/changeset/base/362056 Log: Add missing range checks when receiving USB ethernet packets. Found by: Ilja Van Sprundel, IOActive MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/sys/dev/usb/net/if_cdceem.c head/sys/dev/usb/net/if_muge.c head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_cdceem.c ============================================================================== --- head/sys/dev/usb/net/if_cdceem.c Thu Jun 11 14:09:43 2020 (r362055) +++ head/sys/dev/usb/net/if_cdceem.c Thu Jun 11 14:31:51 2020 (r362056) @@ -427,9 +427,10 @@ cdceem_handle_data(struct usb_xfer *xfer, uint16_t hdr struct usb_ether *ue; struct ifnet *ifp; struct mbuf *m; - int actlen, off; uint32_t computed_crc, received_crc; - uint16_t pktlen; + int pktlen; + int actlen; + int off; off = *offp; sc = usbd_xfer_softc(xfer); @@ -443,7 +444,7 @@ cdceem_handle_data(struct usb_xfer *xfer, uint16_t hdr (hdr & CDCEEM_DATA_CRC) ? "valid" : "absent", pktlen); - if (pktlen < ETHER_HDR_LEN) { + if (pktlen < (ETHER_HDR_LEN + 4)) { CDCEEM_WARN(sc, "bad ethernet frame length %d, should be at least %d", pktlen, ETHER_HDR_LEN); @@ -467,6 +468,14 @@ cdceem_handle_data(struct usb_xfer *xfer, uint16_t hdr } pktlen -= 4; /* Subtract the CRC. */ + + if (pktlen > m->m_len) { + CDCEEM_WARN(sc, "buffer too small %d vs %d bytes", + pktlen, m->m_len); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + m_freem(m); + return; + } usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); off += pktlen; @@ -513,7 +522,7 @@ cdceem_bulk_read_callback(struct usb_xfer *xfer, usb_e pc = usbd_xfer_get_frame(xfer, 0); off = 0; - while (off < actlen) { + while ((off + sizeof(hdr)) <= actlen) { usbd_copy_out(pc, off, &hdr, sizeof(hdr)); CDCEEM_DEBUG(sc, "hdr = %#x", hdr); off += sizeof(hdr); Modified: head/sys/dev/usb/net/if_muge.c ============================================================================== --- head/sys/dev/usb/net/if_muge.c Thu Jun 11 14:09:43 2020 (r362055) +++ head/sys/dev/usb/net/if_muge.c Thu Jun 11 14:31:51 2020 (r362056) @@ -1169,9 +1169,9 @@ muge_bulk_read_callback(struct usb_xfer *xfer, usb_err struct ifnet *ifp = uether_getifp(ue); struct mbuf *m; struct usb_page_cache *pc; - uint16_t pktlen; uint32_t rx_cmd_a, rx_cmd_b; uint16_t rx_cmd_c; + int pktlen; int off; int actlen; @@ -1249,7 +1249,14 @@ muge_bulk_read_callback(struct usb_xfer *xfer, usb_err 1); goto tr_setup; } - + if (pktlen > m->m_len) { + muge_dbg_printf(sc, + "buffer too small %d vs %d bytes", + pktlen, m->m_len); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + m_freem(m); + goto tr_setup; + } usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Thu Jun 11 14:09:43 2020 (r362055) +++ head/sys/dev/usb/net/if_smsc.c Thu Jun 11 14:31:51 2020 (r362056) @@ -955,7 +955,7 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err struct mbuf *m; struct usb_page_cache *pc; uint32_t rxhdr; - uint16_t pktlen; + int pktlen; int off; int actlen; @@ -981,6 +981,9 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err /* The frame header is always aligned on a 4 byte boundary */ off = ((off + 0x3) & ~0x3); + if ((off + sizeof(rxhdr)) > actlen) + goto tr_setup; + usbd_copy_out(pc, off, &rxhdr, sizeof(rxhdr)); off += (sizeof(rxhdr) + ETHER_ALIGN); rxhdr = le32toh(rxhdr); @@ -1009,7 +1012,13 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_err if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); goto tr_setup; } - + if (pktlen > m->m_len) { + smsc_dbg_printf(sc, "buffer too small %d vs %d bytes", + pktlen, m->m_len); + if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); + m_freem(m); + goto tr_setup; + } usbd_copy_out(pc, off, mtod(m, uint8_t *), pktlen); /* Check if RX TCP/UDP checksumming is being offloaded */ From owner-svn-src-head@freebsd.org Thu Jun 11 14:57:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AE62334705; Thu, 11 Jun 2020 14:57:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jRmC1nzZz3Xm2; Thu, 11 Jun 2020 14:57: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3867F19F8A; Thu, 11 Jun 2020 14:57: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 05BEvUsl031908; Thu, 11 Jun 2020 14:57:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BEvUIQ031905; Thu, 11 Jun 2020 14:57:30 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006111457.05BEvUIQ031905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 11 Jun 2020 14:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362059 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 14:57:31 -0000 Author: trasz Date: Thu Jun 11 14:57:30 2020 New Revision: 362059 URL: https://svnweb.freebsd.org/changeset/base/362059 Log: Don't use newlines with linux_msg(). No functional changes. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux.c head/sys/compat/linux/linux_event.c head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux.c ============================================================================== --- head/sys/compat/linux/linux.c Thu Jun 11 14:49:38 2020 (r362058) +++ head/sys/compat/linux/linux.c Thu Jun 11 14:57:30 2020 (r362059) @@ -485,7 +485,7 @@ linux_to_bsd_sockaddr(const struct l_sockaddr *osa, st sin6->sin6_scope_id = 0; } else { linux_msg(curthread, - "obsolete pre-RFC2553 sockaddr_in6 rejected\n"); + "obsolete pre-RFC2553 sockaddr_in6 rejected"); error = EINVAL; goto out; } Modified: head/sys/compat/linux/linux_event.c ============================================================================== --- head/sys/compat/linux/linux_event.c Thu Jun 11 14:49:38 2020 (r362058) +++ head/sys/compat/linux/linux_event.c Thu Jun 11 14:57:30 2020 (r362059) @@ -342,7 +342,7 @@ epoll_to_kevent(struct thread *td, int fd, struct epol if ((pem->flags & LINUX_XUNSUP_EPOLL) == 0) { pem->flags |= LINUX_XUNSUP_EPOLL; LINUX_PEM_XUNLOCK(pem); - linux_msg(td, "epoll_ctl unsupported flags: 0x%x\n", + linux_msg(td, "epoll_ctl unsupported flags: 0x%x", levents); } else LINUX_PEM_XUNLOCK(pem); Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Thu Jun 11 14:49:38 2020 (r362058) +++ head/sys/compat/linux/linux_futex.c Thu Jun 11 14:57:30 2020 (r362059) @@ -1085,7 +1085,7 @@ retry2: return (ENOSYS); default: - linux_msg(td, "unsupported futex op %d\n", args->op); + linux_msg(td, "unsupported futex op %d", args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, unknown_operation, args->op); LIN_SDT_PROBE1(futex, linux_sys_futex, return, ENOSYS); From owner-svn-src-head@freebsd.org Thu Jun 11 15:14:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D62A4335357; Thu, 11 Jun 2020 15:14:39 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jS7z5Lb9z3Zxb; Thu, 11 Jun 2020 15:14:39 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B22331A332; Thu, 11 Jun 2020 15:14:39 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BFEdKk044404; Thu, 11 Jun 2020 15:14:39 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BFEdHX044403; Thu, 11 Jun 2020 15:14:39 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202006111514.05BFEdHX044403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Thu, 11 Jun 2020 15:14:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362060 - head/usr.bin/xargs X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/xargs X-SVN-Commit-Revision: 362060 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 15:14:40 -0000 Author: fernape (ports committer) Date: Thu Jun 11 15:14:39 2020 New Revision: 362060 URL: https://svnweb.freebsd.org/changeset/base/362060 Log: xargs(1): Add EXAMPLES to man page Add EXAMPLES covering options I, J, L, n, P. While here, fix warning (STYLE: no blank before trailing delimiter: Fl P,) Bumping .Dd Approved by: bcr@ Differential Revision: https://reviews.freebsd.org/D25214 Modified: head/usr.bin/xargs/xargs.1 Modified: head/usr.bin/xargs/xargs.1 ============================================================================== --- head/usr.bin/xargs/xargs.1 Thu Jun 11 14:57:30 2020 (r362059) +++ head/usr.bin/xargs/xargs.1 Thu Jun 11 15:14:39 2020 (r362060) @@ -33,7 +33,7 @@ .\" $FreeBSD$ .\" $xMach: xargs.1,v 1.2 2002/02/23 05:23:37 tim Exp $ .\" -.Dd August 4, 2015 +.Dd June 11, 2020 .Dt XARGS 1 .Os .Sh NAME @@ -325,6 +325,32 @@ exits with a value of 126. If any other error occurs, .Nm exits with a value of 1. +.Sh EXAMPLES +Create a 3x3 matrix with numbers from 1 to 9. +Every +.Xr echo 1 +instance receives three lines as arguments: +.Bd -literal -offset indent +$ seq 1 9 | xargs -L3 echo +1 2 3 +4 5 6 +7 8 9 +.Ed +.Pp +Duplicate every line from standard input: +.Bd -literal -offset indent +$ echo -e "one\\ntwo\\nthree" | xargs -I % echo % % +one one +two two +three three +.Ed +.Pp +Execute at most 2 concurrent instances of +.Xr find 1 +every one of them using one of the directories from the standard input: +.Bd -literal -offset indent +echo -e "/usr/ports\\n/etc\\n/usr/local" | xargs -J % -P2 -n1 find % -name file +.Ed .Sh SEE ALSO .Xr echo 1 , .Xr find 1 , @@ -336,7 +362,7 @@ utility is expected to be .St -p1003.2 compliant. The -.Fl J , o , P, R +.Fl J , o , P , R and .Fl S options are non-standard From owner-svn-src-head@freebsd.org Thu Jun 11 15:59:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D71D0337FAE; Thu, 11 Jun 2020 15:59:49 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jT855Lqxz3yCl; Thu, 11 Jun 2020 15:59:49 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2EC91A7FB; Thu, 11 Jun 2020 15:59:49 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BFxndc070436; Thu, 11 Jun 2020 15:59:49 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BFxnSa070435; Thu, 11 Jun 2020 15:59:49 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202006111559.05BFxnSa070435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Thu, 11 Jun 2020 15:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362063 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 362063 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 15:59:49 -0000 Author: erj Date: Thu Jun 11 15:59:49 2020 New Revision: 362063 URL: https://svnweb.freebsd.org/changeset/base/362063 Log: em(4): Always reinit interface when adding/removing VLAN This partially reverts r361053 since there have been reports by users that this breaks some functionality for em(4) devices; it seems at first glance that some sort of interface restart is required for those cards. This isn't a proper fix; this unbreaks those users until a proper fix is found for their issues. PR: 240818 Reported by: Marek Zarychta MFC after: 3 days Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Jun 11 15:17:13 2020 (r362062) +++ head/sys/dev/e1000/if_em.c Thu Jun 11 15:59:49 2020 (r362063) @@ -4059,7 +4059,6 @@ em_if_needs_restart(if_ctx_t ctx __unused, enum iflib_ { switch (event) { case IFLIB_RESTART_VLAN_CONFIG: - return (false); default: return (true); } From owner-svn-src-head@freebsd.org Thu Jun 11 16:16:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47069338A34 for ; Thu, 11 Jun 2020 16:16:44 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5a.ore.mailhop.org (outbound5a.ore.mailhop.org [44.233.67.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jTWb5QNqz40qK for ; Thu, 11 Jun 2020 16:16:43 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1591892196; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=jwqRKOy03dAU2qwLHUyih5F0wEmj+3OgigBtMlnnGcPfcUN6xGtOZegv2TQVJBxxRyvLPzcdOzray lR4/MuYgiVuJhy+HgYAo+VF0guHf3MvjXKHlJbOyXNKMfWzxZESvE5RnSelznzNLp2qMjt/8V0ir9G a7WnfHlbdzv5HTSlx0K5XQEYTvIPe+70+gFvJrBaIg/ahRLGE+Xvy5aaBZbrfG6VnifDEvvQB/2ydt QGzSzHrdBOWYGY5+/4l8sfiYuFxzEQzv8wXRycjhbIJLTSripbnMlOQzyGBwewGYExX458ojIXAD+a ZJVWpRyt/ZJv2jpMuZkmmVwHLiMyBhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=YYMGYo4fTX9lePPC/AVECpDVlRBfIPZ6jNFMBhnK5JA=; b=o8g7GQUItzN2NXHrcTAuHLpbpGMLbYQPQp9sJv3r+dNpdCSX6i03GWnJfZRuAQxWNo+A2NKc0hLKq HezGTSdb3gNQ5bxDiJpeEarF+z+XXCXdUOeSlMv3+qn4S8SbgAjnwNVFdfFv1avePl6w2G7dG3J0Pk bnxRNPhjf18SOTgrFetN9lo2crQgHhMGInOQhizM6+onhfeC4swLx+1II2hdiI2397AmkEQQ7W90UN rEcgD6Z75KSW/3bNUcFZyhfNl8nj8e8uFIPm3zqJZqltE53Y3MGqkH9P6fhYm4jXvCWBwsUTu/hUlH egaIlrjM5umcdNiJ93LY7t+2+2ygQ6Q== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=YYMGYo4fTX9lePPC/AVECpDVlRBfIPZ6jNFMBhnK5JA=; b=u7ftqaKlRkpEAHS6rL87ecAKPuGLH0eZS4oZMi4Cu5txwc3YwKWiKdk/vVFkcH0ZMQ9s3ht+Hv4UQ B8lxSoKbPsL5S1ZXGN3WZTwkoVL3Bj1GEoeYNDwyCJRGdRS+7GO4OBXMgFEYS1IXvlCuGtx7VJ0lxj aVGTgivWxLefgXFJwQevXr3EnZ1tpv4lV7m33CqI/eszfqkRjc5BIQo8G0bjb/NdOe6yr5d/Fv1ZHF 2U2ohPWJFbwgE7q95fuW7YW8qktRiVAnvuj+f4s1LHiyCX66s6PcPqMyUfHw88b8GL2vwWyRE2Q3mK HXQyYoqYFZSMB21e9TwDHbYU//pKtYw== X-MHO-RoutePath: aGlwcGll X-MHO-User: ea37d850-abfe-11ea-b10c-b5956a7dd1a1 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id ea37d850-abfe-11ea-b10c-b5956a7dd1a1; Thu, 11 Jun 2020 16:16:35 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 05BGGWcV004738; Thu, 11 Jun 2020 10:16:32 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r362017 - in head/usr.bin/sed: . tests From: Ian Lepore To: Steffen Nurpmeso , Mateusz Piotrowski <0mp@FreeBSD.org> Cc: Yuri Pankov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 11 Jun 2020 10:16:32 -0600 In-Reply-To: <20200611142908.z3_Ao%steffen@sdaoden.eu> References: <202006101923.05AJNwPt006602@repo.freebsd.org> <20200610220619.Iup5c%steffen@sdaoden.eu> <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org> <20200611142908.z3_Ao%steffen@sdaoden.eu> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49jTWb5QNqz40qK X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:16509, ipnet:44.224.0.0/11, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 16:16:44 -0000 On Thu, 2020-06-11 at 16:29 +0200, Steffen Nurpmeso wrote: > Hello. > > Mateusz Piotrowski wrote in > <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org>: > |On 6/11/20 12:06 AM, Steffen Nurpmeso wrote: > |> Yuri Pankov wrote in > |> : > |>|Mateusz Piotrowski wrote: > |>|> Author: 0mp (doc,ports committer) > |>|> Date: Wed Jun 10 19:23:58 2020 > |>|> New Revision: 362017 > |>|> URL: https://svnweb.freebsd.org/changeset/base/362017 > |>|> > |>|> Log: > |>|> Read commands from stdin when -f - is passed to sed(1) > |> .. > |>|Am I reading it wrong, or is it the same test case added 3 times? > |> > |> It also used "Fl f Cm -" instead of "Fl f Ar -". Just saying.. > > |Which is correct. "-" is not a variable here. It is a fixed string hence > |the use of Cm. > > I would rather say no, .Ar is an argument (to the ".Fl"ag f), > whereas .Cm is a command modifier: > > Command Modifiers > The command modifier is identical to the '.Fl' (flag) command with the > exception that the '.Cm' macro does not assert a dash in front of every > argument. Traditionally flags are marked by the preceding dash, however, > some commands or subsets of commands do not use them. Command modifiers > may also be specified in conjunction with interactive commands such as > editor commands. > Yeah, but... The '.Fl' macro without any arguments results in a dash representing stdin/stdout. Note that giving '.Fl' a single dash will result in two dashes. The '.Fl' macro is parsed and is callable. And that seems to argue that "Fl f Fl" is correct. -- Ian From owner-svn-src-head@freebsd.org Thu Jun 11 17:25:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3203B33AC05; Thu, 11 Jun 2020 17:25:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jW2n0dvXz45Mh; Thu, 11 Jun 2020 17:25:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C49F1B67C; Thu, 11 Jun 2020 17:25:21 +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 05BHPKsx026705; Thu, 11 Jun 2020 17:25:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BHPKq7026704; Thu, 11 Jun 2020 17:25:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006111725.05BHPKq7026704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jun 2020 17:25:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362065 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 362065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 17:25:21 -0000 Author: kib Date: Thu Jun 11 17:25:20 2020 New Revision: 362065 URL: https://svnweb.freebsd.org/changeset/base/362065 Log: Restore TLB invalidations done before smp started. In particular, invalidation of the preloaded modules text to allow execution from it was broken after D25188/r362031. Reviewed by: markj Reported by: delphij, dhw Sponsored by: The FreeBSD Foundation MFC after: 13 days Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Jun 11 16:51:13 2020 (r362064) +++ head/sys/x86/x86/mp_x86.c Thu Jun 11 17:25:20 2020 (r362065) @@ -1698,7 +1698,7 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector int cpu; /* It is not necessary to signal other CPUs while in the debugger. */ - if (kdb_active || KERNEL_PANICKED()) { + if (kdb_active || KERNEL_PANICKED() || !smp_started) { curcpu_cb(pmap, addr1, addr2); return; } @@ -1759,13 +1759,10 @@ void smp_masked_invltlb(cpuset_t mask, pmap_t pmap, smp_invl_cb_t curcpu_cb) { - if (smp_started) { - smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0, - curcpu_cb); + smp_targeted_tlb_shootdown(mask, IPI_INVLTLB, pmap, 0, 0, curcpu_cb); #ifdef COUNT_XINVLTLB_HITS - ipi_global++; + ipi_global++; #endif - } } void @@ -1773,13 +1770,10 @@ smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, pma smp_invl_cb_t curcpu_cb) { - if (smp_started) { - smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0, - curcpu_cb); + smp_targeted_tlb_shootdown(mask, IPI_INVLPG, pmap, addr, 0, curcpu_cb); #ifdef COUNT_XINVLTLB_HITS - ipi_page++; + ipi_page++; #endif - } } void @@ -1787,24 +1781,20 @@ smp_masked_invlpg_range(cpuset_t mask, vm_offset_t add pmap_t pmap, smp_invl_cb_t curcpu_cb) { - if (smp_started) { - smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap, - addr1, addr2, curcpu_cb); + smp_targeted_tlb_shootdown(mask, IPI_INVLRNG, pmap, addr1, addr2, + curcpu_cb); #ifdef COUNT_XINVLTLB_HITS - ipi_range++; - ipi_range_size += (addr2 - addr1) / PAGE_SIZE; + ipi_range++; + ipi_range_size += (addr2 - addr1) / PAGE_SIZE; #endif - } } void smp_cache_flush(smp_invl_cb_t curcpu_cb) { - if (smp_started) { - smp_targeted_tlb_shootdown(all_cpus, IPI_INVLCACHE, NULL, - 0, 0, curcpu_cb); - } + smp_targeted_tlb_shootdown(all_cpus, IPI_INVLCACHE, NULL, 0, 0, + curcpu_cb); } /* From owner-svn-src-head@freebsd.org Thu Jun 11 17:36:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F22E33B12A; Thu, 11 Jun 2020 17:36:21 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jWHS60RGz46ss; Thu, 11 Jun 2020 17:36:20 +0000 (UTC) (envelope-from steffen@sdaoden.eu) Received: by sdaoden.eu (Postfix, from userid 1000) id 504AD16054; Thu, 11 Jun 2020 19:28:00 +0200 (CEST) Date: Thu, 11 Jun 2020 19:28:00 +0200 From: Steffen Nurpmeso To: Ian Lepore Cc: Mateusz Piotrowski <0mp@FreeBSD.org>, Yuri Pankov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362017 - in head/usr.bin/sed: . tests Message-ID: <20200611172800.EnzGX%steffen@sdaoden.eu> In-Reply-To: References: <202006101923.05AJNwPt006602@repo.freebsd.org> <20200610220619.Iup5c%steffen@sdaoden.eu> <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org> <20200611142908.z3_Ao%steffen@sdaoden.eu> Mail-Followup-To: Ian Lepore , Mateusz Piotrowski <0mp@FreeBSD.org>, Yuri Pankov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org User-Agent: s-nail v14.9.19-56-g9975bde7 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. X-Rspamd-Queue-Id: 49jWHS60RGz46ss X-Spamd-Bar: +++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of steffen@sdaoden.eu designates 217.144.132.164 as permitted sender) smtp.mailfrom=steffen@sdaoden.eu X-Spamd-Result: default: False [5.61 / 15.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+a:c]; NEURAL_SPAM_SHORT(0.54)[0.544]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sdaoden.eu]; SEM_URIBL_FRESH15(3.00)[yuripv.dev:email]; RCPT_COUNT_FIVE(0.00)[6]; BAD_REP_POLICIES(0.10)[]; NEURAL_SPAM_MEDIUM(0.36)[0.359]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.71)[0.706]; MID_CONTAINS_FROM(1.00)[]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15987, ipnet:217.144.128.0/20, country:DE]; GREYLIST(0.00)[pass,body] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 17:36:21 -0000 Hey. Ian Lepore wrote in : |On Thu, 2020-06-11 at 16:29 +0200, Steffen Nurpmeso wrote: |> Hello. |> |> Mateusz Piotrowski wrote in |> <995726df-cb28-c294-09ca-6cca302b24a6@FreeBSD.org>: |>|On 6/11/20 12:06 AM, Steffen Nurpmeso wrote: |>|> Yuri Pankov wrote in |>|> : |>|>|Mateusz Piotrowski wrote: |>|>|> Author: 0mp (doc,ports committer) |>|>|> Date: Wed Jun 10 19:23:58 2020 |>|>|> New Revision: 362017 |>|>|> URL: https://svnweb.freebsd.org/changeset/base/362017 |>|>|> |>|>|> Log: |>|>|> Read commands from stdin when -f - is passed to sed(1) |>|> .. |>|>|Am I reading it wrong, or is it the same test case added 3 times? |>|> |>|> It also used "Fl f Cm -" instead of "Fl f Ar -". Just saying.. |> |>|Which is correct. "-" is not a variable here. It is a fixed string hence |>|the use of Cm. |> |> I would rather say no, .Ar is an argument (to the ".Fl"ag f), |> whereas .Cm is a command modifier: |> |> Command Modifiers |> The command modifier is identical to the '.Fl' (flag) command \ |> with the |> exception that the '.Cm' macro does not assert a dash in front \ |> of every |> argument. Traditionally flags are marked by the preceding dash, \ |> however, |> some commands or subsets of commands do not use them. Command \ |> modifiers |> may also be specified in conjunction with interactive commands \ |> such as |> editor commands. |> | |Yeah, but... | | The '.Fl' macro without any arguments results in a dash representing | stdin/stdout. Note that giving '.Fl' a single dash will result in | two dashes. The '.Fl' macro is parsed and is callable. | |And that seems to argue that "Fl f Fl" is correct. This will not result in a well-formed XML document. I seem to have lost track now. He wanted to document the typical "is standard input" argument to the command line option (flag) -f, didn't he? If so then "Fl f Ar -" should be the correct way of documenting this. Of course - "modifies the command" ("is a command modifier"), heh. You could also say "Fl f Pa -" if you go that route, because the argument should be a path, yet it is not in this very special case, which denotes standard input. But i would use "Fl f Ar -". --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt) From owner-svn-src-head@freebsd.org Thu Jun 11 18:02:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A25AA33C65E; Thu, 11 Jun 2020 18:02:10 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (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 49jWsG2Tswz4B37; Thu, 11 Jun 2020 18:02:10 +0000 (UTC) (envelope-from gonzo@freebsd.org) Received: from localhost ([127.0.0.1] helo=id.bluezbox.com) by id.bluezbox.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92 (FreeBSD)) (envelope-from ) id 1jjRWd-000Eq5-6x; Thu, 11 Jun 2020 11:02:03 -0700 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id 05BI23s7057044; Thu, 11 Jun 2020 11:02:03 -0700 (PDT) (envelope-from gonzo@freebsd.org) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@freebsd.org using -f Date: Thu, 11 Jun 2020 11:02:02 -0700 From: Oleksandr Tymoshenko To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362029 - head/sys/dev/hdmi Message-ID: <20200611180202.GA56927@bluezbox.com> References: <202006102138.05ALcZZV087863@repo.freebsd.org> <202006111344.05BDiwc4060074@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202006111344.05BDiwc4060074@gndrsh.dnsmgr.net> X-Operating-System: FreeBSD/11.2-RELEASE-p10 (amd64) User-Agent: Mutt/1.12.1 (2019-06-15) X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Rodney W. Grimes (freebsd@gndrsh.dnsmgr.net) wrote: > > Author: gonzo > > Date: Wed Jun 10 21:38:35 2020 > > New Revision: 362029 > > URL: https://svnweb.freebsd.org/changeset/base/362029 > > > > Log: [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Rspamd-Queue-Id: 49jWsG2Tswz4B37 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:14061, ipnet:45.55.0.0/19, country:US]; local_wl_from(0.00)[freebsd.org] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 18:02:10 -0000 Rodney W. Grimes (freebsd@gndrsh.dnsmgr.net) wrote: > > Author: gonzo > > Date: Wed Jun 10 21:38:35 2020 > > New Revision: 362029 > > URL: https://svnweb.freebsd.org/changeset/base/362029 > > > > Log: > > Fix reading EDID on TVs/monitors without E-DCC support > > > > Writing segment id to I2C device 0x30 only required if the segment is > > non-zero. On the devices without E-DCC support writing to that address > > fails and whole transaction then fails too. To avoid this do > > not attempt write to the segment selection device unless required. > > > > MFC after: 2 weeks > > Is it possible that this bad write is what has caused me to corrupt > the EDID of 3 monitors over the last year while using a Display > Port to HDMI cable on them? Very unlikely. This write just sets segment index for the following EDID read. Also the driver is used only on iMX6 and MIPS Creator CI20. -- gonzo From owner-svn-src-head@freebsd.org Thu Jun 11 18:14:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCCC433CEDD; Thu, 11 Jun 2020 18:14:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jX7Z56d1z4CLV; Thu, 11 Jun 2020 18:14:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AABEA1C2FF; Thu, 11 Jun 2020 18:14:34 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BIEY7J059691; Thu, 11 Jun 2020 18:14:34 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BIEYK2059690; Thu, 11 Jun 2020 18:14:34 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006111814.05BIEYK2059690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Thu, 11 Jun 2020 18:14:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362071 - head/usr.bin/sed/tests X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.bin/sed/tests X-SVN-Commit-Revision: 362071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 18:14:34 -0000 Author: 0mp (doc,ports committer) Date: Thu Jun 11 18:14:34 2020 New Revision: 362071 URL: https://svnweb.freebsd.org/changeset/base/362071 Log: Remove some more duplicate test cases I accidentally committed Reported by: markj, yuripv MFC after: 2 weeks X-MFC-With: 362017 Modified: head/usr.bin/sed/tests/sed2_test.sh Modified: head/usr.bin/sed/tests/sed2_test.sh ============================================================================== --- head/usr.bin/sed/tests/sed2_test.sh Thu Jun 11 17:42:19 2020 (r362070) +++ head/usr.bin/sed/tests/sed2_test.sh Thu Jun 11 18:14:34 2020 (r362071) @@ -134,42 +134,6 @@ commands_on_stdin_body() atf_check -o 'empty' sed -f - < insert_x } -atf_test_case commands_on_stdin -commands_on_stdin_head() -{ - atf_set "descr" "Verify -f -" -} -commands_on_stdin_body() -{ - printf "a\n" > a - printf "s/a/b/\n" > a_to_b - printf "s/b/c/\n" > b_to_c - printf "s/c/d/\n" > ./- - atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c - - # Verify that nothing is printed if there are no input files provided. - printf 'i\\\nx' > insert_x - atf_check -o 'empty' sed -f - < insert_x -} - -atf_test_case commands_on_stdin -commands_on_stdin_head() -{ - atf_set "descr" "Verify -f -" -} -commands_on_stdin_body() -{ - printf "a\n" > a - printf "s/a/b/\n" > a_to_b - printf "s/b/c/\n" > b_to_c - printf "s/c/d/\n" > ./- - atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c - - # Verify that nothing is printed if there are no input files provided. - printf 'i\\\nx' > insert_x - atf_check -o 'empty' sed -f - < insert_x -} - atf_init_test_cases() { atf_add_test_case inplace_command_q From owner-svn-src-head@freebsd.org Thu Jun 11 18:59:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAFBA33E2A3; Thu, 11 Jun 2020 18:59:57 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jY7x5y3Pz4FcT; Thu, 11 Jun 2020 18:59:57 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7A5F1CD5E; Thu, 11 Jun 2020 18:59:57 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BIxvZX085172; Thu, 11 Jun 2020 18:59:57 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BIxvam085171; Thu, 11 Jun 2020 18:59:57 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202006111859.05BIxvam085171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 11 Jun 2020 18:59:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362072 - head/tests/sys/net X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/net X-SVN-Commit-Revision: 362072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 18:59:58 -0000 Author: lwhsu Date: Thu Jun 11 18:59:57 2020 New Revision: 362072 URL: https://svnweb.freebsd.org/changeset/base/362072 Log: Skip sys.net.if_lagg_test.lacp_linkstate_destroy_stress in CI because of panic PR: 244168 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/net/if_lagg_test.sh Modified: head/tests/sys/net/if_lagg_test.sh ============================================================================== --- head/tests/sys/net/if_lagg_test.sh Thu Jun 11 18:14:34 2020 (r362071) +++ head/tests/sys/net/if_lagg_test.sh Thu Jun 11 18:59:57 2020 (r362072) @@ -193,8 +193,7 @@ lacp_linkstate_destroy_stress_head() } lacp_linkstate_destroy_stress_body() { - if [ "$(atf_config_get ci false)" = "true" ] && \ - [ "$(uname -p)" = "i386" ]; then + if [ "$(atf_config_get ci false)" = "true" ]; then atf_skip "https://bugs.freebsd.org/244168" fi From owner-svn-src-head@freebsd.org Thu Jun 11 20:26:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F788340921; Thu, 11 Jun 2020 20:26:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jb400PLcz4M4V; Thu, 11 Jun 2020 20:26:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08E161E20D; Thu, 11 Jun 2020 20:26:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BKQdOi041578; Thu, 11 Jun 2020 20:26:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BKQdC0041577; Thu, 11 Jun 2020 20:26:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006112026.05BKQdC0041577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 11 Jun 2020 20:26:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362075 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 362075 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 20:26:40 -0000 Author: kib Date: Thu Jun 11 20:26:39 2020 New Revision: 362075 URL: https://svnweb.freebsd.org/changeset/base/362075 Log: Correct comment (this should have been committed with r362065). Sponsored by: The FreeBSD Foundation MFC after: 13 days Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Thu Jun 11 19:54:44 2020 (r362074) +++ head/sys/x86/x86/mp_x86.c Thu Jun 11 20:26:39 2020 (r362075) @@ -1697,7 +1697,10 @@ smp_targeted_tlb_shootdown(cpuset_t mask, u_int vector uint32_t generation; int cpu; - /* It is not necessary to signal other CPUs while in the debugger. */ + /* + * It is not necessary to signal other CPUs while booting or + * when in the debugger. + */ if (kdb_active || KERNEL_PANICKED() || !smp_started) { curcpu_cb(pmap, addr1, addr2); return; From owner-svn-src-head@freebsd.org Thu Jun 11 20:35:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 149EF3408DB; Thu, 11 Jun 2020 20:35:29 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jbG86m8Jz4MrQ; Thu, 11 Jun 2020 20:35:28 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1B781E40D; Thu, 11 Jun 2020 20:35:28 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BKZSaF048284; Thu, 11 Jun 2020 20:35:28 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BKZSRU048282; Thu, 11 Jun 2020 20:35:28 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202006112035.05BKZSRU048282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 11 Jun 2020 20:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362076 - in head/sys/dev: netmap virtio/network X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head/sys/dev: netmap virtio/network X-SVN-Commit-Revision: 362076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 20:35:29 -0000 Author: vmaffione Date: Thu Jun 11 20:35:28 2020 New Revision: 362076 URL: https://svnweb.freebsd.org/changeset/base/362076 Log: netmap: introduce netmap_kring_on() This function returns NULL if the ring identified by queue id and direction is in netmap mode. Otherwise return the corresponding kring. Use this function to replace vtnet_netmap_queue_on(). MFC after: 1 week Modified: head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/netmap_kern.h head/sys/dev/virtio/network/if_vtnet.c Modified: head/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- head/sys/dev/netmap/if_vtnet_netmap.h Thu Jun 11 20:26:39 2020 (r362075) +++ head/sys/dev/netmap/if_vtnet_netmap.h Thu Jun 11 20:35:28 2020 (r362076) @@ -33,25 +33,6 @@ #include /* vtophys ? */ #include -/* - * Return 1 if the queue identified by 't' and 'idx' is in netmap mode. - */ -static int -vtnet_netmap_queue_on(struct vtnet_softc *sc, enum txrx t, int idx) -{ - struct netmap_adapter *na = NA(sc->vtnet_ifp); - - if (!nm_native_on(na)) - return 0; - - if (t == NR_RX) - return !!(idx < na->num_rx_rings && - na->rx_rings[idx]->nr_mode == NKR_NETMAP_ON); - - return !!(idx < na->num_tx_rings && - na->tx_rings[idx]->nr_mode == NKR_NETMAP_ON); -} - /* Register and unregister. */ static int vtnet_netmap_reg(struct netmap_adapter *na, int state) Modified: head/sys/dev/netmap/netmap_kern.h ============================================================================== --- head/sys/dev/netmap/netmap_kern.h Thu Jun 11 20:26:39 2020 (r362075) +++ head/sys/dev/netmap/netmap_kern.h Thu Jun 11 20:35:28 2020 (r362076) @@ -1353,6 +1353,24 @@ nm_native_on(struct netmap_adapter *na) return nm_netmap_on(na) && (na->na_flags & NAF_NATIVE); } +static inline struct netmap_kring * +netmap_kring_on(struct netmap_adapter *na, u_int q, enum txrx t) +{ + struct netmap_kring *kring = NULL; + + if (!nm_native_on(na)) + return NULL; + + if (t == NR_RX && q < na->num_rx_rings) + kring = na->rx_rings[q]; + else if (t == NR_TX && q < na->num_tx_rings) + kring = na->tx_rings[q]; + else + return NULL; + + return (kring->nr_mode == NKR_NETMAP_ON) ? kring : NULL; +} + static inline int nm_iszombie(struct netmap_adapter *na) { Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Thu Jun 11 20:26:39 2020 (r362075) +++ head/sys/dev/virtio/network/if_vtnet.c Thu Jun 11 20:35:28 2020 (r362076) @@ -1249,17 +1249,17 @@ vtnet_rxq_free_mbufs(struct vtnet_rxq *rxq) struct mbuf *m; int last; #ifdef DEV_NETMAP - int netmap_bufs = vtnet_netmap_queue_on(rxq->vtnrx_sc, NR_RX, - rxq->vtnrx_id); + struct netmap_kring *kring = netmap_kring_on(NA(rxq->vtnrx_sc->vtnet_ifp), + rxq->vtnrx_id, NR_RX); #else /* !DEV_NETMAP */ - int netmap_bufs = 0; + void *kring = NULL; #endif /* !DEV_NETMAP */ vq = rxq->vtnrx_vq; last = 0; while ((m = virtqueue_drain(vq, &last)) != NULL) { - if (!netmap_bufs) + if (kring == NULL) m_freem(m); } @@ -2074,17 +2074,17 @@ vtnet_txq_free_mbufs(struct vtnet_txq *txq) struct vtnet_tx_header *txhdr; int last; #ifdef DEV_NETMAP - int netmap_bufs = vtnet_netmap_queue_on(txq->vtntx_sc, NR_TX, - txq->vtntx_id); + struct netmap_kring *kring = netmap_kring_on(NA(txq->vtntx_sc->vtnet_ifp), + txq->vtntx_id, NR_TX); #else /* !DEV_NETMAP */ - int netmap_bufs = 0; + void *kring = NULL; #endif /* !DEV_NETMAP */ vq = txq->vtntx_vq; last = 0; while ((txhdr = virtqueue_drain(vq, &last)) != NULL) { - if (!netmap_bufs) { + if (kring == NULL) { m_freem(txhdr->vth_mbuf); uma_zfree(vtnet_tx_header_zone, txhdr); } From owner-svn-src-head@freebsd.org Thu Jun 11 20:56:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 054D4340CF5; Thu, 11 Jun 2020 20:56:01 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jbjr0Mb4z4Nfn; Thu, 11 Jun 2020 20:55:59 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd41.google.com with SMTP id c8so7970466iob.6; Thu, 11 Jun 2020 13:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version; bh=keyeyM4kG1OEfKs3d6DzefAiWrcGKQrXfh+FtAGgIjk=; b=Ieg83xZAoGOPMGS0W9kCIi3+TcO1PVB5Lqkix0SB/elVUfRNm/HG4Ie8wl4uRZEgKL fvJ6ZYuHBdP8AqAJjHFwRNERi6tr3t1o4GDOqwo8H8TrJWM5/SqbSBNSpBEI5qzIv7FN 9sn3LRSZuh9RB/KAR+bWo9M7IHoydAtPwIwgGHQllC3dbqGwwcaBowqiwt1r7IXpvdaX aGmN25Nd9E/XPB3yzwtxZPT+ssiIYtPxdvuvzBOVXCCxW/xLxVlzRrtD2zanzmsq+LXN 1x9df0Suah3ZjDOzpSj60khNVCL7sb8Tp8r95ySPj6wHSVxQ0cv0qPYJE8nJe3F6nvrW mY2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version; bh=keyeyM4kG1OEfKs3d6DzefAiWrcGKQrXfh+FtAGgIjk=; b=hoF2AiHzME9++nn3QZYyRkCdTLVLQJeCX7XaX7z8+CoNdP6//5XyUr+Jcx+jBc8cD0 0pxCWAXREvqfzpg627XKEzzFrzVQKvvQpFzpJBK+lsTNnKfwflQPcJgfItBH+VuQNJ2w CDjtOvwZZ7NQXrEabVyMEoHNRc39jata79br4FFnFKbEzw+v3QYfBVruBzYvUq1H74Ie kr/8gi6RQ1YihcbUmxRJGhfwVRt8+2evk5kn8Jesa+k/CGAm3C8UeqGsM519ccYCFFl4 UVRNFyRK1BAaw6LA0alU9r3HUwWTel4g+D4TbiwVY36wzAnhuflYt4MGqoY9cFjZz9+T 7aTw== X-Gm-Message-State: AOAM532XCwJuRasPJWwKzHyDZDcFDUFyFlGj5AX3G6JQaWKTGllkbTbs TEnbvinFOggvUWmaHDj1SOA= X-Google-Smtp-Source: ABdhPJy/N4VMpPWQhKFabxzTNaduxTtVilWVNnty4PX/V3KDPYGaCWJ9jOaU8QLIZl7QNP4yJua1rg== X-Received: by 2002:a02:c6a7:: with SMTP id o7mr4910815jan.67.1591908957179; Thu, 11 Jun 2020 13:55:57 -0700 (PDT) Received: from ralga.knownspace (173-19-125-130.client.mchsi.com. [173.19.125.130]) by smtp.gmail.com with ESMTPSA id c20sm1959805iot.33.2020.06.11.13.55.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2020 13:55:56 -0700 (PDT) Date: Thu, 11 Jun 2020 15:55:45 -0500 From: Justin Hibbits To: Mark Millard Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 Message-ID: <20200611155545.55526f7c@ralga.knownspace> In-Reply-To: References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/K=rH3L.wMYzt5iz2sACaWQM" X-Rspamd-Queue-Id: 49jbjr0Mb4z4Nfn X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Ieg83xZA; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::d41 as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-3.41 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_ATTACHMENT(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.44)[-0.439]; FREEMAIL_TO(0.00)[yahoo.com]; RECEIVED_SPAMHAUS_PBL(0.00)[173.19.125.130:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.96)[-0.961]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.01)[-1.006]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d41:from]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 20:56:01 -0000 --MP_/K=rH3L.wMYzt5iz2sACaWQM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, 10 Jun 2020 18:56:57 -0700 Mark Millard wrote: > On 2020-May-13, at 08:56, Justin Hibbits wrote: > > > Hi Mark, > > Hello Justin. Hi Mark, > > > On Wed, 13 May 2020 01:43:23 -0700 > > Mark Millard wrote: > > > >> [I'm adding a reference to an old arm64/aarch64 bug that had > >> pages turning to zero, in case this 32-bit powerpc issue is > >> somewhat analogous.] > >> > >>> . . . > > ... > >> . . . > >> > >> (Note: dsl-only.net closed down, so the E-mail > >> address reference is no longer valid.) > >> > >> Author: kib > >> Date: Mon Apr 10 15:32:26 2017 > >> New Revision: 316679 > >> URL: > >> https://svnweb.freebsd.org/changeset/base/316679 > >> > >> > >> Log: > >> Do not lose dirty bits for removing PROT_WRITE on arm64. > >> > >> Arm64 pmap interprets accessed writable ptes as modified, since > >> ARMv8.0 does not track Dirty Bit Modifier in hardware. If writable > >> bit is removed, page must be marked as dirty for MI VM. > >> > >> This change is most important for COW, where fork caused losing > >> content of the dirty pages which were not yet scanned by > >> pagedaemon. > >> > >> Reviewed by: alc, andrew > >> Reported and tested by: Mark Millard >> dsl-only.net> PR: 217138, 217239 > >> Sponsored by: The FreeBSD Foundation > >> MFC after: 2 weeks > >> > >> Modified: > >> head/sys/arm64/arm64/pmap.c > >> > >> Modified: head/sys/arm64/arm64/pmap.c > >> ============================================================================== > >> --- head/sys/arm64/arm64/pmap.c Mon Apr 10 12:35:58 > >> 2017 (r316678) +++ head/sys/arm64/arm64/pmap.c Mon > >> Apr 10 15:32:26 2017 (r316679) @@ -2481,6 +2481,11 @@ > >> pmap_protect(pmap_t pmap, vm_offset_t sv sva += L3_SIZE) { > >> l3 = pmap_load(l3p); > >> if (pmap_l3_valid(l3)) { > >> + if ((l3 & ATTR_SW_MANAGED) && > >> + pmap_page_dirty(l3)) { > >> + > >> vm_page_dirty(PHYS_TO_VM_PAGE(l3 & > >> + ~ATTR_MASK)); > >> + } > >> pmap_set(l3p, ATTR_AP(ATTR_AP_RO)); > >> PTE_SYNC(l3p); > >> /* XXX: Use pmap_invalidate_range > >> */ > >> > >> . . . > >> > > > > Thanks for this reference. I took a quick look at the 3 pmap > > implementations we have (haven't check the new radix pmap yet), and > > it looks like only mmu_oea.c (32-bit AIM pmap, for G3 and G4) is > > missing vm_page_dirty() calls in its pmap_protect() implementation, > > analogous to the change you posted right above. Given this, I think > > it's safe to say that this missing piece is necessary. We'll work > > on a fix for this; looking at moea64_protect(), there may be > > additional work needed to support this as well, so it may take a > > few days. > > Ping? Any clue when the above might happen? > > I've been avoiding the old PowerMacs and leaving > them at head -r360311 , pending an update that > would avoid the kernel zeroing pages that it > should not zero. But I've seen that you were busy > with more modern contexts this last about a month. > > And, clearly, my own context has left pending > (for much longer) other more involved activities > (compared to just periodically updating to > more recent FreeBSD vintages). > > === > Mark Millard > marklmi at yahoo.com > ( dsl-only.net went > away in early 2018-Mar) > Sorry for the delay, I got sidetracked with a bunch of other development. I did install a newer FreeBSD on my dual G4 and couldn't see the problem. That said, the attached patch effectively copies what's done in OEA6464 into OEA pmap. Can you test it? - Justin --MP_/K=rH3L.wMYzt5iz2sACaWQM Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=moea_protect.diff diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index c5b0b048a41..2f1422b36c4 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -1776,6 +1776,9 @@ moea_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, { struct pvo_entry *pvo, *tpvo, key; struct pte *pt; + struct pte old_pte; + vm_page_t m; + int32_t refchg; KASSERT(pm == &curproc->p_vmspace->vm_pmap || pm == kernel_pmap, ("moea_protect: non current pmap")); @@ -1803,12 +1806,31 @@ moea_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, pvo->pvo_pte.pte.pte_lo &= ~PTE_PP; pvo->pvo_pte.pte.pte_lo |= PTE_BR; + old_pte = *pt; + /* * If the PVO is in the page table, update that pte as well. */ if (pt != NULL) { moea_pte_change(pt, &pvo->pvo_pte.pte, pvo->pvo_vaddr); + if (pm != kernel_pmap && m != NULL && + (m->a.flags & PGA_EXECUTABLE) == 0 && + (pvo->pvo_pte.pa & (PTE_I | PTE_G)) == 0) { + if ((m->oflags & VPO_UNMANAGED) == 0) + vm_page_aflag_set(m, PGA_EXECUTABLE); + moea_syncicache(pvo->pvo_pte.pa & PTE_RPGN, + PAGE_SIZE); + } mtx_unlock(&moea_table_mutex); + if ((pvo->pvo_vaddr & PVO_MANAGED) && + (pvo->pvo_pte.prot & VM_PROT_WRITE)) { + m = PHYS_TO_VM_PAGE(old_pte.pte_lo & PTE_RPGN); + refchg = atomic_readandclear_32(&m->md.mdpg_attrs); + if (refchg & PTE_CHG) + vm_page_dirty(m); + if (refchg & PTE_REF) + vm_page_aflag_set(m, PGA_REFERENCED); + } } } rw_wunlock(&pvh_global_lock); --MP_/K=rH3L.wMYzt5iz2sACaWQM-- From owner-svn-src-head@freebsd.org Thu Jun 11 21:36:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC4A4341CFF for ; Thu, 11 Jun 2020 21:36:47 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic303-25.consmr.mail.gq1.yahoo.com (sonic303-25.consmr.mail.gq1.yahoo.com [98.137.64.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jcct57fWz4QnL for ; Thu, 11 Jun 2020 21:36:46 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: oMlrzEkVM1n0fQy94q7okPpe3jwvUEdPQCVGTq7two5lUxYwGoA00PDhSFfvZEV fL8tTKl9DnO7erx4D7Fk1gCOyvv_Wlar7eaZKlyH2.1fPy2P1f1RxnI_O1H2L_7q5H_MiUU4o1by fS31gZjNhXHLCtFStH9Yu2Zua59G7ZOQp9KILYuPKO2HfQSwrkjDxe0HxHhrWQXLkyAEpGOCrdPB tixhqaTKEZJTJYpRRVxzlNHj6hU.lx5GpPxCP4Oa.GRJi1oPYz.3ue_gxDTcoOACRZUkcj5h1E25 _yYhxJH02JqlneJC0kybfKXMRh9UllX36TUV7CZKrWluqLOTFjDRk8cDjhymRxbQJaid6I9abfPf hWVKGITG5XAj.91xH9jldjCL1vvlhfQQBiA7nCJOF59VJUImr6qle1Ly0f0Df8BIV5hcOg8hQ1bd dYsWynkfcP7n0bgMzflkQ823.oFjZ9X6WJhk.Do6h6E06NEF0uiQrTwPvQD0icPV6Byvdix14tOY mtuKVe6joAOd74Cu0eX6pjytREg5P94kRhZAOxrWclD7xM026vi3l05ZiW7F1rde.njtwd5MojU_ wBZC_eCI4jIMWwB_bbNjSFccu3Nki.XCLMhqO0kVyK0sQKjn.ZXSDDGQ.q1M1f34hbarWwA0na.P vK.S0ueW6.gnOQVGwOtwR184YGzhhFDD889cZ9PCnSWDdQMr83zS8tdKkrDPKZ4v1kxBNYjko6qH Misr0ln9ygcAPQEYGY0ynssLLaWq0hKMU3.ZzrPThigjvl2ZoT9qG1vo6ot_WitUm_j_whd1O3AE qsMXZyTN__NPXURKQeRTc1AuYZITSWHKbw0D8IzA1AH0Ku49oBP6icue5oBwwR5uZHSK22.n6Sg7 jDZ9udIgpEwjEwKqvMp84Kr9iMnKuFV0W5xp9_.2AnLlYsGj8J0sLA8QaPckzgpPw.L6r6ixTS8K r1WgMPWRdafAtd.65Sk3TEFhhcIjTnWtcgaPFDjykQ42Y.r8oxsFKV4fWdeUjfzYCEYvZdSAHiCw ICEvnScN9bvsplu_dIdhEbp2rAE5Da1uMQ1eWosMR9_caBjSWYcEq9iyR9EC4LWS6HRzShR_JJdk 5ZC_V05t70_9.JmxQ84i1WsLpKlNQ0KKp3Ioyyp2rmkcitmx8U8A72yasgWp1KaPCthHPqQCQKgu gc4cN1PxG1DGEQim.1x_YEbVT271OE17aoUZjqlah6ityZ_5r3s7BGWyBIf0RjNSdBekz2ylv4DT FD1fuoMYK747RPLTFgM4lUeunGOx_yYZ86MEFBSi5EGyJIwTwLXzNoKCJJ5mfnp2EM6JaQ5GzKa0 zsCYCLnj3rXizkTfIe8BYkvnUpAAW5js27jYX7MmCgKMfMazh4p8K4fWKkKuvat3sqQjlk8kGSFb wyi2uqxZeUebZ4YaDKpN57AKWO5TN Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.gq1.yahoo.com with HTTP; Thu, 11 Jun 2020 21:36:44 +0000 Received: by smtp416.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID fdfd3dccc9714f1e32d72e6a803eab89; Thu, 11 Jun 2020 21:36:39 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: <20200611155545.55526f7c@ralga.knownspace> Date: Thu, 11 Jun 2020 14:36:37 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: quoted-printable Message-Id: <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jcct57fWz4QnL X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.14 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.63)[-0.635]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.013]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.206:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.206:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 21:36:47 -0000 On 2020-Jun-11, at 13:55, Justin Hibbits = wrote: > On Wed, 10 Jun 2020 18:56:57 -0700 > Mark Millard wrote: >=20 >> On 2020-May-13, at 08:56, Justin Hibbits = wrote: >>=20 >>> Hi Mark, =20 >>=20 >> Hello Justin. >=20 > Hi Mark, Hello again, Justin. >>=20 >>> On Wed, 13 May 2020 01:43:23 -0700 >>> Mark Millard wrote: >>>=20 >>>> [I'm adding a reference to an old arm64/aarch64 bug that had >>>> pages turning to zero, in case this 32-bit powerpc issue is >>>> somewhat analogous.] >>>>=20 >>>>> . . . =20 >>> ... =20 >>>> . . . >>>>=20 >>>> (Note: dsl-only.net closed down, so the E-mail >>>> address reference is no longer valid.) >>>>=20 >>>> Author: kib >>>> Date: Mon Apr 10 15:32:26 2017 >>>> New Revision: 316679 >>>> URL:=20 >>>> https://svnweb.freebsd.org/changeset/base/316679 >>>>=20 >>>>=20 >>>> Log: >>>> Do not lose dirty bits for removing PROT_WRITE on arm64. >>>>=20 >>>> Arm64 pmap interprets accessed writable ptes as modified, since >>>> ARMv8.0 does not track Dirty Bit Modifier in hardware. If writable >>>> bit is removed, page must be marked as dirty for MI VM. >>>>=20 >>>> This change is most important for COW, where fork caused losing >>>> content of the dirty pages which were not yet scanned by >>>> pagedaemon. >>>>=20 >>>> Reviewed by: alc, andrew >>>> Reported and tested by: Mark Millard >>> dsl-only.net> PR: 217138, 217239 >>>> Sponsored by: The FreeBSD Foundation >>>> MFC after: 2 weeks >>>>=20 >>>> Modified: >>>> head/sys/arm64/arm64/pmap.c >>>>=20 >>>> Modified: head/sys/arm64/arm64/pmap.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/arm64/arm64/pmap.c Mon Apr 10 12:35:58 >>>> 2017 (r316678) +++ head/sys/arm64/arm64/pmap.c Mon >>>> Apr 10 15:32:26 2017 (r316679) @@ -2481,6 +2481,11 @@ >>>> pmap_protect(pmap_t pmap, vm_offset_t sv sva +=3D L3_SIZE) { >>>> l3 =3D pmap_load(l3p); >>>> if (pmap_l3_valid(l3)) { >>>> + if ((l3 & ATTR_SW_MANAGED) && >>>> + pmap_page_dirty(l3)) { >>>> + >>>> vm_page_dirty(PHYS_TO_VM_PAGE(l3 & >>>> + ~ATTR_MASK)); >>>> + } >>>> pmap_set(l3p, ATTR_AP(ATTR_AP_RO)); >>>> PTE_SYNC(l3p); >>>> /* XXX: Use pmap_invalidate_range >>>> */ >>>>=20 >>>> . . . >>>>=20 >>>=20 >>> Thanks for this reference. I took a quick look at the 3 pmap >>> implementations we have (haven't check the new radix pmap yet), and >>> it looks like only mmu_oea.c (32-bit AIM pmap, for G3 and G4) is >>> missing vm_page_dirty() calls in its pmap_protect() implementation, >>> analogous to the change you posted right above. Given this, I think >>> it's safe to say that this missing piece is necessary. We'll work >>> on a fix for this; looking at moea64_protect(), there may be >>> additional work needed to support this as well, so it may take a >>> few days. =20 >>=20 >> Ping? Any clue when the above might happen? >>=20 >> I've been avoiding the old PowerMacs and leaving >> them at head -r360311 , pending an update that >> would avoid the kernel zeroing pages that it >> should not zero. But I've seen that you were busy >> with more modern contexts this last about a month. >>=20 >> And, clearly, my own context has left pending >> (for much longer) other more involved activities >> (compared to just periodically updating to >> more recent FreeBSD vintages). >>=20 >> . . . >>=20 >=20 > Sorry for the delay, I got sidetracked with a bunch of other > development. > I did install a newer FreeBSD on my dual G4 and couldn't > see the problem. How did you test? In my context it was far easier to see the problem with builds that did not use MALLOC_PRODUCTION. In other words: jemalloc having its asserts tested. The easiest way I found to get the asserts to fail was to do (multiple processes (-m) and totaling to more than enough to force paging/swapping): stress -m 2 --vm-bytes 1700M & (Possibly setting up some shells first to potentially later exit.) Normally stress itself would hit jemalloc asserts. Apparently the asserts did not stop the code and it ran until a failure occurred (via dtv=3D0x0). I never had to manually stop the stress processes. If no failures during, then exit shells that likely were swapped out or partially paged out during the stress run. They hit jemalloc asserts during their cleanup activity in my testing. > That said, the attached patch effectively copies > what's done in OEA6464 into OEA pmap. Can you test it? I'll try it once I get a chance, probably later today. I gather from what I see that moea64_protect did not need the changes that you originally thought might be required? I only see moea_protect changes in the patch. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Thu Jun 11 21:42:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA7563423F6; Thu, 11 Jun 2020 21:42:20 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jclJ45plz4RQl; Thu, 11 Jun 2020 21:42:20 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com [66.111.4.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 823D91F74B; Thu, 11 Jun 2020 21:42:20 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 0D19A27C0054; Thu, 11 Jun 2020 17:42:20 -0400 (EDT) Received: from imap1 ([10.202.2.51]) by compute4.internal (MEProxy); Thu, 11 Jun 2020 17:42:20 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeitddgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdluddtmdenucfjughrpefofgggkfgjfhffhffvufgtsehttdertder reejnecuhfhrohhmpedfuehrrghnughonhcuuegvrhhgrhgvnhdfuceosggurhgrghhonh eshfhrvggvuefuffdrohhrgheqnecuggftrfgrthhtvghrnhepteefveelueekieeltedv jeeuuedutdfgtddviefhgeekhfeuledtteelvdffffetnecuffhomhgrihhnpegushhlqd honhhlhidrnhgvthenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpegsughrrghgohhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqd dutdegvdefheekieegqddukedutdekheduqdgsughrrghgohhnpeephfhrvggvuefuffdr ohhrghesihhmrghprdgttg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id D5332C200A6; Thu, 11 Jun 2020 17:42:19 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-525-ge8fa799-fm-20200609.001-ge8fa7990 Mime-Version: 1.0 Message-Id: <8bf74674-4ccf-4f97-bbc5-fa5131209b66@www.fastmail.com> In-Reply-To: <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> Date: Thu, 11 Jun 2020 16:41:59 -0500 From: "Brandon Bergren" To: "Mark Millard" , "Justin Hibbits" Cc: "Eric van Gyzen" , svn-src-head@freebsd.org, "FreeBSD Current" , "FreeBSD Hackers" , "FreeBSD PowerPC ML" Subject: =?UTF-8?Q?Re:_svn_commit:_r360233_-_in_head:_contrib/jemalloc_._._._:_Th?= =?UTF-8?Q?is_partially_breaks_a_2-socket_32-bit_powerpc_(old_PowerMac_G?= =?UTF-8?Q?4)_based_on_head_-r360311?= Content-Type: text/plain X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 21:42:20 -0000 An update from my end: I now have the ability to test dual processor G4 as well, now that mine is up and running. On Thu, Jun 11, 2020, at 4:36 PM, Mark Millard wrote: > > How did you test? > > In my context it was far easier to see the problem > with builds that did not use MALLOC_PRODUCTION. In > other words: jemalloc having its asserts tested. > > The easiest way I found to get the asserts to fail > was to do (multiple processes (-m) and totaling to > more than enough to force paging/swapping): > > stress -m 2 --vm-bytes 1700M & > > (Possibly setting up some shells first > to potentially later exit.) > > Normally stress itself would hit jemalloc > asserts. Apparently the asserts did not > stop the code and it ran until a failure > occurred (via dtv=0x0). I never had to > manually stop the stress processes. > > If no failures during, then exit shells > that likely were swapped out or partially > paged out during the stress run. They > hit jemalloc asserts during their cleanup > activity in my testing. > > > > That said, the attached patch effectively copies > > what's done in OEA6464 into OEA pmap. Can you test it? > > I'll try it once I get a chance, probably later > today. > > I gather from what I see that moea64_protect did not > need the changes that you originally thought might > be required? I only see moea_protect changes in the > patch. > > === > Mark Millard > marklmi at yahoo.com > ( dsl-only.net went > away in early 2018-Mar) > > -- Brandon Bergren bdragon@FreeBSD.org From owner-svn-src-head@freebsd.org Thu Jun 11 21:42:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 886B33425B8; Thu, 11 Jun 2020 21:42:22 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jclK2TzTz4RNj; Thu, 11 Jun 2020 21:42:21 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd29.google.com with SMTP id d5so8068128ios.9; Thu, 11 Jun 2020 14:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=F8tO4WMoZCGEG/J2fntZPL6ciLwZVHM1ZtZyBw/IUoI=; b=D9/iB+EvZm38xYksenfGSSKo+ldU8mnZfRT6w+jPa7x4AS+b1gqPByrn6viNtSkgTY Yi+91CmPvNUpsn4C5/7UhIUvR152JneaiUe8Ck1wY/q2zzwS1q8FmkAtVKFGq4W9kd4V NZ0CGLmfBxY4kCQN/02hi7NT2nKfAnIot3uN6gIPB/KxVYqE2morCC6AEkez63ZkvrOA axL6OvFX+Vd6qhdCidGLdsYCJMYVBrzJcsf4guPKFQ+3sNZ/72xBnOg3UejOIU3HpfBe 6SY10QCyLyoXcXvOtygRHuCztIafY52DKqHL8mfv/0FXjpUUEP3VZQW3DhRwDxFThzr6 fflg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F8tO4WMoZCGEG/J2fntZPL6ciLwZVHM1ZtZyBw/IUoI=; b=VJGGv7Ix+azrEwYrSBY5TSQr9cFbSaH06OJepPhUNcNaKqIUT217iwGaKZRpltMLmA 2oymZiItOvlfvwTjxewisb3OMpNxfxs+nwe1ecHUv47gU1Txw97qqZAv9GHC4gnpes7S U8pQt3cjOrn+kSWqQoJo6Yt1vshN+i2xiJZKMSNDriBUWLXT+O+Ao8OdtgSv8dOcL3za Y71Gsj8VCe5ig579M9ortFyqPkVfJQ4BgMuAxRLSk5mOGESJL4Nb6WrWaLojzjHEygbl dFamxJYfGp6ppjeaVWWx9m+njlpkEsecIEMf2GYHEfrrXnmUBUHa+C71ArUCHRXKUqXp UByg== X-Gm-Message-State: AOAM533uz8lsomFdWOhZDeRMT3PT0cdw3COZijLKiDCD3ZVCMMHjk4OS 6PgkGwRViLthlgniW+EDTBk= X-Google-Smtp-Source: ABdhPJyLJpawxmcomszvME2wth+iKAOiXtxZXHM5Te35vdZ3Itj+F/v/xFjrHARPgE4okQ5M2dqUjQ== X-Received: by 2002:a02:a518:: with SMTP id e24mr5066004jam.72.1591911740213; Thu, 11 Jun 2020 14:42:20 -0700 (PDT) Received: from ralga.knownspace (173-19-125-130.client.mchsi.com. [173.19.125.130]) by smtp.gmail.com with ESMTPSA id z12sm2061069iol.15.2020.06.11.14.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2020 14:42:20 -0700 (PDT) Date: Thu, 11 Jun 2020 16:42:16 -0500 From: Justin Hibbits To: Mark Millard Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 Message-ID: <20200611164216.47f82775@ralga.knownspace> In-Reply-To: <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49jclK2TzTz4RNj X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=D9/iB+Ev; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::d29 as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-3.48 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.56)[-0.562]; FREEMAIL_TO(0.00)[yahoo.com]; RECEIVED_SPAMHAUS_PBL(0.00)[173.19.125.130:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.91)[-0.914]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.004]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d29:from]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 21:42:23 -0000 On Thu, 11 Jun 2020 14:36:37 -0700 Mark Millard wrote: > On 2020-Jun-11, at 13:55, Justin Hibbits > wrote: > > > On Wed, 10 Jun 2020 18:56:57 -0700 > > Mark Millard wrote: > > > >> On 2020-May-13, at 08:56, Justin Hibbits > >> wrote: > >>> Hi Mark, > >> > >> Hello Justin. > > > > Hi Mark, > > Hello again, Justin. > > >> > >> I've been avoiding the old PowerMacs and leaving > >> them at head -r360311 , pending an update that > >> would avoid the kernel zeroing pages that it > >> should not zero. But I've seen that you were busy > >> with more modern contexts this last about a month. > >> > >> And, clearly, my own context has left pending > >> (for much longer) other more involved activities > >> (compared to just periodically updating to > >> more recent FreeBSD vintages). > >> > >> . . . > >> > > > > Sorry for the delay, I got sidetracked with a bunch of other > > development. > > > I did install a newer FreeBSD on my dual G4 and couldn't > > see the problem. > > How did you test? > > In my context it was far easier to see the problem > with builds that did not use MALLOC_PRODUCTION. In > other words: jemalloc having its asserts tested. > > The easiest way I found to get the asserts to fail > was to do (multiple processes (-m) and totaling to > more than enough to force paging/swapping): > > stress -m 2 --vm-bytes 1700M & > > (Possibly setting up some shells first > to potentially later exit.) > > Normally stress itself would hit jemalloc > asserts. Apparently the asserts did not > stop the code and it ran until a failure > occurred (via dtv=0x0). I never had to > manually stop the stress processes. > > If no failures during, then exit shells > that likely were swapped out or partially > paged out during the stress run. They > hit jemalloc asserts during their cleanup > activity in my testing. My testing was only with a WITNESS kernel, and wasn't an exhaustive test, so obviously is not a straight apples-to-apples comparison. Unfortunately, my backlog of other work got in the way of doing a meaningful extensive test. > > > > That said, the attached patch effectively copies > > what's done in OEA6464 into OEA pmap. Can you test it? > > I'll try it once I get a chance, probably later > today. > > I gather from what I see that moea64_protect did not > need the changes that you originally thought might > be required? I only see moea_protect changes in the > patch. The wording was a little ambiguous. I had meant to convey that I was looking at mmu_oea64.c for inspiration for what's missing in mmu_oea.c. > > === > Mark Millard > marklmi at yahoo.com > ( dsl-only.net went > away in early 2018-Mar) > - Justin From owner-svn-src-head@freebsd.org Thu Jun 11 21:52:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0C69342EDF; Thu, 11 Jun 2020 21:52:06 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jcyZ4mYXz4ShV; Thu, 11 Jun 2020 21:52:06 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F0281F214; Thu, 11 Jun 2020 21:52:06 +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 05BLq6fi095714; Thu, 11 Jun 2020 21:52:06 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BLq6A3095713; Thu, 11 Jun 2020 21:52:06 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006112152.05BLq6A3095713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 11 Jun 2020 21:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362077 - in head/sys: arm64/coresight conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/coresight conf X-SVN-Commit-Revision: 362077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 21:52:06 -0000 Author: br Date: Thu Jun 11 21:52:06 2020 New Revision: 362077 URL: https://svnweb.freebsd.org/changeset/base/362077 Log: Shorten the filename of the coresight replicator driver. Sponsored by: DARPA, AFRL Added: head/sys/arm64/coresight/coresight_replicator.c - copied unchanged from r362076, head/sys/arm64/coresight/coresight_dynamic_replicator.c Deleted: head/sys/arm64/coresight/coresight_dynamic_replicator.c Modified: head/sys/conf/files.arm64 Copied: head/sys/arm64/coresight/coresight_replicator.c (from r362076, head/sys/arm64/coresight/coresight_dynamic_replicator.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_replicator.c Thu Jun 11 21:52:06 2020 (r362077, copy of r362076, head/sys/arm64/coresight/coresight_dynamic_replicator.c) @@ -0,0 +1,172 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 "coresight_if.h" + +#define REPLICATOR_IDFILTER0 0x00 +#define REPLICATOR_IDFILTER1 0x04 + +static struct ofw_compat_data compat_data[] = { + { "arm,coresight-dynamic-replicator", 1 }, + { NULL, 0 } +}; + +struct replicator_softc { + struct resource *res; + struct coresight_platform_data *pdata; +}; + +static struct resource_spec replicator_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int +replicator_init(device_t dev) +{ + struct replicator_softc *sc; + + sc = device_get_softc(dev); + + /* Unlock Coresight */ + bus_write_4(sc->res, CORESIGHT_LAR, CORESIGHT_UNLOCK); + + return (0); +} + +static int +replicator_enable(device_t dev, struct endpoint *endp, + struct coresight_event *event) +{ + struct replicator_softc *sc; + + sc = device_get_softc(dev); + + /* Enable the port. Keep the other port disabled */ + if (endp->reg == 0) { + bus_write_4(sc->res, REPLICATOR_IDFILTER0, 0x00); + bus_write_4(sc->res, REPLICATOR_IDFILTER1, 0xff); + } else { + bus_write_4(sc->res, REPLICATOR_IDFILTER0, 0xff); + bus_write_4(sc->res, REPLICATOR_IDFILTER1, 0x00); + } + + return (0); +} + +static void +replicator_disable(device_t dev, struct endpoint *endp, + struct coresight_event *event) +{ + struct replicator_softc *sc; + + sc = device_get_softc(dev); + + bus_write_4(sc->res, REPLICATOR_IDFILTER0, 0xff); + bus_write_4(sc->res, REPLICATOR_IDFILTER1, 0xff); +} + +static int +replicator_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Coresight Dynamic Replicator"); + + return (BUS_PROBE_DEFAULT); +} + +static int +replicator_attach(device_t dev) +{ + struct replicator_softc *sc; + struct coresight_desc desc; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, replicator_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + return (ENXIO); + } + + sc->pdata = coresight_get_platform_data(dev); + desc.pdata = sc->pdata; + desc.dev = dev; + desc.dev_type = CORESIGHT_DYNAMIC_REPLICATOR; + coresight_register(&desc); + + return (0); +} + +static device_method_t replicator_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, replicator_probe), + DEVMETHOD(device_attach, replicator_attach), + + /* Coresight interface */ + DEVMETHOD(coresight_init, replicator_init), + DEVMETHOD(coresight_enable, replicator_enable), + DEVMETHOD(coresight_disable, replicator_disable), + DEVMETHOD_END +}; + +static driver_t replicator_driver = { + "replicator", + replicator_methods, + sizeof(struct replicator_softc), +}; + +static devclass_t replicator_devclass; + +DRIVER_MODULE(replicator, simplebus, replicator_driver, replicator_devclass, + 0, 0); +MODULE_VERSION(replicator, 1); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Jun 11 20:35:28 2020 (r362076) +++ head/sys/conf/files.arm64 Thu Jun 11 21:52:06 2020 (r362077) @@ -189,7 +189,7 @@ arm64/coresight/coresight.c standard arm64/coresight/coresight_if.m standard arm64/coresight/coresight_cmd.c standard arm64/coresight/coresight_cpu_debug.c standard -arm64/coresight/coresight_dynamic_replicator.c standard +arm64/coresight/coresight_replicator.c standard arm64/coresight/coresight_etm4x.c standard arm64/coresight/coresight_etm4x_acpi.c optional acpi arm64/coresight/coresight_etm4x_fdt.c optional fdt From owner-svn-src-head@freebsd.org Thu Jun 11 22:04:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38A34342DEF for ; Thu, 11 Jun 2020 22:04:19 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic302-22.consmr.mail.gq1.yahoo.com (sonic302-22.consmr.mail.gq1.yahoo.com [98.137.68.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jdDf0svBz4TfW for ; Thu, 11 Jun 2020 22:04:17 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 3oKnKC4VM1lYGbS2O.u1wktRLDRU3MpiMqXIjh4dvuwHa6Xa31BcqeOaAnYEkna KgaMLTs5p9sqvgW.RjjxXYAYJV_6iypseBy49dFp5GhbRsJCpQNNmO6YvGDG41HQIOfEPglmyPik aV4UMifLCBUIWxL6u_K6BACbAvvUnI5FsjDAz.wZTX.UYeDMA65WgzCdP3KmvJvecdk_9BPZbL4J mGIz95E8oulC1mmypm9MPQOPMUyRpgJ3CQZepvvRYWc28Z_yc9XFZ70dUerzNBB0PEFmKt3th.1t AUIAfE9QRVhuyWUcFAg5OHE6ub.5SKbZEectpOWSMO4PxpfT6kUO6cwEtUADP3zoD24aq1elLkGm 7z9XAvXtjo0IPiCmScio_QcE46rCvDuY2zWVIdSJwy3GOYTcV63i6CvQ0uMZKLdEa.y4A5T7vxLg K0m_lWVTOuf4NTVp07JeWzKHcD9CIgYpDZMj1eO.6wusSnDxL0vG6tp1MVbRIBjAIWw2PRfluS0M YaMDNeLEPu8If2Mq92x422oajBAuVtitunhITSCS9cUsbtOTPTBTPgPwJ40xc1sSlX9TCRskvSls Ko6LYt15MmaKXGzsLpXleHQE9391B3kVamWO7pzKKW3K79M3fLuvZp6NWyYKViZ3br0WsroLmcHI lPIKMFw2co1lj5kTWm6UCL3eIOZTWaJCtxH7yWLBrFx0GwveGXUuMYZom7W6XGPZMAJl.vgpLEpa zdhgmRcRvIsJuLoi6yKRwc62vdsJgvJEJu2.NvybfLEXllq5iezyQNYAXJVew6Wud__D59KRIPUr z2fF3ntD_L6CdOlgn3yDFfSYgSUdWCd3gSDIifrlPLY72tojn5yKkleN0rCeoUcCvKL3fI6JErgA 7qAvxDqcuT9HtREMplYj1uRNxej2jSgGz2NRLe7C2v8aAHmzOlh7.e.afuna8QU9T3Z2hiicPK7x v3OA7SUBXV71ysDnoMLMsrLycD_WeezneyBGFCUtq33kTL4WKcAYIv2eHqqeQtLb1.2XNYRtzoQM jCWRSrLxc0m_OWrBOsnai9aTrl6x3pK6HJraAhw_0CWflO5EnDZxw64JsoO3A00aSBMFhy94i5M3 nCvT2U217s0mXtCnMIsr6OiX0gFvwcvPgeJN1_WtBmNtnCl7eCqJu9TbdKTjCLbRdW3DGeZDlU_3 G9u_Z8oYXa6YgMiChWbUGP1M.IrpCOUpICayDRBMnzOfYDY1nxdI.yJ9_ctCVhE9m6yVPxXHrRcN um9MK9xGsfG3ZT6sS3_Bdyu21nRRLoUTXiX5DBqczNXCzakA4Koo6h7OffWPbUBjSZulgijSVXqy VPZEVSM9_Ii3tcYldBKKGe3Z8DT_SY3YtQW40Xc95WejaRKf.cheiyChw7Amdyt1S6XXP7VfHF6a aAN46ixpzMEYRDMHsAO.LXwUGvYaY1h9QhYNyFSq6stWEDUv_UC6vuodWu7lC5XOwGQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Thu, 11 Jun 2020 22:04:16 +0000 Received: by smtp425.mail.gq1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 172ccf42c5eb921977547f6477b474b1; Thu, 11 Jun 2020 22:04:12 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: <8bf74674-4ccf-4f97-bbc5-fa5131209b66@www.fastmail.com> Date: Thu, 11 Jun 2020 15:04:11 -0700 Cc: Justin Hibbits , Eric van Gyzen , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML Content-Transfer-Encoding: quoted-printable Message-Id: <1C6209E6-E980-407B-B635-B76C5F192E8C@yahoo.com> References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <8bf74674-4ccf-4f97-bbc5-fa5131209b66@www.fastmail.com> To: Brandon Bergren X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jdDf0svBz4TfW X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.15 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.65)[-0.654]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.004]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.68.148:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.68.148:from]; FREEMAIL_CC(0.00)[gmail.com,FreeBSD.org,freebsd.org]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 22:04:19 -0000 On 2020-Jun-11, at 14:41, Brandon Bergren = wrote: > An update from my end: I now have the ability to test dual processor = G4 as well, now that mine is up and running. Cool. FYI: Dual processors are not required for the problem to happen: the stress based testing showed the problem just as easily on the single-socket/single-core contexts that I tried. > On Thu, Jun 11, 2020, at 4:36 PM, Mark Millard wrote: >>=20 >> How did you test? >>=20 >> In my context it was far easier to see the problem >> with builds that did not use MALLOC_PRODUCTION. In >> other words: jemalloc having its asserts tested. >>=20 >> The easiest way I found to get the asserts to fail >> was to do (multiple processes (-m) and totaling to >> more than enough to force paging/swapping): >>=20 >> stress -m 2 --vm-bytes 1700M & >>=20 >> (Possibly setting up some shells first >> to potentially later exit.) >>=20 >> Normally stress itself would hit jemalloc >> asserts. Apparently the asserts did not >> stop the code and it ran until a failure >> occurred (via dtv=3D0x0). I never had to >> manually stop the stress processes. >>=20 >> If no failures during, then exit shells >> that likely were swapped out or partially >> paged out during the stress run. They >> hit jemalloc asserts during their cleanup >> activity in my testing. >>=20 >>=20 >>> That said, the attached patch effectively copies >>> what's done in OEA6464 into OEA pmap. Can you test it? >>=20 >> I'll try it once I get a chance, probably later >> today. >>=20 >> I gather from what I see that moea64_protect did not >> need the changes that you originally thought might >> be required? I only see moea_protect changes in the >> patch. >=20 =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Thu Jun 11 22:46:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DFF434458E; Thu, 11 Jun 2020 22:46:09 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jf8x1pG1z4WvS; Thu, 11 Jun 2020 22:46:09 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38A661FC8D; Thu, 11 Jun 2020 22:46:09 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05BMk9PH029919; Thu, 11 Jun 2020 22:46:09 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05BMk8wf029916; Thu, 11 Jun 2020 22:46:08 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <202006112246.05BMk8wf029916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Thu, 11 Jun 2020 22:46:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362078 - in head: sbin/ifconfig sys/net X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in head: sbin/ifconfig sys/net X-SVN-Commit-Revision: 362078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 22:46:09 -0000 Author: rpokala Date: Thu Jun 11 22:46:08 2020 New Revision: 362078 URL: https://svnweb.freebsd.org/changeset/base/362078 Log: Decode the "LACP Fast Timeout" LAGG option flag r286700 added the "lacp_fast_timeout" option to `ifconfig', but we forgot to include the new option in the string used to decode the option bits. Add "LACP_FAST_TIMO" to LAGG_OPT_BITS. Also, s/LAGG_OPT_LACP_TIMEOUT/LAGG_OPT_LACP_FAST_TIMO/g , to be clearer that the flag indicates "Fast Timeout" mode. Reported by: Greg Foster Reviewed by: jpaetzel MFC after: 1 week Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D25239 Modified: head/sbin/ifconfig/iflagg.c head/sys/net/if_lagg.c head/sys/net/if_lagg.h Modified: head/sbin/ifconfig/iflagg.c ============================================================================== --- head/sbin/ifconfig/iflagg.c Thu Jun 11 21:52:06 2020 (r362077) +++ head/sbin/ifconfig/iflagg.c Thu Jun 11 22:46:08 2020 (r362078) @@ -141,8 +141,8 @@ setlaggsetopt(const char *val, int d, int s, const str case -LAGG_OPT_LACP_TXTEST: case LAGG_OPT_LACP_RXTEST: case -LAGG_OPT_LACP_RXTEST: - case LAGG_OPT_LACP_TIMEOUT: - case -LAGG_OPT_LACP_TIMEOUT: + case LAGG_OPT_LACP_FAST_TIMO: + case -LAGG_OPT_LACP_FAST_TIMO: break; default: err(1, "Invalid lagg option"); @@ -316,8 +316,8 @@ static struct cmd lagg_cmds[] = { DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt), DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt), DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt), - DEF_CMD("lacp_fast_timeout", LAGG_OPT_LACP_TIMEOUT, setlaggsetopt), - DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, setlaggsetopt), + DEF_CMD("lacp_fast_timeout", LAGG_OPT_LACP_FAST_TIMO, setlaggsetopt), + DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_FAST_TIMO, setlaggsetopt), DEF_CMD_ARG("flowid_shift", setlaggflowidshift), DEF_CMD_ARG("rr_limit", setlaggrr_limit), }; Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Thu Jun 11 21:52:06 2020 (r362077) +++ head/sys/net/if_lagg.c Thu Jun 11 22:46:08 2020 (r362078) @@ -1246,7 +1246,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data if (lsc->lsc_strict_mode != 0) ro->ro_opts |= LAGG_OPT_LACP_STRICT; if (lsc->lsc_fast_timeout != 0) - ro->ro_opts |= LAGG_OPT_LACP_TIMEOUT; + ro->ro_opts |= LAGG_OPT_LACP_FAST_TIMO; ro->ro_active = sc->sc_active; } else { @@ -1305,8 +1305,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data case -LAGG_OPT_LACP_RXTEST: case LAGG_OPT_LACP_STRICT: case -LAGG_OPT_LACP_STRICT: - case LAGG_OPT_LACP_TIMEOUT: - case -LAGG_OPT_LACP_TIMEOUT: + case LAGG_OPT_LACP_FAST_TIMO: + case -LAGG_OPT_LACP_FAST_TIMO: valid = lacp = 1; break; default: @@ -1366,14 +1366,14 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data case -LAGG_OPT_LACP_STRICT: lsc->lsc_strict_mode = 0; break; - case LAGG_OPT_LACP_TIMEOUT: + case LAGG_OPT_LACP_FAST_TIMO: LACP_LOCK(lsc); LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) lp->lp_state |= LACP_STATE_TIMEOUT; LACP_UNLOCK(lsc); lsc->lsc_fast_timeout = 1; break; - case -LAGG_OPT_LACP_TIMEOUT: + case -LAGG_OPT_LACP_FAST_TIMO: LACP_LOCK(lsc); LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) lp->lp_state &= ~LACP_STATE_TIMEOUT; Modified: head/sys/net/if_lagg.h ============================================================================== --- head/sys/net/if_lagg.h Thu Jun 11 21:52:06 2020 (r362077) +++ head/sys/net/if_lagg.h Thu Jun 11 22:46:08 2020 (r362078) @@ -148,7 +148,7 @@ struct lagg_reqopts { #define LAGG_OPT_LACP_STRICT 0x10 /* LACP strict mode */ #define LAGG_OPT_LACP_TXTEST 0x20 /* LACP debug: txtest */ #define LAGG_OPT_LACP_RXTEST 0x40 /* LACP debug: rxtest */ -#define LAGG_OPT_LACP_TIMEOUT 0x80 /* LACP timeout */ +#define LAGG_OPT_LACP_FAST_TIMO 0x80 /* LACP fast timeout */ #define LAGG_OPT_RR_LIMIT 0x100 /* RR stride */ u_int ro_count; /* number of ports */ u_int ro_active; /* active port count */ @@ -162,7 +162,7 @@ struct lagg_reqopts { #define LAGG_OPT_BITS "\020\001USE_FLOWID\003USE_NUMA" \ "\005LACP_STRICT\006LACP_TXTEST" \ - "\007LACP_RXTEST" + "\007LACP_RXTEST\010LACP_FAST_TIMO" #ifdef _KERNEL From owner-svn-src-head@freebsd.org Thu Jun 11 23:49:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 180B5345333 for ; Thu, 11 Jun 2020 23:49:41 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic317-21.consmr.mail.gq1.yahoo.com (sonic317-21.consmr.mail.gq1.yahoo.com [98.137.66.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jgZC41Flz4ZlJ for ; Thu, 11 Jun 2020 23:49:39 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: He.9TQYVM1mhX3UkSY6ZD9dDWgF8Cb3EkBYcNWmoOYnkr2J0VxnM.NrbIt48x9_ SivTGNX3zV7_7jctFE3O9SBDJbjeEjKMUkQi76qUKYddzTXLfVsKezxBNssv53H_rFA5amXS7ZcU LeLY7Mrj9CH00.MdgeklKnRO8R0OfZvWyUGFYNzQt7rb.ZUlggoFSQ5LCFYoDbgu36l0pKNx5dvh cK3CYPJ_LdUesq3HNe.AVBt8TzeMoetTJ0Sxdu9qeYVO1qN2LApYrgcjZTjP4P0D5Kh9sKwGhW7w pQ2C7aGfkLPFBRP3qsihLU8kKmgqV4gHmj3nblp4RqPNcN9sSX2xbPKK6t3gMnKkflHr.8JrMpju kMOhLNIHumgjlx2zA3y7JSKK39UD44WbG8P_mTNN7jAG0jypjx77wvcZz3Wd22Md6lhV9zQuSSB3 U48dNnN7e0oKRmpPwpxiqaNG3kNDCJf29YSp9vZWfvtLRFip8LRi.zawSGyNnsoYxNLB3ZD536vb Pd7HwhY84OoEp2DFX5sbESp9JK7sswE0vhSvhHSar6jLs1cXSWkIWbe7R5AUlTJjsFMq3jXgATU9 3rpEFGZwjBEVtN7UaiFtg6M50LK.pxOxChhwpVIKn9SRCMDrn2EWbC6UMH6KWvM7FJI0AbTrJeSY UEMwWyfpYLiezxi7JR5I4EFZDBJyvgVG0Wq2UhdEQQJaW67r0nVNeQqmOX7XLTEKqOmIoxXDK3K. h4uJpJD6MYASclWLIwtFMUQlMRPfEVU5.CbpbekJFFXM.vakt1qpxzijCWFL4TYlcEWlK97Kg8qK KH28Sp1d1VCk56bxE4dM.FBtJneMbRDRfae2t9OcTwO3LkT05.VkV27DQVsXo68KxNs8YW09cazj uJKbrsJtq0iN1XAEoOsM2vf26ULRFRgQ4DSFD6s04SiT_n_FmkXTfI.uvsshkQhgFZz5_BYovfZy T4YWfEVIDUZ5NSoKefweuuFtqMdoauYbvziRtwzfpGRvgHfD34PJTtY9X2F6XMl3ijx9N_HnrfZY nlXZiDsJ2zj9TvX0l5H09yt_A_lLsRdb0SP3UwV7A_vebgJI8X3IaZ.S9y2q7kAS.VUNkcVaIyth FYRMVwkyr3pmIYHddSl9AuqVRWIM33VKSdJsS804vEiradp7PBEN5UMrCboOp5HbhFbo9YHst_5o ZbpTcjGQJkIG0s8m70ZkiZVsoFT.DUjmxg1W6k15ffA3.ZlApvTcxQ5hEKQiqwYpZKfp6jVCvpCj QdBWPWGQ0fVOLVFCnZOFeNa.wqe0YogvXmHyz.JHKZs_ZoQZ52S_4ppYFzuBbsS97IqLEuBG2PnX FWJ1xzVLZ6g9M58_lqH.S0hGL7Cok6sZ9UA7EOh43jDsqBmr7JV6PnY.wEsUjfWLj9Kjwhjxh9lX ySgJWtVMr_xzfRL.1h0VZi.hkN1io2cg- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Thu, 11 Jun 2020 23:49:37 +0000 Received: by smtp404.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 7a484c8b324b68c03576f32441dbcc44; Thu, 11 Jun 2020 23:49:36 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: <20200611164216.47f82775@ralga.knownspace> Date: Thu, 11 Jun 2020 16:49:33 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: quoted-printable Message-Id: References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <20200611164216.47f82775@ralga.knownspace> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jgZC41Flz4ZlJ X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.40 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.89)[-0.892]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.013]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.66.147:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.66.147:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 11 Jun 2020 23:49:41 -0000 On 2020-Jun-11, at 14:42, Justin Hibbits = wrote: On Thu, 11 Jun 2020 14:36:37 -0700 Mark Millard wrote: > On 2020-Jun-11, at 13:55, Justin Hibbits > wrote: >=20 >> On Wed, 10 Jun 2020 18:56:57 -0700 >> Mark Millard wrote: . . . >=20 >=20 >> That said, the attached patch effectively copies >> what's done in OEA6464 into OEA pmap. Can you test it? =20 >=20 > I'll try it once I get a chance, probably later > today. > . . . No luck at the change being a fix, I'm afraid. I verified that the build ended up with 00926cb0 bl 008e8dc8 00926cb4 mr r27,r3 00926cb8 addi r3,r3,36 00926cbc hwsync 00926cc0 lwarx r25,0,r3 00926cc4 li r4,0 00926cc8 stwcx. r4,0,r3 00926ccc bne- 00926cc0 00926cd0 andi. r3,r25,128 00926cd4 beq 00926ce0 00926cd8 mr r3,r27 00926cdc bl 008e9874 in the installed kernel. So I doubt a mis-build would be involved. It is a head -r360311 based context still. World is without MALLOC_PRODUCTION so that jemalloc code executes its asserts, catching more and earlier than otherwise. First test . . . The only thing that the witness kernel reported was: Jun 11 15:58:16 FBSDG4S2 kernel: lock order reversal: Jun 11 15:58:16 FBSDG4S2 kernel: 1st 0x216fb00 Mountpoints (UMA zone) @ = /usr/src/sys/vm/uma_core.c:4387 Jun 11 15:58:16 FBSDG4S2 kernel: 2nd 0x1192d2c kernelpmap (kernelpmap) = @ /usr/src/sys/powerpc/aim/mmu_oea.c:1524 Jun 11 15:58:16 FBSDG4S2 kernel: stack backtrace: Jun 11 15:58:16 FBSDG4S2 kernel: #0 0x5ec164 at witness_debugger+0x94 Jun 11 15:58:16 FBSDG4S2 kernel: #1 0x5ebe3c at witness_checkorder+0xb50 Jun 11 15:58:16 FBSDG4S2 kernel: #2 0x536d5c at __mtx_lock_flags+0xcc Jun 11 15:58:16 FBSDG4S2 kernel: #3 0x92636c at moea_kextract+0x5c Jun 11 15:58:16 FBSDG4S2 kernel: #4 0x965d30 at pmap_kextract+0x98 Jun 11 15:58:16 FBSDG4S2 kernel: #5 0x8bfdbc at zone_release+0xf0 Jun 11 15:58:16 FBSDG4S2 kernel: #6 0x8c7854 at bucket_drain+0x2f0 Jun 11 15:58:16 FBSDG4S2 kernel: #7 0x8c728c at bucket_free+0x54 Jun 11 15:58:16 FBSDG4S2 kernel: #8 0x8c74fc at = bucket_cache_reclaim+0x1bc Jun 11 15:58:16 FBSDG4S2 kernel: #9 0x8c7004 at zone_reclaim+0x128 Jun 11 15:58:16 FBSDG4S2 kernel: #10 0x8c3a40 at uma_reclaim+0x170 Jun 11 15:58:16 FBSDG4S2 kernel: #11 0x8c3f70 at uma_reclaim_worker+0x68 Jun 11 15:58:16 FBSDG4S2 kernel: #12 0x50fbac at fork_exit+0xb0 Jun 11 15:58:16 FBSDG4S2 kernel: #13 0x9684ac at fork_trampoline+0xc The processes that were hit were listed as: Jun 11 15:59:11 FBSDG4S2 kernel: pid 971 (cron), jid 0, uid 0: exited on = signal 11 (core dumped) Jun 11 16:02:59 FBSDG4S2 kernel: pid 1111 (stress), jid 0, uid 0: exited = on signal 6 (core dumped) Jun 11 16:03:27 FBSDG4S2 kernel: pid 871 (mountd), jid 0, uid 0: exited = on signal 6 (core dumped) Jun 11 16:03:40 FBSDG4S2 kernel: pid 1065 (su), jid 0, uid 0: exited on = signal 6 Jun 11 16:04:13 FBSDG4S2 kernel: pid 1088 (su), jid 0, uid 0: exited on = signal 6 Jun 11 16:04:28 FBSDG4S2 kernel: pid 968 (sshd), jid 0, uid 0: exited on = signal 6 Jun 11 16:05:42 FBSDG4S2 kernel: pid 1028 (login), jid 0, uid 0: exited = on signal 6 Jun 11 16:05:46 FBSDG4S2 kernel: pid 873 (nfsd), jid 0, uid 0: exited on = signal 6 (core dumped) Rebooting and rerunning and showing the stress output and such (I did not capture copies during the first test, but the first test had similar messages at the same sort of points): Second test . . . # stress -m 2 --vm-bytes 1700M stress: info: [1166] dispatching hogs: 0 cpu, 0 io, 2 vm, 0 hdd : = /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258:= Failed assertion: "slab =3D=3D extent_slab_get(extent)" : = /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258:= Failed assertion: "slab =3D=3D extent_slab_get(extent)" ^C # exit : = /usr/src/contrib/jemalloc/include/jemalloc/internal/sz.h:200: Failed = assertion: "ret =3D=3D sz_index2size_compute(index)" Abort trap The other stuff was similar to to first test, not repeated here. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jun 12 00:30:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC827346A70 for ; Fri, 12 Jun 2020 00:30:29 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic303-25.consmr.mail.gq1.yahoo.com (sonic303-25.consmr.mail.gq1.yahoo.com [98.137.64.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jhTJ17c7z4d1s for ; Fri, 12 Jun 2020 00:30:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: YRjKgZ8VM1nz1gmprGN5LHFr7c2ibc7p8GI71NzCZGXTHdzsyZR0vQwHLwPa7AB bYghn03LipAom3UDNW_Q2cQuWn9XgM5DnTGlgCTXl2Wa3Z9HFd3DmIOY2_ysSmEQ.Oeh8ar4wjSt H2ECt..1MXRVRKV5aAQGLl_a.JINY9SQfnYzg5WLKFewIALgETnCy5290ACMFykqHsY8Ti0GxePq PcfnZEM7kMNRE.yR_K6TY6tiqEh2NHuCrLSguIly.fag_GtIkgVTOQ2eRHGUhSEbAtT9.6GSZ6i_ X00wrvE3HjBUUTPCT8BuBemZVigBjsSx33dX98JsihM_WtJLiNYwUgwaxBQknJ2Z_8iugFOrM2OH Irqz9jLGoV4xO_loLjzF4gaAmzcVNXHePPHLnIEdflC4EPSU7.S15xl8E0_q.J4urQjWiqswcxi_ UZ62T_qN2IURrmbceorIo8QZVBJOwehjwrgFKK4V7dXoWDkPySCWqvXxVXl5n3k_SSljrYAxYumf 9GYlPpS7OXSMhdQ2.wHhU4WrmMSfudpJpEv5xgzv.aS2eNVpKSacc21_AjFVz6YBSjLBLbq1swN7 P4sepPNBuDUJ28VuwHcsiWGZK27cl7KLQMdUv1ZHx88SscE1lffueNxy.WHwktmECdU3iqJEFif9 9X1226AOzW5ZJfBtwPm9dqqWtPE7r3qD4_k4Ux_R99OJiAoHjg8IRFsvIP3ic_pJGpmmX3SlgrMA 6rRANDypWVdvWy9h_RMqg20fdyRyQHBh8S5QHF0Q8ZIkRq4aaEn3k8auG4U7lf3_qEIXDLLYw5Zv PMoDFlv5x77KhYdcn7B7ptwLgGg.kXiKxE0CqotkRJS5GAJEFZZwROi0lAGUE9125jdCUMVQptkt mfM9iDyhBnN1tI3pRo3.O6kAA5jtPVQ0Z2M3DYU2qtVFbnloS8JNT1vCpRwbBVZ_C2RK7F8he6oU O.2y9n0Kgm_I5LSOhpG_kvURahhRNtNuPV.Ly0XTd4pZMjcgMVxbOmOAxjdUzMdPCIpOnM1kS8bA FD980GhZofJlwaWY.e7lI.WfOrOHckJovI8suv3y7FUCInGlUshHE8c5q.P72NLynSb0mfBEPjCE j4jZmFFatRjR.iBK.j5ccgpv10lj6fz66U.iKRDvIXS.KmErysrhKzCMT1qpq2p996qCpKcRLk4s 9jlwaUo_7_mspyx_2Hv01lcg1NIBS4fCgtPsNMi3OH7px84.i6QtDFLzQlQ0HAr_AGIiu4oqNXl8 ZBlRXjH0HLu2EnYM_KYkF_A6lIomSaIJpmoVG8Lge8Ub82MeNtvZQWVj860vD0a2JzYKEWZA6REQ Tr_vabjuSf.kKWZQAGGBJc8WLl1q0CjfIVr23Ffus4_7KsuEpDGW3NHvyRljmCp7ZK._23uKIrmr dWSew1eFYyurdVlR32tWiWaXDTAPeIIHBYzIDTB7X4uz8MDzwQHiUPByJ9Q-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.gq1.yahoo.com with HTTP; Fri, 12 Jun 2020 00:30:26 +0000 Received: by smtp428.mail.gq1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 1f421ce3a9c01e05f91777c49cc0466a; Fri, 12 Jun 2020 00:30:25 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: Date: Thu, 11 Jun 2020 17:30:24 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: quoted-printable Message-Id: References: <8479DD58-44F6-446A-9CA5-D01F0F7C1B38@yahoo.com> <17ACDA02-D7EF-4F26-874A-BB3E935CD072@yahoo.com> <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <20200611164216.47f82775@ralga.knownspace> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jhTJ17c7z4d1s X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.12 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.61)[-0.614]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.014]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.994]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.64.206:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.64.206:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 00:30:29 -0000 On 2020-Jun-11, at 16:49, Mark Millard wrote: > On 2020-Jun-11, at 14:42, Justin Hibbits = wrote: >=20 > On Thu, 11 Jun 2020 14:36:37 -0700 > Mark Millard wrote: >=20 >> On 2020-Jun-11, at 13:55, Justin Hibbits >> wrote: >>=20 >>> On Wed, 10 Jun 2020 18:56:57 -0700 >>> Mark Millard wrote: > . . . >>=20 >>=20 >>> That said, the attached patch effectively copies >>> what's done in OEA6464 into OEA pmap. Can you test it? =20 >>=20 >> I'll try it once I get a chance, probably later >> today. >> . . . >=20 > No luck at the change being a fix, I'm afraid. >=20 > I verified that the build ended up with >=20 > 00926cb0 bl 008e8dc8 > 00926cb4 mr r27,r3 > 00926cb8 addi r3,r3,36 > 00926cbc hwsync > 00926cc0 lwarx r25,0,r3 > 00926cc4 li r4,0 > 00926cc8 stwcx. r4,0,r3 > 00926ccc bne- 00926cc0 > 00926cd0 andi. r3,r25,128 > 00926cd4 beq 00926ce0 > 00926cd8 mr r3,r27 > 00926cdc bl 008e9874 >=20 > in the installed kernel. So I doubt a > mis-build would be involved. It is a > head -r360311 based context still. World is > without MALLOC_PRODUCTION so that jemalloc > code executes its asserts, catching more > and earlier than otherwise. >=20 > First test . . . >=20 > The only thing that the witness kernel reported was: >=20 > Jun 11 15:58:16 FBSDG4S2 kernel: lock order reversal: > Jun 11 15:58:16 FBSDG4S2 kernel: 1st 0x216fb00 Mountpoints (UMA zone) = @ /usr/src/sys/vm/uma_core.c:4387 > Jun 11 15:58:16 FBSDG4S2 kernel: 2nd 0x1192d2c kernelpmap = (kernelpmap) @ /usr/src/sys/powerpc/aim/mmu_oea.c:1524 > Jun 11 15:58:16 FBSDG4S2 kernel: stack backtrace: > Jun 11 15:58:16 FBSDG4S2 kernel: #0 0x5ec164 at witness_debugger+0x94 > Jun 11 15:58:16 FBSDG4S2 kernel: #1 0x5ebe3c at = witness_checkorder+0xb50 > Jun 11 15:58:16 FBSDG4S2 kernel: #2 0x536d5c at __mtx_lock_flags+0xcc > Jun 11 15:58:16 FBSDG4S2 kernel: #3 0x92636c at moea_kextract+0x5c > Jun 11 15:58:16 FBSDG4S2 kernel: #4 0x965d30 at pmap_kextract+0x98 > Jun 11 15:58:16 FBSDG4S2 kernel: #5 0x8bfdbc at zone_release+0xf0 > Jun 11 15:58:16 FBSDG4S2 kernel: #6 0x8c7854 at bucket_drain+0x2f0 > Jun 11 15:58:16 FBSDG4S2 kernel: #7 0x8c728c at bucket_free+0x54 > Jun 11 15:58:16 FBSDG4S2 kernel: #8 0x8c74fc at = bucket_cache_reclaim+0x1bc > Jun 11 15:58:16 FBSDG4S2 kernel: #9 0x8c7004 at zone_reclaim+0x128 > Jun 11 15:58:16 FBSDG4S2 kernel: #10 0x8c3a40 at uma_reclaim+0x170 > Jun 11 15:58:16 FBSDG4S2 kernel: #11 0x8c3f70 at = uma_reclaim_worker+0x68 > Jun 11 15:58:16 FBSDG4S2 kernel: #12 0x50fbac at fork_exit+0xb0 > Jun 11 15:58:16 FBSDG4S2 kernel: #13 0x9684ac at fork_trampoline+0xc >=20 > The processes that were hit were listed as: >=20 > Jun 11 15:59:11 FBSDG4S2 kernel: pid 971 (cron), jid 0, uid 0: exited = on signal 11 (core dumped) > Jun 11 16:02:59 FBSDG4S2 kernel: pid 1111 (stress), jid 0, uid 0: = exited on signal 6 (core dumped) > Jun 11 16:03:27 FBSDG4S2 kernel: pid 871 (mountd), jid 0, uid 0: = exited on signal 6 (core dumped) > Jun 11 16:03:40 FBSDG4S2 kernel: pid 1065 (su), jid 0, uid 0: exited = on signal 6 > Jun 11 16:04:13 FBSDG4S2 kernel: pid 1088 (su), jid 0, uid 0: exited = on signal 6 > Jun 11 16:04:28 FBSDG4S2 kernel: pid 968 (sshd), jid 0, uid 0: exited = on signal 6 >=20 > Jun 11 16:05:42 FBSDG4S2 kernel: pid 1028 (login), jid 0, uid 0: = exited on signal 6 >=20 > Jun 11 16:05:46 FBSDG4S2 kernel: pid 873 (nfsd), jid 0, uid 0: exited = on signal 6 (core dumped) >=20 >=20 > Rebooting and rerunning and showing the stress output and such > (I did not capture copies during the first test, but the first > test had similar messages at the same sort of points): >=20 > Second test . . . >=20 > # stress -m 2 --vm-bytes 1700M > stress: info: [1166] dispatching hogs: 0 cpu, 0 io, 2 vm, 0 hdd > : = /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258:= Failed assertion: "slab =3D=3D extent_slab_get(extent)" > : = /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258:= Failed assertion: "slab =3D=3D extent_slab_get(extent)" > ^C >=20 > # exit > : = /usr/src/contrib/jemalloc/include/jemalloc/internal/sz.h:200: Failed = assertion: "ret =3D=3D sz_index2size_compute(index)" > Abort trap >=20 > The other stuff was similar to to first test, not repeated here. The updated code looks odd to me for how "m" is handled (part of a egrep to ensure I show all the usage of m): moea_protect(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_page_t m; if (pm !=3D kernel_pmap && m !=3D NULL && (m->a.flags & PGA_EXECUTABLE) =3D=3D 0 && if ((m->oflags & VPO_UNMANAGED) =3D=3D = 0) vm_page_aflag_set(m, = PGA_EXECUTABLE); m =3D PHYS_TO_VM_PAGE(old_pte.pte_lo & = PTE_RPGN); refchg =3D = atomic_readandclear_32(&m->md.mdpg_attrs); vm_page_dirty(m); vm_page_aflag_set(m, = PGA_REFERENCED); Or more completely, with notes mixed in: void=20 moea_protect(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) { . . . vm_page_t m; . . . for (pvo =3D RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); pvo !=3D NULL && PVO_VADDR(pvo) < eva; pvo =3D tpvo) { . . . if (pt !=3D NULL) { . . . if (pm !=3D kernel_pmap && m !=3D NULL && NOTE: m seems to be uninitialized but tested for being NULL above. (m->a.flags & PGA_EXECUTABLE) =3D=3D 0 && Note: This looks to potentially be using a random, non-NULL value for m during evaluation of m->a.flags . . . . if ((pvo->pvo_vaddr & PVO_MANAGED) && (pvo->pvo_pte.prot & VM_PROT_WRITE)) { m =3D PHYS_TO_VM_PAGE(old_pte.pte_lo & = PTE_RPGN); Note: m finally is potentially initialized(/set). refchg =3D = atomic_readandclear_32(&m->md.mdpg_attrs); if (refchg & PTE_CHG) vm_page_dirty(m); if (refchg & PTE_REF) vm_page_aflag_set(m, = PGA_REFERENCED); . . . Note: So, if m is set above, then the next loop iteration(s) would use this then-old value instead of an initialized value. It looks to me like at least one assignment to m is missing. moea64_pvo_protect has pg that seems analogous to m and has: pg =3D PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); . . . if (pm !=3D kernel_pmap && pg !=3D NULL && (pg->a.flags & PGA_EXECUTABLE) =3D=3D 0 && (pvo->pvo_pte.pa & (LPTE_I | LPTE_G | LPTE_NOEXEC)) =3D=3D = 0) { if ((pg->oflags & VPO_UNMANAGED) =3D=3D 0) vm_page_aflag_set(pg, PGA_EXECUTABLE); . . . if (pg !=3D NULL && (pvo->pvo_vaddr & PVO_MANAGED) && (oldprot & VM_PROT_WRITE)) { refchg |=3D atomic_readandclear_32(&pg->md.mdpg_attrs); if (refchg & LPTE_CHG) vm_page_dirty(pg); if (refchg & LPTE_REF) vm_page_aflag_set(pg, PGA_REFERENCED); This might suggest some about what is missing. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jun 12 02:25:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC62032A1E1; Fri, 12 Jun 2020 02:25:36 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jl280mR7z3Vw6; Fri, 12 Jun 2020 02:25:35 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io1-xd43.google.com with SMTP id r2so8713343ioo.4; Thu, 11 Jun 2020 19:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NqRsFyli/EmHyKWWTtEHVl2EkHZ2InLe+Tuh08JVv20=; b=UAc04+/a/WE0qz8CjqspFyeoyonPvtB6JscXKU8xg1S6dGaeL2/gIZgu3AB2kiK4t2 k3G1JgOJK8rOtC+tNtoiBXRmjQ780PBGt1gYqxuyIJVbZ1mwiqXX7xmL7ogHvvzpgp+d ndgTm3kBlDCtHswtcWIiQ8/wf70q2KU9gq5+hMnDPad/Ogf1H6NZ6AG/NBxI4G56GaS6 EBJxrV9Jgx0ippbu8AKeHYRS2bSgEzYDaDs7Dib66xB4HigsmNiHViaWGoTaFF2LTDIU jYvsJHtTN3X2h+QQ/infV0xEuDiAZ3W7+hRUoA8m6QpWTD0G41qdrLWx9ZrL9ACiz66l VJbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NqRsFyli/EmHyKWWTtEHVl2EkHZ2InLe+Tuh08JVv20=; b=NPi+5Ho0N1kx5yumsdP9e2CAsJpqtHyhyXTawc/eOtZ2VAuhgLtCbfO1W7OpKDezc0 I91ZUrUyQYRaZBOxhLUs1lCCRZf37bJ3ymaGP/IFSHRo2IHvytFFj3bYQCEDwHEPzk85 hRpEpT5/d22shaCyTN0Yn0rxkMI/Ilkyl/M2ICM5F91YzfSnHBTNLgZL1iv+kT6CNJqu kKW83t0uqyUv6CnL8MaLwEFSX+hmn9kpjtP6anYxouR15YZvZgR0nmQaX8Xz0/2MGlMW 1Ma7snnhaCRl2Z8CNHoPcbRhb03gcf75q7+arJNDkDgx2I/hxPFoB9pmEbW1erqmnPip d4ng== X-Gm-Message-State: AOAM533PghpVNqDO46Naz+/ylCPa3MOUET9y69nvwp5zxKh6zoXbD/+1 gY8bPYrCcD/JbC+3C/DCrN8= X-Google-Smtp-Source: ABdhPJyIdbT++t1G2DOKg8+XsiLgA1xmUy7M4yUQz3SthqO7rERv/fSULjiDtHhgXODBYjJSZ2nTIg== X-Received: by 2002:a6b:8dd0:: with SMTP id p199mr11176492iod.7.1591928735054; Thu, 11 Jun 2020 19:25:35 -0700 (PDT) Received: from ralga.knownspace (173-19-125-130.client.mchsi.com. [173.19.125.130]) by smtp.gmail.com with ESMTPSA id r18sm2443337ilt.43.2020.06.11.19.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2020 19:25:34 -0700 (PDT) Date: Thu, 11 Jun 2020 21:25:32 -0500 From: Justin Hibbits To: Mark Millard Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 Message-ID: <20200611212532.59f677be@ralga.knownspace> In-Reply-To: References: <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <20200611164216.47f82775@ralga.knownspace> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49jl280mR7z3Vw6 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=UAc04+/a; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::d43 as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-1.01)[-1.010]; FREEMAIL_TO(0.00)[yahoo.com]; RECEIVED_SPAMHAUS_PBL(0.00)[173.19.125.130:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.978]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.01)[-1.008]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d43:from]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 02:25:37 -0000 On Thu, 11 Jun 2020 17:30:24 -0700 Mark Millard wrote: > On 2020-Jun-11, at 16:49, Mark Millard wrote: > > > On 2020-Jun-11, at 14:42, Justin Hibbits > > wrote: > > > > On Thu, 11 Jun 2020 14:36:37 -0700 > > Mark Millard wrote: > > > >> On 2020-Jun-11, at 13:55, Justin Hibbits > >> wrote: > >> > >>> On Wed, 10 Jun 2020 18:56:57 -0700 > >>> Mark Millard wrote: > > . . . > >> > >> > >>> That said, the attached patch effectively copies > >>> what's done in OEA6464 into OEA pmap. Can you test it? > >> > >> I'll try it once I get a chance, probably later > >> today. > >> . . . > > > > No luck at the change being a fix, I'm afraid. > > > > I verified that the build ended up with > > > > 00926cb0 bl 008e8dc8 > > 00926cb4 mr r27,r3 > > 00926cb8 addi r3,r3,36 > > 00926cbc hwsync > > 00926cc0 lwarx r25,0,r3 > > 00926cc4 li r4,0 > > 00926cc8 stwcx. r4,0,r3 > > 00926ccc bne- 00926cc0 > > 00926cd0 andi. r3,r25,128 > > 00926cd4 beq 00926ce0 > > 00926cd8 mr r3,r27 > > 00926cdc bl 008e9874 > > > > in the installed kernel. So I doubt a > > mis-build would be involved. It is a > > head -r360311 based context still. World is > > without MALLOC_PRODUCTION so that jemalloc > > code executes its asserts, catching more > > and earlier than otherwise. > > > > First test . . . > > > > The only thing that the witness kernel reported was: > > > > Jun 11 15:58:16 FBSDG4S2 kernel: lock order reversal: > > Jun 11 15:58:16 FBSDG4S2 kernel: 1st 0x216fb00 Mountpoints (UMA > > zone) @ /usr/src/sys/vm/uma_core.c:4387 Jun 11 15:58:16 FBSDG4S2 > > kernel: 2nd 0x1192d2c kernelpmap (kernelpmap) @ > > /usr/src/sys/powerpc/aim/mmu_oea.c:1524 Jun 11 15:58:16 FBSDG4S2 > > kernel: stack backtrace: Jun 11 15:58:16 FBSDG4S2 kernel: #0 > > 0x5ec164 at witness_debugger+0x94 Jun 11 15:58:16 FBSDG4S2 kernel: > > #1 0x5ebe3c at witness_checkorder+0xb50 Jun 11 15:58:16 FBSDG4S2 > > kernel: #2 0x536d5c at __mtx_lock_flags+0xcc Jun 11 15:58:16 > > FBSDG4S2 kernel: #3 0x92636c at moea_kextract+0x5c Jun 11 15:58:16 > > FBSDG4S2 kernel: #4 0x965d30 at pmap_kextract+0x98 Jun 11 15:58:16 > > FBSDG4S2 kernel: #5 0x8bfdbc at zone_release+0xf0 Jun 11 15:58:16 > > FBSDG4S2 kernel: #6 0x8c7854 at bucket_drain+0x2f0 Jun 11 15:58:16 > > FBSDG4S2 kernel: #7 0x8c728c at bucket_free+0x54 Jun 11 15:58:16 > > FBSDG4S2 kernel: #8 0x8c74fc at bucket_cache_reclaim+0x1bc Jun 11 > > 15:58:16 FBSDG4S2 kernel: #9 0x8c7004 at zone_reclaim+0x128 Jun 11 > > 15:58:16 FBSDG4S2 kernel: #10 0x8c3a40 at uma_reclaim+0x170 Jun 11 > > 15:58:16 FBSDG4S2 kernel: #11 0x8c3f70 at uma_reclaim_worker+0x68 > > Jun 11 15:58:16 FBSDG4S2 kernel: #12 0x50fbac at fork_exit+0xb0 Jun > > 11 15:58:16 FBSDG4S2 kernel: #13 0x9684ac at fork_trampoline+0xc > > > > The processes that were hit were listed as: > > > > Jun 11 15:59:11 FBSDG4S2 kernel: pid 971 (cron), jid 0, uid 0: > > exited on signal 11 (core dumped) Jun 11 16:02:59 FBSDG4S2 kernel: > > pid 1111 (stress), jid 0, uid 0: exited on signal 6 (core dumped) > > Jun 11 16:03:27 FBSDG4S2 kernel: pid 871 (mountd), jid 0, uid 0: > > exited on signal 6 (core dumped) Jun 11 16:03:40 FBSDG4S2 kernel: > > pid 1065 (su), jid 0, uid 0: exited on signal 6 Jun 11 16:04:13 > > FBSDG4S2 kernel: pid 1088 (su), jid 0, uid 0: exited on signal 6 > > Jun 11 16:04:28 FBSDG4S2 kernel: pid 968 (sshd), jid 0, uid 0: > > exited on signal 6 > > > > Jun 11 16:05:42 FBSDG4S2 kernel: pid 1028 (login), jid 0, uid 0: > > exited on signal 6 > > > > Jun 11 16:05:46 FBSDG4S2 kernel: pid 873 (nfsd), jid 0, uid 0: > > exited on signal 6 (core dumped) > > > > > > Rebooting and rerunning and showing the stress output and such > > (I did not capture copies during the first test, but the first > > test had similar messages at the same sort of points): > > > > Second test . . . > > > > # stress -m 2 --vm-bytes 1700M > > stress: info: [1166] dispatching hogs: 0 cpu, 0 io, 2 vm, 0 hdd > > : > > /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258: > > Failed assertion: "slab == extent_slab_get(extent)" : > > /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258: > > Failed assertion: "slab == extent_slab_get(extent)" ^C > > > > # exit > > : > > /usr/src/contrib/jemalloc/include/jemalloc/internal/sz.h:200: > > Failed assertion: "ret == sz_index2size_compute(index)" Abort trap > > > > The other stuff was similar to to first test, not repeated here. > > The updated code looks odd to me for how "m" is > handled (part of a egrep to ensure I show all the > usage of m): > > moea_protect(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva, > vm_page_t m; > if (pm != kernel_pmap && m != NULL && > (m->a.flags & PGA_EXECUTABLE) == 0 && > if ((m->oflags & VPO_UNMANAGED) == 0) > vm_page_aflag_set(m, > PGA_EXECUTABLE); m = PHYS_TO_VM_PAGE(old_pte.pte_lo & PTE_RPGN); > refchg = > atomic_readandclear_32(&m->md.mdpg_attrs); vm_page_dirty(m); > vm_page_aflag_set(m, > PGA_REFERENCED); > > Or more completely, with notes mixed in: > > void > moea_protect(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva, > vm_prot_t prot) > { > . . . > vm_page_t m; > . . . > for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); > pvo != NULL && PVO_VADDR(pvo) < eva; pvo = tpvo) { > . . . > if (pt != NULL) { > . . . > if (pm != kernel_pmap && m != NULL && > > NOTE: m seems to be uninitialized but tested for being NULL > above. > > (m->a.flags & PGA_EXECUTABLE) == 0 && > > Note: This looks to potentially be using a random, non-NULL > value for m during evaluation of m->a.flags . > > . . . > > if ((pvo->pvo_vaddr & PVO_MANAGED) && > (pvo->pvo_pte.prot & VM_PROT_WRITE)) { > m = PHYS_TO_VM_PAGE(old_pte.pte_lo & > PTE_RPGN); > > Note: m finally is potentially initialized(/set). > > refchg = > atomic_readandclear_32(&m->md.mdpg_attrs); if (refchg & PTE_CHG) > vm_page_dirty(m); > if (refchg & PTE_REF) > vm_page_aflag_set(m, > PGA_REFERENCED); . . . > > Note: So, if m is set above, then the next loop > iteration(s) would use this then-old value > instead of an initialized value. > > It looks to me like at least one assignment > to m is missing. > > moea64_pvo_protect has pg that seems analogous to > m and has: > > pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); > . . . > if (pm != kernel_pmap && pg != NULL && > (pg->a.flags & PGA_EXECUTABLE) == 0 && > (pvo->pvo_pte.pa & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) > { if ((pg->oflags & VPO_UNMANAGED) == 0) > vm_page_aflag_set(pg, PGA_EXECUTABLE); > > . . . > if (pg != NULL && (pvo->pvo_vaddr & PVO_MANAGED) && > (oldprot & VM_PROT_WRITE)) { > refchg |= atomic_readandclear_32(&pg->md.mdpg_attrs); > if (refchg & LPTE_CHG) > vm_page_dirty(pg); > if (refchg & LPTE_REF) > vm_page_aflag_set(pg, PGA_REFERENCED); > > > This might suggest some about what is missing. Can you try moving the assignment to 'm' to right below the moea_pte_change() call? - Justin > > > === > Mark Millard > marklmi at yahoo.com > ( dsl-only.net went > away in early 2018-Mar) > From owner-svn-src-head@freebsd.org Fri Jun 12 03:29:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED92832B909 for ; Fri, 12 Jun 2020 03:29:33 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic313-10.consmr.mail.ne1.yahoo.com (sonic313-10.consmr.mail.ne1.yahoo.com [66.163.185.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jmRw3754z3YvM for ; Fri, 12 Jun 2020 03:29:32 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: f8ur2nAVM1m_2H7cyU1MzUgF3KAIM1WV9RIwy495A7JUs_f2kG86V7QDw.UGX2u Zs2FYpQfMWE2vLt4BLOwdnusUnk1P3HGLPB1fD2Ujatby5P115DdBvJyZm79CAKKkOfzEGNRz3MF 15S8lAO7EvAoxUieBTPufwYXRInFQxS9Vnd3FiQKESMJDvQFbiF6qFF6QFMDdBNpKv8gz9kR8GY_ TDsNzcdDzUrS9ivQiOXqeTqYMCDKso._fKfjjystBqtTtIPRnDQZUQhfwbtpi5Q1nktybJW12z_k Uk4A1ntCuGpTbNxBtyrl.ewbvPq92LCyCjFpLolXc3kUU5Uo81957z0yzIZ1yr39RqHzpyqWaxHM bPEu9WrZ8QYtZ3LlO7tbfsd_.PAROwY0WfoNfDkKo24TKRz58cbim6XQUTXJNCd9OImNy2cnM9DU krqWisdtMs.3jA5_cWTJ_hDOAgkxJd4CYK2t1V1zR546k1b6cw5hkwynBDDzEb0M5FWkKEgYslMH SVgBYOFxTq5c6NWB1XaPkNu414gZo87EEuU_3.uLD98X4eUgVeuVWW0J1Axat1LnQwlDi.K0Dr0W mAecKZWRGpnbkXEGbrWH343XNkH4TSGBqPiv8m6jSaJtGcs.TNo_Lc5Dfl4xXwU7xk8sjIW7.iRd tmMtpEQY9P2rfznZuGl3YMmifMuw3Jom7vmKO8e8d9s1Ay0g.YCROAoJmMZjBJTs9MCN92OHc8PS 5zlhJrVfduYb3zJ2LTJemaHyXznsUnS.zH_6P8jzIvEJ3U5rukPWtU.AU5AfHyYiGbnpC4q7wnih J.ce.HqC0tWufUnhjGcGyfUgkB25g5pLnx0iOY4wNXC9XnwJnWixy1vD5BArhrDmnlevUB0BBSyv 1a83C.XbKMsBjOZkQEJX2mvWSRC_H4qwqKhzsjnYv2KF9CKLk4yvuciZxaaIagEC7hEaTtNGFlzz FxinOZ9nU2uHJe_PvpvIg._DzMtPTrIvBZ2yrNmFBAEPuKZu6xpfKnX0xiq86H4GOJYihdl7Ixqp 6jed_F1jwsH3231kw_u.RvmDxlYz2g1oN4wSgyhWuTFYN1tJ29fycE9VS1aj8onIbSlnmqljT_M. ieT3MUq52XmsnQldGItsXadv8utSiQ.lqzwMA1GryAHhB3FiMH8hypIvPtXMMMIDTrAcJBioP5y. q0WjPfK2xKYcCyXmx1Bpm_tjUFl2jQ42X8TXCfCzEpFcZNB4lb7kzrs0mBS1aLGQs_4Usr6O6wqz DoLpuLSxAa1WjWmkZiaVRczypLuWlQ2CsHRQGTwkhcsT01wVIiqmvXHxQ05x8WfZm5xFo9brLmO4 gRaFKuE41nPFHcBo72g.UjmtpqzTQT8Zu7I9hiN.WQ2hWnZQH49fZXW9VKtzTyFvLqERbL1W8yLT Qb9LZGZS_tcAg0LDUC1cb Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Fri, 12 Jun 2020 03:29:30 +0000 Received: by smtp424.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 7e9a213763a55615b6663cd901b748e3; Fri, 12 Jun 2020 03:29:29 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: <20200611212532.59f677be@ralga.knownspace> Date: Thu, 11 Jun 2020 20:29:27 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: quoted-printable Message-Id: <1EDCA498-0B67-4374-B7CA-1ECDA8EE32AD@yahoo.com> References: <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <20200611164216.47f82775@ralga.knownspace> <20200611212532.59f677be@ralga.knownspace> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jmRw3754z3YvM X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.33 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.82)[-0.819]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.013]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[66.163.185.33:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[66.163.185.33:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 03:29:34 -0000 On 2020-Jun-11, at 19:25, Justin Hibbits = wrote: > On Thu, 11 Jun 2020 17:30:24 -0700 > Mark Millard wrote: >=20 >> On 2020-Jun-11, at 16:49, Mark Millard wrote: >>=20 >>> On 2020-Jun-11, at 14:42, Justin Hibbits >>> wrote: >>>=20 >>> On Thu, 11 Jun 2020 14:36:37 -0700 >>> Mark Millard wrote: >>>=20 >>>> On 2020-Jun-11, at 13:55, Justin Hibbits >>>> wrote: >>>>=20 >>>>> On Wed, 10 Jun 2020 18:56:57 -0700 >>>>> Mark Millard wrote: =20 >>> . . . =20 >>>>=20 >>>>=20 >>>>> That said, the attached patch effectively copies >>>>> what's done in OEA6464 into OEA pmap. Can you test it? =20 >>>>=20 >>>> I'll try it once I get a chance, probably later >>>> today. >>>> . . . =20 >>>=20 >>> No luck at the change being a fix, I'm afraid. >>>=20 >>> I verified that the build ended up with >>>=20 >>> 00926cb0 bl 008e8dc8 >>> 00926cb4 mr r27,r3 >>> 00926cb8 addi r3,r3,36 >>> 00926cbc hwsync >>> 00926cc0 lwarx r25,0,r3 >>> 00926cc4 li r4,0 >>> 00926cc8 stwcx. r4,0,r3 >>> 00926ccc bne- 00926cc0 >>> 00926cd0 andi. r3,r25,128 >>> 00926cd4 beq 00926ce0 >>> 00926cd8 mr r3,r27 >>> 00926cdc bl 008e9874 >>>=20 >>> in the installed kernel. So I doubt a >>> mis-build would be involved. It is a >>> head -r360311 based context still. World is >>> without MALLOC_PRODUCTION so that jemalloc >>> code executes its asserts, catching more >>> and earlier than otherwise. >>>=20 >>> First test . . . >>>=20 >>> The only thing that the witness kernel reported was: >>>=20 >>> Jun 11 15:58:16 FBSDG4S2 kernel: lock order reversal: >>> Jun 11 15:58:16 FBSDG4S2 kernel: 1st 0x216fb00 Mountpoints (UMA >>> zone) @ /usr/src/sys/vm/uma_core.c:4387 Jun 11 15:58:16 FBSDG4S2 >>> kernel: 2nd 0x1192d2c kernelpmap (kernelpmap) @ >>> /usr/src/sys/powerpc/aim/mmu_oea.c:1524 Jun 11 15:58:16 FBSDG4S2 >>> kernel: stack backtrace: Jun 11 15:58:16 FBSDG4S2 kernel: #0 >>> 0x5ec164 at witness_debugger+0x94 Jun 11 15:58:16 FBSDG4S2 kernel: >>> #1 0x5ebe3c at witness_checkorder+0xb50 Jun 11 15:58:16 FBSDG4S2 >>> kernel: #2 0x536d5c at __mtx_lock_flags+0xcc Jun 11 15:58:16 >>> FBSDG4S2 kernel: #3 0x92636c at moea_kextract+0x5c Jun 11 15:58:16 >>> FBSDG4S2 kernel: #4 0x965d30 at pmap_kextract+0x98 Jun 11 15:58:16 >>> FBSDG4S2 kernel: #5 0x8bfdbc at zone_release+0xf0 Jun 11 15:58:16 >>> FBSDG4S2 kernel: #6 0x8c7854 at bucket_drain+0x2f0 Jun 11 15:58:16 >>> FBSDG4S2 kernel: #7 0x8c728c at bucket_free+0x54 Jun 11 15:58:16 >>> FBSDG4S2 kernel: #8 0x8c74fc at bucket_cache_reclaim+0x1bc Jun 11 >>> 15:58:16 FBSDG4S2 kernel: #9 0x8c7004 at zone_reclaim+0x128 Jun 11 >>> 15:58:16 FBSDG4S2 kernel: #10 0x8c3a40 at uma_reclaim+0x170 Jun 11 >>> 15:58:16 FBSDG4S2 kernel: #11 0x8c3f70 at uma_reclaim_worker+0x68 >>> Jun 11 15:58:16 FBSDG4S2 kernel: #12 0x50fbac at fork_exit+0xb0 Jun >>> 11 15:58:16 FBSDG4S2 kernel: #13 0x9684ac at fork_trampoline+0xc >>>=20 >>> The processes that were hit were listed as: >>>=20 >>> Jun 11 15:59:11 FBSDG4S2 kernel: pid 971 (cron), jid 0, uid 0: >>> exited on signal 11 (core dumped) Jun 11 16:02:59 FBSDG4S2 kernel: >>> pid 1111 (stress), jid 0, uid 0: exited on signal 6 (core dumped) >>> Jun 11 16:03:27 FBSDG4S2 kernel: pid 871 (mountd), jid 0, uid 0: >>> exited on signal 6 (core dumped) Jun 11 16:03:40 FBSDG4S2 kernel: >>> pid 1065 (su), jid 0, uid 0: exited on signal 6 Jun 11 16:04:13 >>> FBSDG4S2 kernel: pid 1088 (su), jid 0, uid 0: exited on signal 6 >>> Jun 11 16:04:28 FBSDG4S2 kernel: pid 968 (sshd), jid 0, uid 0: >>> exited on signal 6 >>>=20 >>> Jun 11 16:05:42 FBSDG4S2 kernel: pid 1028 (login), jid 0, uid 0: >>> exited on signal 6 >>>=20 >>> Jun 11 16:05:46 FBSDG4S2 kernel: pid 873 (nfsd), jid 0, uid 0: >>> exited on signal 6 (core dumped) >>>=20 >>>=20 >>> Rebooting and rerunning and showing the stress output and such >>> (I did not capture copies during the first test, but the first >>> test had similar messages at the same sort of points): >>>=20 >>> Second test . . . >>>=20 >>> # stress -m 2 --vm-bytes 1700M >>> stress: info: [1166] dispatching hogs: 0 cpu, 0 io, 2 vm, 0 hdd >>> : >>> = /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258:= >>> Failed assertion: "slab =3D=3D extent_slab_get(extent)" : >>> = /usr/src/contrib/jemalloc/include/jemalloc/internal/arena_inlines_b.h:258:= >>> Failed assertion: "slab =3D=3D extent_slab_get(extent)" ^C >>>=20 >>> # exit >>> : >>> /usr/src/contrib/jemalloc/include/jemalloc/internal/sz.h:200: >>> Failed assertion: "ret =3D=3D sz_index2size_compute(index)" Abort = trap >>>=20 >>> The other stuff was similar to to first test, not repeated here. =20 >>=20 >> The updated code looks odd to me for how "m" is >> handled (part of a egrep to ensure I show all the >> usage of m): >>=20 >> moea_protect(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva, >> vm_page_t m; >> if (pm !=3D kernel_pmap && m !=3D NULL && >> (m->a.flags & PGA_EXECUTABLE) =3D=3D 0 && >> if ((m->oflags & VPO_UNMANAGED) =3D=3D = 0) >> vm_page_aflag_set(m, >> PGA_EXECUTABLE); m =3D PHYS_TO_VM_PAGE(old_pte.pte_lo & PTE_RPGN); >> refchg =3D >> atomic_readandclear_32(&m->md.mdpg_attrs); vm_page_dirty(m); >> vm_page_aflag_set(m, >> PGA_REFERENCED); >>=20 >> Or more completely, with notes mixed in: >>=20 >> void=20 >> moea_protect(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva, >> vm_prot_t prot) >> { >> . . . >> vm_page_t m; >> . . . >> for (pvo =3D RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); >> pvo !=3D NULL && PVO_VADDR(pvo) < eva; pvo =3D tpvo) { >> . . . >> if (pt !=3D NULL) { >> . . . >> if (pm !=3D kernel_pmap && m !=3D NULL && >>=20 >> NOTE: m seems to be uninitialized but tested for being NULL >> above. >>=20 >> (m->a.flags & PGA_EXECUTABLE) =3D=3D 0 && >>=20 >> Note: This looks to potentially be using a random, non-NULL >> value for m during evaluation of m->a.flags . >>=20 >> . . . >>=20 >> if ((pvo->pvo_vaddr & PVO_MANAGED) && >> (pvo->pvo_pte.prot & VM_PROT_WRITE)) { >> m =3D PHYS_TO_VM_PAGE(old_pte.pte_lo & >> PTE_RPGN); >>=20 >> Note: m finally is potentially initialized(/set). >>=20 >> refchg =3D >> atomic_readandclear_32(&m->md.mdpg_attrs); if (refchg & PTE_CHG) >> vm_page_dirty(m); >> if (refchg & PTE_REF) >> vm_page_aflag_set(m, >> PGA_REFERENCED); . . . >>=20 >> Note: So, if m is set above, then the next loop >> iteration(s) would use this then-old value >> instead of an initialized value. >>=20 >> It looks to me like at least one assignment >> to m is missing. >>=20 >> moea64_pvo_protect has pg that seems analogous to >> m and has: >>=20 >> pg =3D PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); >> . . . >> if (pm !=3D kernel_pmap && pg !=3D NULL && >> (pg->a.flags & PGA_EXECUTABLE) =3D=3D 0 && >> (pvo->pvo_pte.pa & (LPTE_I | LPTE_G | LPTE_NOEXEC)) =3D=3D = 0) >> { if ((pg->oflags & VPO_UNMANAGED) =3D=3D 0) >> vm_page_aflag_set(pg, PGA_EXECUTABLE); >>=20 >> . . . >> if (pg !=3D NULL && (pvo->pvo_vaddr & PVO_MANAGED) && >> (oldprot & VM_PROT_WRITE)) { >> refchg |=3D = atomic_readandclear_32(&pg->md.mdpg_attrs); >> if (refchg & LPTE_CHG) >> vm_page_dirty(pg); >> if (refchg & LPTE_REF) >> vm_page_aflag_set(pg, PGA_REFERENCED); >>=20 >>=20 >> This might suggest some about what is missing. >=20 > Can you try moving the assignment to 'm' to right below the > moea_pte_change() call? Panics during boot. svnlite diff shown later. That change got me a panic just after the lines about ada0 and cd0 details. (Unknown what internal stage.) Hand translated from a picture of the screen: panic: vm_page_free_prep: mapping flags set in page 0xd032a078 . . . panic vm_page_free_prep vm_page_free_toq vm_page_free vm_object_collapse vm_object_deallocate vm_map_process_deferred vm_map_remove exec_new_vmspace exec_elf32_imgact kern_execve sys_execve trap powerpc_interrupt user SC trap by 0x100d7af8 . . . # svnlite diff /usr/src/sys/powerpc/aim/mmu_oea.c Index: /usr/src/sys/powerpc/aim/mmu_oea.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 --- /usr/src/sys/powerpc/aim/mmu_oea.c (revision 360322) +++ /usr/src/sys/powerpc/aim/mmu_oea.c (working copy) @@ -1773,6 +1773,9 @@ { struct pvo_entry *pvo, *tpvo, key; struct pte *pt; + struct pte old_pte; + vm_page_t m; + int32_t refchg; =20 KASSERT(pm =3D=3D &curproc->p_vmspace->vm_pmap || pm =3D=3D = kernel_pmap, ("moea_protect: non current pmap")); @@ -1800,12 +1803,31 @@ pvo->pvo_pte.pte.pte_lo &=3D ~PTE_PP; pvo->pvo_pte.pte.pte_lo |=3D PTE_BR; =20 + old_pte =3D *pt; + /* * If the PVO is in the page table, update that pte as = well. */ if (pt !=3D NULL) { moea_pte_change(pt, &pvo->pvo_pte.pte, = pvo->pvo_vaddr); + m =3D PHYS_TO_VM_PAGE(old_pte.pte_lo & = PTE_RPGN); + if (pm !=3D kernel_pmap && m !=3D NULL && + (m->a.flags & PGA_EXECUTABLE) =3D=3D 0 && + (pvo->pvo_pte.pa & (PTE_I | PTE_G)) =3D=3D = 0) { + if ((m->oflags & VPO_UNMANAGED) =3D=3D = 0) + vm_page_aflag_set(m, = PGA_EXECUTABLE); + moea_syncicache(pvo->pvo_pte.pa & = PTE_RPGN, + PAGE_SIZE); + } mtx_unlock(&moea_table_mutex); + if ((pvo->pvo_vaddr & PVO_MANAGED) && + (pvo->pvo_pte.prot & VM_PROT_WRITE)) { + refchg =3D = atomic_readandclear_32(&m->md.mdpg_attrs); + if (refchg & PTE_CHG) + vm_page_dirty(m); + if (refchg & PTE_REF) + vm_page_aflag_set(m, = PGA_REFERENCED); + } } } rw_wunlock(&pvh_global_lock); =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jun 12 03:47:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CF0D32C11F for ; Fri, 12 Jun 2020 03:47:15 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic302-20.consmr.mail.ne1.yahoo.com (sonic302-20.consmr.mail.ne1.yahoo.com [66.163.186.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jmrL0QD8z3Zmg for ; Fri, 12 Jun 2020 03:47:13 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: VMi9fyQVM1mE6ZiSNMccaR6.dVkr_bGJqiszfpVppTjGBCw4T7ZMPM80goz6P08 aBe_MWPh33ykPTsF4vzvbVtsGD_esUF2BTDWlQbu3fbUGoLW24hT9PTecARP68wsQHPFqA.atDAa C0VhWX3Ygh2DjaYa_b_lVyMnHw3nRHP3YWra81EKp6l6tz4MxW.vkN_uqdlVZPYMAHqAukViyMKT odzhD6lX32m9nK2zNgzDBZ0jjmvpMjKkbunW24fLlF5HYA5U3T0EfSu89I08wGMjruwE_xwUsL8Z LdRAS5627Y2_LI4ac6e4E2RDW8MEFRA24Cm6oVLE3UPOl36MkzgCmrYL2MYBBuyYK_FtqBQM9PGl zEVo7fJUxa2FCneRVCvn4oRE4R3_iatkFW5zDH2_z4BMmrd5y.Tea.WqdIby.8zkAtkBg.3jGor7 OGpzHo4rcRau1kacAA1KaC9J73UUym96m9FP3lCtKWcPyFPcvrOfkEoRZcJ.EP0GFPBuaREJEWCA bKDGn8BFg426VNayqWCkxBJ1faO3vARuxIZmgkvTJ3M_20d5DdSW__dIslwYb7et2OoIcghymzvZ GpoS3Yf_au9qrQNqYFrQOqGa9e59_3RIYT4sczohV4VNL3FiiV193u9xqoNMdVr5CtjiMBsrVk7v JsSGNgeaMzmMB5rbHMCxZOEukhyNLuGkXPzQ8XqrNXH_ca7ynJYOJpD7tXCXwWXeoJ7YG1eRKqYu 1BCSEOKE6w5BJyO3EhiGzQ0Cd9ji6vLOdywBXMJZgT3IQYKarV.0gb_wmbwH8f2bzD505lk5MWwJ hVz81QnBKU01P7CjwPLg8NCXmXkWuxly4XQso1ZuCdex0B1ztiVHrPs4__ddhBV.KV98qm1vEoA1 0yNLHgQegAS2ROstl9na1IQy8dOJ8hLCQYLbKVADF2vvc5yYURZKm3ECmSuLAr64BlwWM16Mx9Kt 5zfb29WLzTjRfHJlaq2qEQF3blgKe_gloF3v5uBTPaQwwi6k28wCIQ6a0yo8xjHvocgFVPHfk7_C hdN6HfLRwJUVBcS8rBhWQYwl_gtC0oTZz8tQBeVp.QO6rfLEbKzc9AT7Rd1UM12aQ110eHQPNv.3 _KwJaTfSWnRGm6wJSVdiBolXzBeR0QOVKc.Vdc_WOxfbxiPjQH.AnAsfEhkWbV2s_jHvg1uq_G2O RzIbePz.Vi6UAMWSjtMbtdNTuz_kBsucTTEXG6pDzKG1Frr8k157uX8cZd6XvANXgrbJ0H5Z45.3 J6zfS2MjXHPxNiP1347osKzhrLE7TsKaGzXn1ocHm4saJ3RqLNMudq_2rXpvnPxs_G49xvBdAgkV It8rkio8l6PyS88bHlIZ3_KGqYm2KLUKrr3FFGeKcFFAAyy84e2CokJck3xmhj5wJDRZf6csW0gr Yg_GbUJ0GBz19BRDMmU2nSuC6ajc5hJ716NWsVEhXOZON67b5755Kx_CnQcdvY7Lf Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Fri, 12 Jun 2020 03:47:12 +0000 Received: by smtp402.mail.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID e174646f2964b434d05b418bca707b84; Fri, 12 Jun 2020 03:47:08 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: <1EDCA498-0B67-4374-B7CA-1ECDA8EE32AD@yahoo.com> Date: Thu, 11 Jun 2020 20:47:06 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: quoted-printable Message-Id: <3605089E-7B5D-4FBA-B0D1-14B789BDF09B@yahoo.com> References: <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <20200611164216.47f82775@ralga.knownspace> <20200611212532.59f677be@ralga.knownspace> <1EDCA498-0B67-4374-B7CA-1ECDA8EE32AD@yahoo.com> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jmrL0QD8z3Zmg X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.32 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.82)[-0.817]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.012]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.992]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[66.163.186.146:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[66.163.186.146:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 03:47:15 -0000 [Just a better panic backtrace text copy.] On 2020-Jun-11, at 20:29, Mark Millard wrote: > On 2020-Jun-11, at 19:25, Justin Hibbits = wrote: >=20 >> On Thu, 11 Jun 2020 17:30:24 -0700 >> Mark Millard wrote: >>=20 >>> On 2020-Jun-11, at 16:49, Mark Millard wrote: >>>=20 >>>> On 2020-Jun-11, at 14:42, Justin Hibbits >>>> wrote: >>>> . . . >>=20 >> Can you try moving the assignment to 'm' to right below the >> moea_pte_change() call? >=20 > Panics during boot. svnlite diff shown later. >=20 > That change got me a panic just after the lines about ada0 > and cd0 details. (Unknown what internal stage.) Hand > translated from a picture of the screen: >=20 > panic: . . . I forgot that 32-bit powerpc dump does partially work for PowerMacs (or at least my context). After booting with a non-debug kernel I've kept around, looking at /var/crash/vmcore.3 shows: panic: vm_page_free_prep: mapping flags set in page 0xd032a078 cpuid =3D 1 time =3D 1591931757 KDB: stack backtrace: 0xd2dc4340: at kdb_backtrace+0x64 0xd2dc43a0: at vpanic+0x208 0xd2dc4410: at panic+0x64 0xd2dc4450: at vm_page_free_prep+0x348 0xd2dc4470: at vm_page_free_toq+0x3c 0xd2dc4490: at vm_page_free+0x20 0xd2dc44a0: at vm_object_collapse+0x4ac 0xd2dc4510: at vm_object_deallocate+0x430 0xd2dc4550: at vm_map_process_deferred+0xec 0xd2dc4570: at vm_map_remove+0x12c 0xd2dc4590: at exec_new_vmspace+0x20c 0xd2dc45f0: at exec_elf32_imgact+0xa70 0xd2dc46a0: at kern_execve+0x600 0xd2dc4910: at sys_execve+0x84 0xd2dc4970: at trap+0x748 0xd2dc4a10: at powerpc_interrupt+0x178 0xd2dc4a40: user SC trap by 0x100d71f8: srr1=3D0xf032 r1=3D0xffffd810 cr=3D0x82000280 xer=3D0 ctr=3D0x10173810 = frame=3D0xd2dc4a48 KDB: enter: panic /wrkdirs/usr/ports/devel/gdb/work-py37/gdb-9.1/gdb/inferior.c:283: = internal-error: struct inferior *find_inferior_pid(int): Assertion `pid = !=3D 0' failed. =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jun 12 04:05:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 535E532C9D0 for ; Fri, 12 Jun 2020 04:05:12 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic316-22.consmr.mail.ne1.yahoo.com (sonic316-22.consmr.mail.ne1.yahoo.com [66.163.187.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jnF264HFz3c7X for ; Fri, 12 Jun 2020 04:05:10 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: RIz_r6oVM1mh2YDU5fSHnOV11dkFFlKXYKeUXZ62oOzYXahDytlmC.xSwAVg3wA QiEltkaATCG4emFY7AyqBVbOucyG_IXQmO8hg8oVJ6ZesW1LHmSK7yZKloOk7yog9Kx2fS3cSQEF gvl_UpGR8OIrJlgC80brpj9OwEFhVa3MthmWYk0Q0raEBMkZJt16f3zzYkZSJuXJk6hlxTguV6Qe SYYtYol7o70vrk07ZPvuXPxuEmV6hdQgWrIIE8gmB7aAKQHBeTDc3vzI0KhNSagy1T_BIu39gj6n lOsYAbyTOusvKWmQG3j9qgNBrL6mPYo4jwPB5bmLOP0CtIh0bWTqVbANwlwqJf0_ZA3tISULbtUn g7xaUjasIgkEvV6j8kjJJJabRWPav6D_73iOousAq11qdsDDcVJ_9KU_.QdtGo8rMdUGPn2GOw.p nyNjOj.RupxX9tLclA6BKcLlYXHIvH..5ZXgdDrRUG2Ue3Ds.XvYreNgFyq6I4JMIbgvBP6dh9hJ mr4IxLXhxcOMIgRFspMYt4UFazL0xwovRsUoQgfobi.IaCxFSraJtq0FY4B5RB5aqPLqyhgTIM.S 67B0LqhgiJ1T74mL2hAhY9nrhVJyoXPlGhnPeuE9Ud8aRt1X77Dtw8t18lRe.gVmhyjLrivvjsdn yzeoTQvG1ePbN_kDlNOMWFTGe0kQpVYy9MWGGRngV1rgTn0JtI2I4s7hDwV_vpgmlOU07ZXwClzg fmSpeK4iFoakrEaN6CYpwdDW_mTxmKcOXZODQ6gCXgGHNfgDSbiH7ce1z2lKu2Oby_L0cIH0Ar8t w0Bm3bFgMdjQb5yy9qWR5NKzGIb1PCwk_XHM4MtXHgN5OOPaBOS1GlDv3vRTcgVIVWhvcKFUogf5 NbdlwAlGgGMxuFf3dVZp6Dbhrj_VMuYmlgcyPFuyQ3IOIO2UJbUgb7iV_dT4a0h.XRWV0p4Q.fDD 1k_0R25mrHhFw_UCU4L01yMKGpHpMXwLhEHadDRD0v.XKP_7cGFT1r2LShvkw2GZRBimEBO6a5i7 BF_wzKdkcCiqBlUrSsCWenivEeJpdBlaeyfhvTPvx.xwg06Ab4lvFYoA2FSMUy4niG2.XhouaYgS oEo2hhlxAfMA5fgtO31ID2GPTyjngJ7M2tPp4IfAGXf66dnIx0iYbTQOvMZ4TWhyI6O_YQt6MNSd aOAo.OUaZB6hf0klxPfkPmXCB9vR88v8MvPgiOiBR6AcdsK4ykcXQH6ZgqJNx.R.DJ6kQfFJvb_C UgexVyKXYYxknujXPrkFPR8xn40fRVYopaSL3Gq4uzPtIuZLXE9OD.RxIe1clnkDBK28T6arPK1L jN_pxyeyRZg_x5a152g4NC2mX.JX596JBKSCbb43QeolEnu6fizP4B1yzhoWVk2Ee6bctONqfNlt wCNvzuCOu20hMj513MrTHmf6Lpnqr26D. Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.ne1.yahoo.com with HTTP; Fri, 12 Jun 2020 04:05:09 +0000 Received: by smtp420.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 9598ca0db01bbcc2708f2559938fbab6; Fri, 12 Jun 2020 04:05:06 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: <3605089E-7B5D-4FBA-B0D1-14B789BDF09B@yahoo.com> Date: Thu, 11 Jun 2020 21:05:05 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: 7bit Message-Id: References: <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <20200611164216.47f82775@ralga.knownspace> <20200611212532.59f677be@ralga.knownspace> <1EDCA498-0B67-4374-B7CA-1ECDA8EE32AD@yahoo.com> <3605089E-7B5D-4FBA-B0D1-14B789BDF09B@yahoo.com> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jnF264HFz3c7X X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.33 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.82)[-0.824]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.01)[-1.014]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.995]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[66.163.187.148:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[66.163.187.148:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 04:05:12 -0000 There is another oddity in the code structure, in that if pt was ever NULL the code would misuse the NULL before the test for non-NULL is made: pt = moea_pvo_to_pte(pvo, -1); . . . old_pte = *pt; /* * If the PVO is in the page table, update that pte as well. */ if (pt != NULL) { (I'm not claiming that this explains the panic.) === Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jun 12 04:19:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D399F32D3B8; Fri, 12 Jun 2020 04:19:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jnY354nxz3clF; Fri, 12 Jun 2020 04:19:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9A9423C01; Fri, 12 Jun 2020 04:19:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05C4J3RT033307; Fri, 12 Jun 2020 04:19:03 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05C4J349033306; Fri, 12 Jun 2020 04:19:03 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006120419.05C4J349033306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 12 Jun 2020 04:19:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362084 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 04:19:03 -0000 Author: adrian Date: Fri Jun 12 04:19:03 2020 New Revision: 362084 URL: https://svnweb.freebsd.org/changeset/base/362084 Log: [net80211] First part of A-MSDU offload handling - don't bump A-MPDU reordering seqno When doing A-MSDU offload handling the driver is required to mark A-MSDUs from the same MPDU with the same sequence number. It then tags them as AMSDU (if it's a decap'ed A-MSDU) and AMSDU_MORE (saying there's more AMSDUs decapped in the same MSDU.) This allows encryption and sequence number offload to work right. In the A-MSDU path the sequence number check looks at the A-MSDU flags in the frame to see whether it's part of the same seqno and will pass them (ie, not increment rx_seq until the last A-MSDU is seen from the driver, or a new seqno shows up.0 However, I did this work in the A-MSDU path but not the A-MSDU in A-MPDU path. For the non A-MDSU offload case the A-MPDU receive reordering will do its thing and then pass up the MPDU up for decap - which then will see it's an A-MSDU and decap each sub-frame. But this isn't done for offloaded A-MSDU frames. This requires two parts: * Don't bump the RX sequence number, same as above; and * If frames go into the reordering buffer, they need to be added into the slot as a set of frames rather than a single frame, so once a new seqno shows up this slot can be marked as "full" and we can move on. This patch does the first. The latter requires that I find and commit work to change rxa_m from an mbuf to an mbufq and the nhandle A-MSDU there. But, the first is enough to allow the normal case (ie, no or not a lot of A-MPDU RX reordering) to work. This allows the athp driver (QCA9880) throughput to go from VERY low (like 5mbit TCP, 1/3-1/4 expected UDP throughput) to ~ 250mbit TCP and > 300mbit UDP on a VHT/40 channel. TCP sucks because, well, it shows up as MASSIVE packet loss when all but one frame in a decap'ed A-MSDU stream is dropped. Le whoops. Now, where'd I put that laptop with the patch for rxa_m mbufq that I wrote like in 2017... Tested: * AR9380, STA/AP mode (a big no-op, no A-MSDU hardware decap); * if_run (RT3593), STA DWDS mode (A-MPDU / A-MSDU receive, but again no A-MSDU hardware decap); * QCA9880, STA/AP mode (which is doing hardware A-MPDU/A-MSDU decap, but no A-MPDU reordering in the firmware.) Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Fri Jun 12 01:58:14 2020 (r362083) +++ head/sys/net80211/ieee80211_ht.c Fri Jun 12 04:19:03 2020 (r362084) @@ -875,6 +875,7 @@ ieee80211_ampdu_reorder(struct ieee80211_node *ni, str ieee80211_seq rxseq; uint8_t tid; int off; + int amsdu_more = ieee80211_check_rxseq_amsdu_more(rxs); KASSERT((m->m_flags & (M_AMPDU | M_AMPDU_MPDU)) == M_AMPDU, ("!a-mpdu or already re-ordered, flags 0x%x", m->m_flags)); @@ -949,10 +950,11 @@ again: return CONSUMED; } else { /* - * In order; advance window and notify + * In order; advance window if needed and notify * caller to dispatch directly. */ - rap->rxa_start = IEEE80211_SEQ_INC(rxseq); + if (amsdu_more) + rap->rxa_start = IEEE80211_SEQ_INC(rxseq); return PROCESS; } } @@ -996,7 +998,8 @@ again: rap->rxa_qframes; ampdu_rx_flush(ni, rap); } - rap->rxa_start = IEEE80211_SEQ_INC(rxseq); + if (amsdu_more) + rap->rxa_start = IEEE80211_SEQ_INC(rxseq); return PROCESS; } } else { From owner-svn-src-head@freebsd.org Fri Jun 12 04:33:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60BA832D88A for ; Fri, 12 Jun 2020 04:33:29 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic306-22.consmr.mail.ne1.yahoo.com (sonic306-22.consmr.mail.ne1.yahoo.com [66.163.189.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jnsg4h38z3dc1 for ; Fri, 12 Jun 2020 04:33:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-YMail-OSG: 333vDqQVM1mnfuANn.3JatGMHevXN6svbO_nGtDOnwK6QhB.2zk_ix0iMr_cEnX aUdUyc1BuvvzDniVL7NDHgW9kRX6zjpkXFQW6tjOrHQTNQPafAqB8SezrSF6o8us1ihCZrFxvvU2 Oz5em88XvXJX85bHi0fxMOS9rUtnHx5B6WpFCRAIRR8eoXcIWYng.LG7bzrOjYj6QX5t5zX62NVR yo82FAyR0_orLiLduf_EPBeMg_fK9I0Oj4vbghMO6NjTVLLZYjG9O7of5BS_Fid8NkrEwmjKuxdw NnUCDysBykoAj_g_ogNFik.YWbQ_WJNhAzeeqg0j7XmBWzf1ypE5mWCN3HwCs49k1gLL0Q68dtcp MvjID8mNuhODZCscVPXEqYEMMKDtyLlIIGoYpVQ8WDLF_LgOrDpRQG25VwCUrtVxX5lc3ln3p1i_ ikTRiMT6vXZ7wtfaZ4B.PwyA61s2L7etexhHiKOMahxd.811eP.KTcvxvkg8tbC6yRBzb22QBZTu JFtjeabVZyaQfqhNHLr6tBcYYFuQfvb6_ZMyRa_92k11iohwP3kAbY46O1GSn2NrtBBInjrO2td5 FuYyfgBKqfByLFDkuAycpWvHigjtoyKRupoEtN6Kc6fZCseLTWQMDOjwPVhLdLfyXiAAzOgsRoZF LoBFmM9tBrzJ7h6rVYLM0oqiqZ6.pcB33EdEqJz13N_C0xx6ptcI7cAGGWhjSTH_u7FBKpOfMi1C nbcDiiYiPu5bWfQxFeT3cSZqTQxU5f7sqvNO59XaXA6WDx9Esl_m1kVAT92SGNaBOrypDVrj7.qq VeMMTFHwCNSLXtU0D0u7qAR7F8NBg3iwrIhsAn0bcrlHfo7VCX7MNez4eHGeZT2JGGdAfrXeu_3X KspgMn12NeleG7xcVX49cg0BInsM2h7ARk5lgotUi6UZ5DVCWuuoTK_KUY_fa.bEjkxDA7PjLVvs TUY5sdE9gJNkithpGRQZphmaRFZNNJFBOm1RA0FQ6Xq8mCWjXbInmdFZp0.c.20afoamh0XvKt6s skk.x3rHMSg9hP0VgNHDJR8FjDFCDFyABmgj7.5707XY.riXBR71RYfiXpz0T1KaN.R7gyXCjsO4 K4Fnizin.mwbQ20Ntvoqr3LwnSU0i4DA.aOvcnG.G7DkuyjoaRs2RtYg3uJZmvcw5WwiEN7tAO5X 4z8N0fatFxhM4S1aa6QTOotAzuazoJLZTUGGY5Gq3j9hV1xTTetV6s0KZymkcmrRnTOkQXOwXFfl 9auh8uiL2kgDFE39qsqnW6PdY22fJW1p6xeaecJj.RkdZZ4c_AwXi9BicjHKu2j5Pa2AvE.rPTab kzjCmzQf7wp8nP.7igXYobTh13PMl636ulWhJAuYaPEAgqXXytf067jdC.9Nh2hn3ogfcFJVD_x7 DVldBNZbRzbV7q1_nLpx6hSOC7UmdxeZO6tAnRywOdNHecSRm0skUB_Sk5ZBJkPQJE2o- Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.ne1.yahoo.com with HTTP; Fri, 12 Jun 2020 04:33:25 +0000 Received: by smtp416.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 2f34606d33939f3e61488b33bfac734b; Fri, 12 Jun 2020 04:33:22 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: svn commit: r360233 - in head: contrib/jemalloc . . . : This partially breaks a 2-socket 32-bit powerpc (old PowerMac G4) based on head -r360311 From: Mark Millard In-Reply-To: Date: Thu, 11 Jun 2020 21:33:20 -0700 Cc: "vangyzen@freebsd.org" , svn-src-head@freebsd.org, FreeBSD Current , FreeBSD Hackers , FreeBSD PowerPC ML , Brandon Bergren Content-Transfer-Encoding: quoted-printable Message-Id: References: <695E6836-F860-4557-B7DE-CC1EDB347F18@yahoo.com> <121B9B09-141B-4DC3-918B-1E7CFB99E779@yahoo.com> <8AAB0462-3FA8-490C-8D8D-7C15B1C9E2DE@yahoo.com> <18E62746-80DB-4195-977D-4FF32D0129EE@yahoo.com> <9562EEE4-62EF-4164-91C0-948CC0432984@yahoo.com> <9B68839B-AEC8-43EE-B3B6-B696A4A57DAE@yahoo.com> <359C9C7D-4106-42B5-AAB5-08EF995B8100@yahoo.com> <20200513105632.06db9e21@titan.knownspace> <20200611155545.55526f7c@ralga.knownspace> <5542B85D-1C3A-41D8-98CE-3C02E990C3EB@yahoo.com> <20200611164216.47f82775@ralga.knownspace> <20200611212532.59f677be@ralga.knownspace> <1EDCA498-0B67-4374-B7CA-1ECDA8EE32AD@yahoo.com> <3605089E-7B5D-4FBA-B0D1-14B789BDF09B@yahoo.com> To: Justin Hibbits X-Mailer: Apple Mail (2.3608.80.23.2.2) X-Rspamd-Queue-Id: 49jnsg4h38z3dc1 X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.38 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_SHORT(-0.87)[-0.866]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36646, ipnet:66.163.184.0/21, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.02)[-1.016]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.996]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[66.163.189.84:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[66.163.189.84:from]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 04:33:29 -0000 [Yet another oddity.] On 2020-Jun-11, at 21:05, Mark Millard wrote: >=20 > There is another oddity in the code structure, in > that if pt was ever NULL the code would misuse the > NULL before the test for non-NULL is made: >=20 > pt =3D moea_pvo_to_pte(pvo, -1); > . . . > old_pte =3D *pt; >=20 > /* > * If the PVO is in the page table, update that pte as = well. > */ > if (pt !=3D NULL) { >=20 > (I'm not claiming that this explains the panic.) There is another NULL handling oddity that the 64-bit code does not have. I'll show 64 relevant bit code first: pg =3D PHYS_TO_VM_PAGE(pvo->pvo_pte.pa & LPTE_RPGN); =20 . . . =20 if (. . .&& pg !=3D NULL && (pg->a.flags & PGA_EXECUTABLE) =3D=3D 0 && . . .) { if ((pg->oflags & VPO_UNMANAGED) =3D=3D 0) vm_page_aflag_set(pg, PGA_EXECUTABLE); . . . } . . . if (pg !=3D NULL && . . .) { refchg |=3D atomic_readandclear_32(&pg->md.mdpg_attrs); if (refchg & LPTE_CHG) vm_page_dirty(pg); if (refchg & LPTE_REF) vm_page_aflag_set(pg, PGA_REFERENCED); } Note: the 2nd outer-if tests for pg !=3D NULL, just like the first outer-if above does. It avoids potential abuse-of-NULL activity. This is not true of the 32-bit code for "m": m =3D PHYS_TO_VM_PAGE(old_pte.pte_lo & = PTE_RPGN); if (. . . && m !=3D NULL && (m->a.flags & PGA_EXECUTABLE) =3D=3D 0 && . . .) { if ((m->oflags & VPO_UNMANAGED) =3D=3D = 0) vm_page_aflag_set(m, = PGA_EXECUTABLE); moea_syncicache(pvo->pvo_pte.pa & = PTE_RPGN, PAGE_SIZE); } . . . if ((pvo->pvo_vaddr & PVO_MANAGED) && (pvo->pvo_pte.prot & VM_PROT_WRITE)) { refchg =3D = atomic_readandclear_32(&m->md.mdpg_attrs); if (refchg & PTE_CHG) vm_page_dirty(m); if (refchg & PTE_REF) vm_page_aflag_set(m, = PGA_REFERENCED); } The &m->md.mdpg_attrs use apparently could be based on m being NULL because there is no test for m !=3D NULL in the 2nd outer-if. Similarly for the other uses of m in that code block. My guess that that the 2nd outer-if should test something like: . . . if (m !=3D NULL && (pvo->pvo_vaddr & PVO_MANAGED) && (pvo->pvo_pte.prot & VM_PROT_WRITE)) { . . . (Presumes that the pre-existing m !=3D NULL tests are necessary, something that I do not know.) =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-svn-src-head@freebsd.org Fri Jun 12 06:10:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A213532FE91; Fri, 12 Jun 2020 06:10:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jr1c3qkSz40TL; Fri, 12 Jun 2020 06:10:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A42C25108; Fri, 12 Jun 2020 06:10:28 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05C6ASiw000630; Fri, 12 Jun 2020 06:10:28 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05C6ASkF000629; Fri, 12 Jun 2020 06:10:28 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006120610.05C6ASkF000629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 12 Jun 2020 06:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362085 - head/tools/tools/net80211/wlanstats X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/tools/tools/net80211/wlanstats X-SVN-Commit-Revision: 362085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 06:10:28 -0000 Author: adrian Date: Fri Jun 12 06:10:27 2020 New Revision: 362085 URL: https://svnweb.freebsd.org/changeset/base/362085 Log: [wlanstats] Add the per-node amsdu hardware decap'ed receive stats. This is useful for tracking hardware provided AMSDU frames to see when we're (a) seeing them, and (b) seeing the split between intermediary and final frames. Tested: * QCA9880 (athp) - AP mode Modified: head/tools/tools/net80211/wlanstats/main.c head/tools/tools/net80211/wlanstats/wlanstats.c Modified: head/tools/tools/net80211/wlanstats/main.c ============================================================================== --- head/tools/tools/net80211/wlanstats/main.c Fri Jun 12 04:19:03 2020 (r362084) +++ head/tools/tools/net80211/wlanstats/main.c Fri Jun 12 06:10:27 2020 (r362085) @@ -63,7 +63,7 @@ static struct { }, { "amsdu", - "input,output,amsdu_tooshort,amsdu_split,amsdu_decap,amsdu_encap,rssi,rate" + "input,output,amsdu_tooshort,amsdu_split,amsdu_decap,amsdu_encap,rx_amsdu_more,rx_amsdu_more_end,rssi,rate" }, }; Modified: head/tools/tools/net80211/wlanstats/wlanstats.c ============================================================================== --- head/tools/tools/net80211/wlanstats/wlanstats.c Fri Jun 12 04:19:03 2020 (r362084) +++ head/tools/tools/net80211/wlanstats/wlanstats.c Fri Jun 12 06:10:27 2020 (r362085) @@ -276,7 +276,11 @@ static const struct fmt wlanstats[] = { { 8, "amsdu_decap", "decap", "A-MSDU frames received" }, #define S_AMSDU_ENCAP AFTER(S_AMSDU_DECAP) { 8, "amsdu_encap", "encap", "A-MSDU frames transmitted" }, -#define S_AMPDU_REORDER AFTER(S_AMSDU_ENCAP) +#define S_AMSDU_RX_MORE AFTER(S_AMSDU_ENCAP) + { 13, "rx_amsdu_more", "rx_amsdu_more", "A-MSDU HW intermediary decap'ed received" }, +#define S_AMSDU_RX_MORE_END AFTER(S_AMSDU_RX_MORE) + { 17, "rx_amsdu_more_end", "rx_amsdu_more_end", "A-MSDU HW end decap'ed received" }, +#define S_AMPDU_REORDER AFTER(S_AMSDU_RX_MORE_END) { 8, "ampdu_reorder", "reorder","A-MPDU frames held in reorder q" }, #define S_AMPDU_FLUSH AFTER(S_AMPDU_REORDER) { 8, "ampdu_flush", "flush", "A-MPDU frames sent up from reorder q" }, @@ -778,6 +782,8 @@ wlan_get_curstat(struct bsdstat *sf, int s, char b[], case S_AMSDU_SPLIT: STAT(amsdu_split); case S_AMSDU_DECAP: STAT(amsdu_decap); case S_AMSDU_ENCAP: STAT(amsdu_encap); + case S_AMSDU_RX_MORE: NSTAT(rx_amsdu_more); + case S_AMSDU_RX_MORE_END: NSTAT(rx_amsdu_more_end); case S_AMPDU_REORDER: STAT(ampdu_rx_reorder); case S_AMPDU_FLUSH: STAT(ampdu_rx_flush); case S_AMPDU_BARBAD: STAT(ampdu_bar_bad); @@ -941,6 +947,8 @@ wlan_get_totstat(struct bsdstat *sf, int s, char b[], case S_AMSDU_SPLIT: STAT(amsdu_split); case S_AMSDU_DECAP: STAT(amsdu_decap); case S_AMSDU_ENCAP: STAT(amsdu_encap); + case S_AMSDU_RX_MORE: NSTAT(rx_amsdu_more); + case S_AMSDU_RX_MORE_END: NSTAT(rx_amsdu_more_end); case S_AMPDU_REORDER: STAT(ampdu_rx_reorder); case S_AMPDU_FLUSH: STAT(ampdu_rx_flush); case S_AMPDU_BARBAD: STAT(ampdu_bar_bad); From owner-svn-src-head@freebsd.org Fri Jun 12 09:34:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DAD2334D9B; Fri, 12 Jun 2020 09:34:11 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jwXg1vH1z4F3X; Fri, 12 Jun 2020 09:34:11 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C53B27164; Fri, 12 Jun 2020 09:34:11 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05C9YBct032959; Fri, 12 Jun 2020 09:34:11 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05C9YA6s032957; Fri, 12 Jun 2020 09:34:10 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202006120934.05C9YA6s032957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 12 Jun 2020 09:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362089 - in head: share/misc usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: in head: share/misc usr.bin/calendar/calendars X-SVN-Commit-Revision: 362089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 09:34:11 -0000 Author: gbe (doc committer) Date: Fri Jun 12 09:34:10 2020 New Revision: 362089 URL: https://svnweb.freebsd.org/changeset/base/362089 Log: Add myself (gbe) to committers-doc.dot and calendar.freebsd Reviewed by: bcr (mentor) Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D25241 Modified: head/share/misc/committers-doc.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-doc.dot ============================================================================== --- head/share/misc/committers-doc.dot Fri Jun 12 07:36:32 2020 (r362088) +++ head/share/misc/committers-doc.dot Fri Jun 12 09:34:10 2020 (r362089) @@ -70,6 +70,7 @@ ebrandi [label="Edson Brandi\nebrandi@FreeBSD.org\n201 gabor [label="Gabor Kovesdan\ngabor@FreeBSD.org\n2007/02/02"] ganbold [label="Ganbold Tsagaankhuu\nganbold@FreeBSD.org\n2008/02/26"] gavin [label="Gavin Atkinson\ngavin@FreeBSD.org\n2011/07/18"] +gbe [label="Gordon Bergling\ngbe@FreeBSD.org\n2020/06/08"] gjb [label="Glen Barber\ngjb@FreeBSD.org\n2010/09/01"] hrs [label="Hiroki Sato\nhrs@FreeBSD.org\n2000/07/06"] issyl0 [label="Isabell Long\nissyl0@FreeBSD.org\n2012/04/25"] @@ -115,6 +116,7 @@ bcr -> dexter bcr -> sg bcr -> carlavilla bcr -> "0mp" +bcr -> gbe blackend -> ale Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Jun 12 07:36:32 2020 (r362088) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Jun 12 09:34:10 2020 (r362089) @@ -357,6 +357,7 @@ 09/09 Yoshio Mita born in Hiroshima, Japan, 1972 09/09 Steven Hartland born in Wordsley, United Kingdom, 1973 09/10 Wesley R. Peters born in Hartford, Alabama, United States, 1961 +09/11 Gordon Bergling born in Magdeburg, Germany, 1981 09/12 Weongyo Jeong born in Haman, Korea, 1980 09/12 Benedict Christopher Reuschling born in Darmstadt, Germany, 1981 09/12 William C. Fumerola II born in Detroit, Michigan, United States, 1981 From owner-svn-src-head@freebsd.org Fri Jun 12 10:13:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6F21335BC7; Fri, 12 Jun 2020 10:13:23 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jxPv42l6z4HkK; Fri, 12 Jun 2020 10:13: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8610E27DC1; Fri, 12 Jun 2020 10:13: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 05CADNr1057497; Fri, 12 Jun 2020 10:13:23 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CADNDq057496; Fri, 12 Jun 2020 10:13:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006121013.05CADNDq057496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 12 Jun 2020 10:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362090 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362090 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 10:13:23 -0000 Author: tuexen Date: Fri Jun 12 10:13:23 2020 New Revision: 362090 URL: https://svnweb.freebsd.org/changeset/base/362090 Log: Small cleanup due to upstream ifdef cleanups. MFC after: 1 week Modified: head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctputil.h ============================================================================== --- head/sys/netinet/sctputil.h Fri Jun 12 09:34:10 2020 (r362089) +++ head/sys/netinet/sctputil.h Fri Jun 12 10:13:23 2020 (r362090) @@ -55,7 +55,7 @@ void sctp_m_freem(struct mbuf *m); #define sctp_m_freem m_freem #endif -#if defined(SCTP_LOCAL_TRACE_BUF) || defined(__APPLE__) +#if defined(SCTP_LOCAL_TRACE_BUF) void sctp_log_trace(uint32_t fr, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f); #endif From owner-svn-src-head@freebsd.org Fri Jun 12 10:43:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CFB033694F; Fri, 12 Jun 2020 10:43:22 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49jy4T74FQz4KdS; Fri, 12 Jun 2020 10:43:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDC968715; Fri, 12 Jun 2020 10:43:21 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CAhLBc075998; Fri, 12 Jun 2020 10:43:21 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CAhL9R075997; Fri, 12 Jun 2020 10:43:21 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202006121043.05CAhL9R075997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 12 Jun 2020 10:43:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362091 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 362091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 10:43:22 -0000 Author: andrew Date: Fri Jun 12 10:43:21 2020 New Revision: 362091 URL: https://svnweb.freebsd.org/changeset/base/362091 Log: Teach the arm64 vfp.h about struct thread. Ensure struct thread is defined in vfp.h. In some cases it is not and stops the kernel from building. Sponsored by: Innovate UK Modified: head/sys/arm64/include/vfp.h Modified: head/sys/arm64/include/vfp.h ============================================================================== --- head/sys/arm64/include/vfp.h Fri Jun 12 10:13:23 2020 (r362090) +++ head/sys/arm64/include/vfp.h Fri Jun 12 10:43:21 2020 (r362091) @@ -42,6 +42,7 @@ struct vfpstate { #ifdef _KERNEL struct pcb; +struct thread; void vfp_init(void); void vfp_discard(struct thread *); From owner-svn-src-head@freebsd.org Fri Jun 12 13:02:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8030633A131; Fri, 12 Jun 2020 13:02:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k19L39cxz4TtN; Fri, 12 Jun 2020 13:02:46 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67EBA9EA2; Fri, 12 Jun 2020 13:02:46 +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 05CD2k7n064025; Fri, 12 Jun 2020 13:02:46 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CD2jXJ064021; Fri, 12 Jun 2020 13:02:45 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202006121302.05CD2jXJ064021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 12 Jun 2020 13:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362095 - in head/contrib/sqlite3: . tea tea/generic X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head/contrib/sqlite3: . tea tea/generic X-SVN-Commit-Revision: 362095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 13:02:46 -0000 Author: cy Date: Fri Jun 12 13:02:44 2020 New Revision: 362095 URL: https://svnweb.freebsd.org/changeset/base/362095 Log: MFV r362082: Update sqlite3 3.31.1 --> 3.32.0. PR: 247149 Reported by: spam123@bitbert.com Reminded by: emaste MFC after: 3 days Security: CVE-2020-11655, CVE-2020-13434, CVE-2020-13435, CVE-2020-13630, CVE-2020-13631, CVE-2020-13632 Modified: head/contrib/sqlite3/Makefile.msc head/contrib/sqlite3/configure head/contrib/sqlite3/configure.ac head/contrib/sqlite3/shell.c head/contrib/sqlite3/sqlite3.c head/contrib/sqlite3/sqlite3.h head/contrib/sqlite3/sqlite3ext.h head/contrib/sqlite3/tea/configure head/contrib/sqlite3/tea/configure.ac head/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: head/contrib/sqlite3/ (props changed) Modified: head/contrib/sqlite3/Makefile.msc ============================================================================== --- head/contrib/sqlite3/Makefile.msc Fri Jun 12 11:44:30 2020 (r362094) +++ head/contrib/sqlite3/Makefile.msc Fri Jun 12 13:02:44 2020 (r362095) @@ -196,6 +196,7 @@ OSTRACE = 0 DEBUG = 0 !ENDIF + # Enable use of available compiler optimizations? Normally, this should be # non-zero. Setting this to zero, thus disabling all compiler optimizations, # can be useful for testing. @@ -288,6 +289,7 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENAB OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBPAGE_VTAB=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DBSTAT_VTAB=1 +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_BYTECODE_VTAB=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_DESERIALIZE=1 !ENDIF OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_COLUMN_METADATA=1 Modified: head/contrib/sqlite3/configure ============================================================================== --- head/contrib/sqlite3/configure Fri Jun 12 11:44:30 2020 (r362094) +++ head/contrib/sqlite3/configure Fri Jun 12 13:02:44 2020 (r362095) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.31.1. +# Generated by GNU Autoconf 2.69 for sqlite 3.32.0. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.31.1' -PACKAGE_STRING='sqlite 3.31.1' +PACKAGE_VERSION='3.32.0' +PACKAGE_STRING='sqlite 3.32.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.31.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.32.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.31.1:";; + short | recursive ) echo "Configuration of sqlite 3.32.0:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.31.1 +sqlite configure 3.32.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.31.1, which was +It was created by sqlite $as_me 3.32.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.31.1' + VERSION='3.32.0' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.31.1, which was +This file was extended by sqlite $as_me 3.32.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.31.1 +sqlite config.status 3.32.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/sqlite3/configure.ac ============================================================================== --- head/contrib/sqlite3/configure.ac Fri Jun 12 11:44:30 2020 (r362094) +++ head/contrib/sqlite3/configure.ac Fri Jun 12 13:02:44 2020 (r362095) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.31.1, http://www.sqlite.org) +AC_INIT(sqlite, 3.32.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: head/contrib/sqlite3/shell.c ============================================================================== --- head/contrib/sqlite3/shell.c Fri Jun 12 11:44:30 2020 (r362094) +++ head/contrib/sqlite3/shell.c Fri Jun 12 13:02:44 2020 (r362095) @@ -36,6 +36,14 @@ #endif /* +** Determine if we are dealing with WinRT, which provides only a subset of +** the full Win32 API. +*/ +#if !defined(SQLITE_OS_WINRT) +# define SQLITE_OS_WINRT 0 +#endif + +/* ** Warning pragmas copied from msvc.h in the core. */ #if defined(_MSC_VER) @@ -147,22 +155,26 @@ typedef unsigned char u8; #if defined(_WIN32) || defined(WIN32) -# include -# include -# define isatty(h) _isatty(h) -# ifndef access -# define access(f,m) _access((f),(m)) +# if SQLITE_OS_WINRT +# define SQLITE_OMIT_POPEN 1 +# else +# include +# include +# define isatty(h) _isatty(h) +# ifndef access +# define access(f,m) _access((f),(m)) +# endif +# ifndef unlink +# define unlink _unlink +# endif +# ifndef strdup +# define strdup _strdup +# endif +# undef popen +# define popen _popen +# undef pclose +# define pclose _pclose # endif -# ifndef unlink -# define unlink _unlink -# endif -# ifndef strdup -# define strdup _strdup -# endif -# undef popen -# define popen _popen -# undef pclose -# define pclose _pclose #else /* Make sure isatty() has a prototype. */ extern int isatty(int); @@ -191,6 +203,9 @@ typedef unsigned char u8; #define ToLower(X) (char)tolower((unsigned char)X) #if defined(_WIN32) || defined(WIN32) +#if SQLITE_OS_WINRT +#include +#endif #include /* string conversion routines only needed on Win32 */ @@ -206,7 +221,7 @@ extern LPWSTR sqlite3_win32_utf8_to_unicode(const char ** rendering quoted strings that contain \n characters). The following ** routines take care of that. */ -#if defined(_WIN32) || defined(WIN32) +#if (defined(_WIN32) || defined(WIN32)) && !SQLITE_OS_WINRT static void setBinaryMode(FILE *file, int isOutput){ if( isOutput ) fflush(file); _setmode(_fileno(file), _O_BINARY); @@ -310,6 +325,7 @@ static int hasTimer(void){ if( getProcessTimesAddr ){ return 1; } else { +#if !SQLITE_OS_WINRT /* GetProcessTimes() isn't supported in WIN95 and some other Windows ** versions. See if the version we are running on has it, and if it ** does, save off a pointer to it and the current process handle. @@ -326,6 +342,7 @@ static int hasTimer(void){ FreeLibrary(hinstLib); } } +#endif } return 0; } @@ -415,7 +432,16 @@ static sqlite3 *globalDb = 0; */ static volatile int seenInterrupt = 0; +#ifdef SQLITE_DEBUG /* +** Out-of-memory simulator variables +*/ +static unsigned int oomCounter = 0; /* Simulate OOM when equals 1 */ +static unsigned int oomRepeat = 0; /* Number of OOMs in a row */ +static void*(*defaultMalloc)(int) = 0; /* The low-level malloc routine */ +#endif /* SQLITE_DEBUG */ + +/* ** This is the name of our program. It is set in main(), used ** in a number of other places, mostly for error messages. */ @@ -466,6 +492,49 @@ static void shell_out_of_memory(void){ exit(1); } +#ifdef SQLITE_DEBUG +/* This routine is called when a simulated OOM occurs. It is broken +** out as a separate routine to make it easy to set a breakpoint on +** the OOM +*/ +void shellOomFault(void){ + if( oomRepeat>0 ){ + oomRepeat--; + }else{ + oomCounter--; + } +} +#endif /* SQLITE_DEBUG */ + +#ifdef SQLITE_DEBUG +/* This routine is a replacement malloc() that is used to simulate +** Out-Of-Memory (OOM) errors for testing purposes. +*/ +static void *oomMalloc(int nByte){ + if( oomCounter ){ + if( oomCounter==1 ){ + shellOomFault(); + return 0; + }else{ + oomCounter--; + } + } + return defaultMalloc(nByte); +} +#endif /* SQLITE_DEBUG */ + +#ifdef SQLITE_DEBUG +/* Register the OOM simulator. This must occur before any memory +** allocations */ +static void registerOomSimulator(void){ + sqlite3_mem_methods mem; + sqlite3_config(SQLITE_CONFIG_GETMALLOC, &mem); + defaultMalloc = mem.xMalloc; + mem.xMalloc = oomMalloc; + sqlite3_config(SQLITE_CONFIG_MALLOC, &mem); +} +#endif + /* ** Write I/O traces to the following stream. */ @@ -2426,6 +2495,7 @@ static int writeFile( if( mtime>=0 ){ #if defined(_WIN32) +#if !SQLITE_OS_WINRT /* Windows */ FILETIME lastAccess; FILETIME lastWrite; @@ -2456,6 +2526,7 @@ static int writeFile( }else{ return 1; } +#endif #elif defined(AT_FDCWD) && 0 /* utimensat() is not universally available */ /* Recent unix */ struct timespec times[2]; @@ -4213,6 +4284,101 @@ int sqlite3MemTraceDeactivate(void){ } /************************* End ../ext/misc/memtrace.c ********************/ +/************************* Begin ../ext/misc/uint.c ******************/ +/* +** 2020-04-14 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This SQLite extension implements the UINT collating sequence. +** +** UINT works like BINARY for text, except that embedded strings +** of digits compare in numeric order. +** +** * Leading zeros are handled properly, in the sense that +** they do not mess of the maginitude comparison of embedded +** strings of digits. "x00123y" is equal to "x123y". +** +** * Only unsigned integers are recognized. Plus and minus +** signs are ignored. Decimal points and exponential notation +** are ignored. +** +** * Embedded integers can be of arbitrary length. Comparison +** is *not* limited integers that can be expressed as a +** 64-bit machine integer. +*/ +/* #include "sqlite3ext.h" */ +SQLITE_EXTENSION_INIT1 +#include +#include +#include + +/* +** Compare text in lexicographic order, except strings of digits +** compare in numeric order. +*/ +static int uintCollFunc( + void *notUsed, + int nKey1, const void *pKey1, + int nKey2, const void *pKey2 +){ + const unsigned char *zA = (const unsigned char*)pKey1; + const unsigned char *zB = (const unsigned char*)pKey2; + int i=0, j=0, x; + (void)notUsed; + while( imodePrior = p->mode; + p->priorShFlgs = p->shellFlgs; memcpy(p->colSepPrior, p->colSeparator, sizeof(p->colSeparator)); memcpy(p->rowSepPrior, p->rowSeparator, sizeof(p->rowSeparator)); } static void outputModePop(ShellState *p){ p->mode = p->modePrior; + p->shellFlgs = p->priorShFlgs; memcpy(p->colSeparator, p->colSepPrior, sizeof(p->colSeparator)); memcpy(p->rowSeparator, p->rowSepPrior, sizeof(p->rowSeparator)); } @@ -10871,8 +11045,7 @@ static void set_table_name(ShellState *p, const char * */ static int run_table_dump_query( ShellState *p, /* Query context */ - const char *zSelect, /* SELECT statement to extract content */ - const char *zFirstRow /* Print before first row, if not NULL */ + const char *zSelect /* SELECT statement to extract content */ ){ sqlite3_stmt *pSelect; int rc; @@ -10889,10 +11062,6 @@ static int run_table_dump_query( rc = sqlite3_step(pSelect); nResult = sqlite3_column_count(pSelect); while( rc==SQLITE_ROW ){ - if( zFirstRow ){ - utf8_printf(p->out, "%s", zFirstRow); - zFirstRow = 0; - } z = (const char*)sqlite3_column_text(pSelect, 0); utf8_printf(p->out, "%s", z); for(i=1; idb, 0, 0); sqlite3_shathree_init(p->db, 0, 0); sqlite3_completion_init(p->db, 0, 0); + sqlite3_uint_init(p->db, 0, 0); #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) sqlite3_dbdata_init(p->db, 0, 0); #endif @@ -13073,6 +13267,8 @@ struct ImportCtx { int n; /* Number of bytes in z */ int nAlloc; /* Space allocated for z[] */ int nLine; /* Current line number */ + int nRow; /* Number of rows imported */ + int nErr; /* Number of errors encountered */ int bNotFirst; /* True if one or more bytes already read */ int cTerm; /* Character that terminated the most recent field */ int cColSep; /* The column separator character. (Usually ",") */ @@ -13454,11 +13650,15 @@ static void output_reset(ShellState *p){ zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile); if( system(zCmd) ){ utf8_printf(stderr, "Failed: [%s]\n", zCmd); + }else{ + /* Give the start/open/xdg-open command some time to get + ** going before we continue, and potential delete the + ** p->zTempFile data file out from under it */ + sqlite3_sleep(2000); } sqlite3_free(zCmd); outputModePop(p); p->doXdgOpen = 0; - sqlite3_sleep(100); } #endif /* !defined(SQLITE_NOHAVE_SYSTEM) */ } @@ -13534,12 +13734,7 @@ static int shell_dbinfo_command(ShellState *p, int nAr "SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1", -1, &pStmt, 0); if( rc ){ - if( !sqlite3_compileoption_used("ENABLE_DBPAGE_VTAB") ){ - utf8_printf(stderr, "the \".dbinfo\" command requires the " - "-DSQLITE_ENABLE_DBPAGE_VTAB compile-time options\n"); - }else{ - utf8_printf(stderr, "error: %s\n", sqlite3_errmsg(p->db)); - } + utf8_printf(stderr, "error: %s\n", sqlite3_errmsg(p->db)); sqlite3_finalize(pStmt); return 1; } @@ -13748,9 +13943,21 @@ static void newTempFile(ShellState *p, const char *zSu sqlite3_file_control(p->db, 0, SQLITE_FCNTL_TEMPFILENAME, &p->zTempFile); } if( p->zTempFile==0 ){ + /* If p->db is an in-memory database then the TEMPFILENAME file-control + ** will not work and we will need to fallback to guessing */ + char *zTemp; sqlite3_uint64 r; sqlite3_randomness(sizeof(r), &r); - p->zTempFile = sqlite3_mprintf("temp%llx.%s", r, zSuffix); + zTemp = getenv("TEMP"); + if( zTemp==0 ) zTemp = getenv("TMP"); + if( zTemp==0 ){ +#ifdef _WIN32 + zTemp = "\\tmp"; +#else + zTemp = "/tmp"; +#endif + } + p->zTempFile = sqlite3_mprintf("%s/temp%llx.%s", zTemp, r, zSuffix); }else{ p->zTempFile = sqlite3_mprintf("%z.%s", p->zTempFile, zSuffix); } @@ -15774,7 +15981,8 @@ static int do_meta_command(char *zLine, ShellState *p) #endif /* !(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) */ if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){ - const char *zLike = 0; + char *zLike = 0; + char *zSql; int i; int savedShowHeader = p->showHeader; int savedShellFlags = p->shellFlgs; @@ -15802,12 +16010,10 @@ static int do_meta_command(char *zLine, ShellState *p) goto meta_command_exit; } }else if( zLike ){ - raw_printf(stderr, "Usage: .dump ?--preserve-rowids? " - "?--newlines? ?LIKE-PATTERN?\n"); - rc = 1; - goto meta_command_exit; + zLike = sqlite3_mprintf("%z OR name LIKE %Q ESCAPE '\\'", + zLike, azArg[i]); }else{ - zLike = azArg[i]; + zLike = sqlite3_mprintf("name LIKE %Q ESCAPE '\\'", azArg[i]); } } @@ -15825,35 +16031,25 @@ static int do_meta_command(char *zLine, ShellState *p) ** corrupt. */ sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0); p->nErr = 0; - if( zLike==0 ){ - run_schema_dump_query(p, - "SELECT name, type, sql FROM sqlite_master " - "WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'" - ); - run_schema_dump_query(p, - "SELECT name, type, sql FROM sqlite_master " - "WHERE name=='sqlite_sequence'" - ); - run_table_dump_query(p, - "SELECT sql FROM sqlite_master " - "WHERE sql NOT NULL AND type IN ('index','trigger','view')", 0 - ); - }else{ - char *zSql; - zSql = sqlite3_mprintf( - "SELECT name, type, sql FROM sqlite_master " - "WHERE tbl_name LIKE %Q AND type=='table'" - " AND sql NOT NULL", zLike); - run_schema_dump_query(p,zSql); - sqlite3_free(zSql); - zSql = sqlite3_mprintf( - "SELECT sql FROM sqlite_master " - "WHERE sql NOT NULL" - " AND type IN ('index','trigger','view')" - " AND tbl_name LIKE %Q", zLike); - run_table_dump_query(p, zSql, 0); - sqlite3_free(zSql); - } + if( zLike==0 ) zLike = sqlite3_mprintf("true"); + zSql = sqlite3_mprintf( + "SELECT name, type, sql FROM sqlite_master " + "WHERE (%s) AND type=='table'" + " AND sql NOT NULL" + " ORDER BY tbl_name='sqlite_sequence', rowid", + zLike + ); + run_schema_dump_query(p,zSql); + sqlite3_free(zSql); + zSql = sqlite3_mprintf( + "SELECT sql FROM sqlite_master " + "WHERE (%s) AND sql NOT NULL" + " AND type IN ('index','trigger','view')", + zLike + ); + run_table_dump_query(p, zSql); + sqlite3_free(zSql); + sqlite3_free(zLike); if( p->writableSchema ){ raw_printf(p->out, "PRAGMA writable_schema=OFF;\n"); p->writableSchema = 0; @@ -15956,6 +16152,7 @@ static int do_meta_command(char *zLine, ShellState *p) { "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" }, { "has_moved", SQLITE_FCNTL_HAS_MOVED, "" }, { "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" }, + { "reserve_bytes", SQLITE_FCNTL_RESERVE_BYTES, "[N]" }, }; int filectrl = -1; int iCtrl = -1; @@ -15963,10 +16160,21 @@ static int do_meta_command(char *zLine, ShellState *p) int isOk = 0; /* 0: usage 1: %lld 2: no-result */ int n2, i; const char *zCmd = 0; + const char *zSchema = 0; open_db(p, 0); zCmd = nArg>=2 ? azArg[1] : "help"; + if( zCmd[0]=='-' + && (strcmp(zCmd,"--schema")==0 || strcmp(zCmd,"-schema")==0) + && nArg>=4 + ){ + zSchema = azArg[2]; + for(i=3; idb, 0, SQLITE_FCNTL_SIZE_LIMIT, &iRes); + sqlite3_file_control(p->db, zSchema, SQLITE_FCNTL_SIZE_LIMIT, &iRes); isOk = 1; break; } @@ -16017,7 +16225,7 @@ static int do_meta_command(char *zLine, ShellState *p) int x; if( nArg!=3 ) break; x = (int)integerValue(azArg[2]); - sqlite3_file_control(p->db, 0, filectrl, &x); + sqlite3_file_control(p->db, zSchema, filectrl, &x); isOk = 2; break; } @@ -16026,7 +16234,7 @@ static int do_meta_command(char *zLine, ShellState *p) int x; if( nArg!=2 && nArg!=3 ) break; x = nArg==3 ? booleanValue(azArg[2]) : -1; - sqlite3_file_control(p->db, 0, filectrl, &x); + sqlite3_file_control(p->db, zSchema, filectrl, &x); iRes = x; isOk = 1; break; @@ -16034,7 +16242,7 @@ static int do_meta_command(char *zLine, ShellState *p) case SQLITE_FCNTL_HAS_MOVED: { int x; if( nArg!=2 ) break; - sqlite3_file_control(p->db, 0, filectrl, &x); + sqlite3_file_control(p->db, zSchema, filectrl, &x); iRes = x; isOk = 1; break; @@ -16042,7 +16250,7 @@ static int do_meta_command(char *zLine, ShellState *p) case SQLITE_FCNTL_TEMPFILENAME: { char *z = 0; if( nArg!=2 ) break; - sqlite3_file_control(p->db, 0, filectrl, &z); + sqlite3_file_control(p->db, zSchema, filectrl, &z); if( z ){ utf8_printf(p->out, "%s\n", z); sqlite3_free(z); @@ -16050,6 +16258,18 @@ static int do_meta_command(char *zLine, ShellState *p) isOk = 2; break; } + case SQLITE_FCNTL_RESERVE_BYTES: { + int x; + if( nArg>=3 ){ + x = atoi(azArg[2]); + sqlite3_file_control(p->db, zSchema, filectrl, &x); + } + x = -1; + sqlite3_file_control(p->db, zSchema, filectrl, &x); + utf8_printf(p->out,"%d\n", x); + isOk = 2; + break; + } } } if( isOk==0 && iCtrl>=0 ){ @@ -16133,8 +16353,8 @@ static int do_meta_command(char *zLine, ShellState *p) }else if( c=='i' && strncmp(azArg[0], "import", n)==0 ){ - char *zTable; /* Insert data into this table */ - char *zFile; /* Name of file to extra content from */ + char *zTable = 0; /* Insert data into this table */ + char *zFile = 0; /* Name of file to extra content from */ sqlite3_stmt *pStmt = NULL; /* A statement */ int nCol; /* Number of columns in the table */ int nByte; /* Number of bytes in an SQL string */ @@ -16145,51 +16365,108 @@ static int do_meta_command(char *zLine, ShellState *p) ImportCtx sCtx; /* Reader context */ char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */ int (SQLITE_CDECL *xCloser)(FILE*); /* Func to close file */ + int eVerbose = 0; /* Larger for more console output */ + int nSkip = 0; /* Initial lines to skip */ + int useOutputMode = 1; /* Use output mode to determine separators */ - if( nArg!=3 ){ - raw_printf(stderr, "Usage: .import FILE TABLE\n"); - goto meta_command_exit; - } - zFile = azArg[1]; - zTable = azArg[2]; - seenInterrupt = 0; memset(&sCtx, 0, sizeof(sCtx)); - open_db(p, 0); - nSep = strlen30(p->colSeparator); - if( nSep==0 ){ - raw_printf(stderr, - "Error: non-null column separator required for import\n"); - return 1; + if( p->mode==MODE_Ascii ){ + xRead = ascii_read_one_field; + }else{ + xRead = csv_read_one_field; } - if( nSep>1 ){ - raw_printf(stderr, "Error: multi-character column separators not allowed" - " for import\n"); - return 1; + for(i=1; iout, "ERROR: extra argument: \"%s\". Usage:\n", z); + showHelp(p->out, "import"); + rc = 1; + goto meta_command_exit; + } + }else if( strcmp(z,"-v")==0 ){ + eVerbose++; + }else if( strcmp(z,"-skip")==0 && iout, "ERROR: unknown option: \"%s\". Usage:\n", z); + showHelp(p->out, "import"); + rc = 1; + goto meta_command_exit; + } } - nSep = strlen30(p->rowSeparator); - if( nSep==0 ){ - raw_printf(stderr, "Error: non-null row separator required for import\n"); - return 1; + if( zTable==0 ){ + utf8_printf(p->out, "ERROR: missing %s argument. Usage:\n", + zFile==0 ? "FILE" : "TABLE"); + showHelp(p->out, "import"); + rc = 1; + goto meta_command_exit; } - if( nSep==2 && p->mode==MODE_Csv && strcmp(p->rowSeparator, SEP_CrLf)==0 ){ - /* When importing CSV (only), if the row separator is set to the - ** default output row separator, change it to the default input - ** row separator. This avoids having to maintain different input - ** and output row separators. */ - sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); + seenInterrupt = 0; + open_db(p, 0); + if( useOutputMode ){ + /* If neither the --csv or --ascii options are specified, then set + ** the column and row separator characters from the output mode. */ + nSep = strlen30(p->colSeparator); + if( nSep==0 ){ + raw_printf(stderr, + "Error: non-null column separator required for import\n"); + rc = 1; + goto meta_command_exit; + } + if( nSep>1 ){ + raw_printf(stderr, + "Error: multi-character column separators not allowed" + " for import\n"); + rc = 1; + goto meta_command_exit; + } nSep = strlen30(p->rowSeparator); + if( nSep==0 ){ + raw_printf(stderr, + "Error: non-null row separator required for import\n"); + rc = 1; + goto meta_command_exit; + } + if( nSep==2 && p->mode==MODE_Csv && strcmp(p->rowSeparator,SEP_CrLf)==0 ){ + /* When importing CSV (only), if the row separator is set to the + ** default output row separator, change it to the default input + ** row separator. This avoids having to maintain different input + ** and output row separators. */ + sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Row); + nSep = strlen30(p->rowSeparator); + } + if( nSep>1 ){ + raw_printf(stderr, "Error: multi-character row separators not allowed" + " for import\n"); + rc = 1; + goto meta_command_exit; + } + sCtx.cColSep = p->colSeparator[0]; + sCtx.cRowSep = p->rowSeparator[0]; } - if( nSep>1 ){ - raw_printf(stderr, "Error: multi-character row separators not allowed" - " for import\n"); - return 1; - } sCtx.zFile = zFile; sCtx.nLine = 1; if( sCtx.zFile[0]=='|' ){ #ifdef SQLITE_OMIT_POPEN raw_printf(stderr, "Error: pipes are not supported in this OS\n"); - return 1; + rc = 1; + goto meta_command_exit; #else sCtx.in = popen(sCtx.zFile+1, "r"); sCtx.zFile = ""; @@ -16199,17 +16476,26 @@ static int do_meta_command(char *zLine, ShellState *p) sCtx.in = fopen(sCtx.zFile, "rb"); xCloser = fclose; } - if( p->mode==MODE_Ascii ){ - xRead = ascii_read_one_field; - }else{ - xRead = csv_read_one_field; - } if( sCtx.in==0 ){ utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile); - return 1; + rc = 1; + goto meta_command_exit; } - sCtx.cColSep = p->colSeparator[0]; - sCtx.cRowSep = p->rowSeparator[0]; + if( eVerbose>=2 || (eVerbose>=1 && useOutputMode) ){ + char zSep[2]; + zSep[1] = 0; + zSep[0] = sCtx.cColSep; + utf8_printf(p->out, "Column separator "); + output_c_string(p->out, zSep); + utf8_printf(p->out, ", row separator "); + zSep[0] = sCtx.cRowSep; + output_c_string(p->out, zSep); + utf8_printf(p->out, "\n"); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jun 12 13:59:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CECE833B2C6; Fri, 12 Jun 2020 13:59:59 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k2RM51x3z4Xr6; Fri, 12 Jun 2020 13:59:59 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A36DAA83F; Fri, 12 Jun 2020 13:59:59 +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 05CDxxUt095566; Fri, 12 Jun 2020 13:59:59 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CDxwc4095562; Fri, 12 Jun 2020 13:59:58 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006121359.05CDxwc4095562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 12 Jun 2020 13:59:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362099 - in head/sys: arm64/coresight conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/coresight conf X-SVN-Commit-Revision: 362099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 13:59:59 -0000 Author: br Date: Fri Jun 12 13:59:58 2020 New Revision: 362099 URL: https://svnweb.freebsd.org/changeset/base/362099 Log: ARM Coresight Trace Memory Controller (TMC): o Split-out FDT attachment to a separate file; o Add ACPI attachment. Sponsored by: DARPA, AFRL Added: head/sys/arm64/coresight/coresight_tmc_acpi.c (contents, props changed) head/sys/arm64/coresight/coresight_tmc_fdt.c (contents, props changed) Modified: head/sys/arm64/coresight/coresight_tmc.c head/sys/arm64/coresight/coresight_tmc.h head/sys/conf/files.arm64 Modified: head/sys/arm64/coresight/coresight_tmc.c ============================================================================== --- head/sys/arm64/coresight/coresight_tmc.c Fri Jun 12 13:54:41 2020 (r362098) +++ head/sys/arm64/coresight/coresight_tmc.c Fri Jun 12 13:59:58 2020 (r362099) @@ -42,9 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include "coresight_if.h" #define TMC_DEBUG @@ -56,25 +53,6 @@ __FBSDID("$FreeBSD$"); #define dprintf(fmt, ...) #endif -static struct ofw_compat_data compat_data[] = { - { "arm,coresight-tmc", 1 }, - { NULL, 0 } -}; - -struct tmc_softc { - struct resource *res; - device_t dev; - uint64_t cycle; - struct coresight_platform_data *pdata; - uint32_t dev_type; -#define CORESIGHT_UNKNOWN 0 -#define CORESIGHT_ETR 1 -#define CORESIGHT_ETF 2 - uint32_t nev; - struct coresight_event *event; - boolean_t etf_configured; -}; - static struct resource_spec tmc_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { -1, 0 } @@ -335,21 +313,6 @@ tmc_read(device_t dev, struct endpoint *endp, } static int -tmc_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) - return (ENXIO); - - device_set_desc(dev, "Coresight Trace Memory Controller (TMC)"); - - return (BUS_PROBE_DEFAULT); -} - -static int tmc_attach(device_t dev) { struct coresight_desc desc; @@ -375,7 +338,6 @@ tmc_attach(device_t dev) static device_method_t tmc_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, tmc_probe), DEVMETHOD(device_attach, tmc_attach), /* Coresight interface */ @@ -386,13 +348,4 @@ static device_method_t tmc_methods[] = { DEVMETHOD_END }; -static driver_t tmc_driver = { - "tmc", - tmc_methods, - sizeof(struct tmc_softc), -}; - -static devclass_t tmc_devclass; - -DRIVER_MODULE(tmc, simplebus, tmc_driver, tmc_devclass, 0, 0); -MODULE_VERSION(tmc, 1); +DEFINE_CLASS_0(tmc, tmc_driver, tmc_methods, sizeof(struct tmc_softc)); Modified: head/sys/arm64/coresight/coresight_tmc.h ============================================================================== --- head/sys/arm64/coresight/coresight_tmc.h Fri Jun 12 13:54:41 2020 (r362098) +++ head/sys/arm64/coresight/coresight_tmc.h Fri Jun 12 13:59:58 2020 (r362099) @@ -116,4 +116,20 @@ #define TMC_COMPID2 0xFF8 /* Component ID2 Register */ #define TMC_COMPID3 0xFFC /* Component ID3 Register */ +DECLARE_CLASS(tmc_driver); + +struct tmc_softc { + struct resource *res; + device_t dev; + uint64_t cycle; + struct coresight_platform_data *pdata; + uint32_t dev_type; +#define CORESIGHT_UNKNOWN 0 +#define CORESIGHT_ETR 1 +#define CORESIGHT_ETF 2 + uint32_t nev; + struct coresight_event *event; + boolean_t etf_configured; +}; + #endif /* !_ARM64_CORESIGHT_CORESIGHT_TMC_H_ */ Added: head/sys/arm64/coresight/coresight_tmc_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_tmc_acpi.c Fri Jun 12 13:59:58 2020 (r362099) @@ -0,0 +1,79 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_acpi.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +static int +tmc_acpi_probe(device_t dev) +{ + static char *tmc_ids[] = { "ARMHC97C", NULL }; + int error; + + error = ACPI_ID_PROBE(device_get_parent(dev), dev, tmc_ids, NULL); + if (error <= 0) + device_set_desc(dev, "ARM Coresight TMC"); + + return (error); +} + +static device_method_t tmc_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, tmc_acpi_probe), + + /* End */ + DEVMETHOD_END +}; + +DEFINE_CLASS_1(tmc, tmc_acpi_driver, tmc_acpi_methods, + sizeof(struct tmc_softc), tmc_driver); + +static devclass_t tmc_acpi_devclass; + +EARLY_DRIVER_MODULE(tmc, acpi, tmc_acpi_driver, tmc_acpi_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Added: head/sys/arm64/coresight/coresight_tmc_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_tmc_fdt.c Fri Jun 12 13:59:58 2020 (r362099) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2018-2020 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 "coresight_if.h" + +static struct ofw_compat_data compat_data[] = { + { "arm,coresight-tmc", 1 }, + { NULL, 0 } +}; + +static int +tmc_fdt_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "ARM Coresight TMC"); + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t tmc_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, tmc_fdt_probe), + DEVMETHOD_END +}; + +DEFINE_CLASS_1(tmc, tmc_fdt_driver, tmc_fdt_methods, + sizeof(struct tmc_softc), tmc_driver); + +static devclass_t tmc_fdt_devclass; + +EARLY_DRIVER_MODULE(tmc, simplebus, tmc_fdt_driver, tmc_fdt_devclass, + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Jun 12 13:54:41 2020 (r362098) +++ head/sys/conf/files.arm64 Fri Jun 12 13:59:58 2020 (r362099) @@ -197,6 +197,8 @@ arm64/coresight/coresight_funnel.c standard arm64/coresight/coresight_funnel_acpi.c optional acpi arm64/coresight/coresight_funnel_fdt.c optional fdt arm64/coresight/coresight_tmc.c standard +arm64/coresight/coresight_tmc_acpi.c optional acpi +arm64/coresight/coresight_tmc_fdt.c optional fdt arm64/intel/firmware.c optional soc_intel_stratix10 arm64/intel/stratix10-soc-fpga-mgr.c optional soc_intel_stratix10 arm64/intel/stratix10-svc.c optional soc_intel_stratix10 From owner-svn-src-head@freebsd.org Fri Jun 12 14:14:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C3B133BA6F; Fri, 12 Jun 2020 14:14:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k2lY75Ptz4Yt0; Fri, 12 Jun 2020 14:14:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEBB4AE29; Fri, 12 Jun 2020 14:14:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CEE19e007936; Fri, 12 Jun 2020 14:14:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CEE1lF007935; Fri, 12 Jun 2020 14:14:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202006121414.05CEE1lF007935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 12 Jun 2020 14:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362100 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 362100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 14:14:02 -0000 Author: mav Date: Fri Jun 12 14:14:01 2020 New Revision: 362100 URL: https://svnweb.freebsd.org/changeset/base/362100 Log: Fix config_intrhook leak on initial reset failure. MFC after: 1 week Sponsored by: iXsystems, Inc. Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Fri Jun 12 13:59:58 2020 (r362099) +++ head/sys/dev/nvme/nvme_ctrlr.c Fri Jun 12 14:14:01 2020 (r362100) @@ -1126,12 +1126,14 @@ nvme_ctrlr_start_config_hook(void *arg) status = nvme_ctrlr_hw_reset(ctrlr); if (status != 0) { nvme_ctrlr_fail(ctrlr); + config_intrhook_disestablish(&ctrlr->config_hook); return; } status = nvme_ctrlr_hw_reset(ctrlr); if (status != 0) { nvme_ctrlr_fail(ctrlr); + config_intrhook_disestablish(&ctrlr->config_hook); return; } From owner-svn-src-head@freebsd.org Fri Jun 12 14:23:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88B2833BF35; Fri, 12 Jun 2020 14:23:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k2y732qTz4ZVZ; Fri, 12 Jun 2020 14:23:11 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63BFAB191; Fri, 12 Jun 2020 14:23:11 +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 05CENBSD013778; Fri, 12 Jun 2020 14:23:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CENBKL013777; Fri, 12 Jun 2020 14:23:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006121423.05CENBKL013777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 12 Jun 2020 14:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362101 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362101 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 14:23:11 -0000 Author: trasz Date: Fri Jun 12 14:23:10 2020 New Revision: 362101 URL: https://svnweb.freebsd.org/changeset/base/362101 Log: Minor code cleanup; no functional changes. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25232 Modified: head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Fri Jun 12 14:14:01 2020 (r362100) +++ head/sys/compat/linux/linux_socket.c Fri Jun 12 14:23:10 2020 (r362101) @@ -92,10 +92,9 @@ static int linux_to_bsd_sockopt_level(int level) { - switch (level) { - case LINUX_SOL_SOCKET: + if (level == LINUX_SOL_SOCKET) return (SOL_SOCKET); - } + /* Remaining values are RFC-defined protocol numbers. */ return (level); } @@ -103,10 +102,8 @@ static int bsd_to_linux_sockopt_level(int level) { - switch (level) { - case SOL_SOCKET: + if (level == SOL_SOCKET) return (LINUX_SOL_SOCKET); - } return (level); } Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Fri Jun 12 14:14:01 2020 (r362100) +++ head/sys/compat/linux/linux_socket.h Fri Jun 12 14:23:10 2020 (r362101) @@ -170,12 +170,6 @@ int linux_accept(struct thread *td, struct linux_accep /* Socket defines */ #define LINUX_SOL_SOCKET 1 -#define LINUX_SOL_IP 0 -#define LINUX_SOL_TCP 6 -#define LINUX_SOL_UDP 17 -#define LINUX_SOL_IPV6 41 -#define LINUX_SOL_IPX 256 -#define LINUX_SOL_AX25 257 #define LINUX_SO_DEBUG 1 #define LINUX_SO_REUSEADDR 2 From owner-svn-src-head@freebsd.org Fri Jun 12 14:25:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D0B633BF48; Fri, 12 Jun 2020 14:25:33 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k30r6VN2z4ZnB; Fri, 12 Jun 2020 14:25: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5F84ACB6; Fri, 12 Jun 2020 14:25: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 05CEPWOc013958; Fri, 12 Jun 2020 14:25:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CEPWYl013957; Fri, 12 Jun 2020 14:25:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006121425.05CEPWYl013957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 12 Jun 2020 14:25:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362102 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 14:25:33 -0000 Author: trasz Date: Fri Jun 12 14:25:32 2020 New Revision: 362102 URL: https://svnweb.freebsd.org/changeset/base/362102 Log: Make linux(4) warn about unsupported fcntls. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25231 Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Fri Jun 12 14:23:10 2020 (r362101) +++ head/sys/compat/linux/linux_file.c Fri Jun 12 14:25:32 2020 (r362102) @@ -1371,9 +1371,10 @@ fcntl_common(struct thread *td, struct linux_fcntl_arg case LINUX_F_DUPFD_CLOEXEC: return (kern_fcntl(td, args->fd, F_DUPFD_CLOEXEC, args->arg)); + default: + linux_msg(td, "unsupported fcntl cmd %d\n", args->cmd); + return (EINVAL); } - - return (EINVAL); } int From owner-svn-src-head@freebsd.org Fri Jun 12 14:31:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E59A33C1F2; Fri, 12 Jun 2020 14:31:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k37X2psZz4b0s; Fri, 12 Jun 2020 14:31:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BE4EAFAB; Fri, 12 Jun 2020 14:31:20 +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 05CEVKM3018875; Fri, 12 Jun 2020 14:31:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CEVKUO018874; Fri, 12 Jun 2020 14:31:20 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006121431.05CEVKUO018874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 12 Jun 2020 14:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362103 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 14:31:20 -0000 Author: trasz Date: Fri Jun 12 14:31:19 2020 New Revision: 362103 URL: https://svnweb.freebsd.org/changeset/base/362103 Log: Fix naming clash. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Fri Jun 12 14:25:32 2020 (r362102) +++ head/sys/compat/linux/linux_socket.c Fri Jun 12 14:31:19 2020 (r362103) @@ -943,7 +943,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc struct msghdr msg; struct l_cmsghdr linux_cmsg; struct l_cmsghdr *ptr_cmsg; - struct l_msghdr linux_msg; + struct l_msghdr linux_msghdr; struct iovec *iov; socklen_t datalen; struct sockaddr *sa; @@ -955,7 +955,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc l_size_t clen; int error, fflag; - error = copyin(msghdr, &linux_msg, sizeof(linux_msg)); + error = copyin(msghdr, &linux_msghdr, sizeof(linux_msghdr)); if (error != 0) return (error); @@ -966,10 +966,11 @@ linux_sendmsg_common(struct thread *td, l_int s, struc * order to handle this case. This should be checked, but allows the * Linux ping to work. */ - if (PTRIN(linux_msg.msg_control) != NULL && linux_msg.msg_controllen == 0) - linux_msg.msg_control = PTROUT(NULL); + if (PTRIN(linux_msghdr.msg_control) != NULL && + linux_msghdr.msg_controllen == 0) + linux_msghdr.msg_control = PTROUT(NULL); - error = linux_to_bsd_msghdr(&msg, &linux_msg); + error = linux_to_bsd_msghdr(&msg, &linux_msghdr); if (error != 0) return (error); @@ -1007,7 +1008,7 @@ linux_sendmsg_common(struct thread *td, l_int s, struc goto bad; } - if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) { + if (linux_msghdr.msg_controllen >= sizeof(struct l_cmsghdr)) { error = ENOBUFS; control = m_get(M_WAITOK, MT_CONTROL); @@ -1015,8 +1016,8 @@ linux_sendmsg_common(struct thread *td, l_int s, struc data = mtod(control, void *); datalen = 0; - ptr_cmsg = PTRIN(linux_msg.msg_control); - clen = linux_msg.msg_controllen; + ptr_cmsg = PTRIN(linux_msghdr.msg_control); + clen = linux_msghdr.msg_controllen; do { error = copyin(ptr_cmsg, &linux_cmsg, sizeof(struct l_cmsghdr)); @@ -1151,7 +1152,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc struct l_cmsghdr *linux_cmsg = NULL; struct l_ucred linux_ucred; socklen_t datalen, maxlen, outlen; - struct l_msghdr linux_msg; + struct l_msghdr linux_msghdr; struct iovec *iov, *uiov; struct mbuf *control = NULL; struct mbuf **controlp; @@ -1163,11 +1164,11 @@ linux_recvmsg_common(struct thread *td, l_int s, struc void *data; int error, i, fd, fds, *fdp; - error = copyin(msghdr, &linux_msg, sizeof(linux_msg)); + error = copyin(msghdr, &linux_msghdr, sizeof(linux_msghdr)); if (error != 0) return (error); - error = linux_to_bsd_msghdr(msg, &linux_msg); + error = linux_to_bsd_msghdr(msg, &linux_msghdr); if (error != 0) return (error); @@ -1195,7 +1196,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc goto bad; if (msg->msg_name) { - msg->msg_name = PTRIN(linux_msg.msg_name); + msg->msg_name = PTRIN(linux_msghdr.msg_name); error = bsd_to_linux_sockaddr(sa, &lsa, msg->msg_namelen); if (error == 0) error = copyout(lsa, PTRIN(msg->msg_name), @@ -1205,12 +1206,12 @@ linux_recvmsg_common(struct thread *td, l_int s, struc goto bad; } - error = bsd_to_linux_msghdr(msg, &linux_msg); + error = bsd_to_linux_msghdr(msg, &linux_msghdr); if (error != 0) goto bad; - maxlen = linux_msg.msg_controllen; - linux_msg.msg_controllen = 0; + maxlen = linux_msghdr.msg_controllen; + linux_msghdr.msg_controllen = 0; if (control) { linux_cmsg = malloc(L_CMSG_HDRSZ, M_LINUX, M_WAITOK | M_ZERO); @@ -1218,7 +1219,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc msg->msg_controllen = control->m_len; cm = CMSG_FIRSTHDR(msg); - outbuf = PTRIN(linux_msg.msg_control); + outbuf = PTRIN(linux_msghdr.msg_control); outlen = 0; while (cm != NULL) { linux_cmsg->cmsg_type = @@ -1284,7 +1285,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc error = EMSGSIZE; goto bad; } else { - linux_msg.msg_flags |= LINUX_MSG_CTRUNC; + linux_msghdr.msg_flags |= LINUX_MSG_CTRUNC; m_dispose_extcontrolm(control); goto out; } @@ -1306,11 +1307,11 @@ linux_recvmsg_common(struct thread *td, l_int s, struc cm = CMSG_NXTHDR(msg, cm); } - linux_msg.msg_controllen = outlen; + linux_msghdr.msg_controllen = outlen; } out: - error = copyout(&linux_msg, msghdr, sizeof(linux_msg)); + error = copyout(&linux_msghdr, msghdr, sizeof(linux_msghdr)); bad: if (control != NULL) { @@ -1807,7 +1808,7 @@ linux_socketcall(struct thread *td, struct linux_socke return (linux_sendfile(td, arg)); } - uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what); + linux_msg(td, "socket type %d not implemented", args->what); return (ENOSYS); } #endif /* __i386__ || __arm__ || (__amd64__ && COMPAT_LINUX32) */ From owner-svn-src-head@freebsd.org Fri Jun 12 14:37:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22C5733C5A4; Fri, 12 Jun 2020 14:37:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k3H407x7z4bjF; Fri, 12 Jun 2020 14:37:52 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA265B2BC; Fri, 12 Jun 2020 14:37:51 +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 05CEbpDJ020244; Fri, 12 Jun 2020 14:37:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CEbpku020240; Fri, 12 Jun 2020 14:37:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006121437.05CEbpku020240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 12 Jun 2020 14:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362104 - in head: share/man/man4 sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: share/man/man4 sys/compat/linux X-SVN-Commit-Revision: 362104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 14:37:52 -0000 Author: trasz Date: Fri Jun 12 14:37:50 2020 New Revision: 362104 URL: https://svnweb.freebsd.org/changeset/base/362104 Log: Add compat.linux.debug sysctl, to make it possible to silence down the debug messages. While here, clean up some variable naming. Reviewed by: bcr (manpages), emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25230 Modified: head/share/man/man4/linux.4 head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_util.c Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Fri Jun 12 14:31:19 2020 (r362103) +++ head/share/man/man4/linux.4 Fri Jun 12 14:37:50 2020 (r362104) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 10, 2020 +.Dd June 12, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -95,6 +95,10 @@ variables and .Xr loader 8 tunables: .Bl -tag -width indent +.It Va compat.linux.debug +Enable debugging messages. +Set to 0 to silence them. +Defaults to 1. .It Va compat.linux.default_openfiles Default soft openfiles resource limit for Linux applications. Set to -1 to disable the limit. Modified: head/sys/compat/linux/linux_mib.c ============================================================================== --- head/sys/compat/linux/linux_mib.c Fri Jun 12 14:31:19 2020 (r362103) +++ head/sys/compat/linux/linux_mib.c Fri Jun 12 14:37:50 2020 (r362104) @@ -63,6 +63,10 @@ static unsigned linux_osd_jail_slot; SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Linux mode"); +int linux_debug = 1; +SYSCTL_INT(_compat_linux, OID_AUTO, debug, CTLFLAG_RWTUN, + &linux_debug, 0, "Log warnings from linux(4); or 0 to disable"); + int linux_default_openfiles = 1024; SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles, CTLFLAG_RWTUN, &linux_default_openfiles, 0, Modified: head/sys/compat/linux/linux_mib.h ============================================================================== --- head/sys/compat/linux/linux_mib.h Fri Jun 12 14:31:19 2020 (r362103) +++ head/sys/compat/linux/linux_mib.h Fri Jun 12 14:37:50 2020 (r362104) @@ -62,6 +62,7 @@ int linux_kernver(struct thread *td); #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) +extern int linux_debug; extern int linux_default_openfiles; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; Modified: head/sys/compat/linux/linux_util.c ============================================================================== --- head/sys/compat/linux/linux_util.c Fri Jun 12 14:31:19 2020 (r362103) +++ head/sys/compat/linux/linux_util.c Fri Jun 12 14:37:50 2020 (r362104) @@ -91,6 +91,9 @@ linux_msg(const struct thread *td, const char *fmt, .. va_list ap; struct proc *p; + if (linux_debug == 0) + return; + p = td->td_proc; printf("linux: pid %d (%s): ", (int)p->p_pid, p->p_comm); va_start(ap, fmt); From owner-svn-src-head@freebsd.org Fri Jun 12 16:31:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7EA133F453; Fri, 12 Jun 2020 16:31:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k5nt5s7Qz3TGm; Fri, 12 Jun 2020 16:31:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C43C6C981; Fri, 12 Jun 2020 16:31:14 +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 05CGVE48091236; Fri, 12 Jun 2020 16:31:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CGVDxa090514; Fri, 12 Jun 2020 16:31:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006121631.05CGVDxa090514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 12 Jun 2020 16:31:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362106 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 16:31:15 -0000 Author: tuexen Date: Fri Jun 12 16:31:13 2020 New Revision: 362106 URL: https://svnweb.freebsd.org/changeset/base/362106 Log: More cleanups due to ifdef cleanup done upstream MFC after: 1 week Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_uio.h Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Fri Jun 12 15:37:55 2020 (r362105) +++ head/sys/netinet/sctp_constants.h Fri Jun 12 16:31:13 2020 (r362106) @@ -1012,7 +1012,7 @@ do { \ do { \ if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \ - SOCKBUF_UNLOCK(&((so)->so_rcv)); \ + SOCKBUF_UNLOCK(&((so)->so_rcv)); \ } else { \ sorwakeup_locked(so); \ } \ Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Fri Jun 12 15:37:55 2020 (r362105) +++ head/sys/netinet/sctp_input.c Fri Jun 12 16:31:13 2020 (r362106) @@ -5723,7 +5723,7 @@ out: return; } -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) extern int *sctp_cpuarry; #endif @@ -5735,7 +5735,7 @@ sctp_input(struct mbuf **mp, int *offp, int proto SCTP m = *mp; off = *offp; -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) if (mp_ncpus > 1) { struct ip *ip; struct sctphdr *sh; Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Fri Jun 12 15:37:55 2020 (r362105) +++ head/sys/netinet/sctp_pcb.c Fri Jun 12 16:31:13 2020 (r362106) @@ -5535,18 +5535,14 @@ sctp_del_local_addr_restricted(struct sctp_tcb *stcb, return; } -/* - * Temporarily remove for __APPLE__ until we use the Tiger equivalents - */ /* sysctl */ static int sctp_max_number_of_assoc = SCTP_MAX_NUM_OF_ASOC; static int sctp_scale_up_for_address = SCTP_SCALE_FOR_ADDR; - - -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) struct sctp_mcore_ctrl *sctp_mcore_workers = NULL; int *sctp_cpuarry = NULL; + void sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use) { @@ -5716,13 +5712,13 @@ sctp_pcb_init(void) #if defined(SCTP_LOCAL_TRACE_BUF) memset(&SCTP_BASE_SYSCTL(sctp_log), 0, sizeof(struct sctp_log)); #endif -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) SCTP_MALLOC(SCTP_BASE_STATS, struct sctpstat *, ((mp_maxid + 1) * sizeof(struct sctpstat)), SCTP_M_MCORE); #endif (void)SCTP_GETTIME_TIMEVAL(&tv); -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) memset(SCTP_BASE_STATS, 0, sizeof(struct sctpstat) * (mp_maxid + 1)); SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_sec = (uint32_t)tv.tv_sec; SCTP_BASE_STATS[PCPU_GET(cpuid)].sctps_discontinuitytime.tv_usec = (uint32_t)tv.tv_usec; @@ -5833,7 +5829,7 @@ sctp_pcb_init(void) } sctp_startup_iterator(); -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) sctp_startup_mcore_threads(); #endif @@ -5988,7 +5984,7 @@ retry: SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_strmoq)); SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_asconf)); SCTP_ZONE_DESTROY(SCTP_BASE_INFO(ipi_zone_asconf_ack)); -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) SCTP_FREE(SCTP_BASE_STATS, SCTP_M_MCORE); #endif } Modified: head/sys/netinet/sctp_pcb.h ============================================================================== --- head/sys/netinet/sctp_pcb.h Fri Jun 12 15:37:55 2020 (r362105) +++ head/sys/netinet/sctp_pcb.h Fri Jun 12 16:31:13 2020 (r362106) @@ -246,7 +246,7 @@ struct sctp_base_info { * All static structures that anchor the system must be here. */ struct sctp_epinfo sctppcbinfo; -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) struct sctpstat *sctpstat; #else struct sctpstat sctpstat; @@ -478,7 +478,6 @@ struct sctp_tcb { #include -/* TODO where to put non-_KERNEL things for __Userspace__? */ #if defined(_KERNEL) || defined(__Userspace__) /* Attention Julian, this is the extern that @@ -646,7 +645,7 @@ sctp_initiate_iterator(inp_func inpf, end_func ef, struct sctp_inpcb *, uint8_t co_off); -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) void sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use); Modified: head/sys/netinet/sctp_structs.h ============================================================================== --- head/sys/netinet/sctp_structs.h Fri Jun 12 15:37:55 2020 (r362105) +++ head/sys/netinet/sctp_structs.h Fri Jun 12 16:31:13 2020 (r362106) @@ -109,7 +109,7 @@ typedef void (*asoc_func) (struct sctp_inpcb *, struct typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val); typedef void (*end_func) (void *ptr, uint32_t val); -#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +#if defined(SCTP_MCORE_INPUT) && defined(SMP) /* whats on the mcore control struct */ struct sctp_mcore_queue { TAILQ_ENTRY(sctp_mcore_queue) next; @@ -129,10 +129,7 @@ struct sctp_mcore_ctrl { int running; int cpuid; }; - - #endif - struct sctp_iterator { TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr; Modified: head/sys/netinet/sctp_uio.h ============================================================================== --- head/sys/netinet/sctp_uio.h Fri Jun 12 15:37:55 2020 (r362105) +++ head/sys/netinet/sctp_uio.h Fri Jun 12 16:31:13 2020 (r362106) @@ -1128,7 +1128,7 @@ struct sctpstat { #define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1) #define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1) -#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT) +#if defined(SMP) && defined(SCTP_USE_PERCPU_STAT) #define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d) #define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d) #else From owner-svn-src-head@freebsd.org Fri Jun 12 16:40:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2616933F32E; Fri, 12 Jun 2020 16:40:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k60C0BYpz3V9k; Fri, 12 Jun 2020 16:40:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01C67C56D; Fri, 12 Jun 2020 16:40:11 +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 05CGeA1B095149; Fri, 12 Jun 2020 16:40:10 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CGeAeV095148; Fri, 12 Jun 2020 16:40:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006121640.05CGeAeV095148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 12 Jun 2020 16:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362107 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 16:40:11 -0000 Author: tuexen Date: Fri Jun 12 16:40:10 2020 New Revision: 362107 URL: https://svnweb.freebsd.org/changeset/base/362107 Log: Whitespace change due to upstream cleanup. MFC after: 1 week Modified: head/sys/netinet/sctp_constants.h Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Fri Jun 12 16:31:13 2020 (r362106) +++ head/sys/netinet/sctp_constants.h Fri Jun 12 16:40:10 2020 (r362107) @@ -992,7 +992,7 @@ do { \ #define sctp_sowwakeup_locked(inp, so) \ do { \ if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \ - SOCKBUF_UNLOCK(&((so)->so_snd)); \ + SOCKBUF_UNLOCK(&((so)->so_snd)); \ inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \ } else { \ sowwakeup_locked(so); \ From owner-svn-src-head@freebsd.org Fri Jun 12 16:51:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 471A233FB4E; Fri, 12 Jun 2020 16:51:56 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k6Fm15pFz3WFq; Fri, 12 Jun 2020 16:51:56 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21019CCA9; Fri, 12 Jun 2020 16:51:56 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CGpukY003645; Fri, 12 Jun 2020 16:51:56 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CGpthl003644; Fri, 12 Jun 2020 16:51:55 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <202006121651.05CGpthl003644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Fri, 12 Jun 2020 16:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362108 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 362108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 16:51:56 -0000 Author: dougm Date: Fri Jun 12 16:51:55 2020 New Revision: 362108 URL: https://svnweb.freebsd.org/changeset/base/362108 Log: The linuxkpi code accesses left/right rb tree pointers without using RB_LEFT or RB_RIGHT, so they aren't stripping off the color bit encoded there. Strip off that bit for linuxkpi. Reported by: dch Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25245 Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Jun 12 16:40:10 2020 (r362107) +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Jun 12 16:51:55 2020 (r362108) @@ -37,8 +37,8 @@ struct rb_node { RB_ENTRY(rb_node) __entry; }; -#define rb_left __entry.rbe_left -#define rb_right __entry.rbe_right +#define rb_left RB_PTR(__entry.rbe_left) +#define rb_right RB_PTR(__entry.rbe_right) /* * We provide a false structure that has the same bit pattern as tree.h From owner-svn-src-head@freebsd.org Fri Jun 12 17:31:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3D54340714; Fri, 12 Jun 2020 17:31:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k77b5CCMz3YHZ; Fri, 12 Jun 2020 17:31:39 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADE94D1E0; Fri, 12 Jun 2020 17:31:39 +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 05CHVddc029746; Fri, 12 Jun 2020 17:31:39 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CHVcKO029742; Fri, 12 Jun 2020 17:31:38 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006121731.05CHVcKO029742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 12 Jun 2020 17:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362109 - in head/sys: arm64/coresight conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/coresight conf X-SVN-Commit-Revision: 362109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 17:31:39 -0000 Author: br Date: Fri Jun 12 17:31:38 2020 New Revision: 362109 URL: https://svnweb.freebsd.org/changeset/base/362109 Log: Coresight replicator: o Add a header file; o Split-out FDT attachment to a separate file; o Add ACPI attachment. Sponsored by: DARPA, AFRL Added: head/sys/arm64/coresight/coresight_replicator.h (contents, props changed) head/sys/arm64/coresight/coresight_replicator_acpi.c (contents, props changed) head/sys/arm64/coresight/coresight_replicator_fdt.c (contents, props changed) Modified: head/sys/arm64/coresight/coresight_replicator.c head/sys/conf/files.arm64 Modified: head/sys/arm64/coresight/coresight_replicator.c ============================================================================== --- head/sys/arm64/coresight/coresight_replicator.c Fri Jun 12 16:51:55 2020 (r362108) +++ head/sys/arm64/coresight/coresight_replicator.c Fri Jun 12 17:31:38 2020 (r362109) @@ -41,25 +41,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include -#include -#include - #include "coresight_if.h" -#define REPLICATOR_IDFILTER0 0x00 -#define REPLICATOR_IDFILTER1 0x04 - -static struct ofw_compat_data compat_data[] = { - { "arm,coresight-dynamic-replicator", 1 }, - { NULL, 0 } -}; - -struct replicator_softc { - struct resource *res; - struct coresight_platform_data *pdata; -}; - static struct resource_spec replicator_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { -1, 0 } @@ -111,21 +96,6 @@ replicator_disable(device_t dev, struct endpoint *endp } static int -replicator_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) - return (ENXIO); - - device_set_desc(dev, "Coresight Dynamic Replicator"); - - return (BUS_PROBE_DEFAULT); -} - -static int replicator_attach(device_t dev) { struct replicator_softc *sc; @@ -149,7 +119,6 @@ replicator_attach(device_t dev) static device_method_t replicator_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, replicator_probe), DEVMETHOD(device_attach, replicator_attach), /* Coresight interface */ @@ -159,14 +128,5 @@ static device_method_t replicator_methods[] = { DEVMETHOD_END }; -static driver_t replicator_driver = { - "replicator", - replicator_methods, - sizeof(struct replicator_softc), -}; - -static devclass_t replicator_devclass; - -DRIVER_MODULE(replicator, simplebus, replicator_driver, replicator_devclass, - 0, 0); -MODULE_VERSION(replicator, 1); +DEFINE_CLASS_0(replicator, replicator_driver, replicator_methods, + sizeof(struct replicator_softc)); Added: head/sys/arm64/coresight/coresight_replicator.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_replicator.h Fri Jun 12 17:31:38 2020 (r362109) @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2020 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ARM64_CORESIGHT_CORESIGHT_REPLICATOR_H_ +#define _ARM64_CORESIGHT_CORESIGHT_REPLICATOR_H_ + +#define REPLICATOR_IDFILTER0 0x00 +#define REPLICATOR_IDFILTER1 0x04 + +DECLARE_CLASS(replicator_driver); + +struct replicator_softc { + struct resource *res; + struct coresight_platform_data *pdata; +}; + +#endif /* !_ARM64_CORESIGHT_CORESIGHT_REPLICATOR_H_ */ Added: head/sys/arm64/coresight/coresight_replicator_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_replicator_acpi.c Fri Jun 12 17:31:38 2020 (r362109) @@ -0,0 +1,81 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Ruslan Bukin + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_acpi.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +static int +replicator_acpi_probe(device_t dev) +{ + static char *replicator_ids[] = { "ARMHC98D", NULL }; + int error; + + error = ACPI_ID_PROBE(device_get_parent(dev), dev, + replicator_ids, NULL); + if (error <= 0) + device_set_desc(dev, "ARM Coresight Replicator"); + + return (error); +} + +static device_method_t replicator_acpi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, replicator_acpi_probe), + + /* End */ + DEVMETHOD_END +}; + +DEFINE_CLASS_1(replicator, replicator_acpi_driver, replicator_acpi_methods, + sizeof(struct replicator_softc), replicator_driver); + +static devclass_t replicator_acpi_devclass; + +EARLY_DRIVER_MODULE(replicator, acpi, replicator_acpi_driver, + replicator_acpi_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Added: head/sys/arm64/coresight/coresight_replicator_fdt.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/coresight/coresight_replicator_fdt.c Fri Jun 12 17:31:38 2020 (r362109) @@ -0,0 +1,83 @@ +/*- + * Copyright (c) 2018-2020 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 "coresight_if.h" + +static struct ofw_compat_data compat_data[] = { + { "arm,coresight-dynamic-replicator", 1 }, + { NULL, 0 } +}; + +static int +replicator_fdt_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "ARM Coresight Replicator"); + + return (BUS_PROBE_DEFAULT); +} + +static device_method_t replicator_fdt_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, replicator_fdt_probe), + DEVMETHOD_END +}; + +DEFINE_CLASS_1(replicator, replicator_fdt_driver, replicator_fdt_methods, + sizeof(struct replicator_softc), replicator_driver); + +static devclass_t replicator_fdt_devclass; + +EARLY_DRIVER_MODULE(replicator, simplebus, replicator_fdt_driver, + replicator_fdt_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Jun 12 16:51:55 2020 (r362108) +++ head/sys/conf/files.arm64 Fri Jun 12 17:31:38 2020 (r362109) @@ -189,13 +189,15 @@ arm64/coresight/coresight.c standard arm64/coresight/coresight_if.m standard arm64/coresight/coresight_cmd.c standard arm64/coresight/coresight_cpu_debug.c standard -arm64/coresight/coresight_replicator.c standard arm64/coresight/coresight_etm4x.c standard arm64/coresight/coresight_etm4x_acpi.c optional acpi arm64/coresight/coresight_etm4x_fdt.c optional fdt arm64/coresight/coresight_funnel.c standard arm64/coresight/coresight_funnel_acpi.c optional acpi arm64/coresight/coresight_funnel_fdt.c optional fdt +arm64/coresight/coresight_replicator.c standard +arm64/coresight/coresight_replicator_acpi.c optional acpi +arm64/coresight/coresight_replicator_fdt.c optional fdt arm64/coresight/coresight_tmc.c standard arm64/coresight/coresight_tmc_acpi.c optional acpi arm64/coresight/coresight_tmc_fdt.c optional fdt From owner-svn-src-head@freebsd.org Fri Jun 12 17:48:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE98D340ABD; Fri, 12 Jun 2020 17:48:12 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k7Vh5BfQz3Z4T; Fri, 12 Jun 2020 17:48:12 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD8E7D57B; Fri, 12 Jun 2020 17:48:12 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CHmCnR037946; Fri, 12 Jun 2020 17:48:12 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CHmCAU037945; Fri, 12 Jun 2020 17:48:12 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <202006121748.05CHmCAU037945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Fri, 12 Jun 2020 17:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362110 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 362110 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 17:48:12 -0000 Author: dougm Date: Fri Jun 12 17:48:12 2020 New Revision: 362110 URL: https://svnweb.freebsd.org/changeset/base/362110 Log: Revert r362108, as it breaks compilation. Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Jun 12 17:31:38 2020 (r362109) +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Jun 12 17:48:12 2020 (r362110) @@ -37,8 +37,8 @@ struct rb_node { RB_ENTRY(rb_node) __entry; }; -#define rb_left RB_PTR(__entry.rbe_left) -#define rb_right RB_PTR(__entry.rbe_right) +#define rb_left __entry.rbe_left +#define rb_right __entry.rbe_right /* * We provide a false structure that has the same bit pattern as tree.h From owner-svn-src-head@freebsd.org Fri Jun 12 17:51:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C541B340F09; Fri, 12 Jun 2020 17:51:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49k7Zg4mWyz3ZBj; Fri, 12 Jun 2020 17:51:39 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id E9665260410; Fri, 12 Jun 2020 19:51:37 +0200 (CEST) Subject: Re: svn commit: r362110 - head/sys/compat/linuxkpi/common/include/linux To: Doug Moore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006121748.05CHmCAU037945@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <204b885c-bf12-d140-987b-d1c684ec2049@selasky.org> Date: Fri, 12 Jun 2020 19:51:18 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <202006121748.05CHmCAU037945@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49k7Zg4mWyz3ZBj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 17:51:39 -0000 On 2020-06-12 19:48, Doug Moore wrote: > Author: dougm > Date: Fri Jun 12 17:48:12 2020 > New Revision: 362110 > URL: https://svnweb.freebsd.org/changeset/base/362110 > > Log: > Revert r362108, as it breaks compilation. > > Modified: > head/sys/compat/linuxkpi/common/include/linux/rbtree.h > > Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Jun 12 17:31:38 2020 (r362109) > +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Jun 12 17:48:12 2020 (r362110) > @@ -37,8 +37,8 @@ > struct rb_node { > RB_ENTRY(rb_node) __entry; > }; > -#define rb_left RB_PTR(__entry.rbe_left) > -#define rb_right RB_PTR(__entry.rbe_right) > +#define rb_left __entry.rbe_left > +#define rb_right __entry.rbe_right > > /* > * We provide a false structure that has the same bit pattern as tree.h > Are you planning to fix those compilation errors? --HPS From owner-svn-src-head@freebsd.org Fri Jun 12 17:54:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8A40340FB6; Fri, 12 Jun 2020 17:54:15 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49k7dg0zvJz3Zfb; Fri, 12 Jun 2020 17:54:14 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 821C6260410; Fri, 12 Jun 2020 19:54:13 +0200 (CEST) Subject: Re: svn commit: r362110 - head/sys/compat/linuxkpi/common/include/linux From: Hans Petter Selasky To: Doug Moore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006121748.05CHmCAU037945@repo.freebsd.org> <204b885c-bf12-d140-987b-d1c684ec2049@selasky.org> Message-ID: <05f111e5-5702-9d2d-5f4c-2b00ade844a8@selasky.org> Date: Fri, 12 Jun 2020 19:53:53 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <204b885c-bf12-d140-987b-d1c684ec2049@selasky.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 49k7dg0zvJz3Zfb X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-2.33 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-0.97)[-0.966]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.96)[-0.960]; NEURAL_HAM_SHORT(-0.10)[-0.101]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 17:54:15 -0000 On 2020-06-12 19:51, Hans Petter Selasky wrote: > On 2020-06-12 19:48, Doug Moore wrote: >> Author: dougm >> Date: Fri Jun 12 17:48:12 2020 >> New Revision: 362110 >> URL: https://svnweb.freebsd.org/changeset/base/362110 >> >> Log: >>    Revert r362108, as it breaks compilation. >> >> Modified: >>    head/sys/compat/linuxkpi/common/include/linux/rbtree.h >> >> Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h >> ============================================================================== >> >> --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h    Fri Jun >> 12 17:31:38 2020    (r362109) >> +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h    Fri Jun >> 12 17:48:12 2020    (r362110) >> @@ -37,8 +37,8 @@ >>   struct rb_node { >>       RB_ENTRY(rb_node)    __entry; >>   }; >> -#define    rb_left        RB_PTR(__entry.rbe_left) >> -#define    rb_right    RB_PTR(__entry.rbe_right) >> +#define    rb_left        __entry.rbe_left >> +#define    rb_right    __entry.rbe_right >>   /* >>    * We provide a false structure that has the same bit pattern as tree.h >> > > Are you planning to fix those compilation errors? > Or is the current code fine? --HPS From owner-svn-src-head@freebsd.org Fri Jun 12 17:59:08 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 434BA3411B9; Fri, 12 Jun 2020 17:59:08 +0000 (UTC) (envelope-from unkadoug@gmail.com) Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k7lH46RCz3Zgv; Fri, 12 Jun 2020 17:59:07 +0000 (UTC) (envelope-from unkadoug@gmail.com) Received: by mail-oi1-x242.google.com with SMTP id a3so9486808oid.4; Fri, 12 Jun 2020 10:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=xuundVn0LmhVYos0FsiMGR3GpqyktcMGOoky1nC2sh0=; b=KU5gaZIrWG8/UFF62Du/H2Cn9h5Qo1fogGnCn/Z14q60wmKXPlTLcFMNjpnMJQ2Gq5 cWoWk6MB08pyCtsn++EyWvnqFUE4qj+o/A/MHk+8WIvV/Nqux9NENJz+a3/lb5uaGvhI AiOZPRZ12/CcIkKZcqcAqXaqPiVKvdzbfnQ/AyBRRsLlr8tIX9PZvvltWyEvEYrLys3e dtNoht+v9lE5SO4kulr0RtyGuChJxr7pyoNYID/b0djTwG0M4frbAkZ0ADggwRobloMh 5lHe04EgclAlzaBNXcuO6k1dUJHPEDwi9n6qiUs2TEpD1FOQR/rG+hm7P0LdI974URFU /vVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=xuundVn0LmhVYos0FsiMGR3GpqyktcMGOoky1nC2sh0=; b=eF7nSFX5bWcQAyggZK5EDiUWVpUWKKNrN926omG15LRUzOQGZGvTXJ0dG0llKT2vZf FtTK9YnQPl0i9dXSkrOqsrF3tLfIC6OBIkprrCOIgzOlb7hq5/R47X0OYnveAASaoa1P H/zISN7KGLPk5aDBdDnPymk8cwAJO1mt9ofHejV2dZIIk3/1/CLUr7L0qlkXsIDuVNPk tbCqNz8sg5y9l6cbN24Y86Qp/iomDi0g1I8nTuIk7R8ilaNBjkpCWVUyFh4g8uaif1yn I3sTZaI4MwMrFTWELcV8mgWHzQVzC+IVHh47S/lzlUfpmb5Z0L00T05AUuKs006Ls/Ip wy7g== X-Gm-Message-State: AOAM531MSea8Q0WwOAPHjji1zokT5yjx1ncXx0Q9cWErtv+/4/OxU43Z fkdSf9MIgBuzN8JasdhiLZsGPl9d2I6jMw== X-Google-Smtp-Source: ABdhPJxo5X8y8nuZfoJCrAhbuAJuZBcxAjC+Oga1I07q+bmhNJA5K+3vjsvrZ39czBTQn5/Uha+idw== X-Received: by 2002:aca:cc84:: with SMTP id c126mr103689oig.128.1591984745999; Fri, 12 Jun 2020 10:59:05 -0700 (PDT) Received: from 108-254-203-202.lightspeed.hstntx.sbcglobal.net (108-254-203-202.lightspeed.hstntx.sbcglobal.net. [108.254.203.202]) by smtp.gmail.com with ESMTPSA id p206sm1508402oib.16.2020.06.12.10.59.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jun 2020 10:59:05 -0700 (PDT) From: Doug Moore X-Google-Original-From: Doug Moore Subject: Re: svn commit: r362110 - head/sys/compat/linuxkpi/common/include/linux To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006121748.05CHmCAU037945@repo.freebsd.org> <204b885c-bf12-d140-987b-d1c684ec2049@selasky.org> <05f111e5-5702-9d2d-5f4c-2b00ade844a8@selasky.org> Message-ID: Date: Fri, 12 Jun 2020 12:59:02 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <05f111e5-5702-9d2d-5f4c-2b00ade844a8@selasky.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 49k7lH46RCz3Zgv X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=KU5gaZIr; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of unkadoug@gmail.com designates 2607:f8b0:4864:20::242 as permitted sender) smtp.mailfrom=unkadoug@gmail.com X-Spamd-Result: default: False [-3.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.01)[-1.005]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.01)[-1.014]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::242:from]; NEURAL_HAM_SHORT(-0.58)[-0.585]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 17:59:08 -0000 As far as I know, by undoing the change that introduced the compilation error, I have fixed the compilation error.  If you mean to ask whether I intend to fix the underlying linuxkpi error, which motivated the earlier unfortunate change, then yes, I do.  I intend to make things better as soon as I can.  Thanks for your inquiry. Doug Moore On 2020-06-12 12:53, Hans Petter Selasky wrote: > On 2020-06-12 19:51, Hans Petter Selasky wrote: >> On 2020-06-12 19:48, Doug Moore wrote: >>> Author: dougm >>> Date: Fri Jun 12 17:48:12 2020 >>> New Revision: 362110 >>> URL: https://svnweb.freebsd.org/changeset/base/362110 >>> >>> Log: >>>    Revert r362108, as it breaks compilation. >>> >>> Modified: >>>    head/sys/compat/linuxkpi/common/include/linux/rbtree.h >>> >>> Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h >>> ============================================================================== >>> >>> --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h    Fri >>> Jun 12 17:31:38 2020    (r362109) >>> +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h    Fri >>> Jun 12 17:48:12 2020    (r362110) >>> @@ -37,8 +37,8 @@ >>>   struct rb_node { >>>       RB_ENTRY(rb_node)    __entry; >>>   }; >>> -#define    rb_left        RB_PTR(__entry.rbe_left) >>> -#define    rb_right    RB_PTR(__entry.rbe_right) >>> +#define    rb_left        __entry.rbe_left >>> +#define    rb_right    __entry.rbe_right >>>   /* >>>    * We provide a false structure that has the same bit pattern as >>> tree.h >>> >> >> Are you planning to fix those compilation errors? >> > > Or is the current code fine? > > --HPS > From owner-svn-src-head@freebsd.org Fri Jun 12 18:13:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8BE2341A9F; Fri, 12 Jun 2020 18:13:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k83w4Tl0z3bqM; Fri, 12 Jun 2020 18:13:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 950F6D8E5; Fri, 12 Jun 2020 18:13:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CIDWQe056166; Fri, 12 Jun 2020 18:13:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CIDWFX056165; Fri, 12 Jun 2020 18:13:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006121813.05CIDWFX056165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 12 Jun 2020 18:13:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362111 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 362111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 18:13:32 -0000 Author: kevans Date: Fri Jun 12 18:13:32 2020 New Revision: 362111 URL: https://svnweb.freebsd.org/changeset/base/362111 Log: posix_spawn: fix for some custom allocator setups libc cannot assume that aligned_alloc and free come from jemalloc, or that any application providing its own malloc and free is actually providing aligned_alloc. Switch back to malloc and just make sure we're passing a properly aligned stack into rfork_thread, as an application perhaps can't reasonably replace just malloc or just free without headaches. This unbreaks ksh93 after r361996, which provides malloc/free but no aligned_alloc. Reported by: freqlabs Diagnosed by: Andrew Gierth X-MFC-With: r361996 Modified: head/lib/libc/gen/posix_spawn.c Modified: head/lib/libc/gen/posix_spawn.c ============================================================================== --- head/lib/libc/gen/posix_spawn.c Fri Jun 12 17:48:12 2020 (r362110) +++ head/lib/libc/gen/posix_spawn.c Fri Jun 12 18:13:32 2020 (r362111) @@ -276,9 +276,19 @@ do_posix_spawn(pid_t *pid, const char *path, stacksz += MAX(3, cnt + 2) * sizeof(char *); stacksz = PSPAWN_STACK_ALIGN(stacksz); } - stack = aligned_alloc(PSPAWN_STACK_ALIGNMENT, stacksz); + + /* + * aligned_alloc is not safe to use here, because we can't guarantee + * that aligned_alloc and free will be provided by the same + * implementation. We've actively hit at least one application that + * will provide its own malloc/free but not aligned_alloc leading to + * a free by the wrong allocator. + */ + stack = malloc(stacksz); if (stack == NULL) return (ENOMEM); + stacksz = (((uintptr_t)stack + stacksz) & ~PSPAWN_STACK_ALIGNBYTES) - + (uintptr_t)stack; #endif psa.path = path; psa.fa = fa; From owner-svn-src-head@freebsd.org Fri Jun 12 18:41:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D069341DC3; Fri, 12 Jun 2020 18:41:13 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49k8gs2dr8z3cdd; Fri, 12 Jun 2020 18:41:13 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55FE7DEC1; Fri, 12 Jun 2020 18:41:13 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CIfDxE069348; Fri, 12 Jun 2020 18:41:13 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CIfDNv069347; Fri, 12 Jun 2020 18:41:13 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <202006121841.05CIfDNv069347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Fri, 12 Jun 2020 18:41:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362112 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 362112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 18:41:13 -0000 Author: gallatin Date: Fri Jun 12 18:41:12 2020 New Revision: 362112 URL: https://svnweb.freebsd.org/changeset/base/362112 Log: x86: Bump default msi/msix vector limit to 2048 Given that 64c/128t CPUs are currently available, and that many devices (nvme, many NICs) desire to map 1 MSI-X vector per core, or even 1 per-thread, it is becoming far easier to see MSI-X interrupt setup fail due to msi vector exhaustion, and devices fail to attach at boot on large system. This bump costs 12KB on amd64 (and 6KB on i386), which seems worth the trade off for a better out of the box experience on high end hardware. Reviewed by: jhb MFC after: 21 days Sponsored by: Netflix Modified: head/sys/x86/x86/msi.c Modified: head/sys/x86/x86/msi.c ============================================================================== --- head/sys/x86/x86/msi.c Fri Jun 12 18:13:32 2020 (r362111) +++ head/sys/x86/x86/msi.c Fri Jun 12 18:41:12 2020 (r362112) @@ -156,7 +156,7 @@ u_int first_msi_irq; SYSCTL_UINT(_machdep, OID_AUTO, first_msi_irq, CTLFLAG_RD, &first_msi_irq, 0, "Number of first IRQ reserved for MSI and MSI-X interrupts"); -u_int num_msi_irqs = 512; +u_int num_msi_irqs = 2048; SYSCTL_UINT(_machdep, OID_AUTO, num_msi_irqs, CTLFLAG_RDTUN, &num_msi_irqs, 0, "Number of IRQs reserved for MSI and MSI-X interrupts"); From owner-svn-src-head@freebsd.org Fri Jun 12 19:56:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 310FD343C4F; Fri, 12 Jun 2020 19:56:20 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kBLX0Y11z3yx5; Fri, 12 Jun 2020 19:56:20 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E10BF054; Fri, 12 Jun 2020 19:56:20 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CJuJje017611; Fri, 12 Jun 2020 19:56:19 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CJuJL2017608; Fri, 12 Jun 2020 19:56:19 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <202006121956.05CJuJL2017608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Fri, 12 Jun 2020 19:56:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362113 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 362113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 19:56:20 -0000 Author: rrs Date: Fri Jun 12 19:56:19 2020 New Revision: 362113 URL: https://svnweb.freebsd.org/changeset/base/362113 Log: So it turns out with the right window scaling you can get the code in all stacks to always want to do a window update, even when no data can be sent. Now in cases where you are not pacing thats probably ok, you just send an extra window update or two. However with bbr (and rack if its paced) every time the pacer goes off its going to send a "window update". Also in testing bbr I have found that if we are not responding to data right away we end up staying in startup but incorrectly holding a pacing gain of 192 (a loss). This is because the idle window code does not restict itself to only work with PROBE_BW. In all other states you dont want it doing a PROBE_BW state change. Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D25247 Modified: head/sys/netinet/tcp_output.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Fri Jun 12 18:41:12 2020 (r362112) +++ head/sys/netinet/tcp_output.c Fri Jun 12 19:56:19 2020 (r362113) @@ -655,7 +655,10 @@ after_sack_rexmit: adv = recwin; if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt)) { oldwin = (tp->rcv_adv - tp->rcv_nxt); - adv -= oldwin; + if (adv > oldwin) + adv -= oldwin; + else + adv = 0; } else oldwin = 0; Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Fri Jun 12 18:41:12 2020 (r362112) +++ head/sys/netinet/tcp_stacks/bbr.c Fri Jun 12 19:56:19 2020 (r362113) @@ -8078,7 +8078,7 @@ bbr_restart_after_idle(struct tcp_bbr *bbr, uint32_t c bbr->r_ctl.rc_bbr_hptsi_gain = bbr->r_ctl.rc_startup_pg; bbr->r_ctl.rc_bbr_cwnd_gain = bbr->r_ctl.rc_startup_pg; bbr_log_type_statechange(bbr, cts, __LINE__); - } else { + } else if (bbr->rc_bbr_state == BBR_STATE_PROBE_BW) { bbr_substate_change(bbr, cts, __LINE__, 1); } } @@ -12000,21 +12000,27 @@ bbr_window_update_needed(struct tcpcb *tp, struct sock * "adv" is the amount we could increase the window, taking into * account that we are limited by TCP_MAXWIN << tp->rcv_scale. */ - uint32_t adv; + int32_t adv; int32_t oldwin; - adv = min(recwin, TCP_MAXWIN << tp->rcv_scale); + adv = recwin; if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt)) { oldwin = (tp->rcv_adv - tp->rcv_nxt); - adv -= oldwin; + if (adv > oldwin) + adv -= oldwin; + else { + /* We can't increase the window */ + adv = 0; + } } else oldwin = 0; /* - * If the new window size ends up being the same as the old size - * when it is scaled, then don't force a window update. + * If the new window size ends up being the same as or less + * than the old size when it is scaled, then don't force + * a window update. */ - if (oldwin >> tp->rcv_scale == (adv + oldwin) >> tp->rcv_scale) + if (oldwin >> tp->rcv_scale >= (adv + oldwin) >> tp->rcv_scale) return (0); if (adv >= (2 * maxseg) && Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Fri Jun 12 18:41:12 2020 (r362112) +++ head/sys/netinet/tcp_stacks/rack.c Fri Jun 12 19:56:19 2020 (r362113) @@ -12845,18 +12845,24 @@ again: int32_t adv; int oldwin; - adv = min(recwin, (long)TCP_MAXWIN << tp->rcv_scale); + adv = recwin; if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt)) { oldwin = (tp->rcv_adv - tp->rcv_nxt); - adv -= oldwin; + if (adv > oldwin) + adv -= oldwin; + else { + /* We can't increase the window */ + adv = 0; + } } else oldwin = 0; /* - * If the new window size ends up being the same as the old - * size when it is scaled, then don't force a window update. + * If the new window size ends up being the same as or less + * than the old size when it is scaled, then don't force + * a window update. */ - if (oldwin >> tp->rcv_scale == (adv + oldwin) >> tp->rcv_scale) + if (oldwin >> tp->rcv_scale >= (adv + oldwin) >> tp->rcv_scale) goto dontupdate; if (adv >= (int32_t)(2 * segsiz) && From owner-svn-src-head@freebsd.org Fri Jun 12 21:10:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E455346067; Fri, 12 Jun 2020 21:10:46 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kD0Q1vnpz44dd; Fri, 12 Jun 2020 21:10:46 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CEB0FAF0; Fri, 12 Jun 2020 21:10:46 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLAkxY063611; Fri, 12 Jun 2020 21:10:46 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLAjlQ063609; Fri, 12 Jun 2020 21:10:45 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <202006122110.05CLAjlQ063609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 12 Jun 2020 21:10:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362119 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 362119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:10:46 -0000 Author: vangyzen Date: Fri Jun 12 21:10:45 2020 New Revision: 362119 URL: https://svnweb.freebsd.org/changeset/base/362119 Log: FPU init: Do potentially blocking operations before disabling interrupts In particular, uma_zcreate creates sysctl oids, which locks an sx lock, which uses IPIs under contention. IPIs tend not to work very well when interrupts are disabled. Who knew, right? Reviewed by: cem kib MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D25098 Modified: head/sys/amd64/amd64/fpu.c head/sys/i386/i386/npx.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Jun 12 20:39:42 2020 (r362118) +++ head/sys/amd64/amd64/fpu.c Fri Jun 12 21:10:45 2020 (r362119) @@ -368,8 +368,18 @@ fpuinitstate(void *arg __unused) register_t saveintr; int cp[4], i, max_ext_n; + /* Do potentially blocking operations before disabling interrupts. */ + fpu_save_area_zone = uma_zcreate("FPU_save_area", + cpu_max_ext_state_size, NULL, NULL, NULL, NULL, + XSAVE_AREA_ALIGN - 1, 0); fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, M_WAITOK | M_ZERO); + if (use_xsave) { + max_ext_n = flsl(xsave_mask); + xsave_area_desc = malloc(max_ext_n * sizeof(struct + xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); + } + saveintr = intr_disable(); stop_emulating(); @@ -399,9 +409,6 @@ fpuinitstate(void *arg __unused) offsetof(struct xstate_hdr, xstate_bv)); *xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; - max_ext_n = flsl(xsave_mask); - xsave_area_desc = malloc(max_ext_n * sizeof(struct - xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); /* x87 state */ xsave_area_desc[0].offset = 0; xsave_area_desc[0].size = 160; @@ -415,10 +422,6 @@ fpuinitstate(void *arg __unused) xsave_area_desc[i].size = cp[0]; } } - - fpu_save_area_zone = uma_zcreate("FPU_save_area", - cpu_max_ext_state_size, NULL, NULL, NULL, NULL, - XSAVE_AREA_ALIGN - 1, 0); start_emulating(); intr_restore(saveintr); Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Fri Jun 12 20:39:42 2020 (r362118) +++ head/sys/i386/i386/npx.c Fri Jun 12 21:10:45 2020 (r362119) @@ -479,8 +479,21 @@ npxinitstate(void *arg __unused) if (!hw_float) return; + /* Do potentially blocking operations before disabling interrupts. */ + fpu_save_area_zone = uma_zcreate("FPU_save_area", + cpu_max_ext_state_size, NULL, NULL, NULL, NULL, + XSAVE_AREA_ALIGN - 1, 0); npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, M_WAITOK | M_ZERO); + if (use_xsave) { + if (xsave_mask >> 32 != 0) + max_ext_n = fls(xsave_mask >> 32) + 32; + else + max_ext_n = fls(xsave_mask); + xsave_area_desc = malloc(max_ext_n * sizeof(struct + xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); + } + saveintr = intr_disable(); stop_emulating(); @@ -522,12 +535,6 @@ npxinitstate(void *arg __unused) offsetof(struct xstate_hdr, xstate_bv)); *xstate_bv = XFEATURE_ENABLED_X87 | XFEATURE_ENABLED_SSE; - if (xsave_mask >> 32 != 0) - max_ext_n = fls(xsave_mask >> 32) + 32; - else - max_ext_n = fls(xsave_mask); - xsave_area_desc = malloc(max_ext_n * sizeof(struct - xsave_area_elm_descr), M_DEVBUF, M_WAITOK | M_ZERO); /* x87 state */ xsave_area_desc[0].offset = 0; xsave_area_desc[0].size = 160; @@ -541,10 +548,6 @@ npxinitstate(void *arg __unused) xsave_area_desc[i].size = cp[0]; } } - - fpu_save_area_zone = uma_zcreate("FPU_save_area", - cpu_max_ext_state_size, NULL, NULL, NULL, NULL, - XSAVE_AREA_ALIGN - 1, 0); start_emulating(); intr_restore(saveintr); From owner-svn-src-head@freebsd.org Fri Jun 12 21:12:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 637C234641F; Fri, 12 Jun 2020 21:12:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kD2M22Ynz44jp; Fri, 12 Jun 2020 21:12:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 413C6FCB0; Fri, 12 Jun 2020 21:12:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLCR9L067005; Fri, 12 Jun 2020 21:12:27 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLCQXX067003; Fri, 12 Jun 2020 21:12:26 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <202006122112.05CLCQXX067003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 12 Jun 2020 21:12:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362120 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 362120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:12:27 -0000 Author: vangyzen Date: Fri Jun 12 21:12:26 2020 New Revision: 362120 URL: https://svnweb.freebsd.org/changeset/base/362120 Log: FPU: make xsave_area_desc static ...because it can be. Reviewed by: cem kib MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D25098 Modified: head/sys/amd64/amd64/fpu.c head/sys/i386/i386/npx.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Jun 12 21:10:45 2020 (r362119) +++ head/sys/amd64/amd64/fpu.c Fri Jun 12 21:12:26 2020 (r362120) @@ -159,7 +159,7 @@ uint64_t xsave_mask; /* the same */ static uma_zone_t fpu_save_area_zone; static struct savefpu *fpu_initialstate; -struct xsave_area_elm_descr { +static struct xsave_area_elm_descr { u_int offset; u_int size; } *xsave_area_desc; Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Fri Jun 12 21:10:45 2020 (r362119) +++ head/sys/i386/i386/npx.c Fri Jun 12 21:12:26 2020 (r362120) @@ -201,7 +201,7 @@ uint64_t xsave_mask; static uma_zone_t fpu_save_area_zone; static union savefpu *npx_initialstate; -struct xsave_area_elm_descr { +static struct xsave_area_elm_descr { u_int offset; u_int size; } *xsave_area_desc; From owner-svn-src-head@freebsd.org Fri Jun 12 21:17:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D05DE3467B0; Fri, 12 Jun 2020 21:17:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kD8h54LGz45CV; Fri, 12 Jun 2020 21:17:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A964510011; Fri, 12 Jun 2020 21:17:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLHu0L067298; Fri, 12 Jun 2020 21:17:56 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLHudg067296; Fri, 12 Jun 2020 21:17:56 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <202006122117.05CLHudg067296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 12 Jun 2020 21:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362121 - in head/sys: amd64/amd64 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 362121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:17:56 -0000 Author: vangyzen Date: Fri Jun 12 21:17:56 2020 New Revision: 362121 URL: https://svnweb.freebsd.org/changeset/base/362121 Log: FPU init: allocate initial state from UMA to ensure alignment The Intel Instruction Set Reference says this about the XSAVE instruction: Use of a destination operand not aligned to 64-byte boundary (in either 64-bit or 32-bit modes) results in a general-protection (#GP) exception. This alignment happens naturally when all malloc buckets are powers of two. However, this change is necessary on some systems when certain non-power-of-two (and non-multiple of 64) malloc buckets are defined. Reviewed by: cem; kib; earlier version by jhb MFC after: 2 weeks Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D25098 Modified: head/sys/amd64/amd64/fpu.c head/sys/i386/i386/npx.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Jun 12 21:12:26 2020 (r362120) +++ head/sys/amd64/amd64/fpu.c Fri Jun 12 21:17:56 2020 (r362121) @@ -372,8 +372,7 @@ fpuinitstate(void *arg __unused) fpu_save_area_zone = uma_zcreate("FPU_save_area", cpu_max_ext_state_size, NULL, NULL, NULL, NULL, XSAVE_AREA_ALIGN - 1, 0); - fpu_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, - M_WAITOK | M_ZERO); + fpu_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO); if (use_xsave) { max_ext_n = flsl(xsave_mask); xsave_area_desc = malloc(max_ext_n * sizeof(struct Modified: head/sys/i386/i386/npx.c ============================================================================== --- head/sys/i386/i386/npx.c Fri Jun 12 21:12:26 2020 (r362120) +++ head/sys/i386/i386/npx.c Fri Jun 12 21:17:56 2020 (r362121) @@ -483,8 +483,7 @@ npxinitstate(void *arg __unused) fpu_save_area_zone = uma_zcreate("FPU_save_area", cpu_max_ext_state_size, NULL, NULL, NULL, NULL, XSAVE_AREA_ALIGN - 1, 0); - npx_initialstate = malloc(cpu_max_ext_state_size, M_DEVBUF, - M_WAITOK | M_ZERO); + npx_initialstate = uma_zalloc(fpu_save_area_zone, M_WAITOK | M_ZERO); if (use_xsave) { if (xsave_mask >> 32 != 0) max_ext_n = fls(xsave_mask >> 32) + 32; From owner-svn-src-head@freebsd.org Fri Jun 12 21:21:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 209E13468A9; Fri, 12 Jun 2020 21:21:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kDDb6zfyz45SF; Fri, 12 Jun 2020 21:21:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB245FE2A; Fri, 12 Jun 2020 21:21:19 +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 05CLLJ2o068300; Fri, 12 Jun 2020 21:21:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLLIP2068291; Fri, 12 Jun 2020 21:21:18 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006122121.05CLLIP2068291@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jun 2020 21:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362122 - in head/sys/mips: include mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/mips: include mips X-SVN-Commit-Revision: 362122 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:21:20 -0000 Author: jhb Date: Fri Jun 12 21:21:18 2020 New Revision: 362122 URL: https://svnweb.freebsd.org/changeset/base/362122 Log: Various fixes to TLS for MIPS. - Clear the current thread's TLS pointer on exec. Previously the TLS pointer (and register) remain unchanged. - Explicitly clear the TLS pointer when new threads are created. - Make md_tls_tcb_offset per-process instead of per-thread. The layout of the TLS and TCB are identical for all threads in a process, it is only the TLS pointer values themselves that vary by thread. This also makes setting md_tls_tcb_offset in cpu_set_user_tls() redundant with the setting in exec_setregs(), so only set it in exec_setregs(). Submitted by: Alfredo Mazzinghi (1) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24957 Modified: head/sys/mips/include/proc.h head/sys/mips/mips/genassym.c head/sys/mips/mips/pm_machdep.c head/sys/mips/mips/swtch.S head/sys/mips/mips/sys_machdep.c head/sys/mips/mips/trap.c head/sys/mips/mips/vm_machdep.c Modified: head/sys/mips/include/proc.h ============================================================================== --- head/sys/mips/include/proc.h Fri Jun 12 21:17:56 2020 (r362121) +++ head/sys/mips/include/proc.h Fri Jun 12 21:21:18 2020 (r362122) @@ -64,7 +64,6 @@ struct mdthread { int md_pc_count; /* performance counter */ int md_pc_spill; /* performance counter spill */ void *md_tls; - size_t md_tls_tcb_offset; /* TCB offset */ #ifdef CPU_CNMIPS struct octeon_cop2_state *md_cop2; /* kernel context */ struct octeon_cop2_state *md_ucop2; /* userland context */ @@ -79,8 +78,7 @@ struct mdthread { #define MDTD_COP2USED 0x0002 /* Process used the COP2 */ struct mdproc { - /* Avoid empty structs because they are undefined behavior. */ - long md_spare; + size_t md_tls_tcb_offset; /* TCB offset */ }; struct syscall_args { Modified: head/sys/mips/mips/genassym.c ============================================================================== --- head/sys/mips/mips/genassym.c Fri Jun 12 21:17:56 2020 (r362121) +++ head/sys/mips/mips/genassym.c Fri Jun 12 21:21:18 2020 (r362122) @@ -70,13 +70,15 @@ __FBSDID("$FreeBSD$"); #endif ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); +ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_UPTE, offsetof(struct thread, td_md.md_upte)); ASSYM(TD_KSTACK, offsetof(struct thread, td_kstack)); ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); ASSYM(TD_MDFLAGS, offsetof(struct thread, td_md.md_flags)); ASSYM(TD_MDTLS, offsetof(struct thread, td_md.md_tls)); -ASSYM(TD_MDTLS_TCB_OFFSET, offsetof(struct thread, td_md.md_tls_tcb_offset)); + +ASSYM(P_MDTLS_TCB_OFFSET, offsetof(struct proc, p_md.md_tls_tcb_offset)); ASSYM(U_PCB_REGS, offsetof(struct pcb, pcb_regs.zero)); ASSYM(U_PCB_CONTEXT, offsetof(struct pcb, pcb_context)); Modified: head/sys/mips/mips/pm_machdep.c ============================================================================== --- head/sys/mips/mips/pm_machdep.c Fri Jun 12 21:17:56 2020 (r362121) +++ head/sys/mips/mips/pm_machdep.c Fri Jun 12 21:21:18 2020 (r362122) @@ -473,12 +473,15 @@ exec_setregs(struct thread *td, struct image_params *i PCPU_SET(fpcurthread, (struct thread *)0); td->td_md.md_ss_addr = 0; + td->td_md.md_tls = NULL; #ifdef COMPAT_FREEBSD32 if (!SV_PROC_FLAG(td->td_proc, SV_LP64)) - td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE32; + td->td_proc->p_md.md_tls_tcb_offset = TLS_TP_OFFSET + + TLS_TCB_SIZE32; else #endif - td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE; + td->td_proc->p_md.md_tls_tcb_offset = TLS_TP_OFFSET + + TLS_TCB_SIZE; } int Modified: head/sys/mips/mips/swtch.S ============================================================================== --- head/sys/mips/mips/swtch.S Fri Jun 12 21:17:56 2020 (r362121) +++ head/sys/mips/mips/swtch.S Fri Jun 12 21:21:18 2020 (r362122) @@ -386,7 +386,8 @@ sw2: .globl cpu_switch_set_userlocal cpu_switch_set_userlocal: PTR_L t0, TD_MDTLS(a1) # Get TLS pointer - PTR_L t1, TD_MDTLS_TCB_OFFSET(a1) # Get TLS/TCB offset + PTR_L t1, TD_PROC(a1) + PTR_L t1, P_MDTLS_TCB_OFFSET(t1) # Get TLS/TCB offset PTR_ADDU v0, t0, t1 MTC0 v0, MIPS_COP_0_USERLOCAL, 2 # write it to ULR for rdhwr Modified: head/sys/mips/mips/sys_machdep.c ============================================================================== --- head/sys/mips/mips/sys_machdep.c Fri Jun 12 21:17:56 2020 (r362121) +++ head/sys/mips/mips/sys_machdep.c Fri Jun 12 21:21:18 2020 (r362122) @@ -72,7 +72,7 @@ sysarch(struct thread *td, struct sysarch_args *uap) */ if (cpuinfo.userlocal_reg == true) { mips_wr_userlocal((unsigned long)(uap->parms + - td->td_md.md_tls_tcb_offset)); + td->td_proc->p_md.md_tls_tcb_offset)); } return (0); case MIPS_GET_TLS: Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Fri Jun 12 21:17:56 2020 (r362121) +++ head/sys/mips/mips/trap.c Fri Jun 12 21:21:18 2020 (r362122) @@ -902,7 +902,7 @@ dofault: if (inst.RType.rd == 29) { frame_regs = &(trapframe->zero); frame_regs[inst.RType.rt] = (register_t)(intptr_t)td->td_md.md_tls; - frame_regs[inst.RType.rt] += td->td_md.md_tls_tcb_offset; + frame_regs[inst.RType.rt] += td->td_proc->p_md.md_tls_tcb_offset; trapframe->pc += sizeof(int); goto out; } Modified: head/sys/mips/mips/vm_machdep.c ============================================================================== --- head/sys/mips/mips/vm_machdep.c Fri Jun 12 21:17:56 2020 (r362121) +++ head/sys/mips/mips/vm_machdep.c Fri Jun 12 21:21:18 2020 (r362122) @@ -141,7 +141,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t */ td2->td_md.md_tls = td1->td_md.md_tls; - td2->td_md.md_tls_tcb_offset = td1->td_md.md_tls_tcb_offset; + p2->p_md.md_tls_tcb_offset = td1->td_proc->p_md.md_tls_tcb_offset; td2->td_md.md_saved_intr = MIPS_SR_INT_IE; td2->td_md.md_spinlock_count = 1; #ifdef CPU_CNMIPS @@ -403,6 +403,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) (MIPS_SR_PX | MIPS_SR_UX | MIPS_SR_KX | MIPS_SR_SX) | (MIPS_SR_INT_IE | MIPS_HARD_INT_MASK)); #endif + td->td_md.md_tls = NULL; } /* @@ -473,16 +474,10 @@ int cpu_set_user_tls(struct thread *td, void *tls_base) { -#if defined(__mips_n64) && defined(COMPAT_FREEBSD32) - if (td->td_proc && SV_PROC_FLAG(td->td_proc, SV_ILP32)) - td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE32; - else -#endif - td->td_md.md_tls_tcb_offset = TLS_TP_OFFSET + TLS_TCB_SIZE; td->td_md.md_tls = (char*)tls_base; if (td == curthread && cpuinfo.userlocal_reg == true) { mips_wr_userlocal((unsigned long)tls_base + - td->td_md.md_tls_tcb_offset); + td->td_proc->p_md.md_tls_tcb_offset); } return (0); From owner-svn-src-head@freebsd.org Fri Jun 12 21:33:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C013347190; Fri, 12 Jun 2020 21:33:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kDV674r1z46j0; Fri, 12 Jun 2020 21:33:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE64810423; Fri, 12 Jun 2020 21:33:02 +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 05CLX2Vg079317; Fri, 12 Jun 2020 21:33:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLX2dF079316; Fri, 12 Jun 2020 21:33:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006122133.05CLX2dF079316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jun 2020 21:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362123 - head/sys/crypto/aesni X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/crypto/aesni X-SVN-Commit-Revision: 362123 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:33:03 -0000 Author: jhb Date: Fri Jun 12 21:33:02 2020 New Revision: 362123 URL: https://svnweb.freebsd.org/changeset/base/362123 Log: Fix AES-CCM requests with an AAD size smaller than a single block. The amount to copy for the first block is the minimum of the size of the AAD region or the remaining space in the first block. Reported by: cryptocheck -z MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D25140 Modified: head/sys/crypto/aesni/aesni_ccm.c Modified: head/sys/crypto/aesni/aesni_ccm.c ============================================================================== --- head/sys/crypto/aesni/aesni_ccm.c Fri Jun 12 21:21:18 2020 (r362122) +++ head/sys/crypto/aesni/aesni_ccm.c Fri Jun 12 21:33:02 2020 (r362123) @@ -155,7 +155,7 @@ cbc_mac_start(const unsigned char *auth_data, size_t a * already partially filled, by auth_amt, so we need * to handle that. The last block needs to be zero padded. */ - copy_amt = MIN(auth_len - auth_amt, + copy_amt = MIN(auth_len, sizeof(staging_block) - auth_amt); byte_ptr = (uint8_t*)&staging_block; bcopy(auth_ptr, &byte_ptr[auth_amt], copy_amt); From owner-svn-src-head@freebsd.org Fri Jun 12 21:48:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09C94347C2A; Fri, 12 Jun 2020 21:48:47 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kDrG6Sdxz47QS; Fri, 12 Jun 2020 21:48:46 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D932A10238; Fri, 12 Jun 2020 21:48:46 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLmkla085848; Fri, 12 Jun 2020 21:48:46 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLmkMU085847; Fri, 12 Jun 2020 21:48:46 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202006122148.05CLmkMU085847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 12 Jun 2020 21:48:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362124 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 362124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:48:47 -0000 Author: sjg Date: Fri Jun 12 21:48:46 2020 New Revision: 362124 URL: https://svnweb.freebsd.org/changeset/base/362124 Log: Minor cleanup of initialized variables Sort the list and cleanup trailing white-space Reviewed by: stevek MFC after: 1 week Modified: head/stand/common/install.c Modified: head/stand/common/install.c ============================================================================== --- head/stand/common/install.c Fri Jun 12 21:33:02 2020 (r362123) +++ head/stand/common/install.c Fri Jun 12 21:48:46 2020 (r362124) @@ -207,15 +207,15 @@ install(char *pkgname) if (*s == '\0') goto invalid_url; - proto = NULL; devname = NULL; devnamelen = 0; - + proto = NULL; + local = 0; + if (i == 4 && !strncasecmp(pkgname, "tftp", i)) { devname = "net0"; devnamelen = 4; proto = &tftp_fsops; - local = 0; } else if (i == 4 && !strncasecmp(pkgname, "file", i)) { currdev = getenv("currdev"); local = 1; From owner-svn-src-head@freebsd.org Fri Jun 12 21:51:20 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E69B6347EB1; Fri, 12 Jun 2020 21:51:20 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kDvD5shTz47ZG; Fri, 12 Jun 2020 21:51:20 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4AF110535; Fri, 12 Jun 2020 21:51:20 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLpKci086787; Fri, 12 Jun 2020 21:51:20 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLpKTD086786; Fri, 12 Jun 2020 21:51:20 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202006122151.05CLpKTD086786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 12 Jun 2020 21:51:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362125 - head/sys/security/mac_veriexec X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/sys/security/mac_veriexec X-SVN-Commit-Revision: 362125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:51:21 -0000 Author: sjg Date: Fri Jun 12 21:51:20 2020 New Revision: 362125 URL: https://svnweb.freebsd.org/changeset/base/362125 Log: mac_veriexec_fingerprint_check_vnode: v_writecount > 0 means active writers v_writecount can actually be < 0 for text, so check for v_writecount > 0 Reviewed by: stevek MFC after: 1 week Modified: head/sys/security/mac_veriexec/veriexec_fingerprint.c Modified: head/sys/security/mac_veriexec/veriexec_fingerprint.c ============================================================================== --- head/sys/security/mac_veriexec/veriexec_fingerprint.c Fri Jun 12 21:48:46 2020 (r362124) +++ head/sys/security/mac_veriexec/veriexec_fingerprint.c Fri Jun 12 21:51:20 2020 (r362125) @@ -215,7 +215,7 @@ mac_veriexec_fingerprint_check_vnode(struct vnode *vp, int error; /* reject fingerprint if writers are active */ - if (vp->v_writecount) + if (vp->v_writecount > 0) return (ETXTBSY); if ((vp->v_mount->mnt_flag & MNT_VERIFIED) != 0) { From owner-svn-src-head@freebsd.org Fri Jun 12 21:53:08 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6FE1347ECA; Fri, 12 Jun 2020 21:53:08 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kDxJ4yVlz47rT; Fri, 12 Jun 2020 21:53:08 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A58A81080D; Fri, 12 Jun 2020 21:53:08 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLr8fD091723; Fri, 12 Jun 2020 21:53:08 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLr8JN091722; Fri, 12 Jun 2020 21:53:08 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <202006122153.05CLr8JN091722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Fri, 12 Jun 2020 21:53:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362126 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 362126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:53:08 -0000 Author: vangyzen Date: Fri Jun 12 21:53:08 2020 New Revision: 362126 URL: https://svnweb.freebsd.org/changeset/base/362126 Log: Honor db_pager_quit in some vm_object ddb commands These can be rather verbose. MFC after: 2 weeks Sponsored by: Dell EMC Isilon Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Fri Jun 12 21:51:20 2020 (r362125) +++ head/sys/vm/vm_object.c Fri Jun 12 21:53:08 2020 (r362126) @@ -2694,6 +2694,8 @@ DB_SHOW_COMMAND(vmochk, vm_object_check) (void *)object->backing_object); } } + if (db_pager_quit) + return; } } @@ -2744,6 +2746,9 @@ DB_SHOW_COMMAND(object, vm_object_print_static) db_printf("(off=0x%jx,page=0x%jx)", (uintmax_t)p->pindex, (uintmax_t)VM_PAGE_TO_PHYS(p)); + + if (db_pager_quit) + break; } if (count != 0) db_printf("\n"); From owner-svn-src-head@freebsd.org Fri Jun 12 21:55:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96FAE3479EE; Fri, 12 Jun 2020 21:55:31 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kF033Vj5z486M; Fri, 12 Jun 2020 21:55:31 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EF30106BA; Fri, 12 Jun 2020 21:55:31 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CLtV6I091903; Fri, 12 Jun 2020 21:55:31 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CLtVCq091902; Fri, 12 Jun 2020 21:55:31 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202006122155.05CLtVCq091902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 12 Jun 2020 21:55:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362127 - head/lib/libsecureboot X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/lib/libsecureboot X-SVN-Commit-Revision: 362127 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 21:55:31 -0000 Author: sjg Date: Fri Jun 12 21:55:30 2020 New Revision: 362127 URL: https://svnweb.freebsd.org/changeset/base/362127 Log: verify_pcr_export: bump kenv_mvallen if needed The loader.ve.hashed list can easily exceed KENV_MVALLEN. If so, bump kenv_mvallen to a multiple of KENV_MVALLEN to accommodate the value. Reviewed by: stevek MFC after: 1 week Modified: head/lib/libsecureboot/verify_file.c Modified: head/lib/libsecureboot/verify_file.c ============================================================================== --- head/lib/libsecureboot/verify_file.c Fri Jun 12 21:53:08 2020 (r362126) +++ head/lib/libsecureboot/verify_file.c Fri Jun 12 21:55:30 2020 (r362127) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libsecureboot.h" #include @@ -532,6 +533,19 @@ verify_pcr_export(void) DEBUG_PRINTF(1, ("%s: setenv(loader.ve.hashed, %s\n", __func__, hinfo)); + if ((hlen = strlen(hinfo)) > KENV_MVALLEN) { + /* + * bump kenv_mvallen + * roundup to multiple of KENV_MVALLEN + */ + char mvallen[16]; + + hlen += KENV_MVALLEN - + (hlen % KENV_MVALLEN); + if (snprintf(mvallen, sizeof(mvallen), + "%d", (int) hlen) < sizeof(mvallen)) + setenv("kenv_mvallen", mvallen, 1); + } free(hinfo); } } From owner-svn-src-head@freebsd.org Fri Jun 12 22:10:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36FAF3480DB; Fri, 12 Jun 2020 22:10:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kFJr0bwwz48jR; Fri, 12 Jun 2020 22:10:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B9C11055E; Fri, 12 Jun 2020 22:10:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CMA3rq098043; Fri, 12 Jun 2020 22:10:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CMA3L3098041; Fri, 12 Jun 2020 22:10:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006122210.05CMA3L3098041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jun 2020 22:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362128 - in head/libexec/rtld-elf: . rtld-libc X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/libexec/rtld-elf: . rtld-libc X-SVN-Commit-Revision: 362128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 22:10:04 -0000 Author: kib Date: Fri Jun 12 22:10:03 2020 New Revision: 362128 URL: https://svnweb.freebsd.org/changeset/base/362128 Log: rtld: set osrel when in the direct exec mode. Rtld itself is a shared object which does not have vendor note, so after the direct exec of ld-elf.so.1 process has p_osrel set to zero. This affects the ABI of syscalls. Set osrel to the __FreeBSD_version value at compile time right after rtld identified direct exec mode. Then, switch to the osrel read from the binary note or zero if no note, right before starting calling ifunc resolvers, which is the first byte of the user code. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/libexec/rtld-elf/rtld-libc/Makefile.inc head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld-libc/Makefile.inc ============================================================================== --- head/libexec/rtld-elf/rtld-libc/Makefile.inc Fri Jun 12 21:55:30 2020 (r362127) +++ head/libexec/rtld-elf/rtld-libc/Makefile.inc Fri Jun 12 22:10:03 2020 (r362128) @@ -46,7 +46,7 @@ _libc_string_objects= bcmp bcopy bzero memset memchr m # Also use all the syscall .o files from libc_nossp_pic: _libc_other_objects= sigsetjmp lstat stat fstat fstatat fstatfs syscall \ cerror geteuid getegid sigfastblock munmap mprotect \ - sysarch __sysctl issetugid __getcwd utrace \ + sysarch __sysctl issetugid __getcwd utrace getpid \ thr_self thr_kill pread mmap lseek _exit _fstat _fstatat _fstatfs \ getdirentries _getdirentries _close _fcntl _open _openat _read \ _sigprocmask _write readlink __realpathat _setjmp setjmp setjmperr Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Fri Jun 12 21:55:30 2020 (r362127) +++ head/libexec/rtld-elf/rtld.c Fri Jun 12 22:10:03 2020 (r362128) @@ -384,11 +384,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr const char *argv0, *binpath; caddr_t imgentry; char buf[MAXPATHLEN]; - int argc, fd, i, phnum, rtld_argc; + int argc, fd, i, mib[4], old_osrel, osrel, phnum, rtld_argc; + size_t sz; #ifdef __powerpc__ int old_auxv_format = 1; #endif - bool dir_enable, explicit_fd, search_in_path; + bool dir_enable, direct_exec, explicit_fd, search_in_path; /* * On entry, the dynamic linker itself has not been relocated yet. @@ -451,6 +452,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr ld_fast_sigblock = true; trust = !issetugid(); + direct_exec = false; md_abi_variant_hook(aux_info); @@ -466,6 +468,21 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr argv0); rtld_die(); } + direct_exec = true; + + /* + * Set osrel for us, it is later reset to the binary' + * value before first instruction of code from the binary + * is executed. + */ + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_OSREL; + mib[3] = getpid(); + osrel = __FreeBSD_version; + sz = sizeof(old_osrel); + (void)sysctl(mib, 4, &old_osrel, &sz, &osrel, sizeof(osrel)); + dbg("opening main program in direct exec mode"); if (argc >= 2) { rtld_argc = parse_args(argv, argc, &search_in_path, &fd, &argv0); @@ -803,6 +820,18 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entr * init functions. */ pre_init(); + + if (direct_exec) { + /* Set osrel for direct-execed binary */ + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_OSREL; + mib[3] = getpid(); + osrel = obj_main->osrel; + sz = sizeof(old_osrel); + dbg("setting osrel to %d", osrel); + (void)sysctl(mib, 4, &old_osrel, &sz, &osrel, sizeof(osrel)); + } wlock_acquire(rtld_bind_lock, &lockstate); From owner-svn-src-head@freebsd.org Fri Jun 12 22:12:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAEEC348772; Fri, 12 Jun 2020 22:12:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kFNB4bKQz49WB; Fri, 12 Jun 2020 22:12:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98D3D106FE; Fri, 12 Jun 2020 22:12:58 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CMCw6a004190; Fri, 12 Jun 2020 22:12:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CMCwm5004188; Fri, 12 Jun 2020 22:12:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006122212.05CMCwm5004188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jun 2020 22:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362129 - in head/sys/x86: include x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/x86: include x86 X-SVN-Commit-Revision: 362129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 22:12:58 -0000 Author: kib Date: Fri Jun 12 22:12:57 2020 New Revision: 362129 URL: https://svnweb.freebsd.org/changeset/base/362129 Log: x86: add bits definitions for SRBDS mitigation control. See https://software.intel.com/security-software-guidance/insights/deep-dive-special-register-buffer-data-sampling Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25221 Modified: head/sys/x86/include/specialreg.h head/sys/x86/x86/identcpu.c Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Fri Jun 12 22:10:03 2020 (r362128) +++ head/sys/x86/include/specialreg.h Fri Jun 12 22:12:57 2020 (r362129) @@ -477,6 +477,7 @@ #define CPUID_STDEXT3_AVX5124FMAPS 0x00000008 #define CPUID_STDEXT3_FSRM 0x00000010 #define CPUID_STDEXT3_AVX512VP2INTERSECT 0x00000100 +#define CPUID_STDEXT3_MCUOPT 0x00000200 #define CPUID_STDEXT3_MD_CLEAR 0x00000400 #define CPUID_STDEXT3_TSXFA 0x00002000 #define CPUID_STDEXT3_PCONFIG 0x00040000 @@ -555,6 +556,7 @@ #define MSR_BBL_CR_BUSY 0x11b #define MSR_BBL_CR_CTL3 0x11e #define MSR_IA32_TSX_CTRL 0x122 +#define MSR_IA32_MCU_OPT_CTRL 0x123 #define MSR_SYSENTER_CS_MSR 0x174 #define MSR_SYSENTER_ESP_MSR 0x175 #define MSR_SYSENTER_EIP_MSR 0x176 @@ -796,6 +798,9 @@ /* MSR IA32_FLUSH_CMD */ #define IA32_FLUSH_CMD_L1D 0x00000001 + +/* MSR IA32_MCU_OPT_CTRL */ +#define IA32_RNGDS_MITG_DIS 0x00000001 /* MSR IA32_HWP_CAPABILITIES */ #define IA32_HWP_CAPABILITIES_HIGHEST_PERFORMANCE(x) (((x) >> 0) & 0xff) Modified: head/sys/x86/x86/identcpu.c ============================================================================== --- head/sys/x86/x86/identcpu.c Fri Jun 12 22:10:03 2020 (r362128) +++ head/sys/x86/x86/identcpu.c Fri Jun 12 22:12:57 2020 (r362129) @@ -1028,6 +1028,7 @@ printcpuinfo(void) "\004AVX512_4FMAPS" "\005FSRM" "\011AVX512VP2INTERSECT" + "\012MCUOPT" "\013MD_CLEAR" "\016TSXFA" "\023PCONFIG" From owner-svn-src-head@freebsd.org Fri Jun 12 22:14:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0695B348442; Fri, 12 Jun 2020 22:14:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kFQG6PKSz49cP; Fri, 12 Jun 2020 22:14: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6E961056D; Fri, 12 Jun 2020 22:14: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 05CMEkQK004318; Fri, 12 Jun 2020 22:14:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CMEjbJ004312; Fri, 12 Jun 2020 22:14:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006122214.05CMEjbJ004312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 12 Jun 2020 22:14:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362130 - in head: share/man/man7 sys/amd64/amd64 sys/dev/cpuctl sys/x86/include sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: share/man/man7 sys/amd64/amd64 sys/dev/cpuctl sys/x86/include sys/x86/x86 X-SVN-Commit-Revision: 362130 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 22:14:47 -0000 Author: kib Date: Fri Jun 12 22:14:45 2020 New Revision: 362130 URL: https://svnweb.freebsd.org/changeset/base/362130 Log: Control for Special Register Buffer Data Sampling mitigation. New microcode update for Intel enables mitigation for SRBDS, which slows down RDSEED and related instructions. The update also provides a control to limit the mitigation to SGX enclaves, which should restore the speed of random generator by the cost of potential cross-core bufer sampling. See https://software.intel.com/security-software-guidance/insights/deep-dive-special-register-buffer-data-sampling GIve the user control over it. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25221 Modified: head/share/man/man7/security.7 head/sys/amd64/amd64/initcpu.c head/sys/amd64/amd64/machdep.c head/sys/dev/cpuctl/cpuctl.c head/sys/x86/include/x86_var.h head/sys/x86/x86/cpu_machdep.c Modified: head/share/man/man7/security.7 ============================================================================== --- head/share/man/man7/security.7 Fri Jun 12 22:12:57 2020 (r362129) +++ head/share/man/man7/security.7 Fri Jun 12 22:14:45 2020 (r362130) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2020 +.Dd June 11, 2020 .Dt SECURITY 7 .Os .Sh NAME @@ -1040,6 +1040,13 @@ page table format used by hypervisors on Intel CPUs to physical address space to machine physical memory. May be disabled to work around a CPU Erratum called Machine Check Error Avoidance on Page Size Change. +.It Dv machdep.mitigations.rngds.enable +amd64 and i386. +Controls mitigation of Special Register Buffer Data Sampling versus +optimization of the MCU access. +When set to zero, the mitigation is disabled, and the RDSEED and RDRAND +instructions do not incur serialization overhead for shared buffer accesses, +and do not serialize off-core memory accessses. .It Dv kern.elf32.aslr.enable Controls system-global Address Space Layout Randomization (ASLR) for normal non-PIE (Position Independent Executable) 32bit binaries. Modified: head/sys/amd64/amd64/initcpu.c ============================================================================== --- head/sys/amd64/amd64/initcpu.c Fri Jun 12 22:12:57 2020 (r362129) +++ head/sys/amd64/amd64/initcpu.c Fri Jun 12 22:14:45 2020 (r362130) @@ -270,6 +270,7 @@ initializecpu(void) hw_ibrs_recalculate(false); hw_ssb_recalculate(false); amd64_syscall_ret_flush_l1d_recalc(); + x86_rngds_mitg_recalculate(false); switch (cpu_vendor_id) { case CPU_VENDOR_AMD: case CPU_VENDOR_HYGON: Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Jun 12 22:12:57 2020 (r362129) +++ head/sys/amd64/amd64/machdep.c Fri Jun 12 22:14:45 2020 (r362130) @@ -1791,6 +1791,9 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TUNABLE_INT_FETCH("machdep.mitigations.taa.enable", &x86_taa_enable); + TUNABLE_INT_FETCH("machdep.mitigations.rndgs.enable", + &x86_rngds_mitg_enable); + finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Fri Jun 12 22:12:57 2020 (r362129) +++ head/sys/dev/cpuctl/cpuctl.c Fri Jun 12 22:14:45 2020 (r362130) @@ -547,6 +547,7 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td #endif hw_mds_recalculate(); x86_taa_recalculate(); + x86_rngds_mitg_recalculate(true); printcpuinfo(); return (0); } Modified: head/sys/x86/include/x86_var.h ============================================================================== --- head/sys/x86/include/x86_var.h Fri Jun 12 22:12:57 2020 (r362129) +++ head/sys/x86/include/x86_var.h Fri Jun 12 22:14:45 2020 (r362130) @@ -95,6 +95,7 @@ extern int hw_mds_disable; extern int hw_ssb_active; extern int x86_taa_enable; extern int cpu_flush_rsb_ctxsw; +extern int x86_rngds_mitg_enable; struct pcb; struct thread; @@ -139,6 +140,7 @@ void hw_ibrs_recalculate(bool all_cpus); void hw_mds_recalculate(void); void hw_ssb_recalculate(bool all_cpus); void x86_taa_recalculate(void); +void x86_rngds_mitg_recalculate(bool all_cpus); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); void nmi_call_kdb_smp(u_int type, struct trapframe *frame); void nmi_handle_intr(u_int type, struct trapframe *frame); Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Fri Jun 12 22:12:57 2020 (r362129) +++ head/sys/x86/x86/cpu_machdep.c Fri Jun 12 22:14:45 2020 (r362130) @@ -1402,6 +1402,60 @@ SYSCTL_INT(_machdep_mitigations, OID_AUTO, flush_rsb_c CTLFLAG_RW | CTLFLAG_NOFETCH, &cpu_flush_rsb_ctxsw, 0, "Flush Return Stack Buffer on context switch"); +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, rngds, + CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "MCU Optimization, disable RDSEED mitigation"); + +int x86_rngds_mitg_enable = 1; +void +x86_rngds_mitg_recalculate(bool all_cpus) +{ + if ((cpu_stdext_feature3 & CPUID_STDEXT3_MCUOPT) == 0) + return; + x86_msr_op(MSR_IA32_MCU_OPT_CTRL, + (x86_rngds_mitg_enable ? MSR_OP_OR : MSR_OP_ANDNOT) | + (all_cpus ? MSR_OP_RENDEZVOUS : MSR_OP_LOCAL), + IA32_RNGDS_MITG_DIS); +} + +static int +sysctl_rngds_mitg_enable_handler(SYSCTL_HANDLER_ARGS) +{ + int error, val; + + val = x86_rngds_mitg_enable; + error = sysctl_handle_int(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + x86_rngds_mitg_enable = val; + x86_rngds_mitg_recalculate(true); + return (0); +} +SYSCTL_PROC(_machdep_mitigations_rngds, OID_AUTO, enable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + sysctl_rngds_mitg_enable_handler, "I", + "MCU Optimization, disabling RDSEED mitigation control " + "(0 - mitigation disabled (RDSEED optimized), 1 - mitigation enabled"); + +static int +sysctl_rngds_state_handler(SYSCTL_HANDLER_ARGS) +{ + const char *state; + + if ((cpu_stdext_feature3 & CPUID_STDEXT3_MCUOPT) == 0) { + state = "Not applicable"; + } else if (x86_rngds_mitg_enable == 0) { + state = "RDSEED not serialized"; + } else { + state = "Mitigated"; + } + return (SYSCTL_OUT(req, state, strlen(state))); +} +SYSCTL_PROC(_machdep_mitigations_rngds, OID_AUTO, state, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_rngds_state_handler, "A", + "MCU Optimization state"); + /* * Enable and restore kernel text write permissions. * Callers must ensure that disable_wp()/restore_wp() are executed From owner-svn-src-head@freebsd.org Fri Jun 12 22:27:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 282CF3488A8; Fri, 12 Jun 2020 22:27:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kFhv0Cvkz49wR; Fri, 12 Jun 2020 22:27:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1EED10B6E; Fri, 12 Jun 2020 22:27:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CMRQtt010669; Fri, 12 Jun 2020 22:27:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CMRQ9Y010668; Fri, 12 Jun 2020 22:27:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006122227.05CMRQ9Y010668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jun 2020 22:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362131 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 362131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 22:27:27 -0000 Author: jhb Date: Fri Jun 12 22:27:26 2020 New Revision: 362131 URL: https://svnweb.freebsd.org/changeset/base/362131 Log: Fix a regression in r361804 for TLS 1.3. I was not including the record type stored in the first byte of the trailer as part of the payload to be encrypted and hashed. Sponsored by: Netflix Modified: head/sys/opencrypto/ktls_ocf.c Modified: head/sys/opencrypto/ktls_ocf.c ============================================================================== --- head/sys/opencrypto/ktls_ocf.c Fri Jun 12 22:14:45 2020 (r362130) +++ head/sys/opencrypto/ktls_ocf.c Fri Jun 12 22:27:26 2020 (r362131) @@ -293,6 +293,7 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls, * record_type even if only the first byte is used. */ trailer[0] = record_type; + crp->crp_payload_length++; iov[iovcnt + 1].iov_base = trailer; iov[iovcnt + 1].iov_len = AES_GMAC_HASH_LEN + 1; uio.uio_iovcnt++; From owner-svn-src-head@freebsd.org Fri Jun 12 22:33:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0237C348A7E; Fri, 12 Jun 2020 22:33:47 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kFrB4rQvz4BYp; Fri, 12 Jun 2020 22:33:46 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi1-f178.google.com with SMTP id b8so10222020oic.1; Fri, 12 Jun 2020 15:33:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=21fRBqw26GTSSKztua6Kdi8lNKe2uYYAubDCPVaCBfs=; b=XjgtfQOhqEQXt9/G+dBZBVaKNa2PGfHPcQNreI0E/+QVQwKAqSOhuL5cWvXXHWDXc8 kMdAZl9XOO5Mqb2a9T04Pf3wz6zheORQip+j5ISTV+3VM0BtcJBt5i/vetzWu0iCrUZ4 Mhl9yIOVQVNOG7J1oM3oCXk/vJ2q+ZYCgO8OovaM5nIML9VkSrHR90HKXk6St7rICQn0 c/lY5bDndvV6f1GoOE+k7dmqwNTAdw8jI9Skp6mE2gC7Z/l7rxSajJDmBQXRpSDmmuR+ u3C2iNLpXSXyBBfTyU8We20LOIp+wylARwNxZDXwhwSNIcBkrveeAS5r9Sv5F3BP+KEC cJpA== X-Gm-Message-State: AOAM533bltU1Vp+wiZpYm/DUCcCvb+xee71G/GRmdCHX2wFHU+OqAuuV 34om27VxppecmjxZF52HOsZb/f0j X-Google-Smtp-Source: ABdhPJzC/IK9LGBCMwn1biW+ShrQ6MXF0WS1g5ZsOl2I7sEejDGQqnhaFeqAj3A9EVSSnBORzaL7MQ== X-Received: by 2002:aca:574b:: with SMTP id l72mr871356oib.59.1592001224928; Fri, 12 Jun 2020 15:33:44 -0700 (PDT) Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com. [209.85.210.44]) by smtp.gmail.com with ESMTPSA id z13sm1626784ooa.28.2020.06.12.15.33.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jun 2020 15:33:44 -0700 (PDT) Received: by mail-ot1-f44.google.com with SMTP id n70so8598728ota.5; Fri, 12 Jun 2020 15:33:44 -0700 (PDT) X-Received: by 2002:a05:6830:20d7:: with SMTP id z23mr13149350otq.157.1592001224462; Fri, 12 Jun 2020 15:33:44 -0700 (PDT) MIME-Version: 1.0 References: <202006122153.05CLr8JN091722@repo.freebsd.org> In-Reply-To: <202006122153.05CLr8JN091722@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 12 Jun 2020 15:33:33 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r362126 - head/sys/vm To: Eric van Gyzen Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 49kFrB4rQvz4BYp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 22:33:47 -0000 On Fri, Jun 12, 2020 at 2:53 PM Eric van Gyzen wrote: > Honor db_pager_quit in some vm_object ddb commands > > These can be rather verbose. We also have this (?)hack in OneFS, which eliminates the need for every debug function to check the db_pager globals: https://people.freebsd.org/~cem/db_pager.patch I'm not sure how objectionable it is. From owner-svn-src-head@freebsd.org Fri Jun 12 23:10:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C73003496E7; Fri, 12 Jun 2020 23:10:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kGfZ579Zz4DCq; Fri, 12 Jun 2020 23:10:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A65C8110FE; Fri, 12 Jun 2020 23:10:30 +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 05CNAUI3035282; Fri, 12 Jun 2020 23:10:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CNAUk3035281; Fri, 12 Jun 2020 23:10:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006122310.05CNAUk3035281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jun 2020 23:10:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362135 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 362135 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 23:10:30 -0000 Author: jhb Date: Fri Jun 12 23:10:30 2020 New Revision: 362135 URL: https://svnweb.freebsd.org/changeset/base/362135 Log: Various optimizations to software AES-CCM and AES-GCM. - Make use of cursors to avoid data copies for AES-CCM and AES-GCM. Pass pointers into the request's input and/or output buffers directly to the Update, encrypt, and decrypt hooks rather than always copying all data into a temporary block buffer on the stack. - Move handling for partial final blocks out of the main loop. This removes branches from the main loop and permits using encrypt/decrypt_last which avoids a memset to clear the rest of the block on the stack. - Shrink the on-stack buffers to assume AES block sizes and CCM/GCM tag lengths. - For AAD data, pass larger chunks to axf->Update. CCM can take each AAD segment in a single call. GMAC can take multiple blocks at a time. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D25058 Modified: head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Fri Jun 12 23:02:34 2020 (r362134) +++ head/sys/opencrypto/cryptosoft.c Fri Jun 12 23:10:30 2020 (r362135) @@ -107,8 +107,8 @@ swcr_encdec(struct swcr_session *ses, struct cryptop * struct enc_xform *exf; int i, blks, inlen, ivlen, outlen, resid; struct crypto_buffer_cursor cc_in, cc_out; - const char *inblk; - char *outblk; + const unsigned char *inblk; + unsigned char *outblk; int error; bool encrypting; @@ -404,11 +404,12 @@ CTASSERT(INT_MAX <= (uint64_t)-1); /* GCM: associated static int swcr_gmac(struct swcr_session *ses, struct cryptop *crp) { - uint32_t blkbuf[howmany(EALG_MAX_BLOCK_LEN, sizeof(uint32_t))]; + uint32_t blkbuf[howmany(AES_BLOCK_LEN, sizeof(uint32_t))]; u_char *blk = (u_char *)blkbuf; - u_char aalg[AALG_MAX_RESULT_LEN]; - u_char iv[EALG_MAX_BLOCK_LEN]; + u_char tag[GMAC_DIGEST_LEN]; + u_char iv[AES_BLOCK_LEN]; struct crypto_buffer_cursor cc; + const u_char *inblk; union authctx ctx; struct swcr_auth *swa; struct auth_hash *axf; @@ -419,7 +420,9 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *cr axf = swa->sw_axf; bcopy(swa->sw_ictx, &ctx, axf->ctxsize); - blksz = axf->blocksize; + blksz = GMAC_BLOCK_LEN; + KASSERT(axf->blocksize == blksz, ("%s: axf block size mismatch", + __func__)); /* Initialize the IV */ ivlen = AES_GCM_IV_LEN; @@ -428,37 +431,49 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *cr axf->Reinit(&ctx, iv, ivlen); crypto_cursor_init(&cc, &crp->crp_buf); crypto_cursor_advance(&cc, crp->crp_payload_start); - for (resid = crp->crp_payload_length; resid > 0; resid -= len) { - len = MIN(resid, blksz); - crypto_cursor_copydata(&cc, len, blk); - bzero(blk + len, blksz - len); + for (resid = crp->crp_payload_length; resid >= blksz; resid -= len) { + len = crypto_cursor_seglen(&cc); + if (len >= blksz) { + inblk = crypto_cursor_segbase(&cc); + len = rounddown(MIN(len, resid), blksz); + crypto_cursor_advance(&cc, len); + } else { + len = blksz; + crypto_cursor_copydata(&cc, len, blk); + inblk = blk; + } + axf->Update(&ctx, inblk, len); + } + if (resid > 0) { + memset(blk, 0, blksz); + crypto_cursor_copydata(&cc, resid, blk); axf->Update(&ctx, blk, blksz); } /* length block */ - bzero(blk, blksz); + memset(blk, 0, blksz); blkp = (uint32_t *)blk + 1; *blkp = htobe32(crp->crp_payload_length * 8); axf->Update(&ctx, blk, blksz); /* Finalize MAC */ - axf->Final(aalg, &ctx); + axf->Final(tag, &ctx); error = 0; if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { - u_char uaalg[AALG_MAX_RESULT_LEN]; + u_char tag2[GMAC_DIGEST_LEN]; crypto_copydata(crp, crp->crp_digest_start, swa->sw_mlen, - uaalg); - if (timingsafe_bcmp(aalg, uaalg, swa->sw_mlen) != 0) + tag2); + if (timingsafe_bcmp(tag, tag2, swa->sw_mlen) != 0) error = EBADMSG; - explicit_bzero(uaalg, sizeof(uaalg)); + explicit_bzero(tag2, sizeof(tag2)); } else { /* Inject the authentication data */ - crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, aalg); + crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, tag); } explicit_bzero(blkbuf, sizeof(blkbuf)); - explicit_bzero(aalg, sizeof(aalg)); + explicit_bzero(tag, sizeof(tag)); explicit_bzero(iv, sizeof(iv)); return (error); } @@ -466,11 +481,13 @@ swcr_gmac(struct swcr_session *ses, struct cryptop *cr static int swcr_gcm(struct swcr_session *ses, struct cryptop *crp) { - uint32_t blkbuf[howmany(EALG_MAX_BLOCK_LEN, sizeof(uint32_t))]; + uint32_t blkbuf[howmany(AES_BLOCK_LEN, sizeof(uint32_t))]; u_char *blk = (u_char *)blkbuf; - u_char aalg[AALG_MAX_RESULT_LEN]; - u_char iv[EALG_MAX_BLOCK_LEN]; + u_char tag[GMAC_DIGEST_LEN]; + u_char iv[AES_BLOCK_LEN]; struct crypto_buffer_cursor cc_in, cc_out; + const u_char *inblk; + u_char *outblk; union authctx ctx; struct swcr_auth *swa; struct swcr_encdec *swe; @@ -483,7 +500,9 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp axf = swa->sw_axf; bcopy(swa->sw_ictx, &ctx, axf->ctxsize); - blksz = axf->blocksize; + blksz = GMAC_BLOCK_LEN; + KASSERT(axf->blocksize == blksz, ("%s: axf block size mismatch", + __func__)); swe = &ses->swcr_encdec; exf = swe->sw_exf; @@ -503,10 +522,22 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp /* Supply MAC with AAD */ crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_aad_start); - for (resid = crp->crp_aad_length; resid > 0; resid -= len) { - len = MIN(resid, blksz); - crypto_cursor_copydata(&cc_in, len, blk); - bzero(blk + len, blksz - len); + for (resid = crp->crp_aad_length; resid >= blksz; resid -= len) { + len = crypto_cursor_seglen(&cc_in); + if (len >= blksz) { + inblk = crypto_cursor_segbase(&cc_in); + len = rounddown(MIN(len, resid), blksz); + crypto_cursor_advance(&cc_in, len); + } else { + len = blksz; + crypto_cursor_copydata(&cc_in, len, blk); + inblk = blk; + } + axf->Update(&ctx, inblk, len); + } + if (resid > 0) { + memset(blk, 0, blksz); + crypto_cursor_copydata(&cc_in, resid, blk); axf->Update(&ctx, blk, blksz); } @@ -520,22 +551,40 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - for (resid = crp->crp_payload_length; resid > 0; resid -= len) { - len = MIN(resid, blksz); - if (len < blksz) - bzero(blk, blksz); - crypto_cursor_copydata(&cc_in, len, blk); + for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - exf->encrypt(swe->sw_kschedule, blk, blk); - axf->Update(&ctx, blk, len); - crypto_cursor_copyback(&cc_out, len, blk); + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + exf->encrypt(swe->sw_kschedule, inblk, outblk); + axf->Update(&ctx, outblk, blksz); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); } else { - axf->Update(&ctx, blk, len); + axf->Update(&ctx, inblk, blksz); } } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + exf->encrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } + axf->Update(&ctx, blk, resid); + } /* length block */ - bzero(blk, blksz); + memset(blk, 0, blksz); blkp = (uint32_t *)blk + 1; *blkp = htobe32(crp->crp_aad_length * 8); blkp = (uint32_t *)blk + 3; @@ -543,18 +592,17 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp axf->Update(&ctx, blk, blksz); /* Finalize MAC */ - axf->Final(aalg, &ctx); + axf->Final(tag, &ctx); /* Validate tag */ error = 0; if (!CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - u_char uaalg[AALG_MAX_RESULT_LEN]; + u_char tag2[GMAC_DIGEST_LEN]; - crypto_copydata(crp, crp->crp_digest_start, swa->sw_mlen, - uaalg); + crypto_copydata(crp, crp->crp_digest_start, swa->sw_mlen, tag2); - r = timingsafe_bcmp(aalg, uaalg, swa->sw_mlen); - explicit_bzero(uaalg, sizeof(uaalg)); + r = timingsafe_bcmp(tag, tag2, swa->sw_mlen); + explicit_bzero(tag2, sizeof(tag2)); if (r != 0) { error = EBADMSG; goto out; @@ -563,24 +611,38 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp /* tag matches, decrypt data */ crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - for (resid = crp->crp_payload_length; resid > 0; - resid -= len) { - len = MIN(resid, blksz); - if (len < blksz) - bzero(blk, blksz); - crypto_cursor_copydata(&cc_in, len, blk); - exf->decrypt(swe->sw_kschedule, blk, blk); - crypto_cursor_copyback(&cc_out, len, blk); + for (resid = crp->crp_payload_length; resid > blksz; + resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + exf->decrypt(swe->sw_kschedule, inblk, outblk); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + exf->decrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } } else { /* Inject the authentication data */ - crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, - aalg); + crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, tag); } out: explicit_bzero(blkbuf, sizeof(blkbuf)); - explicit_bzero(aalg, sizeof(aalg)); + explicit_bzero(tag, sizeof(tag)); explicit_bzero(iv, sizeof(iv)); return (error); @@ -589,21 +651,17 @@ out: static int swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) { - uint32_t blkbuf[howmany(EALG_MAX_BLOCK_LEN, sizeof(uint32_t))]; - u_char *blk = (u_char *)blkbuf; - u_char aalg[AALG_MAX_RESULT_LEN]; - u_char iv[EALG_MAX_BLOCK_LEN]; - struct crypto_buffer_cursor cc; + u_char tag[AES_CBC_MAC_HASH_LEN]; + u_char iv[AES_BLOCK_LEN]; union authctx ctx; struct swcr_auth *swa; struct auth_hash *axf; - int blksz, error, ivlen, len, resid; + int error, ivlen; swa = &ses->swcr_auth; axf = swa->sw_axf; bcopy(swa->sw_ictx, &ctx, axf->ctxsize); - blksz = axf->blocksize; /* Initialize the IV */ ivlen = AES_CCM_IV_LEN; @@ -617,33 +675,27 @@ swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryp ctx.aes_cbc_mac_ctx.cryptDataLength = 0; axf->Reinit(&ctx, iv, ivlen); - crypto_cursor_init(&cc, &crp->crp_buf); - crypto_cursor_advance(&cc, crp->crp_aad_start); - for (resid = crp->crp_payload_length; resid > 0; resid -= len) { - len = MIN(resid, blksz); - crypto_cursor_copydata(&cc, len, blk); - bzero(blk + len, blksz - len); - axf->Update(&ctx, blk, blksz); - } + error = crypto_apply(crp, crp->crp_payload_start, + crp->crp_payload_length, axf->Update, &ctx); + if (error) + return (error); /* Finalize MAC */ - axf->Final(aalg, &ctx); + axf->Final(tag, &ctx); - error = 0; if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { - u_char uaalg[AALG_MAX_RESULT_LEN]; + u_char tag2[AES_CBC_MAC_HASH_LEN]; crypto_copydata(crp, crp->crp_digest_start, swa->sw_mlen, - uaalg); - if (timingsafe_bcmp(aalg, uaalg, swa->sw_mlen) != 0) + tag2); + if (timingsafe_bcmp(tag, tag2, swa->sw_mlen) != 0) error = EBADMSG; - explicit_bzero(uaalg, sizeof(uaalg)); + explicit_bzero(tag2, sizeof(tag)); } else { /* Inject the authentication data */ - crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, aalg); + crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, tag); } - explicit_bzero(blkbuf, sizeof(blkbuf)); - explicit_bzero(aalg, sizeof(aalg)); + explicit_bzero(tag, sizeof(tag)); explicit_bzero(iv, sizeof(iv)); return (error); } @@ -651,23 +703,27 @@ swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryp static int swcr_ccm(struct swcr_session *ses, struct cryptop *crp) { - uint32_t blkbuf[howmany(EALG_MAX_BLOCK_LEN, sizeof(uint32_t))]; + uint32_t blkbuf[howmany(AES_BLOCK_LEN, sizeof(uint32_t))]; u_char *blk = (u_char *)blkbuf; - u_char aalg[AALG_MAX_RESULT_LEN]; - u_char iv[EALG_MAX_BLOCK_LEN]; + u_char tag[AES_CBC_MAC_HASH_LEN]; + u_char iv[AES_BLOCK_LEN]; struct crypto_buffer_cursor cc_in, cc_out; + const u_char *inblk; + u_char *outblk; union authctx ctx; struct swcr_auth *swa; struct swcr_encdec *swe; struct auth_hash *axf; struct enc_xform *exf; - int blksz, error, ivlen, len, r, resid; + int blksz, error, ivlen, r, resid; swa = &ses->swcr_auth; axf = swa->sw_axf; bcopy(swa->sw_ictx, &ctx, axf->ctxsize); - blksz = axf->blocksize; + blksz = AES_BLOCK_LEN; + KASSERT(axf->blocksize == blksz, ("%s: axf block size mismatch", + __func__)); swe = &ses->swcr_encdec; exf = swe->sw_exf; @@ -692,14 +748,10 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp axf->Reinit(&ctx, iv, ivlen); /* Supply MAC with AAD */ - crypto_cursor_init(&cc_in, &crp->crp_buf); - crypto_cursor_advance(&cc_in, crp->crp_aad_start); - for (resid = crp->crp_aad_length; resid > 0; resid -= len) { - len = MIN(resid, blksz); - crypto_cursor_copydata(&cc_in, len, blk); - bzero(blk + len, blksz - len); - axf->Update(&ctx, blk, blksz); - } + error = crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length, + axf->Update, &ctx); + if (error) + return (error); exf->reinit(swe->sw_kschedule, iv); @@ -711,69 +763,104 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); } else cc_out = cc_in; - for (resid = crp->crp_payload_length; resid > 0; resid -= len) { - len = MIN(resid, blksz); - if (len < blksz) - bzero(blk, blksz); - crypto_cursor_copydata(&cc_in, len, blk); + for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - axf->Update(&ctx, blk, len); - exf->encrypt(swe->sw_kschedule, blk, blk); - crypto_cursor_copyback(&cc_out, len, blk); + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + axf->Update(&ctx, inblk, blksz); + exf->encrypt(swe->sw_kschedule, inblk, outblk); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); } else { /* * One of the problems with CCM+CBC is that * the authentication is done on the - * unecncrypted data. As a result, we have to + * unencrypted data. As a result, we have to * decrypt the data twice: once to generate * the tag and a second time after the tag is * verified. */ - exf->decrypt(swe->sw_kschedule, blk, blk); - axf->Update(&ctx, blk, len); + exf->decrypt(swe->sw_kschedule, inblk, blk); + axf->Update(&ctx, blk, blksz); } } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + axf->Update(&ctx, blk, resid); + exf->encrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } else { + exf->decrypt_last(swe->sw_kschedule, blk, blk, resid); + axf->Update(&ctx, blk, resid); + } + } /* Finalize MAC */ - axf->Final(aalg, &ctx); + axf->Final(tag, &ctx); /* Validate tag */ error = 0; if (!CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { - u_char uaalg[AALG_MAX_RESULT_LEN]; + u_char tag2[AES_CBC_MAC_HASH_LEN]; crypto_copydata(crp, crp->crp_digest_start, swa->sw_mlen, - uaalg); + tag2); - r = timingsafe_bcmp(aalg, uaalg, swa->sw_mlen); - explicit_bzero(uaalg, sizeof(uaalg)); + r = timingsafe_bcmp(tag, tag2, swa->sw_mlen); + explicit_bzero(tag2, sizeof(tag2)); if (r != 0) { error = EBADMSG; goto out; } - + /* tag matches, decrypt data */ exf->reinit(swe->sw_kschedule, iv); crypto_cursor_init(&cc_in, &crp->crp_buf); crypto_cursor_advance(&cc_in, crp->crp_payload_start); - for (resid = crp->crp_payload_length; resid > 0; - resid -= len) { - len = MIN(resid, blksz); - if (len < blksz) - bzero(blk, blksz); - crypto_cursor_copydata(&cc_in, len, blk); - exf->decrypt(swe->sw_kschedule, blk, blk); - crypto_cursor_copyback(&cc_out, len, blk); + for (resid = crp->crp_payload_length; resid > blksz; + resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + exf->decrypt(swe->sw_kschedule, inblk, outblk); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + exf->decrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } } else { /* Inject the authentication data */ - crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, - aalg); + crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, tag); } out: explicit_bzero(blkbuf, sizeof(blkbuf)); - explicit_bzero(aalg, sizeof(aalg)); + explicit_bzero(tag, sizeof(tag)); explicit_bzero(iv, sizeof(iv)); return (error); } From owner-svn-src-head@freebsd.org Fri Jun 12 23:42:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F456349E78; Fri, 12 Jun 2020 23:42:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kHMd0Djbz4FmJ; Fri, 12 Jun 2020 23:42:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0345E11957; Fri, 12 Jun 2020 23:42:37 +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 05CNga7N059270; Fri, 12 Jun 2020 23:42:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CNgatD059269; Fri, 12 Jun 2020 23:42:36 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006122342.05CNgatD059269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jun 2020 23:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362136 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 362136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 23:42:37 -0000 Author: jhb Date: Fri Jun 12 23:42:36 2020 New Revision: 362136 URL: https://svnweb.freebsd.org/changeset/base/362136 Log: Allow to be included from userland assembly files. This will be used by future changes to define ELF notes in assembly. Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25211 Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Jun 12 23:10:30 2020 (r362135) +++ head/sys/sys/param.h Fri Jun 12 23:42:36 2020 (r362136) @@ -136,8 +136,10 @@ #endif #ifndef _KERNEL +#ifndef LOCORE /* Signals. */ #include +#endif #endif /* Machine type dependent parameters. */ From owner-svn-src-head@freebsd.org Fri Jun 12 23:43:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CB6E34A15D; Fri, 12 Jun 2020 23:43:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kHNx0PBsz4G3S; Fri, 12 Jun 2020 23:43:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 08DF3118D6; Fri, 12 Jun 2020 23:43:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05CNhiEh059363; Fri, 12 Jun 2020 23:43:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05CNhiMs059362; Fri, 12 Jun 2020 23:43:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006122343.05CNhiMs059362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 Jun 2020 23:43:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362137 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 362137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 12 Jun 2020 23:43:45 -0000 Author: jhb Date: Fri Jun 12 23:43:44 2020 New Revision: 362137 URL: https://svnweb.freebsd.org/changeset/base/362137 Log: Allow to be used in assembly. Hide C-only declarations under #ifndef LOCORE. This will be used by future changes to define ELF notes in assembly. Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25211 Modified: head/sys/sys/elf_common.h Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Fri Jun 12 23:42:36 2020 (r362136) +++ head/sys/sys/elf_common.h Fri Jun 12 23:43:44 2020 (r362137) @@ -46,12 +46,14 @@ * not include the padding. */ +#ifndef LOCORE typedef struct { u_int32_t n_namesz; /* Length of name. */ u_int32_t n_descsz; /* Length of descriptor. */ u_int32_t n_type; /* Type of this note. */ } Elf_Note; typedef Elf_Note Elf_Nhdr; +#endif /* * Option kinds. @@ -112,12 +114,14 @@ typedef Elf_Note Elf_Nhdr; * The header for GNU-style hash sections. */ +#ifndef LOCORE typedef struct { u_int32_t gh_nbuckets; /* Number of hash buckets. */ u_int32_t gh_symndx; /* First visible symbol in .dynsym. */ u_int32_t gh_maskwords; /* #maskwords used in bloom filter. */ u_int32_t gh_shift2; /* Bloom filter shift count. */ } Elf_GNU_Hash_Header; +#endif /* Indexes into the e_ident array. Keep synced with http://www.sco.com/developers/gabi/latest/ch4.eheader.html */ From owner-svn-src-head@freebsd.org Sat Jun 13 00:59:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18BA734B83F; Sat, 13 Jun 2020 00:59:38 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kK4T6TQrz4KF6; Sat, 13 Jun 2020 00:59:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D95F61265E; Sat, 13 Jun 2020 00:59:37 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05D0xbqt002455; Sat, 13 Jun 2020 00:59:37 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05D0xbns002451; Sat, 13 Jun 2020 00:59:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202006130059.05D0xbns002451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 13 Jun 2020 00:59:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362138 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 00:59:38 -0000 Author: cem Date: Sat Jun 13 00:59:36 2020 New Revision: 362138 URL: https://svnweb.freebsd.org/changeset/base/362138 Log: net80211: Add framework for debugnet(4) support Allow net80211 drivers to register a small vtable of debugnet-related methods. This is not a functional change. Driver support is needed, similar to debugnet(4) for wired NICs. Reviewed by: adrian, markj (earlier version both) Differential Revision: https://reviews.freebsd.org/D17308 Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Fri Jun 12 23:43:44 2020 (r362137) +++ head/sys/net80211/ieee80211_freebsd.c Sat Jun 13 00:59:36 2020 (r362138) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include +DEBUGNET_DEFINE(ieee80211); SYSCTL_NODE(_net, OID_AUTO, wlan, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "IEEE 80211 parameters"); @@ -111,7 +112,14 @@ wlan_clone_create(struct if_clone *ifc, int unit, cadd cp.icp_flags & IEEE80211_CLONE_MACADDR ? cp.icp_macaddr : ic->ic_macaddr); - return (vap == NULL ? EIO : 0); + if (vap == NULL) + return (EIO); + +#ifdef DEBUGNET + if (ic->ic_debugnet_meth != NULL) + DEBUGNET_SET(vap->iv_ifp, ieee80211); +#endif + return (0); } static void @@ -1046,6 +1054,54 @@ ieee80211_get_vap_ifname(struct ieee80211vap *vap) return "(none)"; return vap->iv_ifp->if_xname; } + +#ifdef DEBUGNET +static void +ieee80211_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize) +{ + struct ieee80211vap *vap; + struct ieee80211com *ic; + + vap = if_getsoftc(ifp); + ic = vap->iv_ic; + + IEEE80211_LOCK(ic); + ic->ic_debugnet_meth->dn8_init(ic, nrxr, ncl, clsize); + IEEE80211_UNLOCK(ic); +} + +static void +ieee80211_debugnet_event(struct ifnet *ifp, enum debugnet_ev ev) +{ + struct ieee80211vap *vap; + struct ieee80211com *ic; + + vap = if_getsoftc(ifp); + ic = vap->iv_ic; + + IEEE80211_LOCK(ic); + ic->ic_debugnet_meth->dn8_event(ic, ev); + IEEE80211_UNLOCK(ic); +} + +static int +ieee80211_debugnet_transmit(struct ifnet *ifp, struct mbuf *m) +{ + return (ieee80211_vap_transmit(ifp, m)); +} + +static int +ieee80211_debugnet_poll(struct ifnet *ifp, int count) +{ + struct ieee80211vap *vap; + struct ieee80211com *ic; + + vap = if_getsoftc(ifp); + ic = vap->iv_ic; + + return (ic->ic_debugnet_meth->dn8_poll(ic, count)); +} +#endif /* * Module glue. Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Fri Jun 12 23:43:44 2020 (r362137) +++ head/sys/net80211/ieee80211_freebsd.h Sat Jun 13 00:59:36 2020 (r362138) @@ -40,6 +40,10 @@ #include #include +#ifdef DEBUGNET +#include +#endif + /* * Common state locking definitions. */ @@ -492,6 +496,36 @@ typedef int ieee80211_ioctl_setfunc(struct ieee80211va struct ieee80211req *); SET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc); #define IEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set) + +#ifdef DEBUGNET +typedef void debugnet80211_init_t(struct ieee80211com *, int *nrxr, int *ncl, + int *clsize); +typedef void debugnet80211_event_t(struct ieee80211com *, enum debugnet_ev); +typedef int debugnet80211_poll_t(struct ieee80211com *, int); + +struct debugnet80211_methods { + debugnet80211_init_t *dn8_init; + debugnet80211_event_t *dn8_event; + debugnet80211_poll_t *dn8_poll; +}; + +#define DEBUGNET80211_DEFINE(driver) \ + static debugnet80211_init_t driver##_debugnet80211_init; \ + static debugnet80211_event_t driver##_debugnet80211_event; \ + static debugnet80211_poll_t driver##_debugnet80211_poll; \ + \ + static struct debugnet80211_methods driver##_debugnet80211_methods = { \ + .dn8_init = driver##_debugnet80211_init, \ + .dn8_event = driver##_debugnet80211_event, \ + .dn8_poll = driver##_debugnet80211_poll, \ + } +#define DEBUGNET80211_SET(ic, driver) \ + (ic)->ic_debugnet_meth = &driver##_debugnet80211_methods +#else +#define DEBUGNET80211_DEFINE(driver) +#define DEBUGNET80211_SET(ic, driver) +#endif /* DEBUGNET */ + #endif /* _KERNEL */ /* XXX this stuff belongs elsewhere */ Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Fri Jun 12 23:43:44 2020 (r362137) +++ head/sys/net80211/ieee80211_var.h Sat Jun 13 00:59:36 2020 (r362138) @@ -132,6 +132,8 @@ struct ieee80211_rx_ampdu; struct ieee80211_superg; struct ieee80211_frame; +struct net80211dump_methods; + struct ieee80211com { void *ic_softc; /* driver softc */ const char *ic_name; /* usually device name */ @@ -370,6 +372,7 @@ struct ieee80211com { /* The channel width has changed (20<->2040) */ void (*ic_update_chw)(struct ieee80211com *); + const struct debugnet80211_methods *ic_debugnet_meth; uint64_t ic_spare[7]; }; From owner-svn-src-head@freebsd.org Sat Jun 13 01:54:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A156C34C7C9; Sat, 13 Jun 2020 01:54:10 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kLHQ44k9z4MTd; Sat, 13 Jun 2020 01:54:10 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E89812E67; Sat, 13 Jun 2020 01:54:10 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05D1sAOb038769; Sat, 13 Jun 2020 01:54:10 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05D1sAVJ038767; Sat, 13 Jun 2020 01:54:10 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <202006130154.05D1sAVJ038767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sat, 13 Jun 2020 01:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362139 - in head/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 362139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 01:54:10 -0000 Author: dougm Date: Sat Jun 13 01:54:09 2020 New Revision: 362139 URL: https://svnweb.freebsd.org/changeset/base/362139 Log: Linuxkpi uses the rb-tree structures without using their interfaces, making them break when the representation changes. Revert changes that eliminated the color field from rb-trees, leaving everything as it was before. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D25250 Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h head/sys/sys/tree.h Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h Sat Jun 13 00:59:36 2020 (r362138) +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h Sat Jun 13 01:54:09 2020 (r362139) @@ -57,7 +57,11 @@ RB_HEAD(linux_root, rb_node); RB_PROTOTYPE(linux_root, rb_node, __entry, panic_cmp); #define rb_parent(r) RB_PARENT(r, __entry) +#define rb_color(r) RB_COLOR(r, __entry) +#define rb_is_red(r) (rb_color(r) == RB_RED) +#define rb_is_black(r) (rb_color(r) == RB_BLACK) #define rb_set_parent(r, p) rb_parent((r)) = (p) +#define rb_set_color(r, c) rb_color((r)) = (c) #define rb_entry(ptr, type, member) container_of(ptr, type, member) #define RB_EMPTY_ROOT(root) RB_EMPTY((struct linux_root *)root) @@ -78,6 +82,7 @@ rb_link_node(struct rb_node *node, struct rb_node *par struct rb_node **rb_link) { rb_set_parent(node, parent); + rb_set_color(node, RB_RED); node->__entry.rbe_left = node->__entry.rbe_right = NULL; *rb_link = node; } Modified: head/sys/sys/tree.h ============================================================================== --- head/sys/sys/tree.h Sat Jun 13 00:59:36 2020 (r362138) +++ head/sys/sys/tree.h Sat Jun 13 01:54:09 2020 (r362139) @@ -307,38 +307,35 @@ struct name { \ (root)->rbh_root = NULL; \ } while (/*CONSTCOND*/ 0) +#define RB_BLACK 0 +#define RB_RED 1 #define RB_ENTRY(type) \ struct { \ struct type *rbe_left; /* left element */ \ struct type *rbe_right; /* right element */ \ struct type *rbe_parent; /* parent element */ \ + int rbe_color; /* node color */ \ } -#define RB_LF(elm, field) (elm)->field.rbe_left -#define RB_RT(elm, field) (elm)->field.rbe_right -#define RB_FLIP(elm) (*(__uintptr_t *)&(elm) ^= 1) -#define RB_FLIP_LF(elm, field) RB_FLIP(RB_LF(elm, field)) -#define RB_FLIP_RT(elm, field) RB_FLIP(RB_RT(elm, field)) -#define RB_ISRED(elm) ((*(__uintptr_t *)&(elm) & 1) != 0) -#define RB_RED_LF(elm, field) RB_ISRED(RB_LF(elm, field)) -#define RB_RED_RT(elm, field) RB_ISRED(RB_RT(elm, field)) -#define RB_PTR(elm, field) ((__typeof(elm->field.rbe_parent)) \ - ((__uintptr_t)(elm) & ~(__uintptr_t)1)) -#define RB_LEFT(elm, field) RB_PTR(RB_LF(elm, field), field) -#define RB_RIGHT(elm, field) RB_PTR(RB_RT(elm, field), field) +#define RB_LEFT(elm, field) (elm)->field.rbe_left +#define RB_RIGHT(elm, field) (elm)->field.rbe_right #define RB_PARENT(elm, field) (elm)->field.rbe_parent +#define RB_COLOR(elm, field) (elm)->field.rbe_color +#define RB_ISRED(elm, field) ((elm) != NULL && RB_COLOR(elm, field) == RB_RED) #define RB_ROOT(head) (head)->rbh_root #define RB_EMPTY(head) (RB_ROOT(head) == NULL) -#define RB_BOOL int -#define RB_TRUE 1 -#define RB_FALSE 0 -/* For debugging support */ -#define RB_COLOR(elm, field) (RB_PARENT(elm, field) == NULL ? RB_FALSE : \ - RB_LEFT(RB_PARENT(elm, field), field) == elm ? \ - RB_RED_LF(RB_PARENT(elm, field), field) : \ - RB_RED_RT(RB_PARENT(elm, field), field)) +#define RB_SET(elm, parent, field) do { \ + RB_PARENT(elm, field) = parent; \ + RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \ + RB_COLOR(elm, field) = RB_RED; \ +} while (/*CONSTCOND*/ 0) +#define RB_SET_BLACKRED(black, red, field) do { \ + RB_COLOR(black, field) = RB_BLACK; \ + RB_COLOR(red, field) = RB_RED; \ +} while (/*CONSTCOND*/ 0) + /* * Something to be invoked in a loop at the root of every modified subtree, * from the bottom up to the root, to update augmented node data. @@ -347,42 +344,37 @@ struct { \ #define RB_AUGMENT(x) break #endif -/* - * Fix pointers to a parent, and from a parent, as part of rotation. - */ -#define RB_ROTATE_PARENT(head, elm, tmp, field) do { \ - if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) == NULL) \ - RB_ROOT(head) = (tmp); \ - else if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ - RB_LF(RB_PARENT(elm, field), field) = (tmp); \ - else \ - RB_RT(RB_PARENT(elm, field), field) = (tmp); \ - RB_PARENT(elm, field) = (tmp); \ -} while (/*CONSTCOND*/ 0) - -/* - * Rotation makes the descending node red, and the ascending - * node not-red. - */ #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ (tmp) = RB_RIGHT(elm, field); \ - if ((RB_RT(elm, field) = RB_LF(tmp, field)) != NULL) { \ + if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \ } \ - RB_ROTATE_PARENT(head, elm, tmp, field); \ - RB_LF(tmp, field) = (elm); \ - RB_FLIP_LF(tmp, field); \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ + else \ + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ + } else \ + (head)->rbh_root = (tmp); \ + RB_LEFT(tmp, field) = (elm); \ + RB_PARENT(elm, field) = (tmp); \ RB_AUGMENT(elm); \ } while (/*CONSTCOND*/ 0) #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ (tmp) = RB_LEFT(elm, field); \ - if ((RB_LF(elm, field) = RB_RT(tmp, field)) != NULL) { \ + if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \ } \ - RB_ROTATE_PARENT(head, elm, tmp, field); \ - RB_RT(tmp, field) = (elm); \ - RB_FLIP_RT(tmp, field); \ + if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) { \ + if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \ + RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \ + else \ + RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \ + } else \ + (head)->rbh_root = (tmp); \ + RB_RIGHT(tmp, field) = (elm); \ + RB_PARENT(elm, field) = (tmp); \ RB_AUGMENT(elm); \ } while (/*CONSTCOND*/ 0) @@ -447,105 +439,110 @@ struct { \ attr void \ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ { \ - struct type *gparent, *parent; \ - while ((parent = RB_PARENT(elm, field)) != NULL) { \ - if (RB_LEFT(parent, field) == elm) \ - RB_FLIP_LF(parent, field); \ - else \ - RB_FLIP_RT(parent, field); \ - if ((gparent = RB_PARENT(parent, field)) == NULL) \ - break; \ - if (RB_RED_LF(gparent, field) && \ - RB_RED_RT(gparent, field)) { \ - RB_FLIP_LF(gparent, field); \ - RB_FLIP_RT(gparent, field); \ - elm = gparent; \ - continue; \ - } \ - if (RB_RED_LF(gparent, field) && \ - parent == RB_LEFT(gparent, field)) { \ + struct type *parent, *gparent, *tmp; \ + while (RB_ISRED((parent = RB_PARENT(elm, field)), field)) { \ + gparent = RB_PARENT(parent, field); \ + if (parent == RB_LEFT(gparent, field)) { \ + tmp = RB_RIGHT(gparent, field); \ + if (RB_ISRED(tmp, field)) { \ + RB_COLOR(tmp, field) = RB_BLACK; \ + RB_SET_BLACKRED(parent, gparent, field);\ + elm = gparent; \ + continue; \ + } \ if (RB_RIGHT(parent, field) == elm) { \ - RB_ROTATE_LEFT(head, parent, elm, field);\ + RB_ROTATE_LEFT(head, parent, tmp, field);\ + tmp = parent; \ parent = elm; \ + elm = tmp; \ } \ - RB_ROTATE_RIGHT(head, gparent, parent, field); \ - } else if (RB_RED_RT(gparent, field) && \ - parent == RB_RIGHT(gparent, field)) { \ + RB_SET_BLACKRED(parent, gparent, field); \ + RB_ROTATE_RIGHT(head, gparent, tmp, field); \ + } else { \ + tmp = RB_LEFT(gparent, field); \ + if (RB_ISRED(tmp, field)) { \ + RB_COLOR(tmp, field) = RB_BLACK; \ + RB_SET_BLACKRED(parent, gparent, field);\ + elm = gparent; \ + continue; \ + } \ if (RB_LEFT(parent, field) == elm) { \ - RB_ROTATE_RIGHT(head, parent, elm, field);\ + RB_ROTATE_RIGHT(head, parent, tmp, field);\ + tmp = parent; \ parent = elm; \ + elm = tmp; \ } \ - RB_ROTATE_LEFT(head, gparent, parent, field); \ + RB_SET_BLACKRED(parent, gparent, field); \ + RB_ROTATE_LEFT(head, gparent, tmp, field); \ } \ - break; \ } \ + RB_COLOR(head->rbh_root, field) = RB_BLACK; \ } #define RB_GENERATE_REMOVE_COLOR(name, type, field, attr) \ attr void \ -name##_RB_REMOVE_COLOR(struct name *head, struct type *elm) \ +name##_RB_REMOVE_COLOR(struct name *head, struct type *parent) \ { \ - struct type *par, *sib, *tmp; \ - RB_BOOL go_left, left_child, red_par; \ - left_child = (RB_LEFT(elm, field) == NULL); \ + struct type *elm, *tmp; \ + elm = NULL; \ do { \ - go_left = left_child; \ - if (go_left ? \ - !RB_RED_RT(elm, field) : \ - !RB_RED_LF(elm, field)) { \ - par = RB_PARENT(elm, field); \ - left_child = par != NULL && \ - RB_LEFT(par, field) == elm; \ - red_par = left_child ? RB_RED_LF(par, field) : \ - par == NULL ? RB_TRUE : \ - RB_RED_RT(par, field); \ - } \ - if (go_left) { \ - if (RB_RED_RT(elm, field)) { \ - red_par = RB_TRUE; \ - RB_ROTATE_LEFT(head, elm, par, field); \ + if (RB_LEFT(parent, field) == elm) { \ + tmp = RB_RIGHT(parent, field); \ + if (RB_COLOR(tmp, field) == RB_RED) { \ + RB_SET_BLACKRED(tmp, parent, field); \ + RB_ROTATE_LEFT(head, parent, tmp, field);\ + tmp = RB_RIGHT(parent, field); \ } \ - sib = RB_RIGHT(elm, field); \ - if (RB_RED_LF(sib, field)) { \ - RB_ROTATE_RIGHT(head, sib, tmp, field); \ - sib = tmp; \ - } else if (!RB_RED_RT(sib, field)) { \ - RB_FLIP_RT(elm, field); \ - elm = par; \ + if (RB_ISRED(RB_LEFT(tmp, field), field)) { \ + struct type *oleft; \ + oleft = RB_LEFT(tmp, field); \ + RB_COLOR(oleft, field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_RED; \ + RB_ROTATE_RIGHT(head, tmp, oleft, field); \ + tmp = RB_RIGHT(parent, field); \ + } else if (!RB_ISRED(RB_RIGHT(tmp, field), field)) { \ + RB_COLOR(tmp, field) = RB_RED; \ + elm = parent; \ + parent = RB_PARENT(elm, field); \ continue; \ } \ - if (RB_RED_RT(sib, field)) \ - RB_FLIP_RT(sib, field); \ - RB_ROTATE_LEFT(head, elm, sib, field); \ - RB_FLIP_LF(sib, field); \ + if (RB_ISRED(RB_RIGHT(tmp, field), field)) \ + RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ + RB_COLOR(parent, field) = RB_BLACK; \ + RB_ROTATE_LEFT(head, parent, tmp, field); \ + elm = RB_ROOT(head); \ break; \ } else { \ - if (RB_RED_LF(elm, field)) { \ - red_par = RB_TRUE; \ - RB_ROTATE_RIGHT(head, elm, par, field); \ + tmp = RB_LEFT(parent, field); \ + if (RB_COLOR(tmp, field) == RB_RED) { \ + RB_SET_BLACKRED(tmp, parent, field); \ + RB_ROTATE_RIGHT(head, parent, tmp, field);\ + tmp = RB_LEFT(parent, field); \ } \ - sib = RB_LEFT(elm, field); \ - if (RB_RED_RT(sib, field)) { \ - RB_ROTATE_LEFT(head, sib, tmp, field); \ - sib = tmp; \ - } else if (!RB_RED_LF(sib, field)) { \ - RB_FLIP_LF(elm, field); \ - elm = par; \ + if (RB_ISRED(RB_RIGHT(tmp, field), field)) { \ + struct type *oright; \ + oright = RB_RIGHT(tmp, field); \ + RB_COLOR(oright, field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_RED; \ + RB_ROTATE_LEFT(head, tmp, oright, field); \ + tmp = RB_LEFT(parent, field); \ + } else if (!RB_ISRED(RB_LEFT(tmp, field), field)) { \ + RB_COLOR(tmp, field) = RB_RED; \ + elm = parent; \ + parent = RB_PARENT(elm, field); \ continue; \ } \ - if (RB_RED_LF(sib, field)) \ - RB_FLIP_LF(sib, field); \ - RB_ROTATE_RIGHT(head, elm, sib, field); \ - RB_FLIP_RT(sib, field); \ + if (RB_ISRED(RB_LEFT(tmp, field), field)) \ + RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK; \ + RB_COLOR(tmp, field) = RB_COLOR(parent, field); \ + RB_COLOR(parent, field) = RB_BLACK; \ + RB_ROTATE_RIGHT(head, parent, tmp, field); \ + elm = RB_ROOT(head); \ break; \ } \ - } while (!red_par); \ - if (par != NULL && red_par) { \ - if (left_child) \ - RB_FLIP_LF(par, field); \ - else \ - RB_FLIP_RT(par, field); \ - } \ + } while (!RB_ISRED(elm, field) && parent != NULL); \ + RB_COLOR(elm, field) = RB_BLACK; \ } #define RB_GENERATE_REMOVE(name, type, field, attr) \ @@ -553,11 +550,12 @@ attr struct type * \ name##_RB_REMOVE(struct name *head, struct type *elm) \ { \ struct type *child, *old, *parent, *parent_old, *right; \ - RB_BOOL old_red, red; \ + int color; \ \ old = elm; \ parent_old = parent = RB_PARENT(elm, field); \ right = RB_RIGHT(elm, field); \ + color = RB_COLOR(elm, field); \ if (RB_LEFT(elm, field) == NULL) \ elm = child = right; \ else if (right == NULL) \ @@ -565,8 +563,7 @@ name##_RB_REMOVE(struct name *head, struct type *elm) else { \ if ((child = RB_LEFT(right, field)) == NULL) { \ child = RB_RIGHT(right, field); \ - red = RB_RED_RT(old, field); \ - RB_RT(old, field) = child; \ + RB_RIGHT(old, field) = child; \ parent = elm = right; \ } else { \ do \ @@ -574,31 +571,23 @@ name##_RB_REMOVE(struct name *head, struct type *elm) while ((child = RB_LEFT(elm, field)) != NULL); \ child = RB_RIGHT(elm, field); \ parent = RB_PARENT(elm, field); \ - red = RB_RED_LF(parent, field); \ - RB_LF(parent, field) = child; \ + RB_LEFT(parent, field) = child; \ RB_PARENT(RB_RIGHT(old, field), field) = elm; \ } \ RB_PARENT(RB_LEFT(old, field), field) = elm; \ + color = RB_COLOR(elm, field); \ elm->field = old->field; \ } \ - if (parent_old == NULL) { \ + if (parent_old == NULL) \ RB_ROOT(head) = elm; \ - old_red = RB_FALSE; \ - } else if (RB_LEFT(parent_old, field) == old) { \ - old_red = RB_RED_LF(parent_old, field); \ - RB_LF(parent_old, field) = elm; \ - if (old_red && parent != parent_old) \ - RB_FLIP_LF(parent_old, field); \ - } else { \ - old_red = RB_RED_RT(parent_old, field); \ - RB_RT(parent_old, field) = elm; \ - if (old_red && parent != parent_old) \ - RB_FLIP_RT(parent_old, field); \ - } \ - if (child != NULL) \ + else if (RB_LEFT(parent_old, field) == old) \ + RB_LEFT(parent_old, field) = elm; \ + else \ + RB_RIGHT(parent_old, field) = elm; \ + if (child != NULL) { \ RB_PARENT(child, field) = parent; \ - else if (parent != NULL && \ - (parent != parent_old ? !red : !old_red)) \ + RB_COLOR(child, field) = RB_BLACK; \ + } else if (color != RB_RED && parent != NULL) \ name##_RB_REMOVE_COLOR(head, parent); \ while (parent != NULL) { \ RB_AUGMENT(parent); \ @@ -626,14 +615,14 @@ name##_RB_INSERT(struct name *head, struct type *elm) else \ return (tmp); \ } \ - RB_PARENT(elm, field) = parent; \ - RB_LF(elm, field) = RB_RT(elm, field) = NULL; \ - if (parent == NULL) \ + RB_SET(elm, parent, field); \ + if (parent != NULL) { \ + if (comp < 0) \ + RB_LEFT(parent, field) = elm; \ + else \ + RB_RIGHT(parent, field) = elm; \ + } else \ RB_ROOT(head) = elm; \ - else if (comp < 0) \ - RB_LF(parent, field) = elm; \ - else \ - RB_RT(parent, field) = elm; \ name##_RB_INSERT_COLOR(head, elm); \ while (elm != NULL) { \ RB_AUGMENT(elm); \ From owner-svn-src-head@freebsd.org Sat Jun 13 03:04:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04F1634E78D; Sat, 13 Jun 2020 03:04:41 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kMrm6Lhgz4R9k; Sat, 13 Jun 2020 03:04:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5217143DF; Sat, 13 Jun 2020 03:04:40 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05D34ecq082451; Sat, 13 Jun 2020 03:04:40 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05D34ekP082450; Sat, 13 Jun 2020 03:04:40 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202006130304.05D34ekP082450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 13 Jun 2020 03:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362141 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 03:04:41 -0000 Author: cem Date: Sat Jun 13 03:04:40 2020 New Revision: 362141 URL: https://svnweb.freebsd.org/changeset/base/362141 Log: Flip kern.tty_info_kstacks on by default It's a useful debug aid for anyone using Ctrl-T today, and doesn't seem to be widely known. So, enable it out of the box to help people find it. It's a tunable and sysctl, so if you don't like it, it's easy to disable locally. If people really hate it, we can always flip it back. Reported by: Daniel O'Connor Modified: head/sys/kern/tty_info.c Modified: head/sys/kern/tty_info.c ============================================================================== --- head/sys/kern/tty_info.c Sat Jun 13 02:24:35 2020 (r362140) +++ head/sys/kern/tty_info.c Sat Jun 13 03:04:40 2020 (r362141) @@ -239,7 +239,7 @@ sbuf_tty_drain(void *a, const char *d, int len) } #ifdef STACK -static bool tty_info_kstacks = false; +static bool tty_info_kstacks = true; SYSCTL_BOOL(_kern, OID_AUTO, tty_info_kstacks, CTLFLAG_RWTUN, &tty_info_kstacks, 0, "Enable printing kernel stack(9) traces on ^T (tty info)"); From owner-svn-src-head@freebsd.org Sat Jun 13 03:16:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1829234EB89; Sat, 13 Jun 2020 03:16:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kN616fsTz4RTl; Sat, 13 Jun 2020 03:16:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DFEDB142B3; Sat, 13 Jun 2020 03:16:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05D3G9YO089001; Sat, 13 Jun 2020 03:16:09 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05D3G9dq088999; Sat, 13 Jun 2020 03:16:09 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202006130316.05D3G9dq088999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 13 Jun 2020 03:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362142 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362142 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 03:16:10 -0000 Author: cem Date: Sat Jun 13 03:16:09 2020 New Revision: 362142 URL: https://svnweb.freebsd.org/changeset/base/362142 Log: Fix !DEBUGNET build after r362138 X-MFC-With: r362138 Modified: head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Sat Jun 13 03:04:40 2020 (r362141) +++ head/sys/net80211/ieee80211_freebsd.c Sat Jun 13 03:16:09 2020 (r362142) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Sat Jun 13 03:04:40 2020 (r362141) +++ head/sys/net80211/ieee80211_freebsd.h Sat Jun 13 03:16:09 2020 (r362142) @@ -40,9 +40,7 @@ #include #include -#ifdef DEBUGNET #include -#endif /* * Common state locking definitions. From owner-svn-src-head@freebsd.org Sat Jun 13 04:48:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 344243288E6; Sat, 13 Jun 2020 04:48:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kQ8J10zpz4XCp; Sat, 13 Jun 2020 04:48:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D9251588A; Sat, 13 Jun 2020 04:48:16 +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 05D4mGQh044838; Sat, 13 Jun 2020 04:48:16 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05D4lxa4044818; Sat, 13 Jun 2020 04:47:59 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202006130447.05D4lxa4044818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 13 Jun 2020 04:47:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362145 - in head/contrib/sqlite3: . tea X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head/contrib/sqlite3: . tea X-SVN-Commit-Revision: 362145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 04:48:16 -0000 Author: cy Date: Sat Jun 13 04:47:59 2020 New Revision: 362145 URL: https://svnweb.freebsd.org/changeset/base/362145 Log: MFV r362143: Update sqlite3 to 3.32.2 (3320200). CVE-2020-11655: SQLite through 3.31.1 allows attackers to cause a denial of service (segmentation fault) via a malformed window-function query because the AggInfo object's initialization is mishandled. CVE-2020-13434: SQLite through 3.32.0 has an integer overflow in sqlite3_str_vappendf in printf.c. CVE-2020-13435: SQLite through 3.32.0 has a segmentation fault in sqlite3ExprCodeTarget in expr.c. CVE-2020-13630: ext/fts3/fts3.c in SQLite before 3.32.0 has a use-after-free in fts3EvalNextRow, related to the snippet feature CVE-2020-13631: SQLite before 3.32.0 allows a virtual table to be renamed to the name of one of its shadow tables, related to alter.c and build.c. CVE-2020-13632: ext/fts3/fts3_snippet.c in SQLite before 3.32.0 ha s a NULL pointer dereference via a crafted matchinfo() query. PR: 247149 Reported by: spam123@bitbert.com MFC after: 3 days Security: vuxml: c4ac9c79-ab37-11ea-8b5e-b42e99a1b9c3 https://nvd.nist.gov/vuln/detail/CVE-2020-11655 https://nvd.nist.gov/vuln/detail/CVE-2020-13434 https://nvd.nist.gov/vuln/detail/CVE-2020-13435 https://nvd.nist.gov/vuln/detail/CVE-2020-13630 https://nvd.nist.gov/vuln/detail/CVE-2020-13631 https://nvd.nist.gov/vuln/detail/CVE-2020-13632 Modified: head/contrib/sqlite3/configure head/contrib/sqlite3/configure.ac head/contrib/sqlite3/shell.c head/contrib/sqlite3/sqlite3.c head/contrib/sqlite3/sqlite3.h head/contrib/sqlite3/tea/configure head/contrib/sqlite3/tea/configure.ac Directory Properties: head/contrib/sqlite3/ (props changed) Modified: head/contrib/sqlite3/configure ============================================================================== --- head/contrib/sqlite3/configure Sat Jun 13 03:52:15 2020 (r362144) +++ head/contrib/sqlite3/configure Sat Jun 13 04:47:59 2020 (r362145) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.32.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.32.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.32.0' -PACKAGE_STRING='sqlite 3.32.0' +PACKAGE_VERSION='3.32.2' +PACKAGE_STRING='sqlite 3.32.2' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.32.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.32.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.32.0:";; + short | recursive ) echo "Configuration of sqlite 3.32.2:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.32.0 +sqlite configure 3.32.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.32.0, which was +It was created by sqlite $as_me 3.32.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.32.0' + VERSION='3.32.2' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.32.0, which was +This file was extended by sqlite $as_me 3.32.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.32.0 +sqlite config.status 3.32.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/sqlite3/configure.ac ============================================================================== --- head/contrib/sqlite3/configure.ac Sat Jun 13 03:52:15 2020 (r362144) +++ head/contrib/sqlite3/configure.ac Sat Jun 13 04:47:59 2020 (r362145) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.32.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.32.2, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: head/contrib/sqlite3/shell.c ============================================================================== --- head/contrib/sqlite3/shell.c Sat Jun 13 03:52:15 2020 (r362144) +++ head/contrib/sqlite3/shell.c Sat Jun 13 04:47:59 2020 (r362145) @@ -6591,6 +6591,7 @@ int sqlite3_zipfile_init( /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include +#include /* ** Implementation of the "sqlar_compress(X)" SQL function. Modified: head/contrib/sqlite3/sqlite3.c ============================================================================== --- head/contrib/sqlite3/sqlite3.c Sat Jun 13 03:52:15 2020 (r362144) +++ head/contrib/sqlite3/sqlite3.c Sat Jun 13 04:47:59 2020 (r362145) @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.32.0. By combining all the individual C code files into this +** version 3.32.2. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -1162,9 +1162,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.32.0" -#define SQLITE_VERSION_NUMBER 3032000 -#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a" +#define SQLITE_VERSION "3.32.2" +#define SQLITE_VERSION_NUMBER 3032002 +#define SQLITE_SOURCE_ID "2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e86861e8c" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -17843,7 +17843,7 @@ struct Token { ** code for a SELECT that contains aggregate functions. ** ** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a -** pointer to this structure. The Expr.iColumn field is the index in +** pointer to this structure. The Expr.iAgg field is the index in ** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate ** code for that node. ** @@ -19082,6 +19082,9 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Sele SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*); SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*); SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*); +SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker*,Select*); +SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker*,Select*); + #ifdef SQLITE_DEBUG SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*); #endif @@ -28277,6 +28280,13 @@ static char *printfTempBuf(sqlite3_str *pAccum, sqlite #define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */ /* +** Hard limit on the precision of floating-point conversions. +*/ +#ifndef SQLITE_PRINTF_PRECISION_LIMIT +# define SQLITE_FP_PRECISION_LIMIT 100000000 +#endif + +/* ** Render a string given by "fmt" into the StrAccum object. */ SQLITE_API void sqlite3_str_vappendf( @@ -28476,6 +28486,8 @@ SQLITE_API void sqlite3_str_vappendf( ** xtype The class of the conversion. ** infop Pointer to the appropriate info struct. */ + assert( width>=0 ); + assert( precision>=(-1) ); switch( xtype ){ case etPOINTER: flag_long = sizeof(char*)==sizeof(i64) ? 2 : @@ -28597,6 +28609,11 @@ SQLITE_API void sqlite3_str_vappendf( length = 0; #else if( precision<0 ) precision = 6; /* Set default precision */ +#ifdef SQLITE_FP_PRECISION_LIMIT + if( precision>SQLITE_FP_PRECISION_LIMIT ){ + precision = SQLITE_FP_PRECISION_LIMIT; + } +#endif if( realvalue<0.0 ){ realvalue = -realvalue; prefix = '-'; @@ -28879,7 +28896,7 @@ SQLITE_API void sqlite3_str_vappendf( } isnull = escarg==0; if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); - /* For %q, %Q, and %w, the precision is the number of byte (or + /* For %q, %Q, and %w, the precision is the number of bytes (or ** characters if the ! flags is present) to use from the input. ** Because of the extra quoting characters inserted, the number ** of output characters may be larger than the precision. @@ -29964,8 +29981,9 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pVie #endif } if( pExpr->op==TK_AGG_FUNCTION ){ - sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s", - pExpr->op2, pExpr->u.zToken, zFlgs); + sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s iAgg=%d agg=%p", + pExpr->op2, pExpr->u.zToken, zFlgs, + pExpr->iAgg, pExpr->pAggInfo); }else if( pExpr->op2!=0 ){ const char *zOp2; char zBuf[8]; @@ -62135,12 +62153,14 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){ int rc; /* Return code */ int cnt = 0; /* Number of TryBeginRead attempts */ +#ifdef SQLITE_ENABLE_SNAPSHOT + int bChanged = 0; + WalIndexHdr *pSnapshot = pWal->pSnapshot; +#endif assert( pWal->ckptLock==0 ); #ifdef SQLITE_ENABLE_SNAPSHOT - int bChanged = 0; - WalIndexHdr *pSnapshot = pWal->pSnapshot; if( pSnapshot ){ if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){ bChanged = 1; @@ -85800,6 +85820,8 @@ SQLITE_PRIVATE int sqlite3VdbeExec( goto no_mem; } assert( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_BUSY ); + testcase( p->rc!=SQLITE_OK ); + p->rc = SQLITE_OK; assert( p->bIsReader || p->readOnly!=0 ); p->iCurrentTime = 0; assert( p->explain==0 ); @@ -97465,6 +97487,43 @@ SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, return WRC_Continue; } +/* Increase the walkerDepth when entering a subquery, and +** descrease when leaving the subquery. +*/ +SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker *pWalker, Select *pSelect){ + UNUSED_PARAMETER(pSelect); + pWalker->walkerDepth++; + return WRC_Continue; +} +SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker *pWalker, Select *pSelect){ + UNUSED_PARAMETER(pSelect); + pWalker->walkerDepth--; +} + + +/* +** No-op routine for the parse-tree walker. +** +** When this routine is the Walker.xExprCallback then expression trees +** are walked without any actions being taken at each node. Presumably, +** when this routine is used for Walker.xExprCallback then +** Walker.xSelectCallback is set to do something useful for every +** subquery in the parser tree. +*/ +SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){ + UNUSED_PARAMETER2(NotUsed, NotUsed2); + return WRC_Continue; +} + +/* +** No-op routine for the parse-tree walker for SELECT statements. +** subquery in the parser tree. +*/ +SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){ + UNUSED_PARAMETER2(NotUsed, NotUsed2); + return WRC_Continue; +} + /************** End of walker.c **********************************************/ /************** Begin file resolve.c *****************************************/ /* @@ -97493,6 +97552,8 @@ SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, ** ** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..) ** is a helper function - a callback for the tree walker. +** +** See also the sqlite3WindowExtraAggFuncDepth() routine in window.c */ static int incrAggDepth(Walker *pWalker, Expr *pExpr){ if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n; @@ -103234,7 +103295,10 @@ expr_code_doover: switch( op ){ case TK_AGG_COLUMN: { AggInfo *pAggInfo = pExpr->pAggInfo; - struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg]; + struct AggInfo_col *pCol; + assert( pAggInfo!=0 ); + assert( pExpr->iAgg>=0 && pExpr->iAggnColumn ); + pCol = &pAggInfo->aCol[pExpr->iAgg]; if( !pAggInfo->directMode ){ assert( pCol->iMem>0 ); return pCol->iMem; @@ -103534,7 +103598,10 @@ expr_code_doover: } case TK_AGG_FUNCTION: { AggInfo *pInfo = pExpr->pAggInfo; - if( pInfo==0 ){ + if( pInfo==0 + || NEVER(pExpr->iAgg<0) + || NEVER(pExpr->iAgg>=pInfo->nFunc) + ){ assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); }else{ @@ -105290,15 +105357,6 @@ static int analyzeAggregate(Walker *pWalker, Expr *pEx } return WRC_Continue; } -static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){ - UNUSED_PARAMETER(pSelect); - pWalker->walkerDepth++; - return WRC_Continue; -} -static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){ - UNUSED_PARAMETER(pSelect); - pWalker->walkerDepth--; -} /* ** Analyze the pExpr expression looking for aggregate functions and @@ -105312,8 +105370,8 @@ static void analyzeAggregatesInSelectEnd(Walker *pWalk SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){ Walker w; w.xExprCallback = analyzeAggregate; - w.xSelectCallback = analyzeAggregatesInSelect; - w.xSelectCallback2 = analyzeAggregatesInSelectEnd; + w.xSelectCallback = sqlite3WalkerDepthIncrease; + w.xSelectCallback2 = sqlite3WalkerDepthDecrease; w.walkerDepth = 0; w.u.pNC = pNC; w.pParse = 0; @@ -122035,7 +122093,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( sqlite3TableAffinity(v, pTab, regNewData+1); bAffinityDone = 1; } - VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName)); + VdbeNoopComment((v, "prep index %s", pIdx->zName)); iThisCur = iIdxCur+ix; @@ -134007,29 +134065,6 @@ static int selectExpander(Walker *pWalker, Select *p){ return WRC_Continue; } -/* -** No-op routine for the parse-tree walker. -** -** When this routine is the Walker.xExprCallback then expression trees -** are walked without any actions being taken at each node. Presumably, -** when this routine is used for Walker.xExprCallback then -** Walker.xSelectCallback is set to do something useful for every -** subquery in the parser tree. -*/ -SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - return WRC_Continue; -} - -/* -** No-op routine for the parse-tree walker for SELECT statements. -** subquery in the parser tree. -*/ -SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - return WRC_Continue; -} - #if SQLITE_DEBUG /* ** Always assert. This xSelectCallback2 implementation proves that the @@ -135200,7 +135235,7 @@ SQLITE_PRIVATE int sqlite3Select( #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x400 ){ int ii; - SELECTTRACE(0x400,pParse,p,("After aggregate analysis:\n")); + SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", &sAggInfo)); sqlite3TreeViewSelect(0, p, 0); for(ii=0; iiop2 values of those nodes +** due to the extra subquery layer that was added. +** +** See also the incrAggDepth() routine in resolve.c +*/ +static int sqlite3WindowExtraAggFuncDepth(Walker *pWalker, Expr *pExpr){ + if( pExpr->op==TK_AGG_FUNCTION + && pExpr->op2>=pWalker->walkerDepth + ){ + pExpr->op2++; + } + return WRC_Continue; +} + +/* ** If the SELECT statement passed as the second argument does not invoke ** any SQL window functions, this function is a no-op. Otherwise, it ** rewrites the SELECT statement so that window function xStep functions @@ -151353,6 +151405,7 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); if( p->pSrc ){ Table *pTab2; + Walker w; p->pSrc->a[0].pSelect = pSub; sqlite3SrcListAssignCursors(pParse, p->pSrc); pSub->selFlags |= SF_Expanded; @@ -151368,6 +151421,11 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, pTab->tabFlags |= TF_Ephemeral; p->pSrc->a[0].pTab = pTab; pTab = pTab2; + memset(&w, 0, sizeof(w)); + w.xExprCallback = sqlite3WindowExtraAggFuncDepth; + w.xSelectCallback = sqlite3WalkerDepthIncrease; + w.xSelectCallback2 = sqlite3WalkerDepthDecrease; + sqlite3WalkSelect(&w, pSub); } }else{ sqlite3SelectDelete(db, pSub); @@ -224766,7 +224824,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e86861e8c", -1, SQLITE_TRANSIENT); } /* @@ -229549,9 +229607,9 @@ SQLITE_API int sqlite3_stmt_init( #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ -#if __LINE__!=229552 +#if __LINE__!=229610 #undef SQLITE_SOURCE_ID -#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360falt2" +#define SQLITE_SOURCE_ID "2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e8686alt2" #endif /* Return the source-id for this library */ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } Modified: head/contrib/sqlite3/sqlite3.h ============================================================================== --- head/contrib/sqlite3/sqlite3.h Sat Jun 13 03:52:15 2020 (r362144) +++ head/contrib/sqlite3/sqlite3.h Sat Jun 13 04:47:59 2020 (r362145) @@ -123,9 +123,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.32.0" -#define SQLITE_VERSION_NUMBER 3032000 -#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a" +#define SQLITE_VERSION "3.32.2" +#define SQLITE_VERSION_NUMBER 3032002 +#define SQLITE_SOURCE_ID "2020-06-04 12:58:43 ec02243ea6ce33b090870ae55ab8aa2534b54d216d45c4aa2fdbb00e86861e8c" /* ** CAPI3REF: Run-Time Library Version Numbers Modified: head/contrib/sqlite3/tea/configure ============================================================================== --- head/contrib/sqlite3/tea/configure Sat Jun 13 03:52:15 2020 (r362144) +++ head/contrib/sqlite3/tea/configure Sat Jun 13 04:47:59 2020 (r362145) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.32.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.32.2. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.32.0' -PACKAGE_STRING='sqlite 3.32.0' +PACKAGE_VERSION='3.32.2' +PACKAGE_STRING='sqlite 3.32.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1303,7 +1303,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.32.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.32.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1365,7 +1365,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.32.0:";; + short | recursive ) echo "Configuration of sqlite 3.32.2:";; esac cat <<\_ACEOF @@ -1467,7 +1467,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.32.0 +sqlite configure 3.32.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1878,7 +1878,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.32.0, which was +It was created by sqlite $as_me 3.32.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -9373,7 +9373,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.32.0, which was +This file was extended by sqlite $as_me 3.32.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9426,7 +9426,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.32.0 +sqlite config.status 3.32.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: head/contrib/sqlite3/tea/configure.ac ============================================================================== --- head/contrib/sqlite3/tea/configure.ac Sat Jun 13 03:52:15 2020 (r362144) +++ head/contrib/sqlite3/tea/configure.ac Sat Jun 13 04:47:59 2020 (r362145) @@ -19,7 +19,7 @@ dnl to configure the system for the local environment. # so you can encode the package version directly into the source files. #----------------------------------------------------------------------- -AC_INIT([sqlite], [3.32.0]) +AC_INIT([sqlite], [3.32.2]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. From owner-svn-src-head@freebsd.org Sat Jun 13 08:37:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9526632FBD9; Sat, 13 Jun 2020 08:37:25 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kWDj3RnRz3W9v; Sat, 13 Jun 2020 08:37:25 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 578B21833F; Sat, 13 Jun 2020 08:37:25 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05D8bP3C092906; Sat, 13 Jun 2020 08:37:25 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05D8bOOr092904; Sat, 13 Jun 2020 08:37:24 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202006130837.05D8bOOr092904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sat, 13 Jun 2020 08:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362146 - in head/usr.bin/locale: . tests X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: in head/usr.bin/locale: . tests X-SVN-Commit-Revision: 362146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 08:37:25 -0000 Author: yuripv Date: Sat Jun 13 08:37:24 2020 New Revision: 362146 URL: https://svnweb.freebsd.org/changeset/base/362146 Log: locale: exit 1 if unknown keyword was specified PR: 241906 Submitted by: Akos Somfai Modified: head/usr.bin/locale/locale.c head/usr.bin/locale/tests/locale_test.sh Modified: head/usr.bin/locale/locale.c ============================================================================== --- head/usr.bin/locale/locale.c Sat Jun 13 04:47:59 2020 (r362145) +++ head/usr.bin/locale/locale.c Sat Jun 13 08:37:24 2020 (r362146) @@ -61,7 +61,7 @@ void list_locales(void); const char *lookup_localecat(int); char *kwval_lconv(int); int kwval_lookup(const char *, char **, int *, int *, int *); -void showdetails(const char *); +int showdetails(const char *); void showkeywordslist(char *substring); void showlocale(void); void usage(void); @@ -414,7 +414,8 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); if (argc > 0) { while (argc > 0) { - showdetails(*argv); + if (showdetails(*argv) != 0) + exit(EXIT_FAILURE); argv++; argc--; } @@ -837,19 +838,16 @@ kwval_lookup(const char *kwname, char **kwval, int *ca * Show details about requested keyword according to '-k' and/or '-c' * command line options specified. */ -void +int showdetails(const char *kw) { int type, cat, tmpval, alloc; char *kwval; if (kwval_lookup(kw, &kwval, &cat, &type, &alloc) == 0) { - /* - * invalid keyword specified. - * XXX: any actions? - */ + /* Invalid keyword specified */ fprintf(stderr, "Unknown keyword: `%s'\n", kw); - return; + return (1); } if (prt_categories) { @@ -889,6 +887,8 @@ showdetails(const char *kw) if (alloc) free(kwval); + + return (0); } /* Modified: head/usr.bin/locale/tests/locale_test.sh ============================================================================== --- head/usr.bin/locale/tests/locale_test.sh Sat Jun 13 04:47:59 2020 (r362145) +++ head/usr.bin/locale/tests/locale_test.sh Sat Jun 13 08:37:24 2020 (r362146) @@ -160,8 +160,24 @@ no_flags_posix_body() noexpr } +atf_test_case k_flag_unknown_kw +k_flag_unknown_kw_head() +{ + atf_set "descr" \ + "Verify 'locale -k' exit status is '1' for unknown keywords" +} +k_flag_unknown_kw_body() +{ + export LC_ALL="C" + + # Hopefully the keyword will stay nonexistent + atf_check -s exit:1 -o empty -e ignore locale -k nonexistent +} + + atf_init_test_cases() { atf_add_test_case k_flag_posix atf_add_test_case no_flags_posix + atf_add_test_case k_flag_unknown_kw } From owner-svn-src-head@freebsd.org Sat Jun 13 09:16:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F27B7330EDF; Sat, 13 Jun 2020 09:16:07 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kX5M68jqz3YTl; Sat, 13 Jun 2020 09:16:07 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEA7118B26; Sat, 13 Jun 2020 09:16:07 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05D9G7pK017784; Sat, 13 Jun 2020 09:16:07 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05D9G7eX017783; Sat, 13 Jun 2020 09:16:07 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202006130916.05D9G7eX017783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sat, 13 Jun 2020 09:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362147 - head/usr.bin/awk X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/usr.bin/awk X-SVN-Commit-Revision: 362147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 09:16:08 -0000 Author: yuripv Date: Sat Jun 13 09:16:07 2020 New Revision: 362147 URL: https://svnweb.freebsd.org/changeset/base/362147 Log: awk(1): use -version instead of -V -V is OpenBSD specific, use -version instead. While here, fix issue reported by mandoc lint and drop nonexistent script(7) reference. PR: 247004 Reviewed by: 0mp, markj Differential Revision: https://reviews.freebsd.org/D25164 Modified: head/usr.bin/awk/awk.1 Modified: head/usr.bin/awk/awk.1 ============================================================================== --- head/usr.bin/awk/awk.1 Sat Jun 13 08:37:24 2020 (r362146) +++ head/usr.bin/awk/awk.1 Sat Jun 13 09:16:07 2020 (r362147) @@ -23,7 +23,7 @@ .\" THIS SOFTWARE. .\" .\" $FreeBSD$ -.Dd $Mdocdate: September 14 2015 $ +.Dd $Mdocdate: June 6 2020 $ .Dt AWK 1 .Os .Sh NAME @@ -32,7 +32,7 @@ .Sh SYNOPSIS .Nm awk .Op Fl safe -.Op Fl V +.Op Fl version .Op Fl d Ns Op Ar n .Op Fl F Ar fs .Op Fl v Ar var Ns = Ns Ar value @@ -101,7 +101,7 @@ approximation to a .Dq safe version of .Nm . -.It Fl V +.It Fl version Print the version number of .Nm to standard output and exit. @@ -265,7 +265,7 @@ and concatenation .Pq indicated by whitespace . The operators .Ic \&! ++ \-\- += \-= *= /= %= ^= -.Ic > >= < <= == != ?: +.Ic > >= < <= == != ?\&: are also available in expressions. Variables may be scalars, array elements (denoted @@ -752,8 +752,7 @@ Print an error message to standard error: .Xr lex 1 , .Xr printf 1 , .Xr sed 1 , -.Xr re_format 7 , -.Xr script 7 +.Xr re_format 7 .Rs .%A A. V. Aho .%A B. W. Kernighan @@ -774,9 +773,10 @@ except does not support {n,m} pattern matching. .Pp The flags -.Op Fl \&dV +.Fl d , +.Fl safe , and -.Op Fl safe , +.Fl version as well as the commands .Cm fflush , compl , and , or , .Cm xor , lshift , rshift , From owner-svn-src-head@freebsd.org Sat Jun 13 14:11:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A83E03397AD; Sat, 13 Jun 2020 14:11:02 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kfdf41hkz46dY; Sat, 13 Jun 2020 14:11:02 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84F5D1C6B6; Sat, 13 Jun 2020 14:11:02 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05DEB2Vj097869; Sat, 13 Jun 2020 14:11:02 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DEB2mP097868; Sat, 13 Jun 2020 14:11:02 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202006131411.05DEB2mP097868@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sat, 13 Jun 2020 14:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362148 - head/contrib/nvi/common X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/contrib/nvi/common X-SVN-Commit-Revision: 362148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 14:11:02 -0000 Author: yuripv Date: Sat Jun 13 14:11:02 2020 New Revision: 362148 URL: https://svnweb.freebsd.org/changeset/base/362148 Log: nvi: fallback to ISO8859-1 as last resort Current logic of using user's locale encoding that is UTF-8 doesn't make much sense if we already failed the looks_utf8() check and skipped encoding set using "fileencoding" as being UTF-8 as well; fallback to ISO8859-1 in that case. Reviewed by: Zhihao Yuan Differential Revision: https://reviews.freebsd.org/D24919 Modified: head/contrib/nvi/common/exf.c Modified: head/contrib/nvi/common/exf.c ============================================================================== --- head/contrib/nvi/common/exf.c Sat Jun 13 09:16:07 2020 (r362147) +++ head/contrib/nvi/common/exf.c Sat Jun 13 14:11:02 2020 (r362148) @@ -1237,7 +1237,10 @@ file_encinit(SCR *sp) } /* - * Detect UTF-8 and fallback to the locale/preset encoding. + * 1. Check for valid UTF-8. + * 2. Check if fallback fileencoding is set and is NOT UTF-8. + * 3. Check if user locale's encoding is NOT UTF-8. + * 4. Use ISO8859-1 as last resort. * * XXX * A manually set O_FILEENCODING indicates the "fallback @@ -1246,9 +1249,13 @@ file_encinit(SCR *sp) */ if (looks_utf8(buf, blen) > 1) o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0); - else if (!O_ISSET(sp, O_FILEENCODING) || - !strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8")) + else if (O_ISSET(sp, O_FILEENCODING) && + strcasecmp(O_STR(sp, O_FILEENCODING), "utf-8") != 0) + /* Use fileencoding as is */ ; + else if (strcasecmp(codeset(), "utf-8") != 0) o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0); + else + o_set(sp, O_FILEENCODING, OS_STRDUP, "iso8859-1", 0); conv_enc(sp, O_FILEENCODING, 0); #endif From owner-svn-src-head@freebsd.org Sat Jun 13 17:36:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FB7333E2D3; Sat, 13 Jun 2020 17:36:09 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49klBK2byPz4Jn5; Sat, 13 Jun 2020 17:36:09 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5491A1EAB2; Sat, 13 Jun 2020 17:36:09 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05DHa9h0025456; Sat, 13 Jun 2020 17:36:09 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DHa9fY025455; Sat, 13 Jun 2020 17:36:09 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202006131736.05DHa9fY025455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Sat, 13 Jun 2020 17:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362149 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 362149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 17:36:09 -0000 Author: fernape (ports committer) Date: Sat Jun 13 17:36:08 2020 New Revision: 362149 URL: https://svnweb.freebsd.org/changeset/base/362149 Log: sockstat(1): Add EXAMPLES to man page Add three examples showing the use of -4, -6, -l, -L, -p and -P Reviewed by: gbe@ Approved by: bcr@ Modified: head/usr.bin/sockstat/sockstat.1 Modified: head/usr.bin/sockstat/sockstat.1 ============================================================================== --- head/usr.bin/sockstat/sockstat.1 Sat Jun 13 14:11:02 2020 (r362148) +++ head/usr.bin/sockstat/sockstat.1 Sat Jun 13 17:36:08 2020 (r362149) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 3, 2018 +.Dd June 13, 2020 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -177,6 +177,23 @@ If a socket is associated with more than one file desc it is shown multiple times. If a socket is not associated with any file descriptor, the first four columns have no meaning. +.Sh EXAMPLES +Show information for IPv4 sockets listening on port 22 using protocol +TCP: +.Bd -literal -offset indent +$ sockstat -4 -l -P tcp -p 22 +.Ed +.Pp +Show information for sockets using either TCP or UDP, if neither, the local nor +the foreign addresses are in the loopback network: +.Bd -literal -offset indent +$ sockstat -L -P tcp,udp +.Ed +.Pp +Show TCP IPv6 sockets which are listening and connected (default): +.Bd -literal -offset indent +$ sockstat -6 -P tcp +.Ed .Sh SEE ALSO .Xr fstat 1 , .Xr netstat 1 , From owner-svn-src-head@freebsd.org Sat Jun 13 18:18:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 248E533EBF4; Sat, 13 Jun 2020 18:18:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49km7H09zWz4LD9; Sat, 13 Jun 2020 18:18:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBDF61F65F; Sat, 13 Jun 2020 18:18:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05DIIYGn050478; Sat, 13 Jun 2020 18:18:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DIIYBH050477; Sat, 13 Jun 2020 18:18:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006131818.05DIIYBH050477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 13 Jun 2020 18:18:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362150 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 362150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 18:18:35 -0000 Author: kib Date: Sat Jun 13 18:18:34 2020 New Revision: 362150 URL: https://svnweb.freebsd.org/changeset/base/362150 Log: procctl(2): consistently refer to the data pointer as 'data'. Reviewed by: bcr Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25258 Modified: head/lib/libc/sys/procctl.2 Modified: head/lib/libc/sys/procctl.2 ============================================================================== --- head/lib/libc/sys/procctl.2 Sat Jun 13 17:36:08 2020 (r362149) +++ head/lib/libc/sys/procctl.2 Sat Jun 13 18:18:34 2020 (r362150) @@ -40,7 +40,7 @@ .Sh SYNOPSIS .In sys/procctl.h .Ft int -.Fn procctl "idtype_t idtype" "id_t id" "int cmd" "void *arg" +.Fn procctl "idtype_t idtype" "id_t id" "int cmd" "void *data" .Sh DESCRIPTION The .Fn procctl @@ -80,7 +80,7 @@ by in the specified process or its descendants that did not changed the control nor modified it by other means. The -.Va arg +.Fa data parameter must point to the integer variable holding one of the following values: .Bl -tag -width PROC_ASLR_FORCE_DISABLE @@ -99,7 +99,7 @@ Use the system-wide configured policy for ASLR. .It Dv PROC_ASLR_STATUS Returns the current status of ASLR enablement for the target process. The -.Va arg +.Fa data parameter must point to the integer variable, where one of the following values is written: .Bl -tag -width PROC_ASLR_FORCE_DISABLE @@ -119,7 +119,7 @@ argument of the .Xr mmap 2 syscall, in the target process. The -.Va arg +.Fa data parameter must point to the integer variable holding one of the following values: .Bl -tag -width PROC_PROTMAX_FORCE_DISABLE @@ -140,7 +140,7 @@ Use the system-wide configured policy for PROT_MAX. Returns the current status of implicit PROT_MAX enablement for the target process. The -.Va arg +.Fa data parameter must point to the integer variable, where one of the following values is written: .Bl -tag -width PROC_PROTMAX_FORCE_DISABLE @@ -158,7 +158,7 @@ Set process protection state. This is used to mark a process as protected from being killed if the system exhausts the available memory and swap. The -.Fa arg +.Fa data parameter must point to an integer containing an operation and zero or more optional flags. The following operations are supported: From owner-svn-src-head@freebsd.org Sat Jun 13 18:19:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35C4233F07C; Sat, 13 Jun 2020 18:19:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49km8b0gKhz4Lmm; Sat, 13 Jun 2020 18:19:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 121851F434; Sat, 13 Jun 2020 18:19:43 +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 05DIJgRV050579; Sat, 13 Jun 2020 18:19:42 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DIJgZG050578; Sat, 13 Jun 2020 18:19:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006131819.05DIJgZG050578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 13 Jun 2020 18:19:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362151 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 362151 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 18:19:43 -0000 Author: kib Date: Sat Jun 13 18:19:42 2020 New Revision: 362151 URL: https://svnweb.freebsd.org/changeset/base/362151 Log: procctl(2): document PROC_KPTI Reviewed by: bcr Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25258 Modified: head/lib/libc/sys/procctl.2 Modified: head/lib/libc/sys/procctl.2 ============================================================================== --- head/lib/libc/sys/procctl.2 Sat Jun 13 18:18:34 2020 (r362150) +++ head/lib/libc/sys/procctl.2 Sat Jun 13 18:19:42 2020 (r362151) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 16, 2020 +.Dd June 13, 2020 .Dt PROCCTL 2 .Os .Sh NAME @@ -565,6 +565,47 @@ Stack gaps are disabled in the process after .Xr execve 2 . .El .El +.Sh x86 MACHINE-SPECIFIC REQUESTS +.Bl -tag -width PROC_KPTI_STATUS +.It Dv PROC_KPTI_CTL +AMD64 only. +Controls the Kernel Page Table Isolation (KPTI) option for the children +of the specified process. +For the command to work, the +.Va vm.pmap.kpti +tunable must be enabled on boot. +It is not possible to change the KPTI setting for a running process, +except at the +.Xr execve 2 , +where the address space is reinitialized. +.Pp +The +.Fa data +parameter must point to an integer variable containing one of the +following commands: +.Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC +.It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC +Enable KPTI after +.Xr execve 2 . +.It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC +Disable KPTI after +.Xr execve 2 . +Only root or a process having the +.Va PRIV_IO +privilege might use this option. +.El +.It Dv PROC_KPTI_STATUS +Returns the current KPTI status for the specified process. +.Fa data must point to the integer variable, which returns the +following statuses: +.Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC +.It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC +.It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC +.El +.Pp +The status is or-ed with the +.Va PROC_KPTI_STATUS_ACTIVE +in case KPTI is active for the current address space of the process. .Sh NOTES Disabling tracing on a process should not be considered a security feature, as it is bypassable both by the kernel and privileged processes, From owner-svn-src-head@freebsd.org Sat Jun 13 18:21:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BF0B33EE64; Sat, 13 Jun 2020 18:21:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kmBg3NLYz4LwG; Sat, 13 Jun 2020 18:21:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F34D1F3D7; Sat, 13 Jun 2020 18:21:31 +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 05DILVkP053799; Sat, 13 Jun 2020 18:21:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DILVnR053798; Sat, 13 Jun 2020 18:21:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006131821.05DILVnR053798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 13 Jun 2020 18:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362152 - head/usr.bin/ldd X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.bin/ldd X-SVN-Commit-Revision: 362152 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 18:21:31 -0000 Author: kib Date: Sat Jun 13 18:21:31 2020 New Revision: 362152 URL: https://svnweb.freebsd.org/changeset/base/362152 Log: Fix ldd for PIE binaries after rtld stopped accepting binaries for dlopen. ldd proclaims ET_DYN objects as shared libraries and tries to dlopen(RTLD_TRACE) them to get dependencies. Since PIE binaries are ET_DYN | DF_1_PIE, refusal to dlopen such binaries breaks ldd. Fix it by reading and parsing dynamic segment looking for DF_FLAG_1 and taking DF_1_PIE into account when deciding between binary and library. Reported by: Dewayne Geraghty Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25257 Modified: head/usr.bin/ldd/ldd.c Modified: head/usr.bin/ldd/ldd.c ============================================================================== --- head/usr.bin/ldd/ldd.c Sat Jun 13 18:19:42 2020 (r362151) +++ head/usr.bin/ldd/ldd.c Sat Jun 13 18:21:31 2020 (r362152) @@ -289,10 +289,18 @@ is_executable(const char *fname, int fd, int *is_shlib #endif Elf_Ehdr elf; } hdr; - int n; + Elf_Phdr phdr, dynphdr; + Elf_Dyn *dynp; + void *dyndata; +#if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED) + Elf32_Phdr phdr32, dynphdr32; + Elf32_Dyn *dynp32; +#endif + int df1pie, dynamic, i, n; *is_shlib = 0; *type = TYPE_UNKNOWN; + df1pie = 0; if ((n = read(fd, &hdr, sizeof(hdr))) == -1) { warn("%s: can't read program header", fname); @@ -320,8 +328,6 @@ is_executable(const char *fname, int fd, int *is_shlib if ((size_t)n >= sizeof(hdr.elf32) && IS_ELF(hdr.elf32) && hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) { /* Handle 32 bit ELF objects */ - Elf32_Phdr phdr; - int dynamic, i; dynamic = 0; *type = TYPE_ELF32; @@ -331,13 +337,14 @@ is_executable(const char *fname, int fd, int *is_shlib return (0); } for (i = 0; i < hdr.elf32.e_phnum; i++) { - if (read(fd, &phdr, hdr.elf32.e_phentsize) != - sizeof(phdr)) { + if (read(fd, &phdr32, hdr.elf32.e_phentsize) != + sizeof(phdr32)) { warnx("%s: can't read program header", fname); return (0); } - if (phdr.p_type == PT_DYNAMIC) { + if (phdr32.p_type == PT_DYNAMIC) { dynamic = 1; + dynphdr32 = phdr32; break; } } @@ -346,9 +353,36 @@ is_executable(const char *fname, int fd, int *is_shlib warnx("%s: not a dynamic ELF executable", fname); return (0); } + if (hdr.elf32.e_type == ET_DYN) { + if (lseek(fd, dynphdr32.p_offset, SEEK_SET) == -1) { + warnx("%s: dynamic segment out of range", + fname); + return (0); + } + dyndata = malloc(dynphdr32.p_filesz); + if (dyndata == NULL) { + warn("malloc"); + return (0); + } + if (read(fd, dyndata, dynphdr32.p_filesz) != + (ssize_t)dynphdr32.p_filesz) { + free(dyndata); + warnx("%s: can't read dynamic segment", fname); + return (0); + } + for (dynp32 = dyndata; dynp32->d_tag != DT_NULL; + dynp32++) { + if (dynp32->d_tag != DT_FLAGS_1) + continue; + df1pie = (dynp32->d_un.d_val & DF_1_PIE) != 0; + break; + } + free(dyndata); + if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { - *is_shlib = 1; + if (!df1pie) + *is_shlib = 1; return (1); } warnx("%s: not a FreeBSD ELF shared object", fname); @@ -362,8 +396,6 @@ is_executable(const char *fname, int fd, int *is_shlib if ((size_t)n >= sizeof(hdr.elf) && IS_ELF(hdr.elf) && hdr.elf.e_ident[EI_CLASS] == ELF_TARG_CLASS) { /* Handle default ELF objects on this architecture */ - Elf_Phdr phdr; - int dynamic, i; dynamic = 0; *type = TYPE_ELF; @@ -380,6 +412,7 @@ is_executable(const char *fname, int fd, int *is_shlib } if (phdr.p_type == PT_DYNAMIC) { dynamic = 1; + dynphdr = phdr; break; } } @@ -388,10 +421,36 @@ is_executable(const char *fname, int fd, int *is_shlib warnx("%s: not a dynamic ELF executable", fname); return (0); } + if (hdr.elf.e_type == ET_DYN) { + if (lseek(fd, dynphdr.p_offset, SEEK_SET) == -1) { + warnx("%s: dynamic segment out of range", + fname); + return (0); + } + dyndata = malloc(dynphdr.p_filesz); + if (dyndata == NULL) { + warn("malloc"); + return (0); + } + if (read(fd, dyndata, dynphdr.p_filesz) != + (ssize_t)dynphdr.p_filesz) { + free(dyndata); + warnx("%s: can't read dynamic segment", fname); + return (0); + } + for (dynp = dyndata; dynp->d_tag != DT_NULL; dynp++) { + if (dynp->d_tag != DT_FLAGS_1) + continue; + df1pie = (dynp->d_un.d_val & DF_1_PIE) != 0; + break; + } + free(dyndata); + switch (hdr.elf.e_ident[EI_OSABI]) { case ELFOSABI_FREEBSD: - *is_shlib = 1; + if (!df1pie) + *is_shlib = 1; return (1); #ifdef __ARM_EABI__ case ELFOSABI_NONE: From owner-svn-src-head@freebsd.org Sat Jun 13 18:39:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2194D33F772; Sat, 13 Jun 2020 18:39:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kmZr031fz4Ml1; Sat, 13 Jun 2020 18:39:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F100B1FA2F; Sat, 13 Jun 2020 18:38:59 +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 05DIcxr5062683; Sat, 13 Jun 2020 18:38:59 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DIcxLd062682; Sat, 13 Jun 2020 18:38:59 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006131838.05DIcxLd062682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 13 Jun 2020 18:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362153 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 18:39:00 -0000 Author: tuexen Date: Sat Jun 13 18:38:59 2020 New Revision: 362153 URL: https://svnweb.freebsd.org/changeset/base/362153 Log: Simpify a condition, no functional change. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Jun 13 18:21:31 2020 (r362152) +++ head/sys/netinet/sctp_input.c Sat Jun 13 18:38:59 2020 (r362153) @@ -5594,9 +5594,8 @@ trigger_send: if (!TAILQ_EMPTY(&stcb->asoc.asconf_send_queue) || cnt_ctrl_ready || stcb->asoc.trigger_reset || - ((un_sent) && - (stcb->asoc.peers_rwnd > 0 || - (stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0)))) { + ((un_sent > 0) && + (stcb->asoc.peers_rwnd > 0 || stcb->asoc.total_flight == 0))) { SCTPDBG(SCTP_DEBUG_INPUT3, "Calling chunk OUTPUT\n"); sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); SCTPDBG(SCTP_DEBUG_INPUT3, "chunk OUTPUT returns\n"); From owner-svn-src-head@freebsd.org Sat Jun 13 21:23:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38A6E34360E; Sat, 13 Jun 2020 21:23:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49krDb0k7sz4Vmk; Sat, 13 Jun 2020 21:23:27 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE236219C8; Sat, 13 Jun 2020 21:23:26 +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 05DLNQT2067052; Sat, 13 Jun 2020 21:23:26 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DLNQIT067050; Sat, 13 Jun 2020 21:23:26 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006132123.05DLNQIT067050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 13 Jun 2020 21:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362155 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 21:23:27 -0000 Author: tuexen Date: Sat Jun 13 21:23:26 2020 New Revision: 362155 URL: https://svnweb.freebsd.org/changeset/base/362155 Log: Remove usage of empty macro. MFC after: 1 week Modified: head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_pcb.c Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Sat Jun 13 20:54:18 2020 (r362154) +++ head/sys/netinet/sctp_os_bsd.h Sat Jun 13 21:23:26 2020 (r362155) @@ -312,11 +312,6 @@ typedef struct callout sctp_os_timer_t; #define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, nh) ((uint32_t)((nh != NULL) ? nh->nh_mtu : 0)) #define SCTP_GATHER_MTU_FROM_INTFC(sctp_ifn) ((sctp_ifn->ifn_p != NULL) ? ((struct ifnet *)(sctp_ifn->ifn_p))->if_mtu : 0) -/* (de-)register interface event notifications */ -#define SCTP_REGISTER_INTERFACE(ifhandle, af) -#define SCTP_DEREGISTER_INTERFACE(ifhandle, af) - - /*************************/ /* These are for logging */ /*************************/ Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Jun 13 20:54:18 2020 (r362154) +++ head/sys/netinet/sctp_pcb.c Sat Jun 13 21:23:26 2020 (r362155) @@ -301,8 +301,6 @@ sctp_delete_ifn(struct sctp_ifn *sctp_ifnp, int hold_a SCTP_IPI_ADDR_WLOCK(); LIST_REMOVE(sctp_ifnp, next_bucket); LIST_REMOVE(sctp_ifnp, next_ifn); - SCTP_DEREGISTER_INTERFACE(sctp_ifnp->ifn_index, - sctp_ifnp->registered_af); if (hold_addr_lock == 0) SCTP_IPI_ADDR_WUNLOCK(); /* Take away the reference, and possibly free it */ @@ -430,7 +428,6 @@ sctp_add_ifa_to_ifn(struct sctp_ifn *sctp_ifnp, struct } if (sctp_ifnp->ifa_count == 1) { /* register the new interface */ - SCTP_REGISTER_INTERFACE(sctp_ifnp->ifn_index, ifa_af); sctp_ifnp->registered_af = ifa_af; } } @@ -471,13 +468,9 @@ sctp_remove_ifa_from_ifn(struct sctp_ifa *sctp_ifap) /* re-register address family type, if needed */ if ((sctp_ifap->ifn_p->num_v6 == 0) && (sctp_ifap->ifn_p->registered_af == AF_INET6)) { - SCTP_DEREGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET6); - SCTP_REGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET); sctp_ifap->ifn_p->registered_af = AF_INET; } else if ((sctp_ifap->ifn_p->num_v4 == 0) && (sctp_ifap->ifn_p->registered_af == AF_INET)) { - SCTP_DEREGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET); - SCTP_REGISTER_INTERFACE(sctp_ifap->ifn_p->ifn_index, AF_INET6); sctp_ifap->ifn_p->registered_af = AF_INET6; } /* free the ifn refcount */ @@ -678,7 +671,6 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3 vrf->total_ifa_count++; atomic_add_int(&SCTP_BASE_INFO(ipi_count_ifas), 1); if (new_ifn_af) { - SCTP_REGISTER_INTERFACE(ifn_index, new_ifn_af); sctp_ifnp->registered_af = new_ifn_af; } SCTP_IPI_ADDR_WUNLOCK(); From owner-svn-src-head@freebsd.org Sat Jun 13 22:20:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D1A5343FFD; Sat, 13 Jun 2020 22:20:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49ksTv0sFgz4YJG; Sat, 13 Jun 2020 22:20:03 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F33912204A; Sat, 13 Jun 2020 22:20:02 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05DMK2BX097594; Sat, 13 Jun 2020 22:20:02 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DMK2ux097593; Sat, 13 Jun 2020 22:20:02 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006132220.05DMK2ux097593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 13 Jun 2020 22:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362156 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 22:20:03 -0000 Author: adrian Date: Sat Jun 13 22:20:02 2020 New Revision: 362156 URL: https://svnweb.freebsd.org/changeset/base/362156 Log: [net80211] separate out node allocation and node initialisation. This is a new, optional (for now!) method that drivers can use to separate node allocation and node initialisation. Right now they're the same, and drivers that need to do node allocation via firmware commands need to sleep and thus they need to defer node allocation into an internal taskqueue. Right now they're just separate but not deferred. Later on if I get the time we'll start deferring the node and key related operations but that requires making a bunch of other stuff (notably things that generate frames!) also async/deferred. Tested: * RT3593, STA/DWDS mode * AR9380, STA/AP modes * QCA9880 (athp) - STA/AP modes Modified: head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Sat Jun 13 21:23:26 2020 (r362155) +++ head/sys/net80211/ieee80211_node.c Sat Jun 13 22:20:02 2020 (r362156) @@ -80,6 +80,7 @@ static int ieee80211_sta_join1(struct ieee80211_node * static struct ieee80211_node *node_alloc(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); +static int node_init(struct ieee80211_node *); static void node_cleanup(struct ieee80211_node *); static void node_free(struct ieee80211_node *); static void node_age(struct ieee80211_node *); @@ -116,6 +117,7 @@ ieee80211_node_attach(struct ieee80211com *ic) ieee80211_node_timeout, ic); ic->ic_node_alloc = node_alloc; + ic->ic_node_init = node_init; ic->ic_node_free = node_free; ic->ic_node_cleanup = node_cleanup; ic->ic_node_age = node_age; @@ -1074,6 +1076,12 @@ node_alloc(struct ieee80211vap *vap, const uint8_t mac return ni; } +static int +node_init(struct ieee80211_node *ni) +{ + return 0; +} + /* * Initialize an ie blob with the specified data. If previous * data exists re-use the data block. As a side effect we clear @@ -1414,6 +1422,15 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, ni->ni_ic = ic; IEEE80211_NODE_UNLOCK(nt); + /* handle failure; free node state */ + if (ic->ic_node_init(ni) != 0) { + vap->iv_stats.is_rx_nodealloc++; + ieee80211_psq_cleanup(&ni->ni_psq); + ieee80211_ratectl_node_deinit(ni); + _ieee80211_free_node(ni); + return NULL; + } + IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni, "%s: inact_reload %u", __func__, ni->ni_inact_reload); @@ -1456,6 +1473,16 @@ ieee80211_tmp_node(struct ieee80211vap *vap, ieee80211_psq_init(&ni->ni_psq, "unknown"); ieee80211_ratectl_node_init(ni); + + /* handle failure; free node state */ + if (ic->ic_node_init(ni) != 0) { + vap->iv_stats.is_rx_nodealloc++; + ieee80211_psq_cleanup(&ni->ni_psq); + ieee80211_ratectl_node_deinit(ni); + _ieee80211_free_node(ni); + return NULL; + } + } else { /* XXX msg */ vap->iv_stats.is_rx_nodealloc++; Modified: head/sys/net80211/ieee80211_var.h ============================================================================== --- head/sys/net80211/ieee80211_var.h Sat Jun 13 21:23:26 2020 (r362155) +++ head/sys/net80211/ieee80211_var.h Sat Jun 13 22:20:02 2020 (r362156) @@ -310,11 +310,22 @@ struct ieee80211com { /* TDMA update notification */ void (*ic_tdma_update)(struct ieee80211_node *, const struct ieee80211_tdma_param *, int); - /* node state management */ + + /* Node state management */ + + /* Allocate a new node */ struct ieee80211_node* (*ic_node_alloc)(struct ieee80211vap *, const uint8_t [IEEE80211_ADDR_LEN]); + + /* Driver node initialisation after net80211 setup */ + int (*ic_node_init)(struct ieee80211_node *); + + /* Driver node deallocation */ void (*ic_node_free)(struct ieee80211_node *); + + /* Driver node state cleanup before deallocation */ void (*ic_node_cleanup)(struct ieee80211_node *); + void (*ic_node_age)(struct ieee80211_node *); void (*ic_node_drain)(struct ieee80211_node *); int8_t (*ic_node_getrssi)(const struct ieee80211_node*); From owner-svn-src-head@freebsd.org Sat Jun 13 23:35:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E947C3455E6; Sat, 13 Jun 2020 23:35:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49kv8p6GXfz4cRq; Sat, 13 Jun 2020 23:35:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D249A23265; Sat, 13 Jun 2020 23:35:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05DNZMP1046894; Sat, 13 Jun 2020 23:35:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05DNZMsU046892; Sat, 13 Jun 2020 23:35:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006132335.05DNZMsU046892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 13 Jun 2020 23:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362157 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: 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, 13 Jun 2020 23:35:23 -0000 Author: adrian Date: Sat Jun 13 23:35:22 2020 New Revision: 362157 URL: https://svnweb.freebsd.org/changeset/base/362157 Log: [net80211] Handle offloaded AMSDU in AMPDU reordering. In the 11n world, most NICs did A-MPDU receive/transmit offloading but not A-MSDU offloading. So, the net80211 A-MPDU receive path would just receive MPDUs, do the reordering bit, pass it up to the rest of net80211 for crypto decap and then do A-MSDU decap before throwing ethernet frames up to the rest of the system. However 11ac and 11ax NICs are increasingly doing A-MSDU offload (and newer 11ax stuff does socket offload, but hey I don't want to scare people JUST yet) - so although A-MPDU reordering may be done in the OS, A-MSDUs look like a normal MPDU. This means that all the MSDUs are actually faked into a set of MPDUs with matching 802.11 header - the sequence number, QoS header and any encryption verification bits (like IV) are just copied. This shows up as MASSIVE packet loss in net80211, cause after the first MPDU we just toss the rest. (And don't get me started about ethernet decap with A-MPDU host reordering; we'll have to cross that bridge for later 11ac and 11ax bits too.) Anyway, this work changes each A-MPDU reorder slot into an mbufq. The mbufq is treated as a whole set of frames to pass up to the stack and reordered/de-duped as a group. The last frame in the reorder list is checked to see if it's an A-MSDU final frame so any duplicates are correctly tossed rather than double-received. Other than that, the rest of the logic is unchanged. The previous commit did a small subset of this - if there wasn't any reordering going on then it'd accept the A-MSDUs. This is the rest of the needed work. This is a no-op for 11n NICs doing A-MPDU reordering but needing software A-MSDU decap - they aren't tagged as A-MSDU and so any subsequent frames added to the reorder slot are tossed. Tested: * QCA9880 (ath10k/athp) - STA/AP mode; * RT3593 (if_rsu) - 11n STA+DWDS mode (I'm committing through it rn); * QCA9380 (if_ath) - STA/AP mode. Modified: head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ht.h Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sat Jun 13 22:20:02 2020 (r362156) +++ head/sys/net80211/ieee80211_ht.c Sat Jun 13 23:35:22 2020 (r362157) @@ -517,6 +517,22 @@ ieee80211_decap_amsdu(struct ieee80211_node *ni, struc return m; /* last delivered by caller */ } +static void +ampdu_rx_purge_slot(struct ieee80211_rx_ampdu *rap, int i) +{ + struct mbuf *m; + + /* Walk the queue, removing frames as appropriate */ + while (mbufq_len(&rap->rxa_mq[i]) != 0) { + m = mbufq_dequeue(&rap->rxa_mq[i]); + if (m == NULL) + break; + rap->rxa_qbytes -= m->m_pkthdr.len; + rap->rxa_qframes--; + m_freem(m); + } +} + /* * Add the given frame to the current RX reorder slot. * @@ -528,16 +544,94 @@ static int ampdu_rx_add_slot(struct ieee80211_rx_ampdu *rap, int off, int tid, ieee80211_seq rxseq, struct ieee80211_node *ni, - struct mbuf *m) + struct mbuf *m, + const struct ieee80211_rx_stats *rxs) { + const struct ieee80211_rx_stats *rxs_final = NULL; struct ieee80211vap *vap = ni->ni_vap; + int toss_dup; +#define PROCESS 0 /* caller should process frame */ +#define CONSUMED 1 /* frame consumed, caller does nothing */ - if (rap->rxa_m[off] == NULL) { - rap->rxa_m[off] = m; + /* + * Figure out if this is a duplicate frame for the given slot. + * + * We're assuming that the driver will hand us all the frames + * for a given AMSDU decap pass and if we get /a/ frame + * for an AMSDU decap then we'll get all of them. + * + * The tricksy bit is that we don't know when the /end/ of + * the decap pass is, because we aren't tracking state here + * per-slot to know that we've finished receiving the frame list. + * + * The driver sets RX_F_AMSDU and RX_F_AMSDU_MORE to tell us + * what's going on; so ideally we'd just check the frame at the + * end of the reassembly slot to see if its F_AMSDU w/ no F_AMSDU_MORE - + * that means we've received the whole AMSDU decap pass. + */ + + /* + * Get the rxs of the final mbuf in the slot, if one exists. + */ + if (mbufq_len(&rap->rxa_mq[off]) != 0) { + rxs_final = ieee80211_get_rx_params_ptr(mbufq_last(&rap->rxa_mq[off])); + } + + /* Default to tossing the duplicate frame */ + toss_dup = 1; + + /* + * Check to see if the final frame has F_AMSDU and F_AMSDU set, AND + * this frame has F_AMSDU set (MORE or otherwise.) That's a sign + * that more can come. + */ + + if ((rxs != NULL) && (rxs_final != NULL) && + ieee80211_check_rxseq_amsdu(rxs) && + ieee80211_check_rxseq_amsdu(rxs_final)) { + if (! ieee80211_check_rxseq_amsdu_more(rxs_final)) { + /* + * amsdu_more() returning 0 means "it's not the + * final frame" so we can append more + * frames here. + */ + toss_dup = 0; + } + } + + /* + * If the list is empty OR we have determined we can put more + * driver decap'ed AMSDU frames in here, then insert. + */ + if ((mbufq_len(&rap->rxa_mq[off]) == 0) || (toss_dup == 0)) { + if (mbufq_enqueue(&rap->rxa_mq[off], m) != 0) { + IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_11N, + ni->ni_macaddr, + "a-mpdu queue fail", + "seqno %u tid %u BA win <%u:%u> off=%d, qlen=%d, maxqlen=%d", + rxseq, tid, rap->rxa_start, + IEEE80211_SEQ_ADD(rap->rxa_start, rap->rxa_wnd-1), + off, + mbufq_len(&rap->rxa_mq[off]), + rap->rxa_mq[off].mq_maxlen); + /* XXX error count */ + m_freem(m); + return CONSUMED; + } rap->rxa_qframes++; rap->rxa_qbytes += m->m_pkthdr.len; vap->iv_stats.is_ampdu_rx_reorder++; - return (0); + /* + * Statistics for AMSDU decap. + */ + if (rxs != NULL && ieee80211_check_rxseq_amsdu(rxs)) { + if (ieee80211_check_rxseq_amsdu_more(rxs)) { + /* more=1, AMSDU, end of batch */ + IEEE80211_NODE_STAT(ni, rx_amsdu_more_end); + } else { + IEEE80211_NODE_STAT(ni, rx_amsdu_more); + } + } } else { IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT | IEEE80211_MSG_11N, @@ -545,28 +639,29 @@ ampdu_rx_add_slot(struct ieee80211_rx_ampdu *rap, int "seqno %u tid %u BA win <%u:%u>", rxseq, tid, rap->rxa_start, IEEE80211_SEQ_ADD(rap->rxa_start, rap->rxa_wnd-1)); + if (rxs != NULL) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_INPUT | IEEE80211_MSG_11N, + ni->ni_macaddr, "a-mpdu duplicate", + "seqno %d tid %u pktflags 0x%08x\n", + rxseq, tid, rxs->c_pktflags); + } + if (rxs_final != NULL) { + IEEE80211_DISCARD_MAC(vap, + IEEE80211_MSG_INPUT | IEEE80211_MSG_11N, + ni->ni_macaddr, "a-mpdu duplicate", + "final: pktflags 0x%08x\n", + rxs_final->c_pktflags); + } vap->iv_stats.is_rx_dup++; IEEE80211_NODE_STAT(ni, rx_dup); m_freem(m); - return (-1); } + return CONSUMED; +#undef CONSUMED +#undef PROCESS } -static void -ampdu_rx_purge_slot(struct ieee80211_rx_ampdu *rap, int i) -{ - struct mbuf *m; - - m = rap->rxa_m[i]; - if (m == NULL) - return; - - rap->rxa_m[i] = NULL; - rap->rxa_qbytes -= m->m_pkthdr.len; - rap->rxa_qframes--; - m_freem(m); -} - /* * Purge all frames in the A-MPDU re-order queue. */ @@ -585,6 +680,18 @@ ampdu_rx_purge(struct ieee80211_rx_ampdu *rap) rap->rxa_qbytes, rap->rxa_qframes)); } +static void +ieee80211_ampdu_rx_init_rap(struct ieee80211_node *ni, + struct ieee80211_rx_ampdu *rap) +{ + int i; + + /* XXX TODO: ensure the queues are empty */ + memset(rap, 0, sizeof(*rap)); + for (i = 0; i < IEEE80211_AGGR_BAWMAX; i++) + mbufq_init(&rap->rxa_mq[i], 256); +} + /* * Start A-MPDU rx/re-order processing for the specified TID. */ @@ -602,7 +709,7 @@ ampdu_rx_start(struct ieee80211_node *ni, struct ieee8 */ ampdu_rx_purge(rap); } - memset(rap, 0, sizeof(*rap)); + ieee80211_ampdu_rx_init_rap(ni, rap); rap->rxa_wnd = (bufsiz == 0) ? IEEE80211_AGGR_BAWMAX : min(bufsiz, IEEE80211_AGGR_BAWMAX); rap->rxa_start = MS(baseqctl, IEEE80211_BASEQ_START); @@ -638,7 +745,8 @@ ieee80211_ampdu_rx_start_ext(struct ieee80211_node *ni ampdu_rx_purge(rap); } - memset(rap, 0, sizeof(*rap)); + ieee80211_ampdu_rx_init_rap(ni, rap); + rap->rxa_wnd = (baw== 0) ? IEEE80211_AGGR_BAWMAX : min(baw, IEEE80211_AGGR_BAWMAX); if (seq == -1) { @@ -708,18 +816,20 @@ ampdu_dispatch_slot(struct ieee80211_rx_ampdu *rap, st int i) { struct mbuf *m; + int n = 0; - if (rap->rxa_m[i] == NULL) - return (0); + while (mbufq_len(&rap->rxa_mq[i]) != 0) { + m = mbufq_dequeue(&rap->rxa_mq[i]); + if (m == NULL) + break; + n++; - m = rap->rxa_m[i]; - rap->rxa_m[i] = NULL; - rap->rxa_qbytes -= m->m_pkthdr.len; - rap->rxa_qframes--; + rap->rxa_qbytes -= m->m_pkthdr.len; + rap->rxa_qframes--; - ampdu_dispatch(ni, m); - - return (1); + ampdu_dispatch(ni, m); + } + return (n); } static void @@ -728,22 +838,22 @@ ampdu_rx_moveup(struct ieee80211_rx_ampdu *rap, struct { struct ieee80211vap *vap = ni->ni_vap; + /* + * If frames remain, copy the mbuf pointers down so + * they correspond to the offsets in the new window. + */ if (rap->rxa_qframes != 0) { int n = rap->rxa_qframes, j; - - if (winstart != -1) { + for (j = i+1; j < rap->rxa_wnd; j++) { /* - * NB: in window-sliding mode, loop assumes i > 0 - * and/or rxa_m[0] is NULL + * Concat the list contents over, which will + * blank the source list for us. */ - KASSERT(rap->rxa_m[0] == NULL, - ("%s: BA window slot 0 occupied", __func__)); - } - for (j = i+1; j < rap->rxa_wnd; j++) { - if (rap->rxa_m[j] != NULL) { - rap->rxa_m[j-i] = rap->rxa_m[j]; - rap->rxa_m[j] = NULL; - if (--n == 0) + if (mbufq_len(&rap->rxa_mq[j]) != 0) { + n = n - mbufq_len(&rap->rxa_mq[j]); + mbufq_concat(&rap->rxa_mq[j-i], &rap->rxa_mq[j]); + KASSERT(n >= 0, ("%s: n < 0 (%d)", __func__, n)); + if (n == 0) break; } } @@ -768,18 +878,18 @@ static void ampdu_rx_dispatch(struct ieee80211_rx_ampdu *rap, struct ieee80211_node *ni) { struct ieee80211vap *vap = ni->ni_vap; - int i; + int i, r, r2; /* flush run of frames */ + r2 = 0; for (i = 1; i < rap->rxa_wnd; i++) { - if (ampdu_dispatch_slot(rap, ni, i) == 0) + r = ampdu_dispatch_slot(rap, ni, i); + if (r == 0) break; + r2 += r; } - /* - * If frames remain, copy the mbuf pointers down so - * they correspond to the offsets in the new window. - */ + /* move up frames */ ampdu_rx_moveup(rap, ni, i, -1); /* @@ -787,7 +897,14 @@ ampdu_rx_dispatch(struct ieee80211_rx_ampdu *rap, stru * reflect the frames just dispatched. */ rap->rxa_start = IEEE80211_SEQ_ADD(rap->rxa_start, i); - vap->iv_stats.is_ampdu_rx_oor += i; + vap->iv_stats.is_ampdu_rx_oor += r2; + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, + "%s: moved slot up %d slots to start at %d (%d frames)", + __func__, + i, + rap->rxa_start, + r2); } /* @@ -796,15 +913,21 @@ ampdu_rx_dispatch(struct ieee80211_rx_ampdu *rap, stru static void ampdu_rx_flush(struct ieee80211_node *ni, struct ieee80211_rx_ampdu *rap) { - struct ieee80211vap *vap = ni->ni_vap; int i, r; for (i = 0; i < rap->rxa_wnd; i++) { r = ampdu_dispatch_slot(rap, ni, i); if (r == 0) continue; - vap->iv_stats.is_ampdu_rx_oor += r; + ni->ni_vap->iv_stats.is_ampdu_rx_oor += r; + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, + "%s: moved slot up %d slots to start at %d (%d frames)", + __func__, + 1, + rap->rxa_start, + r); + if (rap->rxa_qframes == 0) break; } @@ -832,14 +955,23 @@ ampdu_rx_flush_upto(struct ieee80211_node *ni, */ seqno = rap->rxa_start; for (i = 0; i < rap->rxa_wnd; i++) { - r = ampdu_dispatch_slot(rap, ni, i); - if (r == 0) { + if ((r = mbufq_len(&rap->rxa_mq[i])) != 0) { + (void) ampdu_dispatch_slot(rap, ni, i); + } else { if (!IEEE80211_SEQ_BA_BEFORE(seqno, winstart)) break; } vap->iv_stats.is_ampdu_rx_oor += r; seqno = IEEE80211_SEQ_INC(seqno); + + IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_11N, ni, + "%s: moved slot up %d slots to start at %d (%d frames)", + __func__, + 1, + seqno, + r); } + /* * If frames remain, copy the mbuf pointers down so * they correspond to the offsets in the new window. @@ -862,6 +994,10 @@ ampdu_rx_flush_upto(struct ieee80211_node *ni, * this frame completes a run, flush any pending frames. We * return 1 if the frame is consumed. A 0 is returned if * the frame should be processed normally by the caller. + * + * A-MSDU: handle hardware decap'ed A-MSDU frames that are + * pretending to be MPDU's. They're dispatched directly if + * able; or attempted to put into the receive reordering slot. */ int ieee80211_ampdu_reorder(struct ieee80211_node *ni, struct mbuf *m, @@ -875,7 +1011,8 @@ ieee80211_ampdu_reorder(struct ieee80211_node *ni, str ieee80211_seq rxseq; uint8_t tid; int off; - int amsdu_more = ieee80211_check_rxseq_amsdu_more(rxs); + int amsdu = ieee80211_check_rxseq_amsdu(rxs); + int amsdu_end = ieee80211_check_rxseq_amsdu_more(rxs); KASSERT((m->m_flags & (M_AMPDU | M_AMPDU_MPDU)) == M_AMPDU, ("!a-mpdu or already re-ordered, flags 0x%x", m->m_flags)); @@ -944,7 +1081,7 @@ again: /* * Dispatch as many packets as we can. */ - KASSERT(rap->rxa_m[0] == NULL, ("unexpected dup")); + KASSERT((mbufq_len(&rap->rxa_mq[0]) == 0), ("unexpected dup")); ampdu_dispatch(ni, m); ampdu_rx_dispatch(rap, ni); return CONSUMED; @@ -953,8 +1090,16 @@ again: * In order; advance window if needed and notify * caller to dispatch directly. */ - if (amsdu_more) + if (amsdu) { + if (amsdu_end) { + rap->rxa_start = IEEE80211_SEQ_INC(rxseq); + IEEE80211_NODE_STAT(ni, rx_amsdu_more_end); + } else { + IEEE80211_NODE_STAT(ni, rx_amsdu_more); + } + } else { rap->rxa_start = IEEE80211_SEQ_INC(rxseq); + } return PROCESS; } } @@ -998,8 +1143,24 @@ again: rap->rxa_qframes; ampdu_rx_flush(ni, rap); } - if (amsdu_more) - rap->rxa_start = IEEE80211_SEQ_INC(rxseq); + /* + * Advance the window if needed and notify + * the caller to dispatch directly. + */ + if (amsdu) { + if (amsdu_end) { + rap->rxa_start = + IEEE80211_SEQ_INC(rxseq); + IEEE80211_NODE_STAT(ni, + rx_amsdu_more_end); + } else { + IEEE80211_NODE_STAT(ni, + rx_amsdu_more); + } + } else { + rap->rxa_start = + IEEE80211_SEQ_INC(rxseq); + } return PROCESS; } } else { @@ -1010,8 +1171,7 @@ again: } /* save packet - this consumes, no matter what */ - ampdu_rx_add_slot(rap, off, tid, rxseq, ni, m); - + ampdu_rx_add_slot(rap, off, tid, rxseq, ni, m, rxs); return CONSUMED; } if (off < IEEE80211_SEQ_BA_RANGE) { @@ -1175,6 +1335,7 @@ ieee80211_ht_node_init(struct ieee80211_node *ni) tap->txa_ni = ni; ieee80211_txampdu_init_pps(tap); /* NB: further initialization deferred */ + ieee80211_ampdu_rx_init_rap(ni, &ni->ni_rx_ampdu[tid]); } ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU | IEEE80211_NODE_AMSDU; Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Sat Jun 13 22:20:02 2020 (r362156) +++ head/sys/net80211/ieee80211_ht.h Sat Jun 13 23:35:22 2020 (r362157) @@ -33,6 +33,8 @@ * 802.11n protocol implementation definitions. */ +#include + #define IEEE80211_AGGR_BAWMAX 64 /* max block ack window size */ /* threshold for aging overlapping non-HT bss */ #define IEEE80211_NONHT_PRESENT_AGE msecs_to_ticks(60*1000) @@ -169,7 +171,7 @@ struct ieee80211_rx_ampdu { uint16_t rxa_wnd; /* BA window size */ int rxa_age; /* age of oldest frame in window */ int rxa_nframes; /* frames since ADDBA */ - struct mbuf *rxa_m[IEEE80211_AGGR_BAWMAX]; + struct mbufq rxa_mq[IEEE80211_AGGR_BAWMAX]; void *rxa_private; uint64_t rxa_pad[3]; };