From owner-svn-src-head@freebsd.org Sun Jun 28 00:29: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 92CBD338802; Sun, 28 Jun 2020 00:29: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 49vWhd3Q5Rz4dcG; Sun, 28 Jun 2020 00:29: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 706D8DBB1; Sun, 28 Jun 2020 00:29: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 05S0TLlP047208; Sun, 28 Jun 2020 00:29:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05S0TLd7047207; Sun, 28 Jun 2020 00:29:21 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202006280029.05S0TLd7047207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 28 Jun 2020 00:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362711 - head/usr.bin/top X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/usr.bin/top X-SVN-Commit-Revision: 362711 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 00:29:21 -0000 Author: kib Date: Sun Jun 28 00:29:21 2020 New Revision: 362711 URL: https://svnweb.freebsd.org/changeset/base/362711 Log: top: do not try to use sysctl machdep.smp_active. The sysctl was removed by r76078 in 2001. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/usr.bin/top/machine.c Modified: head/usr.bin/top/machine.c ============================================================================== --- head/usr.bin/top/machine.c Sat Jun 27 22:51:15 2020 (r362710) +++ head/usr.bin/top/machine.c Sun Jun 28 00:29:21 2020 (r362711) @@ -282,10 +282,7 @@ machine_init(struct statics *statics) size_t size; size = sizeof(smpmode); - if ((sysctlbyname("machdep.smp_active", &smpmode, &size, - NULL, 0) != 0 && - sysctlbyname("kern.smp.active", &smpmode, &size, - NULL, 0) != 0) || + if (sysctlbyname("kern.smp.active", &smpmode, &size, NULL, 0) != 0 || size != sizeof(smpmode)) smpmode = 0; From owner-svn-src-head@freebsd.org Sun Jun 28 06: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 B8E99341FEE; Sun, 28 Jun 2020 06:52:39 +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 49vhBv4Xpdz41r7; Sun, 28 Jun 2020 06:52:39 +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 96DCE1267D; Sun, 28 Jun 2020 06:52:39 +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 05S6qdZ6088833; Sun, 28 Jun 2020 06:52:39 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05S6qdrd088832; Sun, 28 Jun 2020 06:52:39 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202006280652.05S6qdrd088832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 28 Jun 2020 06:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362718 - head/usr.sbin/fifolog/lib X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/usr.sbin/fifolog/lib X-SVN-Commit-Revision: 362718 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 06:52:39 -0000 Author: adrian Date: Sun Jun 28 06:52:39 2020 New Revision: 362718 URL: https://svnweb.freebsd.org/changeset/base/362718 Log: [fifolog] wrap the recno when we hit the end of the provided file size. Without this the log just keeps growing to infinity. Reviewed by: phk Differential Revision: https://reviews.freebsd.org/D25478 Modified: head/usr.sbin/fifolog/lib/fifolog_write_poll.c Modified: head/usr.sbin/fifolog/lib/fifolog_write_poll.c ============================================================================== --- head/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Jun 28 04:08:42 2020 (r362717) +++ head/usr.sbin/fifolog/lib/fifolog_write_poll.c Sun Jun 28 06:52:39 2020 (r362718) @@ -239,6 +239,14 @@ fifolog_write_output(struct fifolog_writer *f, int fl, */ f->seq++; f->recno++; + + /* + * Ensure we wrap recno once we hit the file size (in records.) + */ + if (f->recno >= f->ff->logsize) + /* recno 0 is header; skip */ + f->recno = 1; + f->flag = 0; memset(f->obuf, 0, f->obufsize); From owner-svn-src-head@freebsd.org Sun Jun 28 07:43: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 CE3D03437F9; Sun, 28 Jun 2020 07:43:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49vjKw5LlCz43qm; Sun, 28 Jun 2020 07:43:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B267112D2D; Sun, 28 Jun 2020 07:43:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05S7hmNh019380; Sun, 28 Jun 2020 07:43:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05S7hiMe019358; Sun, 28 Jun 2020 07:43:44 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202006280743.05S7hiMe019358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 28 Jun 2020 07:43:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362719 - in head: contrib/llvm-project contrib/llvm-project/clang/lib/CodeGen contrib/llvm-project/compiler-rt/lib/builtins/riscv contrib/llvm-project/libcxx/include contrib/llvm-proje... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/llvm-project contrib/llvm-project/clang/lib/CodeGen contrib/llvm-project/compiler-rt/lib/builtins/riscv contrib/llvm-project/libcxx/include contrib/llvm-project/llvm/lib/CodeGen/Selec... X-SVN-Commit-Revision: 362719 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 07:43:48 -0000 Author: dim Date: Sun Jun 28 07:43:43 2020 New Revision: 362719 URL: https://svnweb.freebsd.org/changeset/base/362719 Log: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp llvmorg-10.0.1-rc2-0-g77d76b71d7d. Also add a few more llvm utilities under WITH_CLANG_EXTRAS: * llvm-dwp, a utility for merging DWARF 5 Split DWARF .dwo files into .dwp (DWARF package files) * llvm-size, a size(1) replacement * llvm-strings, a strings(1) replacement MFC after: 3 weeks Added: head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/int_mul_impl.inc - copied unchanged from r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/int_mul_impl.inc head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/muldi3.S - copied unchanged from r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/muldi3.S head/contrib/llvm-project/llvm/tools/llvm-dwp/ - copied from r362704, vendor/llvm-project/release-10.x/llvm/tools/llvm-dwp/ head/contrib/llvm-project/llvm/tools/llvm-size/ - copied from r362704, vendor/llvm-project/release-10.x/llvm/tools/llvm-size/ head/contrib/llvm-project/llvm/tools/llvm-strings/ - copied from r362704, vendor/llvm-project/release-10.x/llvm/tools/llvm-strings/ head/usr.bin/clang/llvm-dwp/ head/usr.bin/clang/llvm-dwp/Makefile (contents, props changed) head/usr.bin/clang/llvm-size/ head/usr.bin/clang/llvm-size/Makefile (contents, props changed) head/usr.bin/clang/llvm-size/llvm-size.1 (contents, props changed) head/usr.bin/clang/llvm-strings/ head/usr.bin/clang/llvm-strings/Makefile (contents, props changed) head/usr.bin/clang/llvm-strings/llvm-strings.1 (contents, props changed) Modified: head/contrib/llvm-project/FREEBSD-Xlist head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/mulsi3.S head/contrib/llvm-project/libcxx/include/array head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp head/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp head/lib/clang/include/VCSVersion.inc head/lib/clang/include/llvm/Support/VCSRevision.h head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/clang/Makefile Directory Properties: head/contrib/llvm-project/ (props changed) head/contrib/llvm-project/clang/ (props changed) head/contrib/llvm-project/compiler-rt/ (props changed) head/contrib/llvm-project/libcxx/ (props changed) head/contrib/llvm-project/llvm/ (props changed) Modified: head/contrib/llvm-project/FREEBSD-Xlist ============================================================================== --- head/contrib/llvm-project/FREEBSD-Xlist Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/FREEBSD-Xlist Sun Jun 28 07:43:43 2020 (r362719) @@ -864,7 +864,8 @@ llvm/tools/llvm-dis/LLVMBuild.txt llvm/tools/llvm-dwarfdump/CMakeLists.txt llvm/tools/llvm-dwarfdump/LLVMBuild.txt llvm/tools/llvm-dwarfdump/fuzzer/ -llvm/tools/llvm-dwp/ +llvm/tools/llvm-dwp/CMakeLists.txt +llvm/tools/llvm-dwp/LLVMBuild.txt llvm/tools/llvm-elfabi/ llvm/tools/llvm-exegesis/ llvm/tools/llvm-extract/CMakeLists.txt @@ -911,12 +912,14 @@ llvm/tools/llvm-reduce/ llvm/tools/llvm-rtdyld/CMakeLists.txt llvm/tools/llvm-rtdyld/LLVMBuild.txt llvm/tools/llvm-shlib/ -llvm/tools/llvm-size/ +llvm/tools/llvm-size/CMakeLists.txt +llvm/tools/llvm-size/LLVMBuild.txt llvm/tools/llvm-special-case-list-fuzzer/ llvm/tools/llvm-split/ llvm/tools/llvm-stress/CMakeLists.txt llvm/tools/llvm-stress/LLVMBuild.txt -llvm/tools/llvm-strings/ +llvm/tools/llvm-strings/CMakeLists.txt +llvm/tools/llvm-strings/LLVMBuild.txt llvm/tools/llvm-symbolizer/CMakeLists.txt llvm/tools/llvm-undname/ llvm/tools/llvm-xray/CMakeLists.txt Modified: head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp ============================================================================== --- head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/clang/lib/CodeGen/TargetInfo.cpp Sun Jun 28 07:43:43 2020 (r362719) @@ -9677,7 +9677,8 @@ ABIArgInfo RISCVABIInfo::classifyArgumentType(QualType uint64_t Size = getContext().getTypeSize(Ty); // Pass floating point values via FPRs if possible. - if (IsFixed && Ty->isFloatingType() && FLen >= Size && ArgFPRsLeft) { + if (IsFixed && Ty->isFloatingType() && !Ty->isComplexType() && + FLen >= Size && ArgFPRsLeft) { ArgFPRsLeft--; return ABIArgInfo::getDirect(); } Copied: head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/int_mul_impl.inc (from r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/int_mul_impl.inc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/int_mul_impl.inc Sun Jun 28 07:43:43 2020 (r362719, copy of r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/int_mul_impl.inc) @@ -0,0 +1,31 @@ +//===-- int_mul_impl.inc - Integer multiplication -------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Helpers used by __mulsi3, __muldi3. +// +//===----------------------------------------------------------------------===// + +#if !defined(__riscv_mul) + .text + .align 2 + + .globl __mulxi3 + .type __mulxi3, @function +__mulxi3: + mv a2, a0 + mv a0, zero +.L1: + andi a3, a1, 1 + beqz a3, .L2 + add a0, a0, a2 +.L2: + srli a1, a1, 1 + slli a2, a2, 1 + bnez a1, .L1 + ret +#endif Copied: head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/muldi3.S (from r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/muldi3.S) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/muldi3.S Sun Jun 28 07:43:43 2020 (r362719, copy of r362704, vendor/llvm-project/release-10.x/compiler-rt/lib/builtins/riscv/muldi3.S) @@ -0,0 +1,11 @@ +//===--- muldi3.S - Integer multiplication routines -----------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#if __riscv_xlen == 64 +#define __mulxi3 __muldi3 +#include "int_mul_impl.inc" +#endif Modified: head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/mulsi3.S ============================================================================== --- head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/mulsi3.S Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/compiler-rt/lib/builtins/riscv/mulsi3.S Sun Jun 28 07:43:43 2020 (r362719) @@ -1,4 +1,4 @@ -//===--- mulsi3.S - Integer multiplication routines routines ---===// +//===--- mulsi3.S - Integer multiplication routines -----------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,22 +6,7 @@ // //===----------------------------------------------------------------------===// -#if !defined(__riscv_mul) && __riscv_xlen == 32 - .text - .align 2 - - .globl __mulsi3 - .type __mulsi3, @function -__mulsi3: - mv a2, a0 - mv a0, zero -.L1: - andi a3, a1, 1 - beqz a3, .L2 - add a0, a0, a2 -.L2: - srli a1, a1, 1 - slli a2, a2, 1 - bnez a1, .L1 - ret +#if __riscv_xlen == 32 +#define __mulxi3 __mulsi3 +#include "int_mul_impl.inc" #endif Modified: head/contrib/llvm-project/libcxx/include/array ============================================================================== --- head/contrib/llvm-project/libcxx/include/array Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/libcxx/include/array Sun Jun 28 07:43:43 2020 (r362719) @@ -359,7 +359,7 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> #ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES template && ...), void>::type + class = _EnableIf<__all<_IsSame<_Tp, _Args>::value...>::value> > array(_Tp, _Args...) -> array<_Tp, 1 + sizeof...(_Args)>; Modified: head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Sun Jun 28 07:43:43 2020 (r362719) @@ -271,8 +271,20 @@ SDValue DAGTypeLegalizer::PromoteIntRes_AtomicCmpSwap( return Res.getValue(1); } - SDValue Op2 = GetPromotedInteger(N->getOperand(2)); + // Op2 is used for the comparison and thus must be extended according to the + // target's atomic operations. Op3 is merely stored and so can be left alone. + SDValue Op2 = N->getOperand(2); SDValue Op3 = GetPromotedInteger(N->getOperand(3)); + if (TLI.getTargetMachine().getTargetTriple().isRISCV()) { + // The comparison argument must be sign-extended for RISC-V. This is + // abstracted using a new TargetLowering hook in the main LLVM development + // branch, but handled here directly in order to fix the codegen bug for + // 10.x without breaking the libLLVM.so ABI. + Op2 = SExtPromotedInteger(Op2); + } else { + Op2 = GetPromotedInteger(Op2); + } + SDVTList VTs = DAG.getVTList(Op2.getValueType(), N->getValueType(1), MVT::Other); SDValue Res = DAG.getAtomicCmpSwap( Modified: head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Sun Jun 28 07:43:43 2020 (r362719) @@ -5490,10 +5490,21 @@ char TargetLowering::isNegatibleForFree(SDValue Op, Se EVT VT = Op.getValueType(); const SDNodeFlags Flags = Op->getFlags(); const TargetOptions &Options = DAG.getTarget().Options; - if (!Op.hasOneUse() && !(Op.getOpcode() == ISD::FP_EXTEND && - isFPExtFree(VT, Op.getOperand(0).getValueType()))) - return 0; + if (!Op.hasOneUse()) { + bool IsFreeExtend = Op.getOpcode() == ISD::FP_EXTEND && + isFPExtFree(VT, Op.getOperand(0).getValueType()); + // If we already have the use of the negated floating constant, it is free + // to negate it even it has multiple uses. + bool IsFreeConstant = + Op.getOpcode() == ISD::ConstantFP && + !getNegatedExpression(Op, DAG, LegalOperations, ForCodeSize) + .use_empty(); + + if (!IsFreeExtend && !IsFreeConstant) + return 0; + } + // Don't recurse exponentially. if (Depth > SelectionDAG::MaxRecursionDepth) return 0; @@ -5687,14 +5698,7 @@ SDValue TargetLowering::getNegatedExpression(SDValue O ForCodeSize, Depth + 1); char V1 = isNegatibleForFree(Op.getOperand(1), DAG, LegalOperations, ForCodeSize, Depth + 1); - // TODO: This is a hack. It is possible that costs have changed between now - // and the initial calls to isNegatibleForFree(). That is because we - // are rewriting the expression, and that may change the number of - // uses (and therefore the cost) of values. If the negation costs are - // equal, only negate this value if it is a constant. Otherwise, try - // operand 1. A better fix would eliminate uses as a cost factor or - // track the change in uses as we rewrite the expression. - if (V0 > V1 || (V0 == V1 && isa(Op.getOperand(0)))) { + if (V0 > V1) { // fold (fneg (fma X, Y, Z)) -> (fma (fneg X), Y, (fneg Z)) SDValue Neg0 = getNegatedExpression( Op.getOperand(0), DAG, LegalOperations, ForCodeSize, Depth + 1); Modified: head/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp Sun Jun 28 07:43:43 2020 (r362719) @@ -211,6 +211,24 @@ AArch64FrameLowering::getStackIDForScalableVectors() c return TargetStackID::SVEVector; } +/// Returns the size of the fixed object area (allocated next to sp on entry) +/// On Win64 this may include a var args area and an UnwindHelp object for EH. +static unsigned getFixedObjectSize(const MachineFunction &MF, + const AArch64FunctionInfo *AFI, bool IsWin64, + bool IsFunclet) { + if (!IsWin64 || IsFunclet) { + // Only Win64 uses fixed objects, and then only for the function (not + // funclets) + return 0; + } else { + // Var args are stored here in the primary function. + const unsigned VarArgsArea = AFI->getVarArgsGPRSize(); + // To support EH funclets we allocate an UnwindHelp object + const unsigned UnwindHelpObject = (MF.hasEHFunclets() ? 8 : 0); + return alignTo(VarArgsArea + UnwindHelpObject, 16); + } +} + /// Returns the size of the entire SVE stackframe (calleesaves + spills). static StackOffset getSVEStackSize(const MachineFunction &MF) { const AArch64FunctionInfo *AFI = MF.getInfo(); @@ -959,10 +977,7 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio bool IsWin64 = Subtarget.isCallingConvWin64(MF.getFunction().getCallingConv()); - // Var args are accounted for in the containing function, so don't - // include them for funclets. - unsigned FixedObject = (IsWin64 && !IsFunclet) ? - alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + unsigned FixedObject = getFixedObjectSize(MF, AFI, IsWin64, IsFunclet); auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject; // All of the remaining stack allocations are for locals. @@ -993,32 +1008,8 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio ++MBBI; } - // The code below is not applicable to funclets. We have emitted all the SEH - // opcodes that we needed to emit. The FP and BP belong to the containing - // function. - if (IsFunclet) { - if (NeedsWinCFI) { - HasWinCFI = true; - BuildMI(MBB, MBBI, DL, TII->get(AArch64::SEH_PrologEnd)) - .setMIFlag(MachineInstr::FrameSetup); - } - - // SEH funclets are passed the frame pointer in X1. If the parent - // function uses the base register, then the base register is used - // directly, and is not retrieved from X1. - if (F.hasPersonalityFn()) { - EHPersonality Per = classifyEHPersonality(F.getPersonalityFn()); - if (isAsynchronousEHPersonality(Per)) { - BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::COPY), AArch64::FP) - .addReg(AArch64::X1).setMIFlag(MachineInstr::FrameSetup); - MBB.addLiveIn(AArch64::X1); - } - } - - return; - } - - if (HasFP) { + // For funclets the FP belongs to the containing function. + if (!IsFunclet && HasFP) { // Only set up FP if we actually need to. int64_t FPOffset = isTargetDarwin(MF) ? (AFI->getCalleeSavedStackSize() - 16) : 0; @@ -1161,7 +1152,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio // Allocate space for the rest of the frame. if (NumBytes) { - const bool NeedsRealignment = RegInfo->needsStackRealignment(MF); + // Alignment is required for the parent frame, not the funclet + const bool NeedsRealignment = + !IsFunclet && RegInfo->needsStackRealignment(MF); unsigned scratchSPReg = AArch64::SP; if (NeedsRealignment) { @@ -1215,7 +1208,8 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio // FIXME: Clarify FrameSetup flags here. // Note: Use emitFrameOffset() like above for FP if the FrameSetup flag is // needed. - if (RegInfo->hasBasePointer(MF)) { + // For funclets the BP belongs to the containing function. + if (!IsFunclet && RegInfo->hasBasePointer(MF)) { TII->copyPhysReg(MBB, MBBI, DL, RegInfo->getBaseRegister(), AArch64::SP, false); if (NeedsWinCFI) { @@ -1232,6 +1226,19 @@ void AArch64FrameLowering::emitPrologue(MachineFunctio .setMIFlag(MachineInstr::FrameSetup); } + // SEH funclets are passed the frame pointer in X1. If the parent + // function uses the base register, then the base register is used + // directly, and is not retrieved from X1. + if (IsFunclet && F.hasPersonalityFn()) { + EHPersonality Per = classifyEHPersonality(F.getPersonalityFn()); + if (isAsynchronousEHPersonality(Per)) { + BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::COPY), AArch64::FP) + .addReg(AArch64::X1) + .setMIFlag(MachineInstr::FrameSetup); + MBB.addLiveIn(AArch64::X1); + } + } + if (needsFrameMoves) { const DataLayout &TD = MF.getDataLayout(); const int StackGrowth = isTargetDarwin(MF) @@ -1450,10 +1457,7 @@ void AArch64FrameLowering::emitEpilogue(MachineFunctio bool IsWin64 = Subtarget.isCallingConvWin64(MF.getFunction().getCallingConv()); - // Var args are accounted for in the containing function, so don't - // include them for funclets. - unsigned FixedObject = - (IsWin64 && !IsFunclet) ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + unsigned FixedObject = getFixedObjectSize(MF, AFI, IsWin64, IsFunclet); uint64_t AfterCSRPopSize = ArgumentPopSize; auto PrologueSaveSize = AFI->getCalleeSavedStackSize() + FixedObject; @@ -1679,7 +1683,9 @@ static StackOffset getFPOffset(const MachineFunction & const auto &Subtarget = MF.getSubtarget(); bool IsWin64 = Subtarget.isCallingConvWin64(MF.getFunction().getCallingConv()); - unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0; + + unsigned FixedObject = + getFixedObjectSize(MF, AFI, IsWin64, /*IsFunclet=*/false); unsigned FPAdjust = isTargetDarwin(MF) ? 16 : AFI->getCalleeSavedStackSize(MF.getFrameInfo()); return {ObjectOffset + FixedObject + FPAdjust, MVT::i8}; @@ -2632,9 +2638,14 @@ void AArch64FrameLowering::processFunctionBeforeFrameF ++MBBI; // Create an UnwindHelp object. - int UnwindHelpFI = - MFI.CreateStackObject(/*size*/8, /*alignment*/16, false); + // The UnwindHelp object is allocated at the start of the fixed object area + int64_t FixedObject = + getFixedObjectSize(MF, AFI, /*IsWin64*/ true, /*IsFunclet*/ false); + int UnwindHelpFI = MFI.CreateFixedObject(/*Size*/ 8, + /*SPOffset*/ -FixedObject, + /*IsImmutable=*/false); EHInfo.UnwindHelpFrameIdx = UnwindHelpFI; + // We need to store -2 into the UnwindHelp object at the start of the // function. DebugLoc DL; @@ -2656,10 +2667,14 @@ int AArch64FrameLowering::getFrameIndexReferencePrefer const MachineFunction &MF, int FI, unsigned &FrameReg, bool IgnoreSPUpdates) const { const MachineFrameInfo &MFI = MF.getFrameInfo(); - LLVM_DEBUG(dbgs() << "Offset from the SP for " << FI << " is " - << MFI.getObjectOffset(FI) << "\n"); - FrameReg = AArch64::SP; - return MFI.getObjectOffset(FI); + if (IgnoreSPUpdates) { + LLVM_DEBUG(dbgs() << "Offset from the SP for " << FI << " is " + << MFI.getObjectOffset(FI) << "\n"); + FrameReg = AArch64::SP; + return MFI.getObjectOffset(FI); + } + + return getFrameIndexReference(MF, FI, FrameReg); } /// The parent frame offset (aka dispFrame) is only used on X86_64 to retrieve Modified: head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Sun Jun 28 07:43:43 2020 (r362719) @@ -298,6 +298,11 @@ bool PPCAsmPrinter::PrintAsmMemoryOperand(const Machin switch (ExtraCode[0]) { default: return true; // Unknown modifier. + case 'L': // A memory reference to the upper word of a double word op. + O << getDataLayout().getPointerSize() << "("; + printOperand(MI, OpNo, O); + O << ")"; + return false; case 'y': // A memory reference for an X-form instruction { const char *RegName = "r0"; @@ -309,7 +314,6 @@ bool PPCAsmPrinter::PrintAsmMemoryOperand(const Machin } case 'U': // Print 'u' for update form. case 'X': // Print 'x' for indexed form. - { // FIXME: Currently for PowerPC memory operands are always loaded // into a register, so we never get an update or indexed form. // This is bad even for offset forms, since even if we know we @@ -318,7 +322,6 @@ bool PPCAsmPrinter::PrintAsmMemoryOperand(const Machin // tolerate 'U' and 'X' but don't output anything. assert(MI->getOperand(OpNo).isReg()); return false; - } } } Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp Sun Jun 28 07:43:43 2020 (r362719) @@ -181,9 +181,9 @@ void RISCVFrameLowering::emitPrologue(MachineFunction adjustReg(MBB, MBBI, DL, FPReg, SPReg, StackSize - RVFI->getVarArgsSaveSize(), MachineInstr::FrameSetup); - // Emit ".cfi_def_cfa $fp, 0" + // Emit ".cfi_def_cfa $fp, -RVFI->getVarArgsSaveSize()" unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa( - nullptr, RI->getDwarfRegNum(FPReg, true), 0)); + nullptr, RI->getDwarfRegNum(FPReg, true), -RVFI->getVarArgsSaveSize())); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); } Modified: head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp Sun Jun 28 06:52:39 2020 (r362718) +++ head/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVISelLowering.cpp Sun Jun 28 07:43:43 2020 (r362719) @@ -197,6 +197,14 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetM setTruncStoreAction(MVT::f64, MVT::f16, Expand); } + if (Subtarget.is64Bit() && + !(Subtarget.hasStdExtD() || Subtarget.hasStdExtF())) { + setOperationAction(ISD::FP_TO_UINT, MVT::i32, Custom); + setOperationAction(ISD::FP_TO_SINT, MVT::i32, Custom); + setOperationAction(ISD::STRICT_FP_TO_UINT, MVT::i32, Custom); + setOperationAction(ISD::STRICT_FP_TO_SINT, MVT::i32, Custom); + } + setOperationAction(ISD::GlobalAddress, XLenVT, Custom); setOperationAction(ISD::BlockAddress, XLenVT, Custom); setOperationAction(ISD::ConstantPool, XLenVT, Custom); @@ -876,6 +884,32 @@ void RISCVTargetLowering::ReplaceNodeResults(SDNode *N switch (N->getOpcode()) { default: llvm_unreachable("Don't know how to custom type legalize this operation!"); + case ISD::STRICT_FP_TO_SINT: + case ISD::STRICT_FP_TO_UINT: + case ISD::FP_TO_SINT: + case ISD::FP_TO_UINT: { + bool IsStrict = N->isStrictFPOpcode(); + assert(N->getValueType(0) == MVT::i32 && Subtarget.is64Bit() && + "Unexpected custom legalisation"); + SDValue Op0 = IsStrict ? N->getOperand(1) : N->getOperand(0); + RTLIB::Libcall LC; + if (N->getOpcode() == ISD::FP_TO_SINT || + N->getOpcode() == ISD::STRICT_FP_TO_SINT) + LC = RTLIB::getFPTOSINT(Op0.getValueType(), N->getValueType(0)); + else + LC = RTLIB::getFPTOUINT(Op0.getValueType(), N->getValueType(0)); + MakeLibCallOptions CallOptions; + EVT OpVT = Op0.getValueType(); + CallOptions.setTypeListBeforeSoften(OpVT, N->getValueType(0), true); + SDValue Chain = IsStrict ? N->getOperand(0) : SDValue(); + SDValue Result; + std::tie(Result, Chain) = + makeLibCall(DAG, LC, N->getValueType(0), Op0, CallOptions, DL, Chain); + Results.push_back(Result); + if (IsStrict) + Results.push_back(Chain); + break; + } case ISD::READCYCLECOUNTER: { assert(!Subtarget.is64Bit() && "READCYCLECOUNTER only has custom type legalization on riscv32"); Modified: head/lib/clang/include/VCSVersion.inc ============================================================================== --- head/lib/clang/include/VCSVersion.inc Sun Jun 28 06:52:39 2020 (r362718) +++ head/lib/clang/include/VCSVersion.inc Sun Jun 28 07:43:43 2020 (r362719) @@ -1,14 +1,14 @@ // $FreeBSD$ -#define LLVM_REVISION "llvmorg-10.0.0-129-gd24d5c8e308" +#define LLVM_REVISION "llvmorg-10.0.1-rc2-0-g77d76b71d7d" #define LLVM_REPOSITORY "git@github.com:llvm/llvm-project.git" -#define CLANG_REVISION "llvmorg-10.0.0-129-gd24d5c8e308" +#define CLANG_REVISION "llvmorg-10.0.1-rc2-0-g77d76b71d7d" #define CLANG_REPOSITORY "git@github.com:llvm/llvm-project.git" // - -#define LLD_REVISION "llvmorg-10.0.0-129-gd24d5c8e308-1300007" +#define LLD_REVISION "llvmorg-10.0.1-rc2-0-g77d76b71d7d-1300007" #define LLD_REPOSITORY "FreeBSD" -#define LLDB_REVISION "llvmorg-10.0.0-129-gd24d5c8e308" +#define LLDB_REVISION "llvmorg-10.0.1-rc2-0-g77d76b71d7d" #define LLDB_REPOSITORY "git@github.com:llvm/llvm-project.git" Modified: head/lib/clang/include/llvm/Support/VCSRevision.h ============================================================================== --- head/lib/clang/include/llvm/Support/VCSRevision.h Sun Jun 28 06:52:39 2020 (r362718) +++ head/lib/clang/include/llvm/Support/VCSRevision.h Sun Jun 28 07:43:43 2020 (r362719) @@ -1,3 +1,3 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "llvmorg-10.0.0-129-gd24d5c8e308" +#define LLVM_REVISION "llvmorg-10.0.1-rc2-0-g77d76b71d7d" #define LLVM_REPOSITORY "git@github.com:llvm/llvm-project.git" Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sun Jun 28 06:52:39 2020 (r362718) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sun Jun 28 07:43:43 2020 (r362719) @@ -1493,6 +1493,7 @@ OLD_FILES+=usr/bin/llvm-cxxfilt OLD_FILES+=usr/bin/llvm-diff OLD_FILES+=usr/bin/llvm-dis OLD_FILES+=usr/bin/llvm-dwarfdump +OLD_FILES+=usr/bin/llvm-dwp OLD_FILES+=usr/bin/llvm-extract OLD_FILES+=usr/bin/llvm-link OLD_FILES+=usr/bin/llvm-lto @@ -1503,6 +1504,8 @@ OLD_FILES+=usr/bin/llvm-modextract OLD_FILES+=usr/bin/llvm-objcopy OLD_FILES+=usr/bin/llvm-pdbutil OLD_FILES+=usr/bin/llvm-rtdyld +OLD_FILES+=usr/bin/llvm-size +OLD_FILES+=usr/bin/llvm-strings OLD_FILES+=usr/bin/llvm-xray OLD_FILES+=usr/bin/opt OLD_FILES+=usr/share/man/man1/bugpoint.1.gz @@ -1518,6 +1521,8 @@ OLD_FILES+=usr/share/man/man1/llvm-extract.1.gz OLD_FILES+=usr/share/man/man1/llvm-link.1.gz OLD_FILES+=usr/share/man/man1/llvm-objcopy.1.gz OLD_FILES+=usr/share/man/man1/llvm-pdbutil.1.gz +OLD_FILES+=usr/share/man/man1/llvm-size.1.gz +OLD_FILES+=usr/share/man/man1/llvm-strings.1.gz OLD_FILES+=usr/share/man/man1/opt.1.gz .endif @@ -2078,6 +2083,7 @@ OLD_FILES+=usr/share/man/man1/gcov.1.gz OLD_FILES+=usr/bin/llvm-cov OLD_FILES+=usr/bin/llvm-profdata OLD_FILES+=usr/share/man/man1/llvm-cov.1.gz +OLD_FILES+=usr/share/man/man1/llvm-profdata.1.gz .endif .if ${MK_GDB} == no Modified: head/usr.bin/clang/Makefile ============================================================================== --- head/usr.bin/clang/Makefile Sun Jun 28 06:52:39 2020 (r362718) +++ head/usr.bin/clang/Makefile Sun Jun 28 07:43:43 2020 (r362719) @@ -27,6 +27,7 @@ SUBDIR+= llvm-cxxfilt SUBDIR+= llvm-diff SUBDIR+= llvm-dis SUBDIR+= llvm-dwarfdump +SUBDIR+= llvm-dwp SUBDIR+= llvm-extract SUBDIR+= llvm-link SUBDIR+= llvm-lto @@ -37,6 +38,8 @@ SUBDIR+= llvm-modextract SUBDIR+= llvm-objcopy SUBDIR+= llvm-pdbutil SUBDIR+= llvm-rtdyld +SUBDIR+= llvm-size +SUBDIR+= llvm-strings SUBDIR+= llvm-xray SUBDIR+= opt .endif Added: head/usr.bin/clang/llvm-dwp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/llvm-dwp/Makefile Sun Jun 28 07:43:43 2020 (r362719) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PROG_CXX= llvm-dwp +MAN= + +SRCDIR= llvm/tools/llvm-dwp +SRCS+= DWPError.cpp +SRCS+= llvm-dwp.cpp + +LIBADD+= z + +.include "../llvm.prog.mk" Added: head/usr.bin/clang/llvm-size/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/llvm-size/Makefile Sun Jun 28 07:43:43 2020 (r362719) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG_CXX= llvm-size + +SRCDIR= llvm/tools/llvm-size +SRCS+= llvm-size.cpp + +.include "../llvm.prog.mk" Added: head/usr.bin/clang/llvm-size/llvm-size.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/llvm-size/llvm-size.1 Sun Jun 28 07:43:43 2020 (r362719) @@ -0,0 +1,275 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +.TH "LLVM-SIZE" "1" "2020-06-26" "10" "LLVM" +.SH NAME +llvm-size \- print size information +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +\fBllvm\-size\fP [\fIoptions\fP] [\fIinput...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-size\fP is a tool that prints size information for binary files. +It is intended to be a drop\-in replacement for GNU\(aqs \fBsize\fP\&. +.sp +The tool prints size information for each \fBinput\fP specified. If no input is +specified, the program prints size information for \fBa.out\fP\&. If "\fB\-\fP" is +specified as an input file, \fBllvm\-size\fP reads a file from the standard +input stream. If an input is an archive, size information will be displayed for +all its members. +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-A +Equivalent to \fI\%\-\-format\fP with a value of \fBsysv\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-arch= +Architecture(s) from Mach\-O universal binaries to display information for. +.UNINDENT +.INDENT 0.0 +.TP +.B \-B +Equivalent to \fI\%\-\-format\fP with a value of \fBberkeley\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-common +Include ELF common symbol sizes in bss size for \fBberkeley\fP output format, or +as a separate section entry for \fBsysv\fP output. If not specified, these +symbols are ignored. +.UNINDENT +.INDENT 0.0 +.TP +.B \-d +Equivalent to \fI\%\-\-radix\fP with a value of \fB10\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-l +Display verbose address and offset information for segments and sections in +Mach\-O files in \fBdarwin\fP format. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-format= +Set the output format to the \fB\fP specified. Available \fB\fP +options are \fBberkeley\fP (the default), \fBsysv\fP and \fBdarwin\fP\&. +.sp +Berkeley output summarises text, data and bss sizes in each file, as shown +below for a typical pair of ELF files: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=berkeley test.o test2.o + text data bss dec hex filename + 182 16 5 203 cb test.elf + 82 8 1 91 5b test2.o +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +For Mach\-O files, the output format is slightly different: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=berkeley macho.obj macho2.obj +__TEXT __DATA __OBJC others dec hex +4 8 0 0 12 c macho.obj +16 32 0 0 48 30 macho2.obj +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +Sysv output displays size and address information for most sections, with each +file being listed separately: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=sysv test.elf test2.o + test.elf : + section size addr + .eh_frame 92 2097496 + .text 90 2101248 + .data 16 2105344 + .bss 5 2105360 + .comment 209 0 + Total 412 + + test2.o : + section size addr + .text 26 0 + .data 8 0 + .bss 1 0 + .comment 106 0 + .note.GNU\-stack 0 0 + .eh_frame 56 0 + .llvm_addrsig 2 0 + Total 199 +.ft P +.fi +.UNINDENT +.UNINDENT +.sp +\fBdarwin\fP format only affects Mach\-O input files. If an input of a different +file format is specified, \fBllvm\-size\fP falls back to \fBberkeley\fP +format. When producing \fBdarwin\fP format, the tool displays information about +segments and sections: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-format=darwin macho.obj macho2.obj + macho.obj: + Segment : 12 + Section (__TEXT, __text): 4 + Section (__DATA, __data): 8 + total 12 + total 12 + macho2.obj: + Segment : 48 + Section (__TEXT, __text): 16 + Section (__DATA, __data): 32 + total 48 + total 48 +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Display a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Display an uncategorized summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-m +Equivalent to \fI\%\-\-format\fP with a value of \fBdarwin\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-o +Equivalent to \fI\%\-\-radix\fP with a value of \fB8\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-radix= +Display size information in the specified radix. Permitted values are \fB8\fP, +\fB10\fP (the default) and \fB16\fP for octal, decimal and hexadecimal output +respectively. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-radix=8 test.o + text data bss oct hex filename + 0152 04 04 162 72 test.o + +$ llvm\-size \-\-radix=10 test.o + text data bss dec hex filename + 106 4 4 114 72 test.o + +$ llvm\-size \-\-radix=16 test.o + text data bss dec hex filename + 0x6a 0x4 0x4 114 72 test.o +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-totals, \-t +Applies only to \fBberkeley\fP output format. Display the totals for all listed +fields, in addition to the individual file listings. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-size \-\-totals test.elf test2.o + text data bss dec hex filename + 182 16 5 203 cb test.elf + 82 8 1 91 5b test2.o + 264 24 6 294 126 (TOTALS) +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-version +Display the version of the \fBllvm\-size\fP executable. +.UNINDENT +.INDENT 0.0 +.TP +.B \-x +Equivalent to \fI\%\-\-radix\fP with a value of \fB16\fP\&. +.UNINDENT +.INDENT 0.0 +.TP +.B @ +Read command\-line options from response file \fB\fP\&. +.UNINDENT +.SH EXIT STATUS +.sp +\fBllvm\-size\fP exits with a non\-zero exit code if there is an error. +Otherwise, it exits with code 0. +.SH BUGS +.sp +To report bugs, please visit <\fI\%http://llvm.org/bugs/\fP>. +.SH AUTHOR +Maintained by the LLVM Team (https://llvm.org/). +.SH COPYRIGHT +2003-2020, LLVM Project +.\" Generated by docutils manpage writer. +. Added: head/usr.bin/clang/llvm-strings/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/llvm-strings/Makefile Sun Jun 28 07:43:43 2020 (r362719) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +PROG_CXX= llvm-strings +MAN= + +SRCDIR= llvm/tools/llvm-strings +SRCS+= llvm-strings.cpp + +.include "../llvm.prog.mk" Added: head/usr.bin/clang/llvm-strings/llvm-strings.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/clang/llvm-strings/llvm-strings.1 Sun Jun 28 07:43:43 2020 (r362719) @@ -0,0 +1,179 @@ +.\" $FreeBSD$ +.\" Man page generated from reStructuredText. +. +.TH "LLVM-STRINGS" "1" "2020-06-26" "10" "LLVM" +.SH NAME +llvm-strings \- print strings +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +\fBllvm\-strings\fP [\fIoptions\fP] [\fIinput...\fP] +.SH DESCRIPTION +.sp +\fBllvm\-strings\fP is a tool intended as a drop\-in replacement for GNU\(aqs +\fBstrings\fP, which looks for printable strings in files and writes them +to the standard output stream. A printable string is any sequence of four (by +default) or more printable ASCII characters. The end of the file, or any other +byte, terminates the current sequence. +.sp +\fBllvm\-strings\fP looks for strings in each \fBinput\fP file specified. +Unlike GNU \fBstrings\fP it looks in the entire input file, regardless of +file format, rather than restricting the search to certain sections of object +files. If "\fB\-\fP" is specified as an \fBinput\fP, or no \fBinput\fP is specified, +the program reads from the standard input stream. +.SH EXAMPLE +.INDENT 0.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ cat input.txt +bars +foo +wibble blob +$ llvm\-strings input.txt +bars +wibble blob +.ft P +.fi +.UNINDENT +.UNINDENT +.SH OPTIONS +.INDENT 0.0 +.TP +.B \-\-all, \-a +Silently ignored. Present for GNU \fBstrings\fP compatibility. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-bytes=, \-n +Set the minimum number of printable ASCII characters required for a sequence of +bytes to be considered a string. The default value is 4. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help, \-h +Display a summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-help\-list +Display an uncategorized summary of command line options. +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-print\-file\-name, \-f +Display the name of the containing file before each string. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-strings \-\-print\-file\-name test.o test.elf +test.o: _Z5hellov +test.o: some_bss +test.o: test.cpp +test.o: main +test.elf: test.cpp +test.elf: test2.cpp +test.elf: _Z5hellov +test.elf: main +test.elf: some_bss +.ft P +.fi +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 +.TP +.B \-\-radix=, \-t +Display the offset within the file of each string, before the string and using +the specified radix. Valid \fB\fP values are \fBo\fP, \fBd\fP and \fBx\fP for +octal, decimal and hexadecimal respectively. +.sp +Example: +.INDENT 7.0 +.INDENT 3.5 +.sp +.nf +.ft C +$ llvm\-strings \-\-radix=o test.o + 1054 _Z5hellov *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Jun 28 08:28: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 EADC63456A3; Sun, 28 Jun 2020 08:28:14 +0000 (UTC) (envelope-from se@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 49vkKB5jYTz47Ls; Sun, 28 Jun 2020 08:28:14 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f20330048efac7f3c2f423b.dip0.t-ipconnect.de [IPv6:2003:cd:5f20:3300:48ef:ac7f:3c2f:423b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id EFB7F29998; Sun, 28 Jun 2020 08:28:13 +0000 (UTC) (envelope-from se@freebsd.org) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: Eric van Gyzen References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> From: =?UTF-8?Q?Stefan_E=c3=9fer?= Autocrypt: addr=se@freebsd.org; keydata= mQENBFVxiRIBCADOLNOZBsqlplHUQ3tG782FNtVT33rQli9EjNt2fhFERHIo4NxHlWBpHLnU b0s4L/eItx7au0i7Gegv01A9LUMwOnAc9EFAm4EW3Wmoa6MYrcP7xDClohg/Y69f7SNpEs3x YATBy+L6NzWZbJjZXD4vqPgZSDuMcLU7BEdJf0f+6h1BJPnGuwHpsSdnnMrZeIM8xQ8PPUVQ L0GZkVojHgNUngJH6e21qDrud0BkdiBcij0M3TCP4GQrJ/YMdurfc8mhueLpwGR2U1W8TYB7 4UY+NLw0McThOCLCxXflIeF/Y7jSB0zxzvb/H3LWkodUTkV57yX9IbUAGA5RKRg9zsUtABEB AAG0J1N0ZWZhbiBFw59lciAoRnJlZUJTRCkgPHNlQGZyZWVic2Qub3JnPokBVAQTAQoAPgIb AwULCQgHAwUVCgkICwUWAwIBAAIeAQIXgBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+q BQkLJQETAAoJEEfrte9a/fVEOeMH/icmdK1eZQvB3U8quJo9VMaZsaTuCMbUE4NThyfsIvIm MCd+rb/yULmMYwqNfjyKB1x4ikR4x+94l+yJoz7K0Usks+eNKDmMGJM6pWWssTigaJubFdVd hVVC+C1QJi7JshYSib08uONoPmO4lv5Az0TDYGtsMzsES2sIlc62c9go5WPGYhQFRbX3Lk6y V6m8OHh+G9XGSj3oPO4UteRwu+SzTdOLunZBWG1wu34+IeZm663D+2gOppQLWpLa2qaTerqw THu377ayZ2B2LPJ5JkvkZeHYPkwDQ+b5PGn0UhfkxPnDVYki5F7qKxvQ5uq1/q9YaCX7mmOl H2yO7tgVsrW5AQ0EVXGJEgEIALEj9qCXMZVucjpcd3QxM/TlUr98m5viEd1z4tCnPUyRWcIC EVtj2h5xMH+2iB0q1+KWhq+NsWtvScmEmfHnsr7dJ1K677OdpDhKVaJk61eeRulFY1R4yb6C 1MMxK+WgYB+vvpG0UeyR0M4uBewcPvRsq4yGUHFQKtLAbMdoPTSryJA+ElnmK1vdY+rPcHgi OIMBZM7ahsPXC0C9K4e5SP9clGyIoMpbfHXdx9q+Rp3zVtlbhyk3BS/xccu/+9pk9ICXL6GR js2sNnJ0wxdU1DsAlC59a5MnSruwiZFwRnkQhr3x6wk97Lg7sLS9jjTnCN7LGlVmSmpOEMy6 uq1AWfUAEQEAAYkBPAQYAQoAJgIbDBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+rBQkL JQEZAAoJEEfrte9a/fVEuesH/2DNxGWnHvWwMyiyhlQtafvDKwEn/wAgR8gHJFodB7emf8rA TnukH7MVttCoHtjN5lvv9RSBHjNTZls5wR/ANlwdRuPQHd8ZGxLe3S6IuUB3zDSwFltLGurO N2kOMhs5mTGyypSa+uw3rtQbUAVYf1oPbiR4FLtiM8FLyEvE95hX5fPq9Qvx9FmN79kmCIEw jDKPqDaUf/OR2fEF0LSIbXHEk4tNqCEwx5DIJ0fp5/z5UzICUAmwxyRs5O/Hre1jzPsMVyud Ml9t7UTOJGKVWwRory1PMnOFxN+iz5/d4FhYSKXF7kfMiFgol4LuWaxJRwbBrr71VGBrRy2a L1nw6Bc= Cc: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> Date: Sun, 28 Jun 2020 10:28:08 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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, 28 Jun 2020 08:28:15 -0000 Am 27.06.20 um 23:52 schrieb Eric van Gyzen: > On 6/27/20 8:11 AM, John Baldwin wrote: >> On 6/27/20 5:02 AM, Stefan Eßer wrote: >>> Author: se >>> Date: Sat Jun 27 12:02:01 2020 >>> New Revision: 362681 >>> URL: https://svnweb.freebsd.org/changeset/base/362681 >>> >>> Log: >>>    Import new 2-clause BSD licenced implementation of the bc and dc >>> commands >> >> Hmm, I didn't see a commit to add the vendor sources into ^/vendor >> first via our >> standard process for contrib sources, nor any discussion about that in >> the review. > > When you add this to the vendor area, please include the tests, to > remove a barrier to integration. Hi Eric, I have already imported the full sources into the vendor area, including the tests. These tests compare the output of this bc and dc with that of GNU bc/dc and are run as regression tests by the author before a release is tagged (and have been extended over time for each area where an issue has been found). Extensive fuzzing is also performed to verify that the low level math functions give correct results (again using another bc/dc as reference), but we do not want to include those particular tests. I'd like to make the tests available as regression tests in FreeBSD, but have not looked at the best way to integrate them, yet. (The tests are meant to be run within the source directory after building from sources in place, for example, which is not at all what we do in FreeBSD.) Independently of the issue of tests, I'm not sure about the best way to proceed from the current situation with regard to what's in contrib/bc now, and I have decided to leave the incomplete import untouched in contrib/bc until I understand the best way forward. I could delete what's currently in contrib/bc and use svn copy to make the whole contents of vendor/bc/dist available in contrib/bc. The tests require 1112 KB of space, while the rest of the sources takes up less than 900 KB. I could revert the full import to contrib/bc, but that would also revert changes to e.g. usr.bin/Makefile and I'd rather remove just what's now in contrib/bc and then use svn copy to make vendor/bc/dist available there. The sources from the dist directory can be used unmodified, the reason for cherry-picking was just that I did not want to import more than is used at this time ... I'd appreciate any advice given about what causes the least repo churn and extra effort for the Git conversion. Regards, STefan From owner-svn-src-head@freebsd.org Sun Jun 28 11:12: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 764C6348B1F; Sun, 28 Jun 2020 11:12:04 +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 49vnyD2PxHz4G0B; Sun, 28 Jun 2020 11:12:04 +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 4E1D2151F2; Sun, 28 Jun 2020 11:12:04 +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 05SBC4jv050171; Sun, 28 Jun 2020 11:12:04 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SBC4g1050170; Sun, 28 Jun 2020 11:12:04 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006281112.05SBC4g1050170@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 28 Jun 2020 11:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362720 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362720 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 11:12:04 -0000 Author: tuexen Date: Sun Jun 28 11:12:03 2020 New Revision: 362720 URL: https://svnweb.freebsd.org/changeset/base/362720 Log: Don't check ch for not being NULL, since that is true. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Jun 28 07:43:43 2020 (r362719) +++ head/sys/netinet/sctp_input.c Sun Jun 28 11:12:03 2020 (r362720) @@ -5106,7 +5106,7 @@ process_control_chunks: break; case SCTP_STREAM_RESET: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_STREAM_RESET\n"); - if (((stcb == NULL) || (ch == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req)))) { + if ((stcb == NULL) || (chk_length < sizeof(struct sctp_stream_reset_tsn_req))) { /* Its not ours */ *offset = length; return (stcb); @@ -5129,7 +5129,7 @@ process_control_chunks: return (stcb); } - if ((ch != NULL) && (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { + if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { if (stcb->asoc.pktdrop_supported == 0) { goto unknown_chunk; } @@ -5165,8 +5165,7 @@ process_control_chunks: goto next_chunk; } got_auth = 1; - if ((ch == NULL) || sctp_handle_auth(stcb, (struct sctp_auth_chunk *)ch, - m, *offset)) { + if (sctp_handle_auth(stcb, (struct sctp_auth_chunk *)ch, m, *offset)) { /* auth HMAC failed so dump the packet */ *offset = length; return (stcb); From owner-svn-src-head@freebsd.org Sun Jun 28 14:11: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 2232C34CFE2; Sun, 28 Jun 2020 14:11:37 +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 49vsxP0712z4SSj; Sun, 28 Jun 2020 14:11:37 +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 F39A91790D; Sun, 28 Jun 2020 14:11:36 +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 05SEBa3p066034; Sun, 28 Jun 2020 14:11:36 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SEBarK066033; Sun, 28 Jun 2020 14:11:36 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006281411.05SEBarK066033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 28 Jun 2020 14:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362722 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362722 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 14:11:37 -0000 Author: tuexen Date: Sun Jun 28 14:11:36 2020 New Revision: 362722 URL: https://svnweb.freebsd.org/changeset/base/362722 Log: Don't send packets containing ERROR chunks in response to unknown chunks when being in a state where the verification tag to be used is not known yet. MFC after: 1 week Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Jun 28 14:02:49 2020 (r362721) +++ head/sys/netinet/sctp_input.c Sun Jun 28 14:11:36 2020 (r362722) @@ -5178,7 +5178,11 @@ process_control_chunks: default: unknown_chunk: /* it's an unknown chunk! */ - if ((ch->chunk_type & 0x40) && (stcb != NULL)) { + if ((ch->chunk_type & 0x40) && + (stcb != NULL) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_EMPTY) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_INUSE) && + (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) { struct sctp_gen_error_cause *cause; int len; From owner-svn-src-head@freebsd.org Sun Jun 28 15:03: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 AB63D34E1A1; Sun, 28 Jun 2020 15:03:08 +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 49vv4r3wPvz4WYQ; Sun, 28 Jun 2020 15:03:08 +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 81D74181D6; Sun, 28 Jun 2020 15:03:08 +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 05SF38pk001230; Sun, 28 Jun 2020 15:03:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SF37F5001227; Sun, 28 Jun 2020 15:03:07 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202006281503.05SF37F5001227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 28 Jun 2020 15:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362726 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 362726 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 15:03:08 -0000 Author: andrew Date: Sun Jun 28 15:03:07 2020 New Revision: 362726 URL: https://svnweb.freebsd.org/changeset/base/362726 Log: Use EFI memory map to determine attributes for Acpi mappings on arm64. AcpiOsMapMemory is used for device memory when e.g. an _INI method wants to access physical memory, however, aarch64 pmap_mapbios is hardcoded to writeback. Search for the correct memory type to use in pmap_mapbios. Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D25201 Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/pmap.c head/sys/arm64/include/machdep.h Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sun Jun 28 14:40:48 2020 (r362725) +++ head/sys/arm64/arm64/machdep.c Sun Jun 28 15:03:07 2020 (r362726) @@ -120,6 +120,7 @@ int has_pan; * passed into the kernel and used by the EFI code to call runtime services. */ vm_paddr_t efi_systbl_phys; +static struct efi_map_header *efihdr; /* pagezero_* implementations are provided in support.S */ void pagezero_simple(void *); @@ -1071,11 +1072,52 @@ cache_setup(void) } } +int +memory_mapping_mode(vm_paddr_t pa) +{ + struct efi_md *map, *p; + size_t efisz; + int ndesc, i; + + if (efihdr == NULL) + return (VM_MEMATTR_WRITE_BACK); + + /* + * Memory map data provided by UEFI via the GetMemoryMap + * Boot Services API. + */ + efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; + map = (struct efi_md *)((uint8_t *)efihdr + efisz); + + if (efihdr->descriptor_size == 0) + return (VM_MEMATTR_WRITE_BACK); + ndesc = efihdr->memory_size / efihdr->descriptor_size; + + for (i = 0, p = map; i < ndesc; i++, + p = efi_next_descriptor(p, efihdr->descriptor_size)) { + if (pa < p->md_phys || + pa >= p->md_phys + p->md_pages * EFI_PAGE_SIZE) + continue; + if (p->md_type == EFI_MD_TYPE_IOMEM || + p->md_type == EFI_MD_TYPE_IOPORT) + return (VM_MEMATTR_DEVICE); + else if ((p->md_attr & EFI_MD_ATTR_WB) != 0 || + p->md_type == EFI_MD_TYPE_RECLAIM) + return (VM_MEMATTR_WRITE_BACK); + else if ((p->md_attr & EFI_MD_ATTR_WT) != 0) + return (VM_MEMATTR_WRITE_THROUGH); + else if ((p->md_attr & EFI_MD_ATTR_WC) != 0) + return (VM_MEMATTR_WRITE_COMBINING); + break; + } + + return (VM_MEMATTR_DEVICE); +} + void initarm(struct arm64_bootparams *abp) { struct efi_fb *efifb; - struct efi_map_header *efihdr; struct pcpu *pcpup; char *env; #ifdef FDT Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Sun Jun 28 14:40:48 2020 (r362725) +++ head/sys/arm64/arm64/pmap.c Sun Jun 28 15:03:07 2020 (r362726) @@ -5449,7 +5449,7 @@ pmap_mapbios(vm_paddr_t pa, vm_size_t size) /* L3 table is linked */ va = trunc_page(va); pa = trunc_page(pa); - pmap_kenter(va, size, pa, VM_MEMATTR_WRITE_BACK); + pmap_kenter(va, size, pa, memory_mapping_mode(pa)); } return ((void *)(va + offset)); Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Sun Jun 28 14:40:48 2020 (r362725) +++ head/sys/arm64/include/machdep.h Sun Jun 28 15:03:07 2020 (r362726) @@ -56,6 +56,7 @@ vm_offset_t parse_boot_param(struct arm64_bootparams * #ifdef FDT void parse_fdt_bootargs(void); #endif +int memory_mapping_mode(vm_paddr_t pa); extern void (*pagezero)(void *); #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Sun Jun 28 17:28: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 A2CD2351335; Sun, 28 Jun 2020 17:28:11 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49vyJC3shXz4dyP; Sun, 28 Jun 2020 17:28:11 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F22C19942; Sun, 28 Jun 2020 17:28:11 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05SHSBUD087106; Sun, 28 Jun 2020 17:28:11 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SHSBGs087105; Sun, 28 Jun 2020 17:28:11 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <202006281728.05SHSBGs087105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Sun, 28 Jun 2020 17:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362727 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 362727 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 17:28:11 -0000 Author: grembo (ports committer) Date: Sun Jun 28 17:28:11 2020 New Revision: 362727 URL: https://svnweb.freebsd.org/changeset/base/362727 Log: Adapt documentation of kern.tty_info_kstacks. s/stack/kernel stack/, as this feature only shows kernel stacks. Reported by: jhb Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D25488 Modified: head/share/man/man4/termios.4 Modified: head/share/man/man4/termios.4 ============================================================================== --- head/share/man/man4/termios.4 Sun Jun 28 15:03:07 2020 (r362726) +++ head/share/man/man4/termios.4 Sun Jun 28 17:28:11 2020 (r362727) @@ -28,7 +28,7 @@ .\" @(#)termios.4 8.4 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd June 27, 2020 +.Dd June 28, 2020 .Dt TERMIOS 4 .Os .Sh NAME @@ -766,7 +766,7 @@ In case the .Xr sysctl 8 variable .Va kern.tty_info_kstacks -is set to a non-zero value, the running thread's stack is +is set to a non-zero value, the running thread's kernel stack is written to the terminal (e.g., for debugging purposes). .El .Pp From owner-svn-src-head@freebsd.org Sun Jun 28 18:02: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 7F87B351FD3; Sun, 28 Jun 2020 18:02:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49vz3T2mjPz3Rxh; Sun, 28 Jun 2020 18:02:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A41B1A55C; Sun, 28 Jun 2020 18:02:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05SI2Daq007855; Sun, 28 Jun 2020 18:02:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SI2DiL007849; Sun, 28 Jun 2020 18:02:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202006281802.05SI2DiL007849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 28 Jun 2020 18:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362733 - head X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 362733 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 18:02:13 -0000 Author: dim Date: Sun Jun 28 18:02:12 2020 New Revision: 362733 URL: https://svnweb.freebsd.org/changeset/base/362733 Log: Remove older llvm-ranlib.1 entry from ObsoleteFiles.inc, as it has gotten its own manpage now, and should be no longer be removed by "make delete-old". MFC after: 3 weeks Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Jun 28 17:51:17 2020 (r362732) +++ head/ObsoleteFiles.inc Sun Jun 28 18:02:12 2020 (r362733) @@ -6763,7 +6763,6 @@ OLD_FILES+=usr/include/clang/3.3/x86intrin.h OLD_FILES+=usr/include/clang/3.3/xmmintrin.h OLD_FILES+=usr/include/clang/3.3/xopintrin.h OLD_FILES+=usr/share/man/man1/llvm-prof.1.gz -OLD_FILES+=usr/share/man/man1/llvm-ranlib.1.gz OLD_DIRS+=usr/include/clang/3.3 # 20140216: nve(4) removed OLD_FILES+=usr/share/man/man4/if_nve.4.gz From owner-svn-src-head@freebsd.org Sun Jun 28 18:02: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 18579352197; Sun, 28 Jun 2020 18:02:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49vz4C70v6z3SJ2; Sun, 28 Jun 2020 18:02:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBD0419DF6; Sun, 28 Jun 2020 18:02:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05SI2p6X011913; Sun, 28 Jun 2020 18:02:51 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SI2pFJ011912; Sun, 28 Jun 2020 18:02:51 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202006281802.05SI2pFJ011912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 28 Jun 2020 18:02:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362734 - head/usr.bin/clang/llvm-strings X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/usr.bin/clang/llvm-strings X-SVN-Commit-Revision: 362734 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 18:02:52 -0000 Author: dim Date: Sun Jun 28 18:02:51 2020 New Revision: 362734 URL: https://svnweb.freebsd.org/changeset/base/362734 Log: Fix llvm-strings.1 not installing, this was a copy/paste error. MFC after: 3 weeks Modified: head/usr.bin/clang/llvm-strings/Makefile Modified: head/usr.bin/clang/llvm-strings/Makefile ============================================================================== --- head/usr.bin/clang/llvm-strings/Makefile Sun Jun 28 18:02:12 2020 (r362733) +++ head/usr.bin/clang/llvm-strings/Makefile Sun Jun 28 18:02:51 2020 (r362734) @@ -1,7 +1,6 @@ # $FreeBSD$ PROG_CXX= llvm-strings -MAN= SRCDIR= llvm/tools/llvm-strings SRCS+= llvm-strings.cpp From owner-svn-src-head@freebsd.org Sun Jun 28 18:56: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 60724352CF0; Sun, 28 Jun 2020 18:56: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 49w0G91w11z3TfP; Sun, 28 Jun 2020 18:56:33 +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 3CA8E1ACC2; Sun, 28 Jun 2020 18:56:33 +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 05SIuXFV042330; Sun, 28 Jun 2020 18:56:33 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SIuWIa042328; Sun, 28 Jun 2020 18:56:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006281856.05SIuWIa042328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 28 Jun 2020 18:56:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362735 - 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: 362735 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 18:56:33 -0000 Author: trasz Date: Sun Jun 28 18:56:32 2020 New Revision: 362735 URL: https://svnweb.freebsd.org/changeset/base/362735 Log: Make linux(4) support SO_PROTOCOL. Running Python test suite with python3.8 from Focal triggers those. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25491 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 Sun Jun 28 18:02:51 2020 (r362734) +++ head/sys/compat/linux/linux_socket.c Sun Jun 28 18:56:32 2020 (r362735) @@ -236,6 +236,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_TIMESTAMP); case LINUX_SO_ACCEPTCONN: return (SO_ACCEPTCONN); + case LINUX_SO_PROTOCOL: + return (SO_PROTOCOL); } return (-1); } Modified: head/sys/compat/linux/linux_socket.h ============================================================================== --- head/sys/compat/linux/linux_socket.h Sun Jun 28 18:02:51 2020 (r362734) +++ head/sys/compat/linux/linux_socket.h Sun Jun 28 18:56:32 2020 (r362735) @@ -197,6 +197,7 @@ int linux_accept(struct thread *td, struct linux_accep #define LINUX_SO_ACCEPTCONN 30 #define LINUX_SO_SNDBUFFORCE 32 #define LINUX_SO_RCVBUFFORCE 33 +#define LINUX_SO_PROTOCOL 38 /* Socket options */ #define LINUX_IP_TOS 1 From owner-svn-src-head@freebsd.org Sun Jun 28 21:11: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 DA22835612B; Sun, 28 Jun 2020 21:11:10 +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 49w3FV5R1xz3c6g; Sun, 28 Jun 2020 21:11:10 +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 9F24D1C726; Sun, 28 Jun 2020 21:11:10 +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 05SLBAoa025545; Sun, 28 Jun 2020 21:11:10 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SLBAAq025544; Sun, 28 Jun 2020 21:11:10 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202006282111.05SLBAAq025544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 28 Jun 2020 21:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362736 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 362736 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 21:11:10 -0000 Author: gonzo Date: Sun Jun 28 21:11:10 2020 New Revision: 362736 URL: https://svnweb.freebsd.org/changeset/base/362736 Log: Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC For 1000Mb mode to work reliably TX/RX delays need to be configured between the TX/RX clock and the respective signals on the PHY to compensate for differing trace lengths on the PCB. Reviewed by: manu MFC after: 1 week Modified: head/sys/arm64/rockchip/if_dwc_rk.c Modified: head/sys/arm64/rockchip/if_dwc_rk.c ============================================================================== --- head/sys/arm64/rockchip/if_dwc_rk.c Sun Jun 28 18:56:32 2020 (r362735) +++ head/sys/arm64/rockchip/if_dwc_rk.c Sun Jun 28 21:11:10 2020 (r362736) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #define RK3328_GRF_MAC_CON0_RX_SHIFT 7 #define RK3328_GRF_MAC_CON1 0x0904 +#define RK3328_GRF_MAC_CON1_RX_ENA (1 << 1) +#define RK3328_GRF_MAC_CON1_TX_ENA (1 << 0) #define RK3328_GRF_MAC_CON2 0x0908 #define RK3328_GRF_MACPHY_CON0 0x0B00 #define RK3328_GRF_MACPHY_CON1 0x0B04 @@ -71,7 +73,6 @@ static struct ofw_compat_data compat_data[] = { {NULL, 0} }; -#ifdef notyet static void rk3328_set_delays(struct syscon *grf, phandle_t node) { @@ -82,22 +83,26 @@ rk3328_set_delays(struct syscon *grf, phandle_t node) if (OF_getencprop(node, "rx_delay", &rx, sizeof(rx)) <= 0) rx = 0x10; + if (bootverbose) + printf("setting RK3328 RX/TX delays: %d/%d\n", rx, tx); tx = ((tx & RK3328_GRF_MAC_CON0_TX_MASK) << RK3328_GRF_MAC_CON0_TX_SHIFT); rx = ((rx & RK3328_GRF_MAC_CON0_TX_MASK) << RK3328_GRF_MAC_CON0_RX_SHIFT); SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON0, tx | rx | 0xFFFF0000); + SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON1, RK3328_GRF_MAC_CON1_TX_ENA | RK3328_GRF_MAC_CON1_RX_ENA | + ((RK3328_GRF_MAC_CON1_TX_ENA | RK3328_GRF_MAC_CON1_RX_ENA) << 16)); } -#endif #define RK3399_GRF_SOC_CON6 0xc218 +#define RK3399_GRF_SOC_CON6_TX_ENA (1 << 7) #define RK3399_GRF_SOC_CON6_TX_MASK 0x7F #define RK3399_GRF_SOC_CON6_TX_SHIFT 0 #define RK3399_GRF_SOC_CON6_RX_MASK 0x7F +#define RK3399_GRF_SOC_CON6_RX_ENA (1 << 15) #define RK3399_GRF_SOC_CON6_RX_SHIFT 8 -#ifdef notyet static void rk3399_set_delays(struct syscon *grf, phandle_t node) { @@ -108,14 +113,15 @@ rk3399_set_delays(struct syscon *grf, phandle_t node) if (OF_getencprop(node, "rx_delay", &rx, sizeof(rx)) <= 0) rx = 0x10; + if (bootverbose) + printf("setting RK3399 RX/TX delays: %d/%d\n", rx, tx); tx = ((tx & RK3399_GRF_SOC_CON6_TX_MASK) << - RK3399_GRF_SOC_CON6_TX_SHIFT); + RK3399_GRF_SOC_CON6_TX_SHIFT) | RK3399_GRF_SOC_CON6_TX_ENA; rx = ((rx & RK3399_GRF_SOC_CON6_TX_MASK) << - RK3399_GRF_SOC_CON6_RX_SHIFT); + RK3399_GRF_SOC_CON6_RX_SHIFT) | RK3399_GRF_SOC_CON6_RX_ENA; SYSCON_WRITE_4(grf, RK3399_GRF_SOC_CON6, tx | rx | 0xFFFF0000); } -#endif static int if_dwc_rk_probe(device_t dev) @@ -144,12 +150,10 @@ if_dwc_rk_init(device_t dev) return (ENXIO); } -#ifdef notyet if (ofw_bus_is_compatible(dev, "rockchip,rk3399-gmac")) rk3399_set_delays(grf, node); else if (ofw_bus_is_compatible(dev, "rockchip,rk3328-gmac")) rk3328_set_delays(grf, node); -#endif /* Mode should be set according to dtb property */ From owner-svn-src-head@freebsd.org Sun Jun 28 21:15: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 A85633563F0; Sun, 28 Jun 2020 21:15:29 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49w3LT40jkz3cPp; Sun, 28 Jun 2020 21:15:29 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C6CB1C843; Sun, 28 Jun 2020 21:15:29 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05SLFTKj028416; Sun, 28 Jun 2020 21:15:29 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SLFTYg028415; Sun, 28 Jun 2020 21:15:29 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <202006282115.05SLFTYg028415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 28 Jun 2020 21:15:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362737 - head/bin/sh/tests/execution X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh/tests/execution X-SVN-Commit-Revision: 362737 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 21:15:29 -0000 Author: jilles Date: Sun Jun 28 21:15:29 2020 New Revision: 362737 URL: https://svnweb.freebsd.org/changeset/base/362737 Log: sh/tests: Fix flaky execution/bg12.0 When job control is not enabled, the shell ignores SIGINT while waiting for a foreground process unless that process exits on SIGINT. In this case, the foreground process is sleep and it does not exit on SIGINT because the signal is only sent to the shell. Depending on order of events, this could cause the SIGINT to be unexpectedly ignored. On lightly loaded bare metal, the chance of this happening tends to be less than 0.01% but with higher loads and/or virtualization it becomes more likely. Starting the sleep in background and using the wait builtin ensures SIGINT will not be ignored. PR: 247559 Reported by: lwhsu MFC after: 1 week Modified: head/bin/sh/tests/execution/bg12.0 Modified: head/bin/sh/tests/execution/bg12.0 ============================================================================== --- head/bin/sh/tests/execution/bg12.0 Sun Jun 28 21:11:10 2020 (r362736) +++ head/bin/sh/tests/execution/bg12.0 Sun Jun 28 21:15:29 2020 (r362737) @@ -4,7 +4,7 @@ T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX` trap 'rm -rf $T' 0 cd $T || exit 3 mkfifo fifo1 -{ trap - INT; : >fifo1; sleep 5; exit 4; } & +{ trap - INT; : >fifo1; sleep 5 & wait; exit 4; } & : Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0ECA6356671; Sun, 28 Jun 2020 21:33:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49w3kr6dpCz3dYS; Sun, 28 Jun 2020 21:33:08 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C75EA1CC67; Sun, 28 Jun 2020 21:33:08 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05SLX8VP040022; Sun, 28 Jun 2020 21:33:08 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SLX8rL040021; Sun, 28 Jun 2020 21:33:08 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <202006282133.05SLX8rL040021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 28 Jun 2020 21:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362738 - head/bin/sh/tests X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh/tests X-SVN-Commit-Revision: 362738 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 21:33:09 -0000 Author: jilles Date: Sun Jun 28 21:33:08 2020 New Revision: 362738 URL: https://svnweb.freebsd.org/changeset/base/362738 Log: sh/tests: Re-enable bin.sh.execution.functional_test.bg12.0 This reverts r362646. PR: 247559 MFC after: 1 week Modified: head/bin/sh/tests/functional_test.sh Modified: head/bin/sh/tests/functional_test.sh ============================================================================== --- head/bin/sh/tests/functional_test.sh Sun Jun 28 21:15:29 2020 (r362737) +++ head/bin/sh/tests/functional_test.sh Sun Jun 28 21:33:08 2020 (r362738) @@ -27,7 +27,6 @@ # $FreeBSD$ SRCDIR=$(atf_get_srcdir) -CATEGORY=$(basename ${SRCDIR}) check() { @@ -61,20 +60,7 @@ add_testcase() esac atf_test_case ${tc_escaped} - - if [ "$(atf_config_get ci false)" = "true" ]; then - case "${CATEGORY}/${tc}" in - execution/bg12.0) - eval "${tc_escaped}_body() { atf_skip 'https://bugs.freebsd.org/247559'; }" - ;; - *) - eval "${tc_escaped}_body() { check ${tc}; }" - ;; - esac - else - eval "${tc_escaped}_body() { check ${tc}; }" - fi - + eval "${tc_escaped}_body() { check ${tc}; }" atf_add_test_case ${tc_escaped} } From owner-svn-src-head@freebsd.org Sun Jun 28 21:34: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 E432E3566C8; Sun, 28 Jun 2020 21:34:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49w3mb5mN4z3dbw; Sun, 28 Jun 2020 21:34: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 8F0F81C8CF; Sun, 28 Jun 2020 21:34: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 05SLYdCP040143; Sun, 28 Jun 2020 21:34:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SLYdfL040142; Sun, 28 Jun 2020 21:34:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006282134.05SLYdfL040142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 28 Jun 2020 21:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362739 - in head/sys: compat/linuxkpi/common/src dev/md X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: compat/linuxkpi/common/src dev/md X-SVN-Commit-Revision: 362739 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 21:34:40 -0000 Author: markj Date: Sun Jun 28 21:34:38 2020 New Revision: 362739 URL: https://svnweb.freebsd.org/changeset/base/362739 Log: Remove some redundant assignments and computations. Reported by: alc Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25400 Modified: head/sys/compat/linuxkpi/common/src/linux_page.c head/sys/dev/md/md.c Modified: head/sys/compat/linuxkpi/common/src/linux_page.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_page.c Sun Jun 28 21:33:08 2020 (r362738) +++ head/sys/compat/linuxkpi/common/src/linux_page.c Sun Jun 28 21:34:38 2020 (r362739) @@ -199,7 +199,7 @@ linux_get_user_pages_internal(vm_map_t map, unsigned l int count; prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; - len = ((size_t)nr_pages) << PAGE_SHIFT; + len = ptoa((vm_offset_t)nr_pages); count = vm_fault_quick_hold_pages(map, start, len, prot, pages, nr_pages); return (count == -1 ? -EFAULT : nr_pages); } @@ -219,9 +219,8 @@ __get_user_pages_fast(unsigned long start, int nr_page return (0); MPASS(pages != NULL); - va = start; map = &curthread->td_proc->p_vmspace->vm_map; - end = start + (((size_t)nr_pages) << PAGE_SHIFT); + end = start + ptoa((vm_offset_t)nr_pages); if (!vm_map_range_valid(map, start, end)) return (-EINVAL); prot = write ? (VM_PROT_READ | VM_PROT_WRITE) : VM_PROT_READ; Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Sun Jun 28 21:33:08 2020 (r362738) +++ head/sys/dev/md/md.c Sun Jun 28 21:34:38 2020 (r362739) @@ -1561,8 +1561,8 @@ mdresize(struct md_s *sc, struct md_req *mdr) if (mdr->md_mediasize <= 0 || (mdr->md_mediasize % PAGE_SIZE) != 0) return (EDOM); - oldpages = OFF_TO_IDX(round_page(sc->mediasize)); - newpages = OFF_TO_IDX(round_page(mdr->md_mediasize)); + oldpages = OFF_TO_IDX(sc->mediasize); + newpages = OFF_TO_IDX(mdr->md_mediasize); if (newpages < oldpages) { VM_OBJECT_WLOCK(sc->object); vm_object_page_remove(sc->object, newpages, 0, 0); From owner-svn-src-head@freebsd.org Sun Jun 28 21:35: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 CC536356A17; Sun, 28 Jun 2020 21:35:04 +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 49w3n453mNz3dr2; Sun, 28 Jun 2020 21:35:04 +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 90FEB1CD15; Sun, 28 Jun 2020 21:35:04 +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 05SLZ4No040223; Sun, 28 Jun 2020 21:35:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SLZ4w7040222; Sun, 28 Jun 2020 21:35:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006282135.05SLZ4w7040222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 28 Jun 2020 21:35:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362740 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 362740 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 21:35:04 -0000 Author: markj Date: Sun Jun 28 21:35:04 2020 New Revision: 362740 URL: https://svnweb.freebsd.org/changeset/base/362740 Log: Fix UMA's first-touch policy on systems with empty domains. Suppose a thread is running on a CPU in a NUMA domain with no physical RAM. When an item is freed to a first-touch zone, it ends up in the cross-domain bucket. When the bucket is full, it gets placed in another domain's bucket queue. However, when allocating an item, UMA will always go to the keg upon a per-CPU cache miss because the empty domain's bucket queue will always be empty. This means that a non-empty domain's bucket queues can grow very rapidly on such systems. For example, it can easily cause mbuf allocation failures when the zone limit is reached. Change cache_alloc() to follow a round-robin policy when running on an empty domain. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25355 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Sun Jun 28 21:34:38 2020 (r362739) +++ head/sys/vm/uma_core.c Sun Jun 28 21:35:04 2020 (r362740) @@ -3398,7 +3398,7 @@ static __noinline bool cache_alloc(uma_zone_t zone, uma_cache_t cache, void *udata, int flags) { uma_bucket_t bucket; - int domain; + int curdomain, domain; bool new; CRITICAL_ASSERT(curthread); @@ -3445,7 +3445,8 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * * the critical section. */ domain = PCPU_GET(domain); - if ((cache_uz_flags(cache) & UMA_ZONE_ROUNDROBIN) != 0) + if ((cache_uz_flags(cache) & UMA_ZONE_ROUNDROBIN) != 0 || + VM_DOMAIN_EMPTY(domain)) domain = zone_domain_highest(zone, domain); bucket = cache_fetch_bucket(zone, cache, domain); if (bucket == NULL) { @@ -3470,7 +3471,8 @@ cache_alloc(uma_zone_t zone, uma_cache_t cache, void * cache = &zone->uz_cpu[curcpu]; if (cache->uc_allocbucket.ucb_bucket == NULL && ((cache_uz_flags(cache) & UMA_ZONE_FIRSTTOUCH) == 0 || - domain == PCPU_GET(domain))) { + (curdomain = PCPU_GET(domain)) == domain || + VM_DOMAIN_EMPTY(curdomain))) { if (new) atomic_add_long(&ZDOM_GET(zone, domain)->uzd_imax, bucket->ub_cnt); @@ -3877,7 +3879,7 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int do /* Avoid allocs targeting empty domains. */ if (domain != UMA_ANYDOMAIN && VM_DOMAIN_EMPTY(domain)) domain = UMA_ANYDOMAIN; - if ((zone->uz_flags & UMA_ZONE_ROUNDROBIN) != 0) + else if ((zone->uz_flags & UMA_ZONE_ROUNDROBIN) != 0) domain = UMA_ANYDOMAIN; if (zone->uz_max_items > 0) From owner-svn-src-head@freebsd.org Sun Jun 28 21:48: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 30B98356AB6; Sun, 28 Jun 2020 21:48:57 +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 49w4550SpHz3fLC; Sun, 28 Jun 2020 21:48:57 +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 E76611CF0C; Sun, 28 Jun 2020 21:48:56 +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 05SLmudV046957; Sun, 28 Jun 2020 21:48:56 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SLmuTa046956; Sun, 28 Jun 2020 21:48:56 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006282148.05SLmuTa046956@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: Sun, 28 Jun 2020 21:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362741 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 362741 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 21:48:57 -0000 Author: 0mp (doc,ports committer) Date: Sun Jun 28 21:48:56 2020 New Revision: 362741 URL: https://svnweb.freebsd.org/changeset/base/362741 Log: Document that Intel Dual Band Wireless AC 8265 is supported by iwm(4) MFC after: 2 weeks Modified: head/share/man/man4/iwm.4 head/share/man/man4/iwmfw.4 Modified: head/share/man/man4/iwm.4 ============================================================================== --- head/share/man/man4/iwm.4 Sun Jun 28 21:35:04 2020 (r362740) +++ head/share/man/man4/iwm.4 Sun Jun 28 21:48:56 2020 (r362741) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd June 28, 2020 .Dt IWM 4 .Os .Sh NAME @@ -88,6 +88,7 @@ driver provides support for: .It Intel Dual Band Wireless AC 7260 .It Intel Dual Band Wireless AC 7265 .It Intel Dual Band Wireless AC 8260 +.It Intel Dual Band Wireless AC 8265 .It Intel Dual Band Wireless AC 9260 .It Intel Dual Band Wireless AC 9270 .It Intel Dual Band Wireless AC 946X Modified: head/share/man/man4/iwmfw.4 ============================================================================== --- head/share/man/man4/iwmfw.4 Sun Jun 28 21:35:04 2020 (r362740) +++ head/share/man/man4/iwmfw.4 Sun Jun 28 21:48:56 2020 (r362741) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 7, 2019 +.Dd June 28, 2020 .Dt IWMFW 4 .Os .Sh NAME @@ -68,7 +68,7 @@ iwm9260fw_load="YES" .Ed .Sh DESCRIPTION This module provides access to firmware sets for the -Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260, +Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260, 8265, 9000 and 9260 series of IEEE 802.11n/11ac adapters. It may be statically linked into the kernel, or loaded as a module. .Sh SEE ALSO From owner-svn-src-head@freebsd.org Sun Jun 28 22:04: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 4FE25357193; Sun, 28 Jun 2020 22:04:53 +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 49w4RT18jpz3g5h; Sun, 28 Jun 2020 22:04:53 +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 0BEA71D1C8; Sun, 28 Jun 2020 22:04:53 +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 05SM4qD1058966; Sun, 28 Jun 2020 22:04:52 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05SM4qic058965; Sun, 28 Jun 2020 22:04:52 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006282204.05SM4qic058965@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: Sun, 28 Jun 2020 22:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362742 - head/usr.sbin/config X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.sbin/config X-SVN-Commit-Revision: 362742 X-SVN-Commit-Repository: base MIME-Version: 1.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, 28 Jun 2020 22:04:53 -0000 Author: 0mp (doc,ports committer) Date: Sun Jun 28 22:04:52 2020 New Revision: 362742 URL: https://svnweb.freebsd.org/changeset/base/362742 Log: Do not use macros in the argument to -width This patch improves the presentation of the FILES section dramatically. MFC after: 2 weeks Modified: head/usr.sbin/config/config.8 Modified: head/usr.sbin/config/config.8 ============================================================================== --- head/usr.sbin/config/config.8 Sun Jun 28 21:48:56 2020 (r362741) +++ head/usr.sbin/config/config.8 Sun Jun 28 22:04:52 2020 (r362742) @@ -28,7 +28,7 @@ .\" @(#)config.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd May 8, 2007 +.Dd June 29, 2020 .Dt CONFIG 8 .Os .Sh NAME @@ -61,7 +61,7 @@ that give alternate files for a specific machine section below). .Pp Available options and operands: -.Bl -tag -width ".Ar SYSTEM_NAME" +.Bl -tag -width "SYSTEM_NAME" .It Fl V Print the .Nm @@ -235,7 +235,7 @@ installs in the root file system. .El .Sh FILES -.Bl -tag -width ".Pa /sys/ Ns Va ARCH Ns Pa /compile/ Ns Ar SYSTEM_NAME" -compact +.Bl -tag -width "/sys/ARCH/compile/SYSTEM_NAME" -compact .It Pa /sys/conf/files list of common files system is built from .It Pa /sys/conf/Makefile. Ns Va ARCH From owner-svn-src-head@freebsd.org Mon Jun 29 00:31: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 C207F359334; Mon, 29 Jun 2020 00:31:11 +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 49w7hH4z7pz42SB; Mon, 29 Jun 2020 00:31:11 +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 8E20A1EBCB; Mon, 29 Jun 2020 00:31:11 +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 05T0VBhm045174; Mon, 29 Jun 2020 00:31:11 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VBAU045173; Mon, 29 Jun 2020 00:31:11 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VBAU045173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362744 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362744 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:31:11 -0000 Author: chuck Date: Mon Jun 29 00:31:11 2020 New Revision: 362744 URL: https://svnweb.freebsd.org/changeset/base/362744 Log: bhyve: convert NVMe logging statements Convert the debug and warning logging macros to be parameterized and correctly use bhyve's PRINTLN macro. Reviewed by: imp Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24878 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:28:11 2020 (r362743) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:11 2020 (r362744) @@ -83,8 +83,8 @@ __FBSDID("$FreeBSD$"); static int nvme_debug = 0; -#define DPRINTF(params) if (nvme_debug) PRINTLN params -#define WPRINTF(params) PRINTLN params +#define DPRINTF(fmt, args...) if (nvme_debug) PRINTLN(fmt, ##args) +#define WPRINTF(fmt, args...) PRINTLN(fmt, ##args) /* defaults; can be overridden */ #define NVME_MSIX_BAR 4 @@ -495,7 +495,7 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { - DPRINTF(("%s", __func__)); + DPRINTF("%s", __func__); sc->regs.cap_lo = (ZERO_BASED(sc->max_qentries) & NVME_CAP_LO_REG_MQES_MASK) | (1 << NVME_CAP_LO_REG_CQR_SHIFT) | @@ -562,23 +562,23 @@ pci_nvme_init_controller(struct vmctx *ctx, struct pci { uint16_t acqs, asqs; - DPRINTF(("%s", __func__)); + DPRINTF("%s", __func__); asqs = (sc->regs.aqa & NVME_AQA_REG_ASQS_MASK) + 1; sc->submit_queues[0].size = asqs; sc->submit_queues[0].qbase = vm_map_gpa(ctx, sc->regs.asq, sizeof(struct nvme_command) * asqs); - DPRINTF(("%s mapping Admin-SQ guest 0x%lx, host: %p", - __func__, sc->regs.asq, sc->submit_queues[0].qbase)); + DPRINTF("%s mapping Admin-SQ guest 0x%lx, host: %p", + __func__, sc->regs.asq, sc->submit_queues[0].qbase); acqs = ((sc->regs.aqa >> NVME_AQA_REG_ACQS_SHIFT) & NVME_AQA_REG_ACQS_MASK) + 1; sc->compl_queues[0].size = acqs; sc->compl_queues[0].qbase = vm_map_gpa(ctx, sc->regs.acq, sizeof(struct nvme_completion) * acqs); - DPRINTF(("%s mapping Admin-CQ guest 0x%lx, host: %p", - __func__, sc->regs.acq, sc->compl_queues[0].qbase)); + DPRINTF("%s mapping Admin-CQ guest 0x%lx, host: %p", + __func__, sc->regs.acq, sc->compl_queues[0].qbase); } static int @@ -634,10 +634,10 @@ nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struc { uint16_t qid = command->cdw10 & 0xffff; - DPRINTF(("%s DELETE_IO_SQ %u", __func__, qid)); + DPRINTF("%s DELETE_IO_SQ %u", __func__, qid); if (qid == 0 || qid > sc->num_squeues) { - WPRINTF(("%s NOT PERMITTED queue id %u / num_squeues %u", - __func__, qid, sc->num_squeues)); + WPRINTF("%s NOT PERMITTED queue id %u / num_squeues %u", + __func__, qid, sc->num_squeues); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, NVME_SC_INVALID_QUEUE_IDENTIFIER); return (1); @@ -657,8 +657,8 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc struct nvme_submission_queue *nsq; if ((qid == 0) || (qid > sc->num_squeues)) { - WPRINTF(("%s queue index %u > num_squeues %u", - __func__, qid, sc->num_squeues)); + WPRINTF("%s queue index %u > num_squeues %u", + __func__, qid, sc->num_squeues); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, NVME_SC_INVALID_QUEUE_IDENTIFIER); @@ -673,20 +673,20 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc nsq->cqid = (command->cdw11 >> 16) & 0xffff; nsq->qpriority = (command->cdw11 >> 1) & 0x03; - DPRINTF(("%s sq %u size %u gaddr %p cqid %u", __func__, - qid, nsq->size, nsq->qbase, nsq->cqid)); + DPRINTF("%s sq %u size %u gaddr %p cqid %u", __func__, + qid, nsq->size, nsq->qbase, nsq->cqid); pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); - DPRINTF(("%s completed creating IOSQ qid %u", - __func__, qid)); + DPRINTF("%s completed creating IOSQ qid %u", + __func__, qid); } else { /* * Guest sent non-cont submission queue request. * This setting is unsupported by this emulation. */ - WPRINTF(("%s unsupported non-contig (list-based) " - "create i/o submission queue", __func__)); + WPRINTF("%s unsupported non-contig (list-based) " + "create i/o submission queue", __func__); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); } @@ -699,10 +699,10 @@ nvme_opc_delete_io_cq(struct pci_nvme_softc* sc, struc { uint16_t qid = command->cdw10 & 0xffff; - DPRINTF(("%s DELETE_IO_CQ %u", __func__, qid)); + DPRINTF("%s DELETE_IO_CQ %u", __func__, qid); if (qid == 0 || qid > sc->num_cqueues) { - WPRINTF(("%s queue index %u / num_cqueues %u", - __func__, qid, sc->num_cqueues)); + WPRINTF("%s queue index %u / num_cqueues %u", + __func__, qid, sc->num_cqueues); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, NVME_SC_INVALID_QUEUE_IDENTIFIER); return (1); @@ -722,8 +722,8 @@ nvme_opc_create_io_cq(struct pci_nvme_softc* sc, struc struct nvme_completion_queue *ncq; if ((qid == 0) || (qid > sc->num_cqueues)) { - WPRINTF(("%s queue index %u > num_cqueues %u", - __func__, qid, sc->num_cqueues)); + WPRINTF("%s queue index %u > num_cqueues %u", + __func__, qid, sc->num_cqueues); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, NVME_SC_INVALID_QUEUE_IDENTIFIER); @@ -744,9 +744,9 @@ nvme_opc_create_io_cq(struct pci_nvme_softc* sc, struc /* * Non-contig completion queue unsupported. */ - WPRINTF(("%s unsupported non-contig (list-based) " + WPRINTF("%s unsupported non-contig (list-based) " "create i/o completion queue", - __func__)); + __func__); /* 0x12 = Invalid Use of Controller Memory Buffer */ pci_nvme_status_genc(&compl->status, 0x12); @@ -762,7 +762,7 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struc uint32_t logsize = (1 + ((command->cdw10 >> 16) & 0xFFF)) * 2; uint8_t logpage = command->cdw10 & 0xFF; - DPRINTF(("%s log page %u len %u", __func__, logpage, logsize)); + DPRINTF("%s log page %u len %u", __func__, logpage, logsize); pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); @@ -784,8 +784,8 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struc NVME_COPY_TO_PRP); break; default: - WPRINTF(("%s get log page %x command not supported", - __func__, logpage)); + WPRINTF("%s get log page %x command not supported", + __func__, logpage); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, NVME_SC_INVALID_LOG_PAGE); @@ -800,8 +800,8 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv { void *dest; - DPRINTF(("%s identify 0x%x nsid 0x%x", __func__, - command->cdw10 & 0xFF, command->nsid)); + DPRINTF("%s identify 0x%x nsid 0x%x", __func__, + command->cdw10 & 0xFF, command->nsid); switch (command->cdw10 & 0xFF) { case 0x00: /* return Identify Namespace data structure */ @@ -832,8 +832,8 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv case 0x14: case 0x15: default: - DPRINTF(("%s unsupported identify command requested 0x%x", - __func__, command->cdw10 & 0xFF)); + DPRINTF("%s unsupported identify command requested 0x%x", + __func__, command->cdw10 & 0xFF); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (1); } @@ -850,29 +850,29 @@ nvme_set_feature_queues(struct pci_nvme_softc* sc, str nqr = command->cdw11 & 0xFFFF; if (nqr == 0xffff) { - WPRINTF(("%s: Illegal NSQR value %#x", __func__, nqr)); + WPRINTF("%s: Illegal NSQR value %#x", __func__, nqr); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (-1); } sc->num_squeues = ONE_BASED(nqr); if (sc->num_squeues > sc->max_queues) { - DPRINTF(("NSQR=%u is greater than max %u", sc->num_squeues, - sc->max_queues)); + DPRINTF("NSQR=%u is greater than max %u", sc->num_squeues, + sc->max_queues); sc->num_squeues = sc->max_queues; } nqr = (command->cdw11 >> 16) & 0xFFFF; if (nqr == 0xffff) { - WPRINTF(("%s: Illegal NCQR value %#x", __func__, nqr)); + WPRINTF("%s: Illegal NCQR value %#x", __func__, nqr); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (-1); } sc->num_cqueues = ONE_BASED(nqr); if (sc->num_cqueues > sc->max_queues) { - DPRINTF(("NCQR=%u is greater than max %u", sc->num_cqueues, - sc->max_queues)); + DPRINTF("NCQR=%u is greater than max %u", sc->num_cqueues, + sc->max_queues); sc->num_cqueues = sc->max_queues; } @@ -888,33 +888,33 @@ nvme_opc_set_features(struct pci_nvme_softc* sc, struc int feature = command->cdw10 & 0xFF; uint32_t iv; - DPRINTF(("%s feature 0x%x", __func__, feature)); + DPRINTF("%s feature 0x%x", __func__, feature); compl->cdw0 = 0; switch (feature) { case NVME_FEAT_ARBITRATION: - DPRINTF((" arbitration 0x%x", command->cdw11)); + DPRINTF(" arbitration 0x%x", command->cdw11); break; case NVME_FEAT_POWER_MANAGEMENT: - DPRINTF((" power management 0x%x", command->cdw11)); + DPRINTF(" power management 0x%x", command->cdw11); break; case NVME_FEAT_LBA_RANGE_TYPE: - DPRINTF((" lba range 0x%x", command->cdw11)); + DPRINTF(" lba range 0x%x", command->cdw11); break; case NVME_FEAT_TEMPERATURE_THRESHOLD: - DPRINTF((" temperature threshold 0x%x", command->cdw11)); + DPRINTF(" temperature threshold 0x%x", command->cdw11); break; case NVME_FEAT_ERROR_RECOVERY: - DPRINTF((" error recovery 0x%x", command->cdw11)); + DPRINTF(" error recovery 0x%x", command->cdw11); break; case NVME_FEAT_VOLATILE_WRITE_CACHE: - DPRINTF((" volatile write cache 0x%x", command->cdw11)); + DPRINTF(" volatile write cache 0x%x", command->cdw11); break; case NVME_FEAT_NUMBER_OF_QUEUES: nvme_set_feature_queues(sc, command, compl); break; case NVME_FEAT_INTERRUPT_COALESCING: - DPRINTF((" interrupt coalescing 0x%x", command->cdw11)); + DPRINTF(" interrupt coalescing 0x%x", command->cdw11); /* in uS */ sc->intr_coales_aggr_time = ((command->cdw11 >> 8) & 0xFF)*100; @@ -924,8 +924,8 @@ nvme_opc_set_features(struct pci_nvme_softc* sc, struc case NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION: iv = command->cdw11 & 0xFFFF; - DPRINTF((" interrupt vector configuration 0x%x", - command->cdw11)); + DPRINTF(" interrupt vector configuration 0x%x", + command->cdw11); for (uint32_t i = 0; i < sc->num_cqueues + 1; i++) { if (sc->compl_queues[i].intr_vec == iv) { @@ -939,23 +939,23 @@ nvme_opc_set_features(struct pci_nvme_softc* sc, struc } break; case NVME_FEAT_WRITE_ATOMICITY: - DPRINTF((" write atomicity 0x%x", command->cdw11)); + DPRINTF(" write atomicity 0x%x", command->cdw11); break; case NVME_FEAT_ASYNC_EVENT_CONFIGURATION: - DPRINTF((" async event configuration 0x%x", - command->cdw11)); + DPRINTF(" async event configuration 0x%x", + command->cdw11); sc->async_ev_config = command->cdw11; break; case NVME_FEAT_SOFTWARE_PROGRESS_MARKER: - DPRINTF((" software progress marker 0x%x", - command->cdw11)); + DPRINTF(" software progress marker 0x%x", + command->cdw11); break; case 0x0C: - DPRINTF((" autonomous power state transition 0x%x", - command->cdw11)); + DPRINTF(" autonomous power state transition 0x%x", + command->cdw11); break; default: - WPRINTF(("%s invalid feature", __func__)); + WPRINTF("%s invalid feature", __func__); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (1); } @@ -970,22 +970,22 @@ nvme_opc_get_features(struct pci_nvme_softc* sc, struc { int feature = command->cdw10 & 0xFF; - DPRINTF(("%s feature 0x%x", __func__, feature)); + DPRINTF("%s feature 0x%x", __func__, feature); compl->cdw0 = 0; switch (feature) { case NVME_FEAT_ARBITRATION: - DPRINTF((" arbitration")); + DPRINTF(" arbitration"); break; case NVME_FEAT_POWER_MANAGEMENT: - DPRINTF((" power management")); + DPRINTF(" power management"); break; case NVME_FEAT_LBA_RANGE_TYPE: - DPRINTF((" lba range")); + DPRINTF(" lba range"); break; case NVME_FEAT_TEMPERATURE_THRESHOLD: - DPRINTF((" temperature threshold")); + DPRINTF(" temperature threshold"); switch ((command->cdw11 >> 20) & 0x3) { case 0: /* Over temp threshold */ @@ -996,47 +996,47 @@ nvme_opc_get_features(struct pci_nvme_softc* sc, struc compl->cdw0 = 0; break; default: - WPRINTF((" invalid threshold type select")); + WPRINTF(" invalid threshold type select"); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (1); } break; case NVME_FEAT_ERROR_RECOVERY: - DPRINTF((" error recovery")); + DPRINTF(" error recovery"); break; case NVME_FEAT_VOLATILE_WRITE_CACHE: - DPRINTF((" volatile write cache")); + DPRINTF(" volatile write cache"); break; case NVME_FEAT_NUMBER_OF_QUEUES: compl->cdw0 = NVME_FEATURE_NUM_QUEUES(sc); - DPRINTF((" number of queues (submit %u, completion %u)", + DPRINTF(" number of queues (submit %u, completion %u)", compl->cdw0 & 0xFFFF, - (compl->cdw0 >> 16) & 0xFFFF)); + (compl->cdw0 >> 16) & 0xFFFF); break; case NVME_FEAT_INTERRUPT_COALESCING: - DPRINTF((" interrupt coalescing")); + DPRINTF(" interrupt coalescing"); break; case NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION: - DPRINTF((" interrupt vector configuration")); + DPRINTF(" interrupt vector configuration"); break; case NVME_FEAT_WRITE_ATOMICITY: - DPRINTF((" write atomicity")); + DPRINTF(" write atomicity"); break; case NVME_FEAT_ASYNC_EVENT_CONFIGURATION: - DPRINTF((" async event configuration")); + DPRINTF(" async event configuration"); sc->async_ev_config = command->cdw11; break; case NVME_FEAT_SOFTWARE_PROGRESS_MARKER: - DPRINTF((" software progress marker")); + DPRINTF(" software progress marker"); break; case 0x0C: - DPRINTF((" autonomous power state transition")); + DPRINTF(" autonomous power state transition"); break; default: - WPRINTF(("%s invalid feature 0x%x", __func__, feature)); + WPRINTF("%s invalid feature 0x%x", __func__, feature); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (1); } @@ -1049,8 +1049,8 @@ static int nvme_opc_abort(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { - DPRINTF(("%s submission queue %u, command ID 0x%x", __func__, - command->cdw10 & 0xFFFF, (command->cdw10 >> 16) & 0xFFFF)); + DPRINTF("%s submission queue %u, command ID 0x%x", __func__, + command->cdw10 & 0xFFFF, (command->cdw10 >> 16) & 0xFFFF); /* TODO: search for the command ID and abort it */ @@ -1063,7 +1063,7 @@ static int nvme_opc_async_event_req(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { - DPRINTF(("%s async event request 0x%x", __func__, command->cdw11)); + DPRINTF("%s async event request 0x%x", __func__, command->cdw11); /* * TODO: raise events when they happen based on the Set Features cmd. @@ -1084,7 +1084,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u struct nvme_completion_queue *cq; uint16_t sqhead; - DPRINTF(("%s index %u", __func__, (uint32_t)value)); + DPRINTF("%s index %u", __func__, (uint32_t)value); sq = &sc->submit_queues[0]; cq = &sc->compl_queues[0]; @@ -1092,12 +1092,12 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u sqhead = atomic_load_acq_short(&sq->head); if (atomic_testandset_int(&sq->busy, 1)) { - DPRINTF(("%s SQ busy, head %u, tail %u", - __func__, sqhead, sq->tail)); + DPRINTF("%s SQ busy, head %u, tail %u", + __func__, sqhead, sq->tail); return; } - DPRINTF(("sqhead %u, tail %u", sqhead, sq->tail)); + DPRINTF("sqhead %u, tail %u", sqhead, sq->tail); while (sqhead != atomic_load_acq_short(&sq->tail)) { cmd = &(sq->qbase)[sqhead]; @@ -1106,51 +1106,51 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u switch (cmd->opc) { case NVME_OPC_DELETE_IO_SQ: - DPRINTF(("%s command DELETE_IO_SQ", __func__)); + DPRINTF("%s command DELETE_IO_SQ", __func__); nvme_opc_delete_io_sq(sc, cmd, &compl); break; case NVME_OPC_CREATE_IO_SQ: - DPRINTF(("%s command CREATE_IO_SQ", __func__)); + DPRINTF("%s command CREATE_IO_SQ", __func__); nvme_opc_create_io_sq(sc, cmd, &compl); break; case NVME_OPC_DELETE_IO_CQ: - DPRINTF(("%s command DELETE_IO_CQ", __func__)); + DPRINTF("%s command DELETE_IO_CQ", __func__); nvme_opc_delete_io_cq(sc, cmd, &compl); break; case NVME_OPC_CREATE_IO_CQ: - DPRINTF(("%s command CREATE_IO_CQ", __func__)); + DPRINTF("%s command CREATE_IO_CQ", __func__); nvme_opc_create_io_cq(sc, cmd, &compl); break; case NVME_OPC_GET_LOG_PAGE: - DPRINTF(("%s command GET_LOG_PAGE", __func__)); + DPRINTF("%s command GET_LOG_PAGE", __func__); nvme_opc_get_log_page(sc, cmd, &compl); break; case NVME_OPC_IDENTIFY: - DPRINTF(("%s command IDENTIFY", __func__)); + DPRINTF("%s command IDENTIFY", __func__); nvme_opc_identify(sc, cmd, &compl); break; case NVME_OPC_ABORT: - DPRINTF(("%s command ABORT", __func__)); + DPRINTF("%s command ABORT", __func__); nvme_opc_abort(sc, cmd, &compl); break; case NVME_OPC_SET_FEATURES: - DPRINTF(("%s command SET_FEATURES", __func__)); + DPRINTF("%s command SET_FEATURES", __func__); nvme_opc_set_features(sc, cmd, &compl); break; case NVME_OPC_GET_FEATURES: - DPRINTF(("%s command GET_FEATURES", __func__)); + DPRINTF("%s command GET_FEATURES", __func__); nvme_opc_get_features(sc, cmd, &compl); break; case NVME_OPC_ASYNC_EVENT_REQUEST: - DPRINTF(("%s command ASYNC_EVENT_REQ", __func__)); + DPRINTF("%s command ASYNC_EVENT_REQ", __func__); /* XXX dont care, unhandled for now nvme_opc_async_event_req(sc, cmd, &compl); */ compl.status = NVME_NO_STATUS; break; default: - WPRINTF(("0x%x command is not implemented", - cmd->opc)); + WPRINTF("0x%x command is not implemented", + cmd->opc); pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE); } sqhead = (sqhead + 1) % sq->size; @@ -1173,7 +1173,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u } } - DPRINTF(("setting sqhead %u", sqhead)); + DPRINTF("setting sqhead %u", sqhead); atomic_store_short(&sq->head, sqhead); atomic_store_int(&sq->busy, 0); @@ -1208,7 +1208,7 @@ pci_nvme_append_iov_req(struct pci_nvme_softc *sc, str if (iovidx == NVME_MAX_BLOCKIOVS) { int err = 0; - DPRINTF(("large I/O, doing partial req")); + DPRINTF("large I/O, doing partial req"); iovidx = 0; req->io_req.br_iovcnt = 0; @@ -1252,7 +1252,7 @@ pci_nvme_append_iov_req(struct pci_nvme_softc *sc, str void *gptr; if ((lba + size) > sc->nvstore.size) { - WPRINTF(("%s write would overflow RAM", __func__)); + WPRINTF("%s write would overflow RAM", __func__); return (-1); } @@ -1275,9 +1275,9 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc, struct nvme_completion *compl; int phase; - DPRINTF(("%s sqid %d cqid %u cid %u status: 0x%x 0x%x", + DPRINTF("%s sqid %d cqid %u cid %u status: 0x%x 0x%x", __func__, sqid, sq->cqid, cid, NVME_STATUS_GET_SCT(status), - NVME_STATUS_GET_SC(status))); + NVME_STATUS_GET_SC(status)); pthread_mutex_lock(&cq->mtx); @@ -1303,8 +1303,8 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc, if (cq->intr_en & NVME_CQ_INTEN) { pci_generate_msix(sc->nsc_pi, cq->intr_vec); } else { - DPRINTF(("%s: CQ%u interrupt disabled\n", - __func__, sq->cqid)); + DPRINTF("%s: CQ%u interrupt disabled", + __func__, sq->cqid); } } } @@ -1366,7 +1366,7 @@ pci_nvme_io_done(struct blockif_req *br, int err) struct nvme_submission_queue *sq = req->nvme_sq; uint16_t code, status; - DPRINTF(("%s error %d %s", __func__, err, strerror(err))); + DPRINTF("%s error %d %s", __func__, err, strerror(err)); /* TODO return correct error */ code = err ? NVME_SC_DATA_TRANSFER_ERROR : NVME_SC_SUCCESS; @@ -1381,7 +1381,7 @@ pci_nvme_io_partial(struct blockif_req *br, int err) { struct pci_nvme_ioreq *req = br->br_param; - DPRINTF(("%s error %d %s", __func__, err, strerror(err))); + DPRINTF("%s error %d %s", __func__, err, strerror(err)); pthread_cond_signal(&req->cv); } @@ -1520,14 +1520,14 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint sq = &sc->submit_queues[idx]; if (atomic_testandset_int(&sq->busy, 1)) { - DPRINTF(("%s sqid %u busy", __func__, idx)); + DPRINTF("%s sqid %u busy", __func__, idx); return; } sqhead = atomic_load_acq_short(&sq->head); - DPRINTF(("nvme_handle_io qid %u head %u tail %u cmdlist %p", - idx, sqhead, sq->tail, sq->qbase)); + DPRINTF("nvme_handle_io qid %u head %u tail %u cmdlist %p", + idx, sqhead, sq->tail, sq->qbase); while (sqhead != atomic_load_acq_short(&sq->tail)) { struct nvme_command *cmd; @@ -1550,8 +1550,8 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint continue; } else if (cmd->opc == 0x08) { /* TODO: write zeroes */ - WPRINTF(("%s write zeroes lba 0x%lx blocks %u", - __func__, lba, cmd->cdw12 & 0xFFFF)); + WPRINTF("%s write zeroes lba 0x%lx blocks %u", + __func__, lba, cmd->cdw12 & 0xFFFF); pci_nvme_status_genc(&status, NVME_SC_SUCCESS); pci_nvme_set_completion(sc, sq, idx, cmd->cid, 0, status, 1); @@ -1585,17 +1585,17 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint * increase page count */ - DPRINTF(("[h%u:t%u:n%u] %s starting LBA 0x%lx blocks %lu " + DPRINTF("[h%u:t%u:n%u] %s starting LBA 0x%lx blocks %lu " "(%lu-bytes)", sqhead==0 ? sq->size-1 : sqhead-1, sq->tail, sq->size, cmd->opc == NVME_OPC_WRITE ? "WRITE" : "READ", - lba, nblocks, bytes)); + lba, nblocks, bytes); cmd->prp1 &= ~(0x03UL); cmd->prp2 &= ~(0x03UL); - DPRINTF((" prp1 0x%lx prp2 0x%lx", cmd->prp1, cmd->prp2)); + DPRINTF(" prp1 0x%lx prp2 0x%lx", cmd->prp1, cmd->prp2); size = bytes; lba *= sc->nvstore.sectsz; @@ -1653,7 +1653,7 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint i = 0; } if (prp_list[i] == 0) { - WPRINTF(("PRP2[%d] = 0 !!!", i)); + WPRINTF("PRP2[%d] = 0 !!!", i); err = 1; break; } @@ -1699,8 +1699,8 @@ iodone: err = blockif_write(sc->nvstore.ctx, &req->io_req); break; default: - WPRINTF(("%s unhandled io command 0x%x", - __func__, cmd->opc)); + WPRINTF("%s unhandled io command 0x%x", + __func__, cmd->opc); err = 1; } @@ -1725,8 +1725,8 @@ static void pci_nvme_handle_doorbell(struct vmctx *ctx, struct pci_nvme_softc* sc, uint64_t idx, int is_sq, uint64_t value) { - DPRINTF(("nvme doorbell %lu, %s, val 0x%lx", - idx, is_sq ? "SQ" : "CQ", value & 0xFFFF)); + DPRINTF("nvme doorbell %lu, %s, val 0x%lx", + idx, is_sq ? "SQ" : "CQ", value & 0xFFFF); if (is_sq) { atomic_store_short(&sc->submit_queues[idx].tail, @@ -1737,18 +1737,18 @@ pci_nvme_handle_doorbell(struct vmctx *ctx, struct pci } else { /* submission queue; handle new entries in SQ */ if (idx > sc->num_squeues) { - WPRINTF(("%s SQ index %lu overflow from " + WPRINTF("%s SQ index %lu overflow from " "guest (max %u)", - __func__, idx, sc->num_squeues)); + __func__, idx, sc->num_squeues); return; } pci_nvme_handle_io_cmd(sc, (uint16_t)idx); } } else { if (idx > sc->num_cqueues) { - WPRINTF(("%s queue index %lu overflow from " + WPRINTF("%s queue index %lu overflow from " "guest (max %u)", - __func__, idx, sc->num_cqueues)); + __func__, idx, sc->num_cqueues); return; } @@ -1763,46 +1763,46 @@ pci_nvme_bar0_reg_dumps(const char *func, uint64_t off switch (offset) { case NVME_CR_CAP_LOW: - DPRINTF(("%s %s NVME_CR_CAP_LOW", func, s)); + DPRINTF("%s %s NVME_CR_CAP_LOW", func, s); break; case NVME_CR_CAP_HI: - DPRINTF(("%s %s NVME_CR_CAP_HI", func, s)); + DPRINTF("%s %s NVME_CR_CAP_HI", func, s); break; case NVME_CR_VS: - DPRINTF(("%s %s NVME_CR_VS", func, s)); + DPRINTF("%s %s NVME_CR_VS", func, s); break; case NVME_CR_INTMS: - DPRINTF(("%s %s NVME_CR_INTMS", func, s)); + DPRINTF("%s %s NVME_CR_INTMS", func, s); break; case NVME_CR_INTMC: - DPRINTF(("%s %s NVME_CR_INTMC", func, s)); + DPRINTF("%s %s NVME_CR_INTMC", func, s); break; case NVME_CR_CC: - DPRINTF(("%s %s NVME_CR_CC", func, s)); + DPRINTF("%s %s NVME_CR_CC", func, s); break; case NVME_CR_CSTS: - DPRINTF(("%s %s NVME_CR_CSTS", func, s)); + DPRINTF("%s %s NVME_CR_CSTS", func, s); break; case NVME_CR_NSSR: - DPRINTF(("%s %s NVME_CR_NSSR", func, s)); + DPRINTF("%s %s NVME_CR_NSSR", func, s); break; case NVME_CR_AQA: - DPRINTF(("%s %s NVME_CR_AQA", func, s)); + DPRINTF("%s %s NVME_CR_AQA", func, s); break; case NVME_CR_ASQ_LOW: - DPRINTF(("%s %s NVME_CR_ASQ_LOW", func, s)); + DPRINTF("%s %s NVME_CR_ASQ_LOW", func, s); break; case NVME_CR_ASQ_HI: - DPRINTF(("%s %s NVME_CR_ASQ_HI", func, s)); + DPRINTF("%s %s NVME_CR_ASQ_HI", func, s); break; case NVME_CR_ACQ_LOW: - DPRINTF(("%s %s NVME_CR_ACQ_LOW", func, s)); + DPRINTF("%s %s NVME_CR_ACQ_LOW", func, s); break; case NVME_CR_ACQ_HI: - DPRINTF(("%s %s NVME_CR_ACQ_HI", func, s)); + DPRINTF("%s %s NVME_CR_ACQ_HI", func, s); break; default: - DPRINTF(("unknown nvme bar-0 offset 0x%lx", offset)); + DPRINTF("unknown nvme bar-0 offset 0x%lx", offset); } } @@ -1819,9 +1819,9 @@ pci_nvme_write_bar_0(struct vmctx *ctx, struct pci_nvm int is_sq = (belloffset % 8) < 4; if (belloffset > ((sc->max_queues+1) * 8 - 4)) { - WPRINTF(("guest attempted an overflow write offset " + WPRINTF("guest attempted an overflow write offset " "0x%lx, val 0x%lx in %s", - offset, value, __func__)); + offset, value, __func__); return; } @@ -1829,13 +1829,13 @@ pci_nvme_write_bar_0(struct vmctx *ctx, struct pci_nvm return; } - DPRINTF(("nvme-write offset 0x%lx, size %d, value 0x%lx", - offset, size, value)); + DPRINTF("nvme-write offset 0x%lx, size %d, value 0x%lx", + offset, size, value); if (size != 4) { - WPRINTF(("guest wrote invalid size %d (offset 0x%lx, " + WPRINTF("guest wrote invalid size %d (offset 0x%lx, " "val 0x%lx) to bar0 in %s", - size, offset, value, __func__)); + size, offset, value, __func__); /* TODO: shutdown device */ return; } @@ -1861,12 +1861,12 @@ pci_nvme_write_bar_0(struct vmctx *ctx, struct pci_nvm case NVME_CR_CC: ccreg = (uint32_t)value; - DPRINTF(("%s NVME_CR_CC en %x css %x shn %x iosqes %u " + DPRINTF("%s NVME_CR_CC en %x css %x shn %x iosqes %u " "iocqes %u", __func__, NVME_CC_GET_EN(ccreg), NVME_CC_GET_CSS(ccreg), NVME_CC_GET_SHN(ccreg), NVME_CC_GET_IOSQES(ccreg), - NVME_CC_GET_IOCQES(ccreg))); + NVME_CC_GET_IOCQES(ccreg)); if (NVME_CC_GET_SHN(ccreg)) { /* perform shutdown - flush out data to backend */ @@ -1920,8 +1920,8 @@ pci_nvme_write_bar_0(struct vmctx *ctx, struct pci_nvm (value << 32); break; default: - DPRINTF(("%s unknown offset 0x%lx, value 0x%lx size %d", - __func__, offset, value, size)); + DPRINTF("%s unknown offset 0x%lx, value 0x%lx size %d", + __func__, offset, value, size); } pthread_mutex_unlock(&sc->mtx); } @@ -1934,8 +1934,8 @@ pci_nvme_write(struct vmctx *ctx, int vcpu, struct pci if (baridx == pci_msix_table_bar(pi) || baridx == pci_msix_pba_bar(pi)) { - DPRINTF(("nvme-write baridx %d, msix: off 0x%lx, size %d, " - " value 0x%lx", baridx, offset, size, value)); + DPRINTF("nvme-write baridx %d, msix: off 0x%lx, size %d, " + " value 0x%lx", baridx, offset, size, value); pci_emul_msix_twrite(pi, offset, size, value); return; @@ -1947,8 +1947,8 @@ pci_nvme_write(struct vmctx *ctx, int vcpu, struct pci break; default: - DPRINTF(("%s unknown baridx %d, val 0x%lx", - __func__, baridx, value)); + DPRINTF("%s unknown baridx %d, val 0x%lx", + __func__, baridx, value); } } @@ -1966,7 +1966,7 @@ static uint64_t pci_nvme_read_bar_0(struct pci_nvme_so pthread_mutex_unlock(&sc->mtx); } else { value = 0; - WPRINTF(("pci_nvme: read invalid offset %ld", offset)); + WPRINTF("pci_nvme: read invalid offset %ld", offset); } switch (size) { @@ -1981,8 +1981,8 @@ static uint64_t pci_nvme_read_bar_0(struct pci_nvme_so break; } - DPRINTF((" nvme-read offset 0x%lx, size %d -> value 0x%x", - offset, size, (uint32_t)value)); + DPRINTF(" nvme-read offset 0x%lx, size %d -> value 0x%x", + offset, size, (uint32_t)value); return (value); } @@ -1997,8 +1997,8 @@ pci_nvme_read(struct vmctx *ctx, int vcpu, struct pci_ if (baridx == pci_msix_table_bar(pi) || baridx == pci_msix_pba_bar(pi)) { - DPRINTF(("nvme-read bar: %d, msix: regoff 0x%lx, size %d", - baridx, offset, size)); + DPRINTF("nvme-read bar: %d, msix: regoff 0x%lx, size %d", + baridx, offset, size); return pci_emul_msix_tread(pi, offset, size); } @@ -2008,7 +2008,7 @@ pci_nvme_read(struct vmctx *ctx, int vcpu, struct pci_ return pci_nvme_read_bar_0(sc, offset, size); default: - DPRINTF(("unknown bar %d, 0x%lx", baridx, offset)); + DPRINTF("unknown bar %d, 0x%lx", baridx, offset); } return (0); @@ -2174,23 +2174,23 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p 2 * sizeof(uint32_t) * (sc->max_queues + 1); pci_membar_sz = MAX(pci_membar_sz, NVME_MMIO_SPACE_MIN); - DPRINTF(("nvme membar size: %u", pci_membar_sz)); + DPRINTF("nvme membar size: %u", pci_membar_sz); error = pci_emul_alloc_bar(pi, 0, PCIBAR_MEM64, pci_membar_sz); if (error) { - WPRINTF(("%s pci alloc mem bar failed", __func__)); + WPRINTF("%s pci alloc mem bar failed", __func__); goto done; } error = pci_emul_add_msixcap(pi, sc->max_queues + 1, NVME_MSIX_BAR); if (error) { - WPRINTF(("%s pci add msixcap failed", __func__)); + WPRINTF("%s pci add msixcap failed", __func__); goto done; } error = pci_emul_add_pciecap(pi, PCIEM_TYPE_ROOT_INT_EP); if (error) { - WPRINTF(("%s pci add Express capability failed", __func__)); + WPRINTF("%s pci add Express capability failed", __func__); goto done; } From owner-svn-src-head@freebsd.org Mon Jun 29 00: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 919E2359436; Mon, 29 Jun 2020 00:31:15 +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 49w7hL6d3Zz42mf; Mon, 29 Jun 2020 00:31:14 +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 B8F561E765; Mon, 29 Jun 2020 00:31:14 +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 05T0VEW3045219; Mon, 29 Jun 2020 00:31:14 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VEni045218; Mon, 29 Jun 2020 00:31:14 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VEni045218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362745 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362745 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:31:15 -0000 Author: chuck Date: Mon Jun 29 00:31:14 2020 New Revision: 362745 URL: https://svnweb.freebsd.org/changeset/base/362745 Log: bhyve: refactor NVMe IO command handling This refactors the NVMe I/O command processing function to make adding new commands easier. The main change is to move command specific processing (i.e. Read/Write) to separate functions for each NVMe I/O command and leave the common per-command processing in the existing pci_nvme_handle_io_cmd() function. While here, add checks for some common errors (invalid Namespace ID, invalid opcode, LBA out of range). Add myself to the Copyright holders Reviewed by: imp Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24879 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:11 2020 (r362744) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:14 2020 (r362745) @@ -3,6 +3,7 @@ * * Copyright (c) 2017 Shunsuke Mie * Copyright (c) 2018 Leon Dang + * Copyright (c) 2020 Chuck Tuffli * * Function crc16 Copyright (c) 2017, Fedor Uporov * Obtained from function ext2_crc16() in sys/fs/ext2fs/ext2_csum.c @@ -1386,6 +1387,122 @@ pci_nvme_io_partial(struct blockif_req *br, int err) pthread_cond_signal(&req->cv); } +static bool +nvme_opc_write_read(struct pci_nvme_softc *sc, + struct nvme_command *cmd, + struct pci_nvme_blockstore *nvstore, + struct pci_nvme_ioreq *req, + uint16_t *status) +{ + uint64_t lba, nblocks, bytes; + size_t offset; + bool is_write = cmd->opc == NVME_OPC_WRITE; + bool pending = false; + + lba = ((uint64_t)cmd->cdw11 << 32) | cmd->cdw10; + nblocks = (cmd->cdw12 & 0xFFFF) + 1; + + offset = lba * nvstore->sectsz; + bytes = nblocks * nvstore->sectsz; + + if ((offset + bytes) > nvstore->size) { + WPRINTF("%s command would exceed LBA range", __func__); + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } + + req->io_req.br_offset = lba; + + /* PRP bits 1:0 must be zero */ + cmd->prp1 &= ~0x3UL; + cmd->prp2 &= ~0x3UL; + + if (nvstore->type == NVME_STOR_RAM) { + uint8_t *buf = nvstore->ctx; + enum nvme_copy_dir dir; + + if (is_write) + dir = NVME_COPY_TO_PRP; + else + dir = NVME_COPY_FROM_PRP; + + if (nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, + buf + offset, bytes, dir)) + pci_nvme_status_genc(status, + NVME_SC_DATA_TRANSFER_ERROR); + else + pci_nvme_status_genc(status, NVME_SC_SUCCESS); + } else { + uint64_t size; + int err; + + size = MIN(PAGE_SIZE - (cmd->prp1 % PAGE_SIZE), bytes); + if (pci_nvme_append_iov_req(sc, req, cmd->prp1, + size, is_write, offset)) { + pci_nvme_status_genc(status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + + offset += size; + bytes -= size; + + if (bytes == 0) { + ; + } else if (bytes <= PAGE_SIZE) { + size = bytes; + if (pci_nvme_append_iov_req(sc, req, cmd->prp2, + size, is_write, offset)) { + pci_nvme_status_genc(status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + } else { + void *vmctx = sc->nsc_pi->pi_vmctx; + uint64_t *prp_list = &cmd->prp2; + uint64_t *last = prp_list; + + /* PRP2 is pointer to a physical region page list */ + while (bytes) { + /* Last entry in list points to the next list */ + if (prp_list == last) { + uint64_t prp = *prp_list; + + prp_list = paddr_guest2host(vmctx, prp, + PAGE_SIZE - (prp % PAGE_SIZE)); + last = prp_list + (NVME_PRP2_ITEMS - 1); + } + + size = MIN(bytes, PAGE_SIZE); + + if (pci_nvme_append_iov_req(sc, req, *prp_list, + size, is_write, offset)) { + pci_nvme_status_genc(status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + + offset += size; + bytes -= size; + + prp_list++; + } + } + req->io_req.br_callback = pci_nvme_io_done; + if (is_write) + err = blockif_write(nvstore->ctx, &req->io_req); + else + err = blockif_read(nvstore->ctx, &req->io_req); + + if (err) + pci_nvme_status_genc(status, NVME_SC_DATA_TRANSFER_ERROR); + else + pending = true; + } +out: + return (pending); +} + static void pci_nvme_dealloc_sm(struct blockif_req *br, int err) { @@ -1421,14 +1538,15 @@ pci_nvme_dealloc_sm(struct blockif_req *br, int err) } } -static int +static bool nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, struct nvme_command *cmd, struct pci_nvme_blockstore *nvstore, struct pci_nvme_ioreq *req, uint16_t *status) { - int err = -1; + int err; + bool pending = false; if ((sc->ctrldata.oncs & NVME_ONCS_DSM) == 0) { pci_nvme_status_genc(status, NVME_SC_INVALID_OPCODE); @@ -1463,9 +1581,6 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); - req->opc = cmd->opc; - req->cid = cmd->cid; - req->nsid = cmd->nsid; /* * If the request is for more than a single range, store * the ranges in the br_iov. Optimize for the common case @@ -1501,11 +1616,13 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, err = blockif_delete(nvstore->ctx, &req->io_req); if (err) pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); + else + pending = true; free(range); } out: - return (err); + return (pending); } static void @@ -1514,7 +1631,6 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint struct nvme_submission_queue *sq; uint16_t status; uint16_t sqhead; - int err; /* handle all submissions up to sq->tail index */ sq = &sc->submit_queues[idx]; @@ -1531,189 +1647,69 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint while (sqhead != atomic_load_acq_short(&sq->tail)) { struct nvme_command *cmd; - struct pci_nvme_ioreq *req = NULL; - uint64_t lba; - uint64_t nblocks, bytes, size, cpsz; + struct pci_nvme_ioreq *req; + uint32_t nsid; + bool pending; - /* TODO: support scatter gather list handling */ + pending = false; + req = NULL; + status = 0; cmd = &sq->qbase[sqhead]; sqhead = (sqhead + 1) % sq->size; - lba = ((uint64_t)cmd->cdw11 << 32) | cmd->cdw10; + nsid = le32toh(cmd->nsid); + if ((nsid == 0) || (nsid > sc->ctrldata.nn)) { + pci_nvme_status_genc(&status, + NVME_SC_INVALID_NAMESPACE_OR_FORMAT); + status |= + NVME_STATUS_DNR_MASK << NVME_STATUS_DNR_SHIFT; + goto complete; + } - if (cmd->opc == NVME_OPC_FLUSH) { - pci_nvme_status_genc(&status, NVME_SC_SUCCESS); - pci_nvme_set_completion(sc, sq, idx, cmd->cid, 0, - status, 1); - - continue; - } else if (cmd->opc == 0x08) { - /* TODO: write zeroes */ - WPRINTF("%s write zeroes lba 0x%lx blocks %u", - __func__, lba, cmd->cdw12 & 0xFFFF); - pci_nvme_status_genc(&status, NVME_SC_SUCCESS); - pci_nvme_set_completion(sc, sq, idx, cmd->cid, 0, - status, 1); - - continue; + req = pci_nvme_get_ioreq(sc); + if (req == NULL) { + pci_nvme_status_genc(&status, + NVME_SC_INTERNAL_DEVICE_ERROR); + WPRINTF("%s: unable to allocate IO req", __func__); + goto complete; } + req->nvme_sq = sq; + req->sqid = idx; + req->opc = cmd->opc; + req->cid = cmd->cid; + req->nsid = cmd->nsid; - if (sc->nvstore.type == NVME_STOR_BLOCKIF) { - req = pci_nvme_get_ioreq(sc); - req->nvme_sq = sq; - req->sqid = idx; - } - - if (cmd->opc == NVME_OPC_DATASET_MANAGEMENT) { - if (nvme_opc_dataset_mgmt(sc, cmd, &sc->nvstore, req, - &status)) { - pci_nvme_set_completion(sc, sq, idx, cmd->cid, - 0, status, 1); - if (req) - pci_nvme_release_ioreq(sc, req); - } - continue; - } - - nblocks = (cmd->cdw12 & 0xFFFF) + 1; - - bytes = nblocks * sc->nvstore.sectsz; - - /* - * If data starts mid-page and flows into the next page, then - * increase page count - */ - - DPRINTF("[h%u:t%u:n%u] %s starting LBA 0x%lx blocks %lu " - "(%lu-bytes)", - sqhead==0 ? sq->size-1 : sqhead-1, sq->tail, sq->size, - cmd->opc == NVME_OPC_WRITE ? - "WRITE" : "READ", - lba, nblocks, bytes); - - cmd->prp1 &= ~(0x03UL); - cmd->prp2 &= ~(0x03UL); - - DPRINTF(" prp1 0x%lx prp2 0x%lx", cmd->prp1, cmd->prp2); - - size = bytes; - lba *= sc->nvstore.sectsz; - - cpsz = PAGE_SIZE - (cmd->prp1 % PAGE_SIZE); - - if (cpsz > bytes) - cpsz = bytes; - - if (req != NULL) { - req->io_req.br_offset = ((uint64_t)cmd->cdw11 << 32) | - cmd->cdw10; - req->opc = cmd->opc; - req->cid = cmd->cid; - req->nsid = cmd->nsid; - } - - err = pci_nvme_append_iov_req(sc, req, cmd->prp1, cpsz, - cmd->opc == NVME_OPC_WRITE, lba); - lba += cpsz; - size -= cpsz; - - if (size == 0) - goto iodone; - - if (size <= PAGE_SIZE) { - /* prp2 is second (and final) page in transfer */ - - err = pci_nvme_append_iov_req(sc, req, cmd->prp2, - size, - cmd->opc == NVME_OPC_WRITE, - lba); - } else { - uint64_t *prp_list; - int i; - - /* prp2 is pointer to a physical region page list */ - prp_list = paddr_guest2host(sc->nsc_pi->pi_vmctx, - cmd->prp2, PAGE_SIZE); - - i = 0; - while (size != 0) { - cpsz = MIN(size, PAGE_SIZE); - - /* - * Move to linked physical region page list - * in last item. - */ - if (i == (NVME_PRP2_ITEMS-1) && - size > PAGE_SIZE) { - assert((prp_list[i] & (PAGE_SIZE-1)) == 0); - prp_list = paddr_guest2host( - sc->nsc_pi->pi_vmctx, - prp_list[i], PAGE_SIZE); - i = 0; - } - if (prp_list[i] == 0) { - WPRINTF("PRP2[%d] = 0 !!!", i); - err = 1; - break; - } - - err = pci_nvme_append_iov_req(sc, req, - prp_list[i], cpsz, - cmd->opc == NVME_OPC_WRITE, lba); - if (err) - break; - - lba += cpsz; - size -= cpsz; - i++; - } - } - -iodone: - if (sc->nvstore.type == NVME_STOR_RAM) { - uint16_t code, status; - - code = err ? NVME_SC_LBA_OUT_OF_RANGE : - NVME_SC_SUCCESS; - pci_nvme_status_genc(&status, code); - - pci_nvme_set_completion(sc, sq, idx, cmd->cid, 0, - status, 1); - - continue; - } - - - if (err) - goto do_error; - - req->io_req.br_callback = pci_nvme_io_done; - - err = 0; switch (cmd->opc) { + case NVME_OPC_FLUSH: + pci_nvme_status_genc(&status, NVME_SC_SUCCESS); + break; + case NVME_OPC_WRITE: case NVME_OPC_READ: - err = blockif_read(sc->nvstore.ctx, &req->io_req); + pending = nvme_opc_write_read(sc, cmd, &sc->nvstore, + req, &status); break; - case NVME_OPC_WRITE: - err = blockif_write(sc->nvstore.ctx, &req->io_req); + case NVME_OPC_WRITE_ZEROES: + /* TODO: write zeroes + WPRINTF("%s write zeroes lba 0x%lx blocks %u", + __func__, lba, cmd->cdw12 & 0xFFFF); */ + pci_nvme_status_genc(&status, NVME_SC_SUCCESS); break; - default: - WPRINTF("%s unhandled io command 0x%x", - __func__, cmd->opc); - err = 1; + case NVME_OPC_DATASET_MANAGEMENT: + pending = nvme_opc_dataset_mgmt(sc, cmd, &sc->nvstore, + req, &status); + break; + default: + WPRINTF("%s unhandled io command 0x%x", + __func__, cmd->opc); + pci_nvme_status_genc(&status, NVME_SC_INVALID_OPCODE); } - -do_error: - if (err) { - uint16_t status; - - pci_nvme_status_genc(&status, - NVME_SC_DATA_TRANSFER_ERROR); - +complete: + if (!pending) { pci_nvme_set_completion(sc, sq, idx, cmd->cid, 0, - status, 1); - pci_nvme_release_ioreq(sc, req); + status, 1); + if (req != NULL) + pci_nvme_release_ioreq(sc, req); } } From owner-svn-src-head@freebsd.org Mon Jun 29 00:31: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 9F2A9359681; Mon, 29 Jun 2020 00:31:23 +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 49w7hT0q7fz42kM; Mon, 29 Jun 2020 00:31:20 +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 2A1471EA3E; Mon, 29 Jun 2020 00:31:18 +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 05T0VHBI046226; Mon, 29 Jun 2020 00:31:17 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VHcn046225; Mon, 29 Jun 2020 00:31:17 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VHcn046225@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362746 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362746 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:31:23 -0000 Author: chuck Date: Mon Jun 29 00:31:17 2020 New Revision: 362746 URL: https://svnweb.freebsd.org/changeset/base/362746 Log: bhyve: implement NVMe Flush command This adds support for the NVMe I/O command Flush. For block-based devices, submit a DIOCGFLUSH to the backing storage. Otherwise, command is treated like a NOP and completes with a Successful status. Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24880 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:14 2020 (r362745) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:17 2020 (r362746) @@ -58,6 +58,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include @@ -1387,7 +1388,47 @@ pci_nvme_io_partial(struct blockif_req *br, int err) pthread_cond_signal(&req->cv); } +/* + * Implements the Flush command. The specification states: + * If a volatile write cache is not present, Flush commands complete + * successfully and have no effect + * in the description of the Volatile Write Cache (VWC) field of the Identify + * Controller data. Therefore, set status to Success if the command is + * not supported (i.e. RAM or as indicated by the blockif). + */ static bool +nvme_opc_flush(struct pci_nvme_softc *sc, + struct nvme_command *cmd, + struct pci_nvme_blockstore *nvstore, + struct pci_nvme_ioreq *req, + uint16_t *status) +{ + bool pending = false; + + if (nvstore->type == NVME_STOR_RAM) { + pci_nvme_status_genc(status, NVME_SC_SUCCESS); + } else { + int err; + + req->io_req.br_callback = pci_nvme_io_done; + + err = blockif_flush(nvstore->ctx, &req->io_req); + switch (err) { + case 0: + pending = true; + break; + case EOPNOTSUPP: + pci_nvme_status_genc(status, NVME_SC_SUCCESS); + break; + default: + pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); + } + } + + return (pending); +} + +static bool nvme_opc_write_read(struct pci_nvme_softc *sc, struct nvme_command *cmd, struct pci_nvme_blockstore *nvstore, @@ -1682,7 +1723,8 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint switch (cmd->opc) { case NVME_OPC_FLUSH: - pci_nvme_status_genc(&status, NVME_SC_SUCCESS); + pending = nvme_opc_flush(sc, cmd, &sc->nvstore, + req, &status); break; case NVME_OPC_WRITE: case NVME_OPC_READ: From owner-svn-src-head@freebsd.org Mon Jun 29 00:31: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 2B69A359442; Mon, 29 Jun 2020 00:31:24 +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 49w7hW2Dd2z42fG; Mon, 29 Jun 2020 00:31:23 +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 536F41EC3D; Mon, 29 Jun 2020 00:31:21 +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 05T0VLFD046273; Mon, 29 Jun 2020 00:31:21 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VLhU046272; Mon, 29 Jun 2020 00:31:21 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VLhU046272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362747 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362747 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:31:24 -0000 Author: chuck Date: Mon Jun 29 00:31:20 2020 New Revision: 362747 URL: https://svnweb.freebsd.org/changeset/base/362747 Log: bhyve: add a comment explaining NVME dsm option Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24881 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:17 2020 (r362746) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:20 2020 (r362747) @@ -34,7 +34,7 @@ * bhyve PCIe-NVMe device emulation. * * options: - * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=# + * -s ,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z,eui64=#,dsm= * * accepted devpath: * /dev/blockdev @@ -47,6 +47,7 @@ * sectsz = sector size (defaults to blockif sector size) * ser = serial number (20-chars max) * eui64 = IEEE Extended Unique Identifier (8 byte value) + * dsm = DataSet Management support. Option is one of auto, enable,disable * */ From owner-svn-src-head@freebsd.org Mon Jun 29 00:31: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 5743635945D; Mon, 29 Jun 2020 00:31:34 +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 49w7hj2f4bz42Qb; Mon, 29 Jun 2020 00:31:33 +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 084F21E76A; Mon, 29 Jun 2020 00:31:28 +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 05T0VRNh047110; Mon, 29 Jun 2020 00:31:27 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VRCv047109; Mon, 29 Jun 2020 00:31:27 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VRCv047109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362749 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362749 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:31:34 -0000 Author: chuck Date: Mon Jun 29 00:31:27 2020 New Revision: 362749 URL: https://svnweb.freebsd.org/changeset/base/362749 Log: bhyve: Consolidate NVMe CQ update Consolidate the code which writes Completion Queue entries and updates the CQ doorbell value. While in the neighborhood, convert the "toggle CQ phase bit" code to use an XOR operation instead of an "if/else" branch. Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24882 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:24 2020 (r362748) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:27 2020 (r362749) @@ -329,16 +329,6 @@ pci_nvme_status_genc(uint16_t *status, uint16_t code) pci_nvme_status_tc(status, NVME_SCT_GENERIC, code); } -static __inline void -pci_nvme_toggle_phase(uint16_t *status, int prev) -{ - - if (prev) - *status &= ~NVME_STATUS_P; - else - *status |= NVME_STATUS_P; -} - /* * Initialize the requested number or IO Submission and Completion Queues. * Admin queues are allocated implicitly. @@ -617,6 +607,7 @@ pci_nvme_init_controller(struct vmctx *ctx, struct pci sc->compl_queues[0].size = acqs; sc->compl_queues[0].qbase = vm_map_gpa(ctx, sc->regs.acq, sizeof(struct nvme_completion) * acqs); + DPRINTF("%s mapping Admin-CQ guest 0x%lx, host: %p", __func__, sc->regs.acq, sc->compl_queues[0].qbase); } @@ -668,6 +659,45 @@ nvme_prp_memcpy(struct vmctx *ctx, uint64_t prp1, uint return (0); } +/* + * Write a Completion Queue Entry update + * + * Write the completion and update the doorbell value + */ +static void +pci_nvme_cq_update(struct pci_nvme_softc *sc, + struct nvme_completion_queue *cq, + uint32_t cdw0, + uint16_t cid, + uint16_t sqid, + uint16_t status) +{ + struct nvme_submission_queue *sq = &sc->submit_queues[sqid]; + struct nvme_completion *cqe; + + assert(cq->qbase != NULL); + + pthread_mutex_lock(&cq->mtx); + + cqe = &cq->qbase[cq->tail]; + + /* Flip the phase bit */ + status |= (cqe->status ^ NVME_STATUS_P) & NVME_STATUS_P_MASK; + + cqe->cdw0 = cdw0; + cqe->sqhd = sq->head; + cqe->sqid = sqid; + cqe->cid = cid; + cqe->status = status; + + cq->tail++; + if (cq->tail >= cq->size) { + cq->tail = 0; + } + + pthread_mutex_unlock(&cq->mtx); +} + static int nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) @@ -757,6 +787,7 @@ static int nvme_opc_create_io_cq(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { + if (command->cdw11 & NVME_CMD_CDW11_PC) { uint16_t qid = command->cdw10 & 0xffff; struct nvme_completion_queue *ncq; @@ -1191,24 +1222,11 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u sqhead = (sqhead + 1) % sq->size; if (NVME_COMPLETION_VALID(compl)) { - struct nvme_completion *cp; - int phase; - - pthread_mutex_lock(&cq->mtx); - - cp = &(cq->qbase)[cq->tail]; - cp->cdw0 = compl.cdw0; - cp->sqid = 0; - cp->sqhd = sqhead; - cp->cid = cmd->cid; - - phase = NVME_STATUS_GET_P(cp->status); - cp->status = compl.status; - pci_nvme_toggle_phase(&cp->status, phase); - - cq->tail = (cq->tail + 1) % cq->size; - - pthread_mutex_unlock(&cq->mtx); + pci_nvme_cq_update(sc, &sc->compl_queues[0], + compl.cdw0, + cmd->cid, + 0, /* SQID */ + compl.status); } } @@ -1311,32 +1329,16 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc, uint32_t cdw0, uint16_t status) { struct nvme_completion_queue *cq = &sc->compl_queues[sq->cqid]; - struct nvme_completion *compl; - int phase; DPRINTF("%s sqid %d cqid %u cid %u status: 0x%x 0x%x", __func__, sqid, sq->cqid, cid, NVME_STATUS_GET_SCT(status), NVME_STATUS_GET_SC(status)); - pthread_mutex_lock(&cq->mtx); - - assert(cq->qbase != NULL); - - compl = &cq->qbase[cq->tail]; - - compl->cdw0 = cdw0; - compl->sqid = sqid; - compl->sqhd = sq->head; - compl->cid = cid; - - // toggle phase - phase = NVME_STATUS_GET_P(compl->status); - compl->status = status; - pci_nvme_toggle_phase(&compl->status, phase); - - cq->tail = (cq->tail + 1) % cq->size; - - pthread_mutex_unlock(&cq->mtx); + pci_nvme_cq_update(sc, cq, + 0, /* CDW0 */ + cid, + sqid, + status); if (cq->head != cq->tail) { if (cq->intr_en & NVME_CQ_INTEN) { From owner-svn-src-head@freebsd.org Mon Jun 29 00:31: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 9878D3593E2; Mon, 29 Jun 2020 00:31:51 +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 49w7j22Xkrz435Z; Mon, 29 Jun 2020 00:31:50 +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 28C061ED8C; Mon, 29 Jun 2020 00:31:31 +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 05T0VVd3047155; Mon, 29 Jun 2020 00:31:31 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VV0d047154; Mon, 29 Jun 2020 00:31:31 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VV0d047154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362750 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362750 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:31:51 -0000 Author: chuck Date: Mon Jun 29 00:31:30 2020 New Revision: 362750 URL: https://svnweb.freebsd.org/changeset/base/362750 Log: bhyve: implement NVMe Namespace Identification Descriptor NVMe 1.3 compliant controllers must implement the Namespace Identification Descriptor structure (i.e. CNS=3). Previously this was unimplemented. Fixes UNH Test 1.1.4-0 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24884 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:27 2020 (r362749) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:30 2020 (r362750) @@ -870,10 +870,13 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv struct nvme_completion* compl) { void *dest; + uint16_t status; DPRINTF("%s identify 0x%x nsid 0x%x", __func__, command->cdw10 & 0xFF, command->nsid); + pci_nvme_status_genc(&status, NVME_SC_SUCCESS); + switch (command->cdw10 & 0xFF) { case 0x00: /* return Identify Namespace data structure */ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, @@ -892,24 +895,30 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv ((uint32_t *)dest)[0] = 1; ((uint32_t *)dest)[1] = 0; break; - case 0x11: - pci_nvme_status_genc(&compl->status, - NVME_SC_INVALID_NAMESPACE_OR_FORMAT); - return (1); case 0x03: /* list of NSID structures in CDW1.NSID, 4096 bytes */ - case 0x10: - case 0x12: - case 0x13: - case 0x14: - case 0x15: + if (command->nsid != 1) { + pci_nvme_status_genc(&status, + NVME_SC_INVALID_NAMESPACE_OR_FORMAT); + break; + } + dest = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, + sizeof(uint32_t) * 1024); + /* All bytes after the descriptor shall be zero */ + bzero(dest, sizeof(uint32_t) * 1024); + + /* Return NIDT=1 (i.e. EUI64) descriptor */ + ((uint8_t *)dest)[0] = 1; + ((uint8_t *)dest)[1] = sizeof(uint64_t); + bcopy(sc->nsdata.eui64, ((uint8_t *)dest) + 4, sizeof(uint64_t)); + break; default: DPRINTF("%s unsupported identify command requested 0x%x", __func__, command->cdw10 & 0xFF); - pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); + pci_nvme_status_genc(&status, NVME_SC_INVALID_FIELD); return (1); } - pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); + compl->status = status; return (1); } From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 AEFBD35978C; Mon, 29 Jun 2020 00:32:02 +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 49w7jF2yh6z436S; Mon, 29 Jun 2020 00:32:00 +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 AF3651EA56; Mon, 29 Jun 2020 00:31:41 +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 05T0Vf4Q047288; Mon, 29 Jun 2020 00:31:41 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VfJk047287; Mon, 29 Jun 2020 00:31:41 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VfJk047287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362753 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362753 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:03 -0000 Author: chuck Date: Mon Jun 29 00:31:41 2020 New Revision: 362753 URL: https://svnweb.freebsd.org/changeset/base/362753 Log: bhyve: add more compliant NVMe Get/Set Features Create a generic Get/Set Features by saving off the contents of CDW11 from the Set command and returning the saved value in the completion of the Get command. Implementation allows providing optional implementation for both Set and Get. Add infrastructure to determine which feature ID's are namespace specific and flag violations of this category of error. Also adds the feature specific behavior of Set Features, Number of Queues to only allow this command once per Controller reset. Fixes UNH Tests 1.2, 5.4, and 5.5.6 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24887 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:37 2020 (r362752) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:41 2020 (r362753) @@ -222,6 +222,23 @@ enum nvme_dsm_type { NVME_DATASET_MANAGEMENT_DISABLE, }; +struct pci_nvme_softc; +struct nvme_feature_obj; + +typedef void (*nvme_feature_cb)(struct pci_nvme_softc *, + struct nvme_feature_obj *, + struct nvme_command *, + struct nvme_completion *); + +struct nvme_feature_obj { + uint32_t cdw11; + nvme_feature_cb set; + nvme_feature_cb get; + bool namespace_specific; +}; + +#define NVME_FID_MAX (NVME_FEAT_ENDURANCE_GROUP_EVENT_CONFIGURATION + 1) + struct pci_nvme_softc { struct pci_devinst *nsc_pi; @@ -241,6 +258,7 @@ struct pci_nvme_softc { uint32_t max_queues; /* max number of IO SQ's or CQ's */ uint32_t num_cqueues; uint32_t num_squeues; + bool num_q_is_set; /* Has host set Number of Queues */ struct pci_nvme_ioreq *ioreqs; STAILQ_HEAD(, pci_nvme_ioreq) ioreqs_free; /* free list of ioreqs */ @@ -255,10 +273,7 @@ struct pci_nvme_softc { struct nvme_completion_queue *compl_queues; struct nvme_submission_queue *submit_queues; - /* controller features */ - uint32_t intr_coales_aggr_time; /* 0x08: uS to delay intr */ - uint32_t intr_coales_aggr_thresh; /* 0x08: compl-Q entries */ - uint32_t async_ev_config; /* 0x0B: async event config */ + struct nvme_feature_obj feat[NVME_FID_MAX]; enum nvme_dsm_type dataset_management; }; @@ -303,6 +318,15 @@ static void pci_nvme_io_partial(struct blockif_req *br #define NVME_ONCS_DSM (NVME_CTRLR_DATA_ONCS_DSM_MASK << \ NVME_CTRLR_DATA_ONCS_DSM_SHIFT) +static void nvme_feature_invalid_cb(struct pci_nvme_softc *, + struct nvme_feature_obj *, + struct nvme_command *, + struct nvme_completion *); +static void nvme_feature_num_queues(struct pci_nvme_softc *, + struct nvme_feature_obj *, + struct nvme_command *, + struct nvme_completion *); + static __inline void cpywithpad(char *dst, size_t dst_size, const char *src, char pad) { @@ -542,6 +566,18 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) } static void +pci_nvme_init_features(struct pci_nvme_softc *sc) +{ + + sc->feat[0].set = nvme_feature_invalid_cb; + sc->feat[0].get = nvme_feature_invalid_cb; + + sc->feat[NVME_FEAT_LBA_RANGE_TYPE].namespace_specific = true; + sc->feat[NVME_FEAT_ERROR_RECOVERY].namespace_specific = true; + sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues; +} + +static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { uint32_t i; @@ -577,6 +613,8 @@ pci_nvme_reset_locked(struct pci_nvme_softc *sc) sc->compl_queues[i].tail = 0; sc->compl_queues[i].head = 0; } + + sc->num_q_is_set = false; } static void @@ -982,24 +1020,144 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv DPRINTF("%s unsupported identify command requested 0x%x", __func__, command->cdw10 & 0xFF); pci_nvme_status_genc(&status, NVME_SC_INVALID_FIELD); - return (1); + break; } compl->status = status; return (1); } -static int -nvme_set_feature_queues(struct pci_nvme_softc* sc, struct nvme_command* command, - struct nvme_completion* compl) +static const char * +nvme_fid_to_name(uint8_t fid) { + const char *name; + + switch (fid) { + case NVME_FEAT_ARBITRATION: + name = "Arbitration"; + break; + case NVME_FEAT_POWER_MANAGEMENT: + name = "Power Management"; + break; + case NVME_FEAT_LBA_RANGE_TYPE: + name = "LBA Range Type"; + break; + case NVME_FEAT_TEMPERATURE_THRESHOLD: + name = "Temperature Threshold"; + break; + case NVME_FEAT_ERROR_RECOVERY: + name = "Error Recovery"; + break; + case NVME_FEAT_VOLATILE_WRITE_CACHE: + name = "Volatile Write Cache"; + break; + case NVME_FEAT_NUMBER_OF_QUEUES: + name = "Number of Queues"; + break; + case NVME_FEAT_INTERRUPT_COALESCING: + name = "Interrupt Coalescing"; + break; + case NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION: + name = "Interrupt Vector Configuration"; + break; + case NVME_FEAT_WRITE_ATOMICITY: + name = "Write Atomicity Normal"; + break; + case NVME_FEAT_ASYNC_EVENT_CONFIGURATION: + name = "Asynchronous Event Configuration"; + break; + case NVME_FEAT_AUTONOMOUS_POWER_STATE_TRANSITION: + name = "Autonomous Power State Transition"; + break; + case NVME_FEAT_HOST_MEMORY_BUFFER: + name = "Host Memory Buffer"; + break; + case NVME_FEAT_TIMESTAMP: + name = "Timestamp"; + break; + case NVME_FEAT_KEEP_ALIVE_TIMER: + name = "Keep Alive Timer"; + break; + case NVME_FEAT_HOST_CONTROLLED_THERMAL_MGMT: + name = "Host Controlled Thermal Management"; + break; + case NVME_FEAT_NON_OP_POWER_STATE_CONFIG: + name = "Non-Operation Power State Config"; + break; + case NVME_FEAT_READ_RECOVERY_LEVEL_CONFIG: + name = "Read Recovery Level Config"; + break; + case NVME_FEAT_PREDICTABLE_LATENCY_MODE_CONFIG: + name = "Predictable Latency Mode Config"; + break; + case NVME_FEAT_PREDICTABLE_LATENCY_MODE_WINDOW: + name = "Predictable Latency Mode Window"; + break; + case NVME_FEAT_LBA_STATUS_INFORMATION_ATTRIBUTES: + name = "LBA Status Information Report Interval"; + break; + case NVME_FEAT_HOST_BEHAVIOR_SUPPORT: + name = "Host Behavior Support"; + break; + case NVME_FEAT_SANITIZE_CONFIG: + name = "Sanitize Config"; + break; + case NVME_FEAT_ENDURANCE_GROUP_EVENT_CONFIGURATION: + name = "Endurance Group Event Configuration"; + break; + case NVME_FEAT_SOFTWARE_PROGRESS_MARKER: + name = "Software Progress Marker"; + break; + case NVME_FEAT_HOST_IDENTIFIER: + name = "Host Identifier"; + break; + case NVME_FEAT_RESERVATION_NOTIFICATION_MASK: + name = "Reservation Notification Mask"; + break; + case NVME_FEAT_RESERVATION_PERSISTENCE: + name = "Reservation Persistence"; + break; + case NVME_FEAT_NAMESPACE_WRITE_PROTECTION_CONFIG: + name = "Namespace Write Protection Config"; + break; + default: + name = "Unknown"; + break; + } + + return (name); +} + +static void +nvme_feature_invalid_cb(struct pci_nvme_softc *sc, + struct nvme_feature_obj *feat, + struct nvme_command *command, + struct nvme_completion *compl) +{ + + pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); +} + +static void +nvme_feature_num_queues(struct pci_nvme_softc *sc, + struct nvme_feature_obj *feat, + struct nvme_command *command, + struct nvme_completion *compl) +{ uint16_t nqr; /* Number of Queues Requested */ + if (sc->num_q_is_set) { + WPRINTF("%s: Number of Queues already set", __func__); + pci_nvme_status_genc(&compl->status, + NVME_SC_COMMAND_SEQUENCE_ERROR); + return; + } + nqr = command->cdw11 & 0xFFFF; if (nqr == 0xffff) { WPRINTF("%s: Illegal NSQR value %#x", __func__, nqr); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); - return (-1); + return; } sc->num_squeues = ONE_BASED(nqr); @@ -1013,7 +1171,7 @@ nvme_set_feature_queues(struct pci_nvme_softc* sc, str if (nqr == 0xffff) { WPRINTF("%s: Illegal NCQR value %#x", __func__, nqr); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); - return (-1); + return; } sc->num_cqueues = ONE_BASED(nqr); @@ -1023,173 +1181,77 @@ nvme_set_feature_queues(struct pci_nvme_softc* sc, str sc->num_cqueues = sc->max_queues; } + /* Patch the command value which will be saved on callback's return */ + command->cdw11 = NVME_FEATURE_NUM_QUEUES(sc); compl->cdw0 = NVME_FEATURE_NUM_QUEUES(sc); - return (0); + sc->num_q_is_set = true; } static int -nvme_opc_set_features(struct pci_nvme_softc* sc, struct nvme_command* command, - struct nvme_completion* compl) +nvme_opc_set_features(struct pci_nvme_softc *sc, struct nvme_command *command, + struct nvme_completion *compl) { - int feature = command->cdw10 & 0xFF; - uint32_t iv; + struct nvme_feature_obj *feat; + uint32_t nsid = command->nsid; + uint8_t fid = command->cdw10 & 0xFF; - DPRINTF("%s feature 0x%x", __func__, feature); - compl->cdw0 = 0; + DPRINTF("%s: Feature ID 0x%x (%s)", __func__, fid, nvme_fid_to_name(fid)); - switch (feature) { - case NVME_FEAT_ARBITRATION: - DPRINTF(" arbitration 0x%x", command->cdw11); - break; - case NVME_FEAT_POWER_MANAGEMENT: - DPRINTF(" power management 0x%x", command->cdw11); - break; - case NVME_FEAT_LBA_RANGE_TYPE: - DPRINTF(" lba range 0x%x", command->cdw11); - break; - case NVME_FEAT_TEMPERATURE_THRESHOLD: - DPRINTF(" temperature threshold 0x%x", command->cdw11); - break; - case NVME_FEAT_ERROR_RECOVERY: - DPRINTF(" error recovery 0x%x", command->cdw11); - break; - case NVME_FEAT_VOLATILE_WRITE_CACHE: - DPRINTF(" volatile write cache 0x%x", command->cdw11); - break; - case NVME_FEAT_NUMBER_OF_QUEUES: - nvme_set_feature_queues(sc, command, compl); - break; - case NVME_FEAT_INTERRUPT_COALESCING: - DPRINTF(" interrupt coalescing 0x%x", command->cdw11); - - /* in uS */ - sc->intr_coales_aggr_time = ((command->cdw11 >> 8) & 0xFF)*100; - - sc->intr_coales_aggr_thresh = command->cdw11 & 0xFF; - break; - case NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION: - iv = command->cdw11 & 0xFFFF; - - DPRINTF(" interrupt vector configuration 0x%x", - command->cdw11); - - for (uint32_t i = 0; i < sc->num_cqueues + 1; i++) { - if (sc->compl_queues[i].intr_vec == iv) { - if (command->cdw11 & (1 << 16)) - sc->compl_queues[i].intr_en |= - NVME_CQ_INTCOAL; - else - sc->compl_queues[i].intr_en &= - ~NVME_CQ_INTCOAL; - } - } - break; - case NVME_FEAT_WRITE_ATOMICITY: - DPRINTF(" write atomicity 0x%x", command->cdw11); - break; - case NVME_FEAT_ASYNC_EVENT_CONFIGURATION: - DPRINTF(" async event configuration 0x%x", - command->cdw11); - sc->async_ev_config = command->cdw11; - break; - case NVME_FEAT_SOFTWARE_PROGRESS_MARKER: - DPRINTF(" software progress marker 0x%x", - command->cdw11); - break; - case 0x0C: - DPRINTF(" autonomous power state transition 0x%x", - command->cdw11); - break; - default: - WPRINTF("%s invalid feature", __func__); + if (fid >= NVME_FID_MAX) { + DPRINTF("%s invalid feature 0x%x", __func__, fid); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (1); } + feat = &sc->feat[fid]; + if (!feat->namespace_specific && + !((nsid == 0) || (nsid == NVME_GLOBAL_NAMESPACE_TAG))) { + pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_FEATURE_NOT_NS_SPECIFIC); + return (1); + } + + compl->cdw0 = 0; pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); - return (1); + + if (feat->set) + feat->set(sc, feat, command, compl); + + if (compl->status == NVME_SC_SUCCESS) + feat->cdw11 = command->cdw11; + + return (0); } static int nvme_opc_get_features(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { - int feature = command->cdw10 & 0xFF; + struct nvme_feature_obj *feat; + uint8_t fid = command->cdw10 & 0xFF; - DPRINTF("%s feature 0x%x", __func__, feature); + DPRINTF("%s: Feature ID 0x%x (%s)", __func__, fid, nvme_fid_to_name(fid)); - compl->cdw0 = 0; - - switch (feature) { - case NVME_FEAT_ARBITRATION: - DPRINTF(" arbitration"); - break; - case NVME_FEAT_POWER_MANAGEMENT: - DPRINTF(" power management"); - break; - case NVME_FEAT_LBA_RANGE_TYPE: - DPRINTF(" lba range"); - break; - case NVME_FEAT_TEMPERATURE_THRESHOLD: - DPRINTF(" temperature threshold"); - switch ((command->cdw11 >> 20) & 0x3) { - case 0: - /* Over temp threshold */ - compl->cdw0 = 0xFFFF; - break; - case 1: - /* Under temp threshold */ - compl->cdw0 = 0; - break; - default: - WPRINTF(" invalid threshold type select"); - pci_nvme_status_genc(&compl->status, - NVME_SC_INVALID_FIELD); - return (1); - } - break; - case NVME_FEAT_ERROR_RECOVERY: - DPRINTF(" error recovery"); - break; - case NVME_FEAT_VOLATILE_WRITE_CACHE: - DPRINTF(" volatile write cache"); - break; - case NVME_FEAT_NUMBER_OF_QUEUES: - compl->cdw0 = NVME_FEATURE_NUM_QUEUES(sc); - - DPRINTF(" number of queues (submit %u, completion %u)", - compl->cdw0 & 0xFFFF, - (compl->cdw0 >> 16) & 0xFFFF); - - break; - case NVME_FEAT_INTERRUPT_COALESCING: - DPRINTF(" interrupt coalescing"); - break; - case NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION: - DPRINTF(" interrupt vector configuration"); - break; - case NVME_FEAT_WRITE_ATOMICITY: - DPRINTF(" write atomicity"); - break; - case NVME_FEAT_ASYNC_EVENT_CONFIGURATION: - DPRINTF(" async event configuration"); - sc->async_ev_config = command->cdw11; - break; - case NVME_FEAT_SOFTWARE_PROGRESS_MARKER: - DPRINTF(" software progress marker"); - break; - case 0x0C: - DPRINTF(" autonomous power state transition"); - break; - default: - WPRINTF("%s invalid feature 0x%x", __func__, feature); + if (fid >= NVME_FID_MAX) { + DPRINTF("%s invalid feature 0x%x", __func__, fid); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (1); } + compl->cdw0 = 0; pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); - return (1); + + feat = &sc->feat[fid]; + if (feat->get) { + feat->get(sc, feat, command, compl); + } + + if (compl->status == NVME_SC_SUCCESS) { + compl->cdw0 = feat->cdw11; + } + + return (0); } static int @@ -2312,7 +2374,6 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pthread_mutex_init(&sc->ioreqs[i].mtx, NULL); pthread_cond_init(&sc->ioreqs[i].cv, NULL); } - sc->intr_coales_aggr_thresh = 1; pci_set_cfgdata16(pi, PCIR_DEVICE, 0x0A0A); pci_set_cfgdata16(pi, PCIR_VENDOR, 0xFB5D); @@ -2363,6 +2424,7 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pci_nvme_init_nsdata(sc, &sc->nsdata, 1, &sc->nvstore); pci_nvme_init_ctrldata(sc); pci_nvme_init_logpages(sc); + pci_nvme_init_features(sc); pci_nvme_reset(sc); From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 A424D359729; Mon, 29 Jun 2020 00:32:02 +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 49w7jF2yQRz436Q; Mon, 29 Jun 2020 00:32:00 +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 2E1761EC56; Mon, 29 Jun 2020 00:31: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 05T0Vi39047333; Mon, 29 Jun 2020 00:31:44 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0Vi2d047332; Mon, 29 Jun 2020 00:31:44 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0Vi2d047332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362754 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362754 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:02 -0000 Author: chuck Date: Mon Jun 29 00:31:44 2020 New Revision: 362754 URL: https://svnweb.freebsd.org/changeset/base/362754 Log: bhyve: make unsupported NVMe commands a debug message Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24888 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:41 2020 (r362753) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:44 2020 (r362754) @@ -1353,7 +1353,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u compl.status = NVME_NO_STATUS; break; default: - WPRINTF("0x%x command is not implemented", + DPRINTF("0x%x command is not implemented", cmd->opc); pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE); } From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 2E76D359374; Mon, 29 Jun 2020 00:32:02 +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 49w7jD4NHzz43FL; Mon, 29 Jun 2020 00:31:59 +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 724FE1EBE3; Mon, 29 Jun 2020 00:31:34 +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 05T0VYWH047201; Mon, 29 Jun 2020 00:31:34 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VYG5047200; Mon, 29 Jun 2020 00:31:34 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VYG5047200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362751 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362751 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:02 -0000 Author: chuck Date: Mon Jun 29 00:31:34 2020 New Revision: 362751 URL: https://svnweb.freebsd.org/changeset/base/362751 Log: bhyve: fix NVMe Get Log Page command Fix the logic in nvme_opc_get_log_page to calculate the number of DWORDS (uint32_t) instead of WORDS (uint16_t) for the byte length. And only return the allowed number of Log Page bytes as determined by the user request and actual size of the requested log page. Fixes UNH Test 1.3 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24885 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:30 2020 (r362750) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:34 2020 (r362751) @@ -830,32 +830,42 @@ static int nvme_opc_get_log_page(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { - uint32_t logsize = (1 + ((command->cdw10 >> 16) & 0xFFF)) * 2; + uint32_t logsize; uint8_t logpage = command->cdw10 & 0xFF; DPRINTF("%s log page %u len %u", __func__, logpage, logsize); pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); + /* + * Command specifies the number of dwords to return in fields NUMDU + * and NUMDL. This is a zero-based value. + */ + logsize = ((command->cdw11 << 16) | (command->cdw10 >> 16)) + 1; + logsize *= sizeof(uint32_t); + switch (logpage) { case NVME_LOG_ERROR: nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)&sc->err_log, logsize, + command->prp2, (uint8_t *)&sc->err_log, + MIN(logsize, sizeof(sc->err_log)), NVME_COPY_TO_PRP); break; case NVME_LOG_HEALTH_INFORMATION: /* TODO: present some smart info */ nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)&sc->health_log, logsize, + command->prp2, (uint8_t *)&sc->health_log, + MIN(logsize, sizeof(sc->health_log)), NVME_COPY_TO_PRP); break; case NVME_LOG_FIRMWARE_SLOT: nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, - command->prp2, (uint8_t *)&sc->fw_log, logsize, + command->prp2, (uint8_t *)&sc->fw_log, + MIN(logsize, sizeof(sc->fw_log)), NVME_COPY_TO_PRP); break; default: - WPRINTF("%s get log page %x command not supported", + DPRINTF("%s get log page %x command not supported", __func__, logpage); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, From owner-svn-src-head@freebsd.org Mon Jun 29 00: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 C0DC135972A; Mon, 29 Jun 2020 00:32:02 +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 49w7jF2JwKz431T; Mon, 29 Jun 2020 00:31:59 +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 5A61C1EC54; Mon, 29 Jun 2020 00:31:38 +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 05T0Vcls047244; Mon, 29 Jun 2020 00:31:38 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VcBV047243; Mon, 29 Jun 2020 00:31:38 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VcBV047243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362752 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362752 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:03 -0000 Author: chuck Date: Mon Jun 29 00:31:37 2020 New Revision: 362752 URL: https://svnweb.freebsd.org/changeset/base/362752 Log: bhyve: fix NVMe queue creation and deletion Add checks for various types of invalid I/O Queue Create and Delete command parameters, including: - QID=0 - QID>MAX - QID already in use - Delete an Active CQ - Invalid QSIZE - Invalid CQID (SQ creation) - Invalid interrupt vector (CQ creation) Fixes UNH Tests 1.4.2-5,7-8 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24886 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:34 2020 (r362751) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:37 2020 (r362752) @@ -705,7 +705,8 @@ nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struc uint16_t qid = command->cdw10 & 0xffff; DPRINTF("%s DELETE_IO_SQ %u", __func__, qid); - if (qid == 0 || qid > sc->num_squeues) { + if (qid == 0 || qid > sc->num_squeues || + (sc->submit_queues[qid].qbase == NULL)) { WPRINTF("%s NOT PERMITTED queue id %u / num_squeues %u", __func__, qid, sc->num_squeues); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, @@ -714,6 +715,7 @@ nvme_opc_delete_io_sq(struct pci_nvme_softc* sc, struc } sc->submit_queues[qid].qbase = NULL; + sc->submit_queues[qid].cqid = 0; pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); return (1); } @@ -726,7 +728,8 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc uint16_t qid = command->cdw10 & 0xffff; struct nvme_submission_queue *nsq; - if ((qid == 0) || (qid > sc->num_squeues)) { + if ((qid == 0) || (qid > sc->num_squeues) || + (sc->submit_queues[qid].qbase != NULL)) { WPRINTF("%s queue index %u > num_squeues %u", __func__, qid, sc->num_squeues); pci_nvme_status_tc(&compl->status, @@ -737,12 +740,39 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc nsq = &sc->submit_queues[qid]; nsq->size = ONE_BASED((command->cdw10 >> 16) & 0xffff); + DPRINTF("%s size=%u (max=%u)", __func__, nsq->size, sc->max_qentries); + if ((nsq->size < 2) || (nsq->size > sc->max_qentries)) { + /* + * Queues must specify at least two entries + * NOTE: "MAXIMUM QUEUE SIZE EXCEEDED" was renamed to + * "INVALID QUEUE SIZE" in the NVM Express 1.3 Spec + */ + pci_nvme_status_tc(&compl->status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_MAXIMUM_QUEUE_SIZE_EXCEEDED); + return (1); + } - nsq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, - sizeof(struct nvme_command) * (size_t)nsq->size); nsq->cqid = (command->cdw11 >> 16) & 0xffff; + if ((nsq->cqid == 0) || (nsq->cqid > sc->num_cqueues)) { + pci_nvme_status_tc(&compl->status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_QUEUE_IDENTIFIER); + return (1); + } + + if (sc->compl_queues[nsq->cqid].qbase == NULL) { + pci_nvme_status_tc(&compl->status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_COMPLETION_QUEUE_INVALID); + return (1); + } + nsq->qpriority = (command->cdw11 >> 1) & 0x03; + nsq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, + sizeof(struct nvme_command) * (size_t)nsq->size); + DPRINTF("%s sq %u size %u gaddr %p cqid %u", __func__, qid, nsq->size, nsq->qbase, nsq->cqid); @@ -768,9 +798,11 @@ nvme_opc_delete_io_cq(struct pci_nvme_softc* sc, struc struct nvme_completion* compl) { uint16_t qid = command->cdw10 & 0xffff; + uint16_t sqid; DPRINTF("%s DELETE_IO_CQ %u", __func__, qid); - if (qid == 0 || qid > sc->num_cqueues) { + if (qid == 0 || qid > sc->num_cqueues || + (sc->compl_queues[qid].qbase == NULL)) { WPRINTF("%s queue index %u / num_cqueues %u", __func__, qid, sc->num_cqueues); pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, @@ -778,6 +810,15 @@ nvme_opc_delete_io_cq(struct pci_nvme_softc* sc, struc return (1); } + /* Deleting an Active CQ is an error */ + for (sqid = 1; sqid < sc->num_squeues + 1; sqid++) + if (sc->submit_queues[sqid].cqid == qid) { + pci_nvme_status_tc(&compl->status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_QUEUE_DELETION); + return (1); + } + sc->compl_queues[qid].qbase = NULL; pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); return (1); @@ -787,41 +828,57 @@ static int nvme_opc_create_io_cq(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { + struct nvme_completion_queue *ncq; + uint16_t qid = command->cdw10 & 0xffff; - if (command->cdw11 & NVME_CMD_CDW11_PC) { - uint16_t qid = command->cdw10 & 0xffff; - struct nvme_completion_queue *ncq; + /* Only support Physically Contiguous queues */ + if ((command->cdw11 & NVME_CMD_CDW11_PC) == 0) { + WPRINTF("%s unsupported non-contig (list-based) " + "create i/o completion queue", + __func__); - if ((qid == 0) || (qid > sc->num_cqueues)) { - WPRINTF("%s queue index %u > num_cqueues %u", - __func__, qid, sc->num_cqueues); - pci_nvme_status_tc(&compl->status, - NVME_SCT_COMMAND_SPECIFIC, - NVME_SC_INVALID_QUEUE_IDENTIFIER); - return (1); - } + pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); + return (1); + } - ncq = &sc->compl_queues[qid]; - ncq->intr_en = (command->cdw11 & NVME_CMD_CDW11_IEN) >> 1; - ncq->intr_vec = (command->cdw11 >> 16) & 0xffff; - ncq->size = ONE_BASED((command->cdw10 >> 16) & 0xffff); + if ((qid == 0) || (qid > sc->num_cqueues) || + (sc->compl_queues[qid].qbase != NULL)) { + WPRINTF("%s queue index %u > num_cqueues %u", + __func__, qid, sc->num_cqueues); + pci_nvme_status_tc(&compl->status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_QUEUE_IDENTIFIER); + return (1); + } - ncq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx, - command->prp1, - sizeof(struct nvme_command) * (size_t)ncq->size); + ncq = &sc->compl_queues[qid]; + ncq->intr_en = (command->cdw11 & NVME_CMD_CDW11_IEN) >> 1; + ncq->intr_vec = (command->cdw11 >> 16) & 0xffff; + if (ncq->intr_vec > (sc->max_queues + 1)) { + pci_nvme_status_tc(&compl->status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_INTERRUPT_VECTOR); + return (1); + } - pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); - } else { - /* - * Non-contig completion queue unsupported. + ncq->size = ONE_BASED((command->cdw10 >> 16) & 0xffff); + if ((ncq->size < 2) || (ncq->size > sc->max_qentries)) { + /* + * Queues must specify at least two entries + * NOTE: "MAXIMUM QUEUE SIZE EXCEEDED" was renamed to + * "INVALID QUEUE SIZE" in the NVM Express 1.3 Spec */ - WPRINTF("%s unsupported non-contig (list-based) " - "create i/o completion queue", - __func__); - - /* 0x12 = Invalid Use of Controller Memory Buffer */ - pci_nvme_status_genc(&compl->status, 0x12); + pci_nvme_status_tc(&compl->status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_MAXIMUM_QUEUE_SIZE_EXCEEDED); + return (1); } + ncq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx, + command->prp1, + sizeof(struct nvme_command) * (size_t)ncq->size); + + pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); + return (1); } From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 9B72E359554; Mon, 29 Jun 2020 00:32:10 +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 49w7jP2BTnz43Q7; Mon, 29 Jun 2020 00:32:08 +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 80A8C1EA5A; Mon, 29 Jun 2020 00:31:48 +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 05T0Vmcp047379; Mon, 29 Jun 2020 00:31:48 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0Vmlf047378; Mon, 29 Jun 2020 00:31:48 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0Vmlf047378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362755 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362755 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:10 -0000 Author: chuck Date: Mon Jun 29 00:31:47 2020 New Revision: 362755 URL: https://svnweb.freebsd.org/changeset/base/362755 Log: bhyve: implement NVMe Format NVM command The Format NVM command mainly allows the host to specify the block size and protection information used for the Namespace. As the bhyve implementation simply maps the capabilities of the backing storage through to the guest, there isn't anything to implement. But a side effect of the format is the NVMe Controller shall not return any data previously written (i.e. erase previously written data). This patch implements this later behavior to provide a compliant implementation. Fixes UNH Test 1.6 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24889 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:44 2020 (r362754) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:47 2020 (r362755) @@ -280,6 +280,9 @@ struct pci_nvme_softc { static void pci_nvme_io_partial(struct blockif_req *br, int err); +static struct pci_nvme_ioreq *pci_nvme_get_ioreq(struct pci_nvme_softc *); +static void pci_nvme_release_ioreq(struct pci_nvme_softc *, struct pci_nvme_ioreq *); +static void pci_nvme_io_done(struct blockif_req *, int); /* Controller Configuration utils */ #define NVME_CC_GET_EN(cc) \ @@ -645,6 +648,7 @@ pci_nvme_init_controller(struct vmctx *ctx, struct pci sc->compl_queues[0].size = acqs; sc->compl_queues[0].qbase = vm_map_gpa(ctx, sc->regs.acq, sizeof(struct nvme_completion) * acqs); + sc->compl_queues[0].intr_en = NVME_CQ_INTEN; DPRINTF("%s mapping Admin-CQ guest 0x%lx, host: %p", __func__, sc->regs.acq, sc->compl_queues[0].qbase); @@ -1255,6 +1259,71 @@ nvme_opc_get_features(struct pci_nvme_softc* sc, struc } static int +nvme_opc_format_nvm(struct pci_nvme_softc* sc, struct nvme_command* command, + struct nvme_completion* compl) +{ + uint8_t ses, lbaf, pi; + + /* Only supports Secure Erase Setting - User Data Erase */ + ses = (command->cdw10 >> 9) & 0x7; + if (ses > 0x1) { + pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); + return (1); + } + + /* Only supports a single LBA Format */ + lbaf = command->cdw10 & 0xf; + if (lbaf != 0) { + pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_FORMAT); + return (1); + } + + /* Doesn't support Protection Infomation */ + pi = (command->cdw10 >> 5) & 0x7; + if (pi != 0) { + pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); + return (1); + } + + if (sc->nvstore.type == NVME_STOR_RAM) { + if (sc->nvstore.ctx) + free(sc->nvstore.ctx); + sc->nvstore.ctx = calloc(1, sc->nvstore.size); + pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); + } else { + struct pci_nvme_ioreq *req; + int err; + + req = pci_nvme_get_ioreq(sc); + if (req == NULL) { + pci_nvme_status_genc(&compl->status, + NVME_SC_INTERNAL_DEVICE_ERROR); + WPRINTF("%s: unable to allocate IO req", __func__); + return (1); + } + req->nvme_sq = &sc->submit_queues[0]; + req->sqid = 0; + req->opc = command->opc; + req->cid = command->cid; + req->nsid = command->nsid; + + req->io_req.br_offset = 0; + req->io_req.br_resid = sc->nvstore.size; + req->io_req.br_callback = pci_nvme_io_done; + + err = blockif_delete(sc->nvstore.ctx, &req->io_req); + if (err) { + pci_nvme_status_genc(&compl->status, + NVME_SC_INTERNAL_DEVICE_ERROR); + pci_nvme_release_ioreq(sc, req); + } + } + + return (1); +} + +static int nvme_opc_abort(struct pci_nvme_softc* sc, struct nvme_command* command, struct nvme_completion* compl) { @@ -1351,6 +1420,15 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u nvme_opc_async_event_req(sc, cmd, &compl); */ compl.status = NVME_NO_STATUS; + break; + case NVME_OPC_FORMAT_NVM: + DPRINTF("%s command FORMAT_NVM", __func__); + if ((sc->ctrldata.oacs & + (1 << NVME_CTRLR_DATA_OACS_FORMAT_SHIFT)) == 0) { + pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE); + } + compl.status = NVME_NO_STATUS; + nvme_opc_format_nvm(sc, cmd, &compl); break; default: DPRINTF("0x%x command is not implemented", From owner-svn-src-head@freebsd.org Mon Jun 29 00: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 8F1B33596B6; Mon, 29 Jun 2020 00:32:14 +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 49w7jS3zxBz43GB; Mon, 29 Jun 2020 00:32:11 +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 D644B1EA5D; Mon, 29 Jun 2020 00:31:51 +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 05T0VpxS049581; Mon, 29 Jun 2020 00:31:51 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VpkP049545; Mon, 29 Jun 2020 00:31:51 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VpkP049545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362756 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362756 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:15 -0000 Author: chuck Date: Mon Jun 29 00:31:51 2020 New Revision: 362756 URL: https://svnweb.freebsd.org/changeset/base/362756 Log: bhyve: refactor NVMe I/O read/write Split the NVM I/O function (i.e. nvme_opc_write_read) into separate functions - one for RAM based backing-store and another for disk based backing-store for easier maintenance. No functional changes. Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24890 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:47 2020 (r362755) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:51 2020 (r362756) @@ -1683,6 +1683,108 @@ nvme_opc_flush(struct pci_nvme_softc *sc, return (pending); } +static uint16_t +nvme_write_read_ram(struct pci_nvme_softc *sc, + struct pci_nvme_blockstore *nvstore, + uint64_t prp1, uint64_t prp2, + size_t offset, uint64_t bytes, + bool is_write) +{ + uint8_t *buf = nvstore->ctx; + enum nvme_copy_dir dir; + uint16_t status; + + if (is_write) + dir = NVME_COPY_TO_PRP; + else + dir = NVME_COPY_FROM_PRP; + + if (nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, prp1, prp2, + buf + offset, bytes, dir)) + pci_nvme_status_genc(&status, + NVME_SC_DATA_TRANSFER_ERROR); + else + pci_nvme_status_genc(&status, NVME_SC_SUCCESS); + + return (status); +} + +static uint16_t +nvme_write_read_blockif(struct pci_nvme_softc *sc, + struct pci_nvme_blockstore *nvstore, + struct pci_nvme_ioreq *req, + uint64_t prp1, uint64_t prp2, + size_t offset, uint64_t bytes, + bool is_write) +{ + uint64_t size; + int err; + uint16_t status = NVME_NO_STATUS; + + size = MIN(PAGE_SIZE - (prp1 % PAGE_SIZE), bytes); + if (pci_nvme_append_iov_req(sc, req, prp1, + size, is_write, offset)) { + pci_nvme_status_genc(&status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + + offset += size; + bytes -= size; + + if (bytes == 0) { + ; + } else if (bytes <= PAGE_SIZE) { + size = bytes; + if (pci_nvme_append_iov_req(sc, req, prp2, + size, is_write, offset)) { + pci_nvme_status_genc(&status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + } else { + void *vmctx = sc->nsc_pi->pi_vmctx; + uint64_t *prp_list = &prp2; + uint64_t *last = prp_list; + + /* PRP2 is pointer to a physical region page list */ + while (bytes) { + /* Last entry in list points to the next list */ + if (prp_list == last) { + uint64_t prp = *prp_list; + + prp_list = paddr_guest2host(vmctx, prp, + PAGE_SIZE - (prp % PAGE_SIZE)); + last = prp_list + (NVME_PRP2_ITEMS - 1); + } + + size = MIN(bytes, PAGE_SIZE); + + if (pci_nvme_append_iov_req(sc, req, *prp_list, + size, is_write, offset)) { + pci_nvme_status_genc(&status, + NVME_SC_DATA_TRANSFER_ERROR); + goto out; + } + + offset += size; + bytes -= size; + + prp_list++; + } + } + req->io_req.br_callback = pci_nvme_io_done; + if (is_write) + err = blockif_write(nvstore->ctx, &req->io_req); + else + err = blockif_read(nvstore->ctx, &req->io_req); + + if (err) + pci_nvme_status_genc(&status, NVME_SC_DATA_TRANSFER_ERROR); +out: + return (status); +} + static bool nvme_opc_write_read(struct pci_nvme_softc *sc, struct nvme_command *cmd, @@ -1714,85 +1816,13 @@ nvme_opc_write_read(struct pci_nvme_softc *sc, cmd->prp2 &= ~0x3UL; if (nvstore->type == NVME_STOR_RAM) { - uint8_t *buf = nvstore->ctx; - enum nvme_copy_dir dir; - - if (is_write) - dir = NVME_COPY_TO_PRP; - else - dir = NVME_COPY_FROM_PRP; - - if (nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, - buf + offset, bytes, dir)) - pci_nvme_status_genc(status, - NVME_SC_DATA_TRANSFER_ERROR); - else - pci_nvme_status_genc(status, NVME_SC_SUCCESS); + *status = nvme_write_read_ram(sc, nvstore, cmd->prp1, + cmd->prp2, offset, bytes, is_write); } else { - uint64_t size; - int err; + *status = nvme_write_read_blockif(sc, nvstore, req, + cmd->prp1, cmd->prp2, offset, bytes, is_write); - size = MIN(PAGE_SIZE - (cmd->prp1 % PAGE_SIZE), bytes); - if (pci_nvme_append_iov_req(sc, req, cmd->prp1, - size, is_write, offset)) { - pci_nvme_status_genc(status, - NVME_SC_DATA_TRANSFER_ERROR); - goto out; - } - - offset += size; - bytes -= size; - - if (bytes == 0) { - ; - } else if (bytes <= PAGE_SIZE) { - size = bytes; - if (pci_nvme_append_iov_req(sc, req, cmd->prp2, - size, is_write, offset)) { - pci_nvme_status_genc(status, - NVME_SC_DATA_TRANSFER_ERROR); - goto out; - } - } else { - void *vmctx = sc->nsc_pi->pi_vmctx; - uint64_t *prp_list = &cmd->prp2; - uint64_t *last = prp_list; - - /* PRP2 is pointer to a physical region page list */ - while (bytes) { - /* Last entry in list points to the next list */ - if (prp_list == last) { - uint64_t prp = *prp_list; - - prp_list = paddr_guest2host(vmctx, prp, - PAGE_SIZE - (prp % PAGE_SIZE)); - last = prp_list + (NVME_PRP2_ITEMS - 1); - } - - size = MIN(bytes, PAGE_SIZE); - - if (pci_nvme_append_iov_req(sc, req, *prp_list, - size, is_write, offset)) { - pci_nvme_status_genc(status, - NVME_SC_DATA_TRANSFER_ERROR); - goto out; - } - - offset += size; - bytes -= size; - - prp_list++; - } - } - req->io_req.br_callback = pci_nvme_io_done; - if (is_write) - err = blockif_write(nvstore->ctx, &req->io_req); - else - err = blockif_read(nvstore->ctx, &req->io_req); - - if (err) - pci_nvme_status_genc(status, NVME_SC_DATA_TRANSFER_ERROR); - else + if (*status == NVME_NO_STATUS) pending = true; } out: From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 28FE735980E; Mon, 29 Jun 2020 00:32:38 +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 49w7jw0Zfrz43JX; Mon, 29 Jun 2020 00:32:35 +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 59E991EE08; Mon, 29 Jun 2020 00:31:55 +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 05T0Vt4o049780; Mon, 29 Jun 2020 00:31:55 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0Vtks049779; Mon, 29 Jun 2020 00:31:55 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0Vtks049779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362757 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362757 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:38 -0000 Author: chuck Date: Mon Jun 29 00:31:54 2020 New Revision: 362757 URL: https://svnweb.freebsd.org/changeset/base/362757 Log: bhyve: base pci_nvme_ioreq size on advertised MDTS NVMe controllers advertise their Max Data Transfer Size (MDTS) to limit the number of page descriptors in an I/O request. Take advantage of this and size the struct pci_nvme_ioreq accordingly. Ensuring these values match both future-proofs the code and allows removing some complexity which only exists to handle this possibility. Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24891 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:51 2020 (r362756) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:54 2020 (r362757) @@ -99,9 +99,16 @@ static int nvme_debug = 0; #define NVME_QUEUES 16 #define NVME_MAX_QENTRIES 2048 +/* Memory Page size Minimum reported in CAP register */ +#define NVME_MPSMIN 0 +/* MPSMIN converted to bytes */ +#define NVME_MPSMIN_BYTES (1 << (12 + NVME_MPSMIN)) #define NVME_PRP2_ITEMS (PAGE_SIZE/sizeof(uint64_t)) -#define NVME_MAX_BLOCKIOVS 512 +#define NVME_MDTS 9 +/* Note the + 1 allows for the initial descriptor to not be page aligned */ +#define NVME_MAX_IOVEC ((1 << NVME_MDTS) + 1) +#define NVME_MAX_DATA_SIZE ((1 << NVME_MDTS) * NVME_MPSMIN_BYTES) /* This is a synthetic status code to indicate there is no status */ #define NVME_NO_STATUS 0xffff @@ -186,6 +193,18 @@ struct pci_nvme_blockstore { uint32_t deallocate:1; }; +/* + * Calculate the number of additional page descriptors for guest IO requests + * based on the advertised Max Data Transfer (MDTS) and given the number of + * default iovec's in a struct blockif_req. + * + * Note the + 1 allows for the initial descriptor to not be page aligned. + */ +#define MDTS_PAD_SIZE \ + NVME_MAX_IOVEC > BLOCKIF_IOV_MAX ? \ + NVME_MAX_IOVEC - BLOCKIF_IOV_MAX : \ + 0 + struct pci_nvme_ioreq { struct pci_nvme_softc *sc; STAILQ_ENTRY(pci_nvme_ioreq) link; @@ -200,17 +219,9 @@ struct pci_nvme_ioreq { uint64_t prev_gpaddr; size_t prev_size; - /* - * lock if all iovs consumed (big IO); - * complete transaction before continuing - */ - pthread_mutex_t mtx; - pthread_cond_t cv; - struct blockif_req io_req; - /* pad to fit up to 512 page descriptors from guest IO request */ - struct iovec iovpadding[NVME_MAX_BLOCKIOVS-BLOCKIF_IOV_MAX]; + struct iovec iovpadding[MDTS_PAD_SIZE]; }; enum nvme_dsm_type { @@ -279,7 +290,6 @@ struct pci_nvme_softc { }; -static void pci_nvme_io_partial(struct blockif_req *br, int err); static struct pci_nvme_ioreq *pci_nvme_get_ioreq(struct pci_nvme_softc *); static void pci_nvme_release_ioreq(struct pci_nvme_softc *, struct pci_nvme_ioreq *); static void pci_nvme_io_done(struct blockif_req *, int); @@ -433,7 +443,7 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->mic = 0; - cd->mdts = 9; /* max data transfer size (2^mdts * CAP.MPSMIN) */ + cd->mdts = NVME_MDTS; /* max data transfer size (2^mdts * CAP.MPSMIN) */ cd->ver = 0x00010300; @@ -1461,81 +1471,46 @@ pci_nvme_append_iov_req(struct pci_nvme_softc *sc, str { int iovidx; - if (req != NULL) { - /* concatenate contig block-iovs to minimize number of iovs */ - if ((req->prev_gpaddr + req->prev_size) == gpaddr) { - iovidx = req->io_req.br_iovcnt - 1; + if (req == NULL) + return (-1); - req->io_req.br_iov[iovidx].iov_base = - paddr_guest2host(req->sc->nsc_pi->pi_vmctx, - req->prev_gpaddr, size); + if (req->io_req.br_iovcnt == NVME_MAX_IOVEC) { + return (-1); + } - req->prev_size += size; - req->io_req.br_resid += size; + /* concatenate contig block-iovs to minimize number of iovs */ + if ((req->prev_gpaddr + req->prev_size) == gpaddr) { + iovidx = req->io_req.br_iovcnt - 1; - req->io_req.br_iov[iovidx].iov_len = req->prev_size; - } else { - pthread_mutex_lock(&req->mtx); + req->io_req.br_iov[iovidx].iov_base = + paddr_guest2host(req->sc->nsc_pi->pi_vmctx, + req->prev_gpaddr, size); - iovidx = req->io_req.br_iovcnt; - if (iovidx == NVME_MAX_BLOCKIOVS) { - int err = 0; + req->prev_size += size; + req->io_req.br_resid += size; - DPRINTF("large I/O, doing partial req"); + req->io_req.br_iov[iovidx].iov_len = req->prev_size; + } else { + iovidx = req->io_req.br_iovcnt; + if (iovidx == 0) { + req->io_req.br_offset = lba; + req->io_req.br_resid = 0; + req->io_req.br_param = req; + } - iovidx = 0; - req->io_req.br_iovcnt = 0; + req->io_req.br_iov[iovidx].iov_base = + paddr_guest2host(req->sc->nsc_pi->pi_vmctx, + gpaddr, size); - req->io_req.br_callback = pci_nvme_io_partial; + req->io_req.br_iov[iovidx].iov_len = size; - if (!do_write) - err = blockif_read(sc->nvstore.ctx, - &req->io_req); - else - err = blockif_write(sc->nvstore.ctx, - &req->io_req); + req->prev_gpaddr = gpaddr; + req->prev_size = size; + req->io_req.br_resid += size; - /* wait until req completes before cont */ - if (err == 0) - pthread_cond_wait(&req->cv, &req->mtx); - } - if (iovidx == 0) { - req->io_req.br_offset = lba; - req->io_req.br_resid = 0; - req->io_req.br_param = req; - } - - req->io_req.br_iov[iovidx].iov_base = - paddr_guest2host(req->sc->nsc_pi->pi_vmctx, - gpaddr, size); - - req->io_req.br_iov[iovidx].iov_len = size; - - req->prev_gpaddr = gpaddr; - req->prev_size = size; - req->io_req.br_resid += size; - - req->io_req.br_iovcnt++; - - pthread_mutex_unlock(&req->mtx); - } - } else { - /* RAM buffer: read/write directly */ - void *p = sc->nvstore.ctx; - void *gptr; - - if ((lba + size) > sc->nvstore.size) { - WPRINTF("%s write would overflow RAM", __func__); - return (-1); - } - - p = (void *)((uintptr_t)p + (uintptr_t)lba); - gptr = paddr_guest2host(sc->nsc_pi->pi_vmctx, gpaddr, size); - if (do_write) - memcpy(p, gptr, size); - else - memcpy(gptr, p, size); + req->io_req.br_iovcnt++; } + return (0); } @@ -1633,16 +1608,6 @@ pci_nvme_io_done(struct blockif_req *br, int err) pci_nvme_release_ioreq(req->sc, req); } -static void -pci_nvme_io_partial(struct blockif_req *br, int err) -{ - struct pci_nvme_ioreq *req = br->br_param; - - DPRINTF("%s error %d %s", __func__, err, strerror(err)); - - pthread_cond_signal(&req->cv); -} - /* * Implements the Flush command. The specification states: * If a volatile write cache is not present, Flush commands complete @@ -1800,9 +1765,14 @@ nvme_opc_write_read(struct pci_nvme_softc *sc, lba = ((uint64_t)cmd->cdw11 << 32) | cmd->cdw10; nblocks = (cmd->cdw12 & 0xFFFF) + 1; - offset = lba * nvstore->sectsz; bytes = nblocks * nvstore->sectsz; + if (bytes > NVME_MAX_DATA_SIZE) { + WPRINTF("%s command would exceed MDTS", __func__); + pci_nvme_status_genc(status, NVME_SC_INVALID_FIELD); + goto out; + } + offset = lba * nvstore->sectsz; if ((offset + bytes) > nvstore->size) { WPRINTF("%s command would exceed LBA range", __func__); pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); @@ -2479,8 +2449,6 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p sc->ioreqs = calloc(sc->ioslots, sizeof(struct pci_nvme_ioreq)); for (int i = 0; i < sc->ioslots; i++) { STAILQ_INSERT_TAIL(&sc->ioreqs_free, &sc->ioreqs[i], link); - pthread_mutex_init(&sc->ioreqs[i].mtx, NULL); - pthread_cond_init(&sc->ioreqs[i].cv, NULL); } pci_set_cfgdata16(pi, PCIR_DEVICE, 0x0A0A); From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 680133597B4; Mon, 29 Jun 2020 00:32:41 +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 49w7jz5mw7z43YH; Mon, 29 Jun 2020 00:32:39 +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 BDD291EAC7; Mon, 29 Jun 2020 00:31:58 +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 05T0VwwM049826; Mon, 29 Jun 2020 00:31:58 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VwS7049825; Mon, 29 Jun 2020 00:31:58 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VwS7049825@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362758 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362758 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:41 -0000 Author: chuck Date: Mon Jun 29 00:31:58 2020 New Revision: 362758 URL: https://svnweb.freebsd.org/changeset/base/362758 Log: bhyve: validate NVMe deallocate range values For NVMe emulation, validate the Data Set Management LBA ranges do not exceed the capacity of the backing storage. If they do, return an "LBA Out of Range" error. Fixes UNH Test 2.2.3 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24893 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:54 2020 (r362757) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:58 2020 (r362758) @@ -1877,6 +1877,11 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); + if ((range[0].starting_lba * sectsz) > nvstore->size) { + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } + /* * If the request is for more than a single range, store * the ranges in the br_iov. Optimize for the common case @@ -1896,6 +1901,10 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, struct iovec *iov = req->io_req.br_iov; for (r = 0; r <= nr; r++) { + if ((range[r].starting_lba * sectsz) > nvstore->size) { + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } iov[r].iov_base = (void *)(range[r].starting_lba * sectsz); iov[r].iov_len = range[r].length * sectsz; } From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 C0211359572; Mon, 29 Jun 2020 00:32:43 +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 49w7k15gXcz43dq; Mon, 29 Jun 2020 00:32:41 +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 F0B8E1EC6C; Mon, 29 Jun 2020 00:32:01 +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 05T0W1Sp049873; Mon, 29 Jun 2020 00:32:01 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0W1bm049872; Mon, 29 Jun 2020 00:32:01 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0W1bm049872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362759 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362759 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:44 -0000 Author: chuck Date: Mon Jun 29 00:32:01 2020 New Revision: 362759 URL: https://svnweb.freebsd.org/changeset/base/362759 Log: bhyve: implement NVMe SMART data I/O statistics SMART data in NVMe includes statistics for number of read and write commands issued as well as the number of "data units" read and written. NVMe defines "data unit" as thousands of 512 byte blocks (e.g. 1 data unit is 1-1,000 512 byte blocks, 3 data units are 2,001-3,000 512 byte blocks). This patch implements counters for: - Data Units Read - Data Units Written - Host Read Commands - Host Write Commands and exposes the values when the guest reads the SMART/Health Log Page. Fixes UNH Test 1.3.8 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24894 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:58 2020 (r362758) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:01 2020 (r362759) @@ -218,6 +218,7 @@ struct pci_nvme_ioreq { uint64_t prev_gpaddr; size_t prev_size; + size_t bytes; struct blockif_req io_req; @@ -287,6 +288,14 @@ struct pci_nvme_softc { struct nvme_feature_obj feat[NVME_FID_MAX]; enum nvme_dsm_type dataset_management; + + /* Accounting for SMART data */ + __uint128_t read_data_units; + __uint128_t write_data_units; + __uint128_t read_commands; + __uint128_t write_commands; + uint32_t read_dunits_remainder; + uint32_t write_dunits_remainder; }; @@ -576,6 +585,10 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) memset(&sc->err_log, 0, sizeof(sc->err_log)); memset(&sc->health_log, 0, sizeof(sc->health_log)); memset(&sc->fw_log, 0, sizeof(sc->fw_log)); + + /* Set read/write remainder to round up according to spec */ + sc->read_dunits_remainder = 999; + sc->write_dunits_remainder = 999; } static void @@ -961,7 +974,17 @@ nvme_opc_get_log_page(struct pci_nvme_softc* sc, struc NVME_COPY_TO_PRP); break; case NVME_LOG_HEALTH_INFORMATION: - /* TODO: present some smart info */ + pthread_mutex_lock(&sc->mtx); + memcpy(&sc->health_log.data_units_read, &sc->read_data_units, + sizeof(sc->health_log.data_units_read)); + memcpy(&sc->health_log.data_units_written, &sc->write_data_units, + sizeof(sc->health_log.data_units_written)); + memcpy(&sc->health_log.host_read_commands, &sc->read_commands, + sizeof(sc->health_log.host_read_commands)); + memcpy(&sc->health_log.host_write_commands, &sc->write_commands, + sizeof(sc->health_log.host_write_commands)); + pthread_mutex_unlock(&sc->mtx); + nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, command->prp1, command->prp2, (uint8_t *)&sc->health_log, MIN(logsize, sizeof(sc->health_log)), @@ -1465,6 +1488,47 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u pthread_mutex_unlock(&sq->mtx); } +/* + * Update the Write and Read statistics reported in SMART data + * + * NVMe defines "data unit" as thousand's of 512 byte blocks and is rounded up. + * E.g. 1 data unit is 1 - 1,000 512 byte blocks. 3 data units are 2,001 - 3,000 + * 512 byte blocks. Rounding up is acheived by initializing the remainder to 999. + */ +static void +pci_nvme_stats_write_read_update(struct pci_nvme_softc *sc, uint8_t opc, + size_t bytes, uint16_t status) +{ + + pthread_mutex_lock(&sc->mtx); + switch (opc) { + case NVME_OPC_WRITE: + sc->write_commands++; + if (status != NVME_SC_SUCCESS) + break; + sc->write_dunits_remainder += (bytes / 512); + while (sc->write_dunits_remainder >= 1000) { + sc->write_data_units++; + sc->write_dunits_remainder -= 1000; + } + break; + case NVME_OPC_READ: + sc->read_commands++; + if (status != NVME_SC_SUCCESS) + break; + sc->read_dunits_remainder += (bytes / 512); + while (sc->read_dunits_remainder >= 1000) { + sc->read_data_units++; + sc->read_dunits_remainder -= 1000; + } + break; + default: + DPRINTF("%s: Invalid OPC 0x%02x for stats", __func__, opc); + break; + } + pthread_mutex_unlock(&sc->mtx); +} + static int pci_nvme_append_iov_req(struct pci_nvme_softc *sc, struct pci_nvme_ioreq *req, uint64_t gpaddr, size_t size, int do_write, uint64_t lba) @@ -1605,6 +1669,8 @@ pci_nvme_io_done(struct blockif_req *br, int err) pci_nvme_status_genc(&status, code); pci_nvme_set_completion(req->sc, sq, req->sqid, req->cid, 0, status); + pci_nvme_stats_write_read_update(req->sc, req->opc, + req->bytes, status); pci_nvme_release_ioreq(req->sc, req); } @@ -1779,6 +1845,7 @@ nvme_opc_write_read(struct pci_nvme_softc *sc, goto out; } + req->bytes = bytes; req->io_req.br_offset = lba; /* PRP bits 1:0 must be zero */ @@ -1796,6 +1863,9 @@ nvme_opc_write_read(struct pci_nvme_softc *sc, pending = true; } out: + if (!pending) + pci_nvme_stats_write_read_update(sc, cmd->opc, bytes, *status); + return (pending); } From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 B0F2535964C; Mon, 29 Jun 2020 00:32:43 +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 49w7k13PD5z43dh; Mon, 29 Jun 2020 00:32:40 +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 B62E41EDB1; Mon, 29 Jun 2020 00:32:05 +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 05T0W5IH049919; Mon, 29 Jun 2020 00:32:05 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0W5tR049918; Mon, 29 Jun 2020 00:32:05 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0W5tR049918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362760 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362760 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:44 -0000 Author: chuck Date: Mon Jun 29 00:32:04 2020 New Revision: 362760 URL: https://svnweb.freebsd.org/changeset/base/362760 Log: bhyve: validate the NVMe LBA start and count Add checks that the combination of Starting LBA and Number of Logical Blocks in a command will not exceed the range of the underlying storage. Note that because NVMe specifices the Starting LBA as a uint64_t, care must be taken when converting it and the block count to avoid an integer overflow. Fixes UNH Tests 2.2.3, 2.3.2, and 2.4.2 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24895 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:01 2020 (r362759) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:04 2020 (r362760) @@ -1529,6 +1529,34 @@ pci_nvme_stats_write_read_update(struct pci_nvme_softc pthread_mutex_unlock(&sc->mtx); } +/* + * Check if the combination of Starting LBA (slba) and Number of Logical + * Blocks (nlb) exceeds the range of the underlying storage. + * + * Because NVMe specifies the SLBA in blocks as a uint64_t and blockif stores + * the capacity in bytes as a uint64_t, care must be taken to avoid integer + * overflow. + */ +static bool +pci_nvme_out_of_range(struct pci_nvme_blockstore *nvstore, uint64_t slba, + uint32_t nlb) +{ + size_t offset, bytes; + + /* Overflow check of multiplying Starting LBA by the sector size */ + if (slba >> (64 - nvstore->sectsz_bits)) + return (true); + + offset = slba << nvstore->sectsz_bits; + bytes = nlb << nvstore->sectsz_bits; + + /* Overflow check of Number of Logical Blocks */ + if ((nvstore->size - offset) < bytes) + return (true); + + return (false); +} + static int pci_nvme_append_iov_req(struct pci_nvme_softc *sc, struct pci_nvme_ioreq *req, uint64_t gpaddr, size_t size, int do_write, uint64_t lba) @@ -1830,20 +1858,20 @@ nvme_opc_write_read(struct pci_nvme_softc *sc, lba = ((uint64_t)cmd->cdw11 << 32) | cmd->cdw10; nblocks = (cmd->cdw12 & 0xFFFF) + 1; + if (pci_nvme_out_of_range(nvstore, lba, nblocks)) { + WPRINTF("%s command would exceed LBA range", __func__); + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } - bytes = nblocks * nvstore->sectsz; + bytes = nblocks << nvstore->sectsz_bits; if (bytes > NVME_MAX_DATA_SIZE) { WPRINTF("%s command would exceed MDTS", __func__); pci_nvme_status_genc(status, NVME_SC_INVALID_FIELD); goto out; } - offset = lba * nvstore->sectsz; - if ((offset + bytes) > nvstore->size) { - WPRINTF("%s command would exceed LBA range", __func__); - pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); - goto out; - } + offset = lba << nvstore->sectsz_bits; req->bytes = bytes; req->io_req.br_offset = lba; @@ -1921,8 +1949,9 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, if (cmd->cdw11 & NVME_DSM_ATTR_DEALLOCATE) { struct nvme_dsm_range *range; + size_t offset, bytes; uint32_t nr, r; - int sectsz = sc->nvstore.sectsz; + int sectsz_bits = sc->nvstore.sectsz_bits; /* * DSM calls are advisory only, and compliant controllers @@ -1947,10 +1976,13 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); - if ((range[0].starting_lba * sectsz) > nvstore->size) { + if (pci_nvme_out_of_range(nvstore, range[0].starting_lba, + range[0].length)) { pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); goto out; } + offset = range[0].starting_lba << sectsz_bits; + bytes = range[0].length << sectsz_bits; /* * If the request is for more than a single range, store @@ -1962,8 +1994,8 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, nr = cmd->cdw10 & 0xff; req->io_req.br_iovcnt = 0; - req->io_req.br_offset = range[0].starting_lba * sectsz; - req->io_req.br_resid = range[0].length * sectsz; + req->io_req.br_offset = offset; + req->io_req.br_resid = bytes; if (nr == 0) { req->io_req.br_callback = pci_nvme_io_done; @@ -1971,12 +2003,19 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, struct iovec *iov = req->io_req.br_iov; for (r = 0; r <= nr; r++) { - if ((range[r].starting_lba * sectsz) > nvstore->size) { + if (pci_nvme_out_of_range(nvstore, range[r].starting_lba, + range[r].length)) { pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); goto out; } - iov[r].iov_base = (void *)(range[r].starting_lba * sectsz); - iov[r].iov_len = range[r].length * sectsz; + offset = range[r].starting_lba << sectsz_bits; + bytes = range[r].length << sectsz_bits; + if ((nvstore->size - offset) < bytes) { + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } + iov[r].iov_base = (void *)offset; + iov[r].iov_len = bytes; } req->io_req.br_callback = pci_nvme_dealloc_sm; From owner-svn-src-head@freebsd.org Mon Jun 29 00:32: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 EED07359812; Mon, 29 Jun 2020 00:32:50 +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 49w7kB00vXz43mn; Mon, 29 Jun 2020 00:32:49 +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 E74EA1EE13; Mon, 29 Jun 2020 00:32:08 +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 05T0W8UU049962; Mon, 29 Jun 2020 00:32:08 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0W8hJ049961; Mon, 29 Jun 2020 00:32:08 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0W8hJ049961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362761 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362761 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:32:51 -0000 Author: chuck Date: Mon Jun 29 00:32:08 2020 New Revision: 362761 URL: https://svnweb.freebsd.org/changeset/base/362761 Log: bhyve: Add AER support to NVMe emulation This adds support to bhyve's NVMe device emulation for processing Async Event Requests but not returning them (i.e. Async Event Notifications). Fixes UNH Test 5.5.2 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24896 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:04 2020 (r362760) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:08 2020 (r362761) @@ -251,6 +251,11 @@ struct nvme_feature_obj { #define NVME_FID_MAX (NVME_FEAT_ENDURANCE_GROUP_EVENT_CONFIGURATION + 1) +struct pci_nvme_aer { + STAILQ_ENTRY(pci_nvme_aer) link; + uint16_t cid; /* Command ID of the submitted AER */ +}; + struct pci_nvme_softc { struct pci_devinst *nsc_pi; @@ -296,6 +301,9 @@ struct pci_nvme_softc { __uint128_t write_commands; uint32_t read_dunits_remainder; uint32_t write_dunits_remainder; + + STAILQ_HEAD(, pci_nvme_aer) aer_list; + uint32_t aer_count; }; @@ -604,6 +612,93 @@ pci_nvme_init_features(struct pci_nvme_softc *sc) } static void +pci_nvme_aer_init(struct pci_nvme_softc *sc) +{ + + STAILQ_INIT(&sc->aer_list); + sc->aer_count = 0; +} + +static void +pci_nvme_aer_destroy(struct pci_nvme_softc *sc) +{ + struct pci_nvme_aer *aer = NULL; + + while (!STAILQ_EMPTY(&sc->aer_list)) { + aer = STAILQ_FIRST(&sc->aer_list); + STAILQ_REMOVE_HEAD(&sc->aer_list, link); + free(aer); + } + + pci_nvme_aer_init(sc); +} + +static bool +pci_nvme_aer_available(struct pci_nvme_softc *sc) +{ + + return (!STAILQ_EMPTY(&sc->aer_list)); +} + +static bool +pci_nvme_aer_limit_reached(struct pci_nvme_softc *sc) +{ + struct nvme_controller_data *cd = &sc->ctrldata; + + /* AERL is a zero based value while aer_count is one's based */ + return (sc->aer_count == (cd->aerl + 1)); +} + +/* + * Add an Async Event Request + * + * Stores an AER to be returned later if the Controller needs to notify the + * host of an event. + * Note that while the NVMe spec doesn't require Controllers to return AER's + * in order, this implementation does preserve the order. + */ +static int +pci_nvme_aer_add(struct pci_nvme_softc *sc, uint16_t cid) +{ + struct pci_nvme_aer *aer = NULL; + + if (pci_nvme_aer_limit_reached(sc)) + return (-1); + + aer = calloc(1, sizeof(struct pci_nvme_aer)); + if (aer == NULL) + return (-1); + + sc->aer_count++; + + /* Save the Command ID for use in the completion message */ + aer->cid = cid; + STAILQ_INSERT_TAIL(&sc->aer_list, aer, link); + + return (0); +} + +/* + * Get an Async Event Request structure + * + * Returns a pointer to an AER previously submitted by the host or NULL if + * no AER's exist. Caller is responsible for freeing the returned struct. + */ +static struct pci_nvme_aer * +pci_nvme_aer_get(struct pci_nvme_softc *sc) +{ + struct pci_nvme_aer *aer = NULL; + + aer = STAILQ_FIRST(&sc->aer_list); + if (aer != NULL) { + STAILQ_REMOVE_HEAD(&sc->aer_list, link); + sc->aer_count--; + } + + return (aer); +} + +static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { uint32_t i; @@ -641,6 +736,8 @@ pci_nvme_reset_locked(struct pci_nvme_softc *sc) } sc->num_q_is_set = false; + + pci_nvme_aer_destroy(sc); } static void @@ -1376,13 +1473,26 @@ nvme_opc_async_event_req(struct pci_nvme_softc* sc, { DPRINTF("%s async event request 0x%x", __func__, command->cdw11); + /* Don't exceed the Async Event Request Limit (AERL). */ + if (pci_nvme_aer_limit_reached(sc)) { + pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_ASYNC_EVENT_REQUEST_LIMIT_EXCEEDED); + return (1); + } + + if (pci_nvme_aer_add(sc, command->cid)) { + pci_nvme_status_tc(&compl->status, NVME_SCT_GENERIC, + NVME_SC_INTERNAL_DEVICE_ERROR); + return (1); + } + /* - * TODO: raise events when they happen based on the Set Features cmd. + * Raise events when they happen based on the Set Features cmd. * These events happen async, so only set completion successful if * there is an event reflective of the request to get event. */ - pci_nvme_status_tc(&compl->status, NVME_SCT_COMMAND_SPECIFIC, - NVME_SC_ASYNC_EVENT_REQUEST_LIMIT_EXCEEDED); + compl->status = NVME_NO_STATUS; + return (0); } @@ -1449,10 +1559,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u break; case NVME_OPC_ASYNC_EVENT_REQUEST: DPRINTF("%s command ASYNC_EVENT_REQ", __func__); - /* XXX dont care, unhandled for now nvme_opc_async_event_req(sc, cmd, &compl); - */ - compl.status = NVME_NO_STATUS; break; case NVME_OPC_FORMAT_NVM: DPRINTF("%s command FORMAT_NVM", __func__); @@ -2619,6 +2726,8 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pci_nvme_init_ctrldata(sc); pci_nvme_init_logpages(sc); pci_nvme_init_features(sc); + + pci_nvme_aer_init(sc); pci_nvme_reset(sc); From owner-svn-src-head@freebsd.org Mon Jun 29 00:33: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 EAFBD359664; Mon, 29 Jun 2020 00:33:00 +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 49w7kL1sTRz43y6; Mon, 29 Jun 2020 00:32:57 +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 34DE21EE84; Mon, 29 Jun 2020 00:32:12 +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 05T0WCiE050008; Mon, 29 Jun 2020 00:32:12 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0WCNE050007; Mon, 29 Jun 2020 00:32:12 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0WCNE050007@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362762 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362762 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:33:01 -0000 Author: chuck Date: Mon Jun 29 00:32:11 2020 New Revision: 362762 URL: https://svnweb.freebsd.org/changeset/base/362762 Log: bhyve: add basic NVMe Firmware Commit support This commit updates the Identify Controller data to advertise the Controller supports a single firmware slot and that firmware slot 1 is read-only. Additionally, it returns an "Invalid Firmware Slot" error when the host issues any Firmware Commit command (a.k.a. Firmware Activate). Fixes UNH Test 5.5.3 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24897 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:08 2020 (r362761) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:11 2020 (r362762) @@ -468,6 +468,9 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) cd->acl = 2; cd->aerl = 4; + /* Advertise 1, Read-only firmware slot */ + cd->frmw = NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK | + (1 << NVME_CTRLR_DATA_FRMW_NUM_SLOTS_SHIFT); cd->lpa = 0; /* TODO: support some simple things like SMART */ cd->elpe = 0; /* max error log page entries */ cd->npss = 1; /* number of power states support */ @@ -1556,6 +1559,12 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u case NVME_OPC_GET_FEATURES: DPRINTF("%s command GET_FEATURES", __func__); nvme_opc_get_features(sc, cmd, &compl); + break; + case NVME_OPC_FIRMWARE_ACTIVATE: + DPRINTF("%s command FIRMWARE_ACTIVATE", __func__); + pci_nvme_status_tc(&compl.status, + NVME_SCT_COMMAND_SPECIFIC, + NVME_SC_INVALID_FIRMWARE_SLOT); break; case NVME_OPC_ASYNC_EVENT_REQUEST: DPRINTF("%s command ASYNC_EVENT_REQ", __func__); From owner-svn-src-head@freebsd.org Mon Jun 29 00:33: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 13A6E35981F; Mon, 29 Jun 2020 00:33:11 +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 49w7kX1XQBz43rM; Mon, 29 Jun 2020 00:33:08 +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 E3D241EF04; Mon, 29 Jun 2020 00:32:18 +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 05T0WI9N050097; Mon, 29 Jun 2020 00:32:18 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0WIXT050096; Mon, 29 Jun 2020 00:32:18 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0WIXT050096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362764 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362764 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:33:11 -0000 Author: chuck Date: Mon Jun 29 00:32:18 2020 New Revision: 362764 URL: https://svnweb.freebsd.org/changeset/base/362764 Log: bhyve: fix NVMe Get Features, Predictable Latency If the Predictable Latency Mode is not supported, NVMe Controllers must return Invalid Field in Command status for the Get Features command with IDs: - Predictable Latency Mode Config - Predictable Latency Mode Window Fixes UNH Tests 3.6 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24899 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:15 2020 (r362763) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:18 2020 (r362764) @@ -618,6 +618,10 @@ pci_nvme_init_features(struct pci_nvme_softc *sc) sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues; sc->feat[NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION].set = nvme_feature_iv_config; + sc->feat[NVME_FEAT_PREDICTABLE_LATENCY_MODE_CONFIG].get = + nvme_feature_invalid_cb; + sc->feat[NVME_FEAT_PREDICTABLE_LATENCY_MODE_WINDOW].get = + nvme_feature_invalid_cb; } static void From owner-svn-src-head@freebsd.org Mon Jun 29 00:33: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 034BD359768; Mon, 29 Jun 2020 00:33:10 +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 49w7kX5Kjlz43x0; Mon, 29 Jun 2020 00:33:08 +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 5D19E1EE8E; Mon, 29 Jun 2020 00:32:22 +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 05T0WM2C050143; Mon, 29 Jun 2020 00:32:22 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0WM6R050142; Mon, 29 Jun 2020 00:32:22 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0WM6R050142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362765 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362765 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:33:11 -0000 Author: chuck Date: Mon Jun 29 00:32:21 2020 New Revision: 362765 URL: https://svnweb.freebsd.org/changeset/base/362765 Log: bhyve: NVMe handle zero length DSM ranges Dataset Management range specifications may have a zero length (a.k.a. an empty range definition). Handle the case of all ranges being empty by completing with Success (DSM commands are advisory only). For Deallocate, skip empty range definitions when sending TRIM's to the backing storage. Fixes UNH Test 2.2.4 Reviewed by: imp Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24900 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:18 2020 (r362764) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:21 2020 (r362765) @@ -2098,6 +2098,8 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, struct pci_nvme_ioreq *req, uint16_t *status) { + struct nvme_dsm_range *range; + uint32_t nr, r, non_zero, dr; int err; bool pending = false; @@ -2106,10 +2108,31 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, goto out; } + nr = cmd->cdw10 & 0xff; + + /* copy locally because a range entry could straddle PRPs */ + range = calloc(1, NVME_MAX_DSM_TRIM); + if (range == NULL) { + pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); + goto out; + } + nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, + (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); + + /* Check for invalid ranges and the number of non-zero lengths */ + non_zero = 0; + for (r = 0; r <= nr; r++) { + if (pci_nvme_out_of_range(nvstore, + range[r].starting_lba, range[r].length)) { + pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + goto out; + } + if (range[r].length != 0) + non_zero++; + } + if (cmd->cdw11 & NVME_DSM_ATTR_DEALLOCATE) { - struct nvme_dsm_range *range; size_t offset, bytes; - uint32_t nr, r; int sectsz_bits = sc->nvstore.sectsz_bits; /* @@ -2121,25 +2144,17 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, goto out; } - if (req == NULL) { - pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); + /* If all ranges have a zero length, return Success */ + if (non_zero == 0) { + pci_nvme_status_genc(status, NVME_SC_SUCCESS); goto out; } - /* copy locally because a range entry could straddle PRPs */ - range = calloc(1, NVME_MAX_DSM_TRIM); - if (range == NULL) { + if (req == NULL) { pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); goto out; } - nvme_prp_memcpy(sc->nsc_pi->pi_vmctx, cmd->prp1, cmd->prp2, - (uint8_t *)range, NVME_MAX_DSM_TRIM, NVME_COPY_FROM_PRP); - if (pci_nvme_out_of_range(nvstore, range[0].starting_lba, - range[0].length)) { - pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); - goto out; - } offset = range[0].starting_lba << sectsz_bits; bytes = range[0].length << sectsz_bits; @@ -2150,8 +2165,6 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, * * Note that NVMe Number of Ranges is a zero based value */ - nr = cmd->cdw10 & 0xff; - req->io_req.br_iovcnt = 0; req->io_req.br_offset = offset; req->io_req.br_resid = bytes; @@ -2161,20 +2174,20 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, } else { struct iovec *iov = req->io_req.br_iov; - for (r = 0; r <= nr; r++) { - if (pci_nvme_out_of_range(nvstore, range[r].starting_lba, - range[r].length)) { - pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); - goto out; - } + for (r = 0, dr = 0; r <= nr; r++) { offset = range[r].starting_lba << sectsz_bits; bytes = range[r].length << sectsz_bits; + if (bytes == 0) + continue; + if ((nvstore->size - offset) < bytes) { - pci_nvme_status_genc(status, NVME_SC_LBA_OUT_OF_RANGE); + pci_nvme_status_genc(status, + NVME_SC_LBA_OUT_OF_RANGE); goto out; } - iov[r].iov_base = (void *)offset; - iov[r].iov_len = bytes; + iov[dr].iov_base = (void *)offset; + iov[dr].iov_len = bytes; + dr++; } req->io_req.br_callback = pci_nvme_dealloc_sm; @@ -2183,7 +2196,7 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, * prev_size to track the number of entries */ req->prev_gpaddr = 0; - req->prev_size = r; + req->prev_size = dr; } err = blockif_delete(nvstore->ctx, &req->io_req); @@ -2191,10 +2204,9 @@ nvme_opc_dataset_mgmt(struct pci_nvme_softc *sc, pci_nvme_status_genc(status, NVME_SC_INTERNAL_DEVICE_ERROR); else pending = true; - - free(range); } out: + free(range); return (pending); } From owner-svn-src-head@freebsd.org Mon Jun 29 00:33: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 4F7B3359767; Mon, 29 Jun 2020 00:33:10 +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 49w7kW3Rqcz446H; Mon, 29 Jun 2020 00:33:06 +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 B55D61EC7C; Mon, 29 Jun 2020 00:32:15 +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 05T0WFOo050054; Mon, 29 Jun 2020 00:32:15 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0WF6V050053; Mon, 29 Jun 2020 00:32:15 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0WF6V050053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362763 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362763 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:33:11 -0000 Author: chuck Date: Mon Jun 29 00:32:15 2020 New Revision: 362763 URL: https://svnweb.freebsd.org/changeset/base/362763 Log: bhyve: add NVMe Feature Interrupt Vector Config This adds support for NVMe Get Features, Interrupt Vector Config parameter error checking done by the UNH compliance tests. Fixes UNH Tests 1.6.8 and 5.5.6 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24898 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:11 2020 (r362762) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:15 2020 (r362763) @@ -356,6 +356,10 @@ static void nvme_feature_num_queues(struct pci_nvme_so struct nvme_feature_obj *, struct nvme_command *, struct nvme_completion *); +static void nvme_feature_iv_config(struct pci_nvme_softc *, + struct nvme_feature_obj *, + struct nvme_command *, + struct nvme_completion *); static __inline void cpywithpad(char *dst, size_t dst_size, const char *src, char pad) @@ -612,6 +616,8 @@ pci_nvme_init_features(struct pci_nvme_softc *sc) sc->feat[NVME_FEAT_LBA_RANGE_TYPE].namespace_specific = true; sc->feat[NVME_FEAT_ERROR_RECOVERY].namespace_specific = true; sc->feat[NVME_FEAT_NUMBER_OF_QUEUES].set = nvme_feature_num_queues; + sc->feat[NVME_FEAT_INTERRUPT_VECTOR_CONFIGURATION].set = + nvme_feature_iv_config; } static void @@ -1273,6 +1279,39 @@ nvme_feature_invalid_cb(struct pci_nvme_softc *sc, { pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); +} + +static void +nvme_feature_iv_config(struct pci_nvme_softc *sc, + struct nvme_feature_obj *feat, + struct nvme_command *command, + struct nvme_completion *compl) +{ + uint32_t i; + uint32_t cdw11 = command->cdw11; + uint16_t iv; + bool cd; + + pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); + + iv = cdw11 & 0xffff; + cd = cdw11 & (1 << 16); + + if (iv > (sc->max_queues + 1)) { + return; + } + + /* No Interrupt Coalescing (i.e. not Coalescing Disable) for Admin Q */ + if ((iv == 0) && !cd) + return; + + /* Requested Interrupt Vector must be used by a CQ */ + for (i = 0; i < sc->num_cqueues + 1; i++) { + if (sc->compl_queues[i].intr_vec == iv) { + pci_nvme_status_genc(&compl->status, NVME_SC_SUCCESS); + } + } + } static void From owner-svn-src-head@freebsd.org Mon Jun 29 00:33: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 825D6359998; Mon, 29 Jun 2020 00:33:19 +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 49w7kh6Mqgz44CG; Mon, 29 Jun 2020 00:33:16 +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 AE32F1EAD6; Mon, 29 Jun 2020 00:32:25 +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 05T0WP68050186; Mon, 29 Jun 2020 00:32:25 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0WPaf050185; Mon, 29 Jun 2020 00:32:25 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290032.05T0WPaf050185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:32:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362766 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362766 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:33:19 -0000 Author: chuck Date: Mon Jun 29 00:32:24 2020 New Revision: 362766 URL: https://svnweb.freebsd.org/changeset/base/362766 Log: bhyve: fix NVMe Active Namespace list The NVMe specification requires unused entries in the Identify, Active Namespace ID data to be zero. Fix is bzero the provided page, similar to what is done for the Namespace Descriptors list. Fixes UNH Tests 2.6 and 2.9 Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24901 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:21 2020 (r362765) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:32:24 2020 (r362766) @@ -1144,8 +1144,9 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nv case 0x02: /* list of 1024 active NSIDs > CDW1.NSID */ dest = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1, sizeof(uint32_t) * 1024); + /* All unused entries shall be zero */ + bzero(dest, sizeof(uint32_t) * 1024); ((uint32_t *)dest)[0] = 1; - ((uint32_t *)dest)[1] = 0; break; case 0x03: /* list of NSID structures in CDW1.NSID, 4096 bytes */ if (command->nsid != 1) { From owner-svn-src-head@freebsd.org Mon Jun 29 00:38: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 858F935A01E; Mon, 29 Jun 2020 00:38:39 +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 49w7rv2tTwz45tB; Mon, 29 Jun 2020 00:38:39 +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 8AEDF1EC3E; Mon, 29 Jun 2020 00:31:24 +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 05T0VOIF047066; Mon, 29 Jun 2020 00:31:24 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T0VOlI047065; Mon, 29 Jun 2020 00:31:24 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202006290031.05T0VOlI047065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Mon, 29 Jun 2020 00:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362748 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 362748 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 00:38:39 -0000 Author: chuck Date: Mon Jun 29 00:31:24 2020 New Revision: 362748 URL: https://svnweb.freebsd.org/changeset/base/362748 Log: bhyve: add locks around NVMe queue accesses The NVMe code attempted to ensure thread safety through a combination of using atomics and a "busy" flag. But this approach leads to unavoidable race conditions. Fix is to use per-queue mutex locks to ensure thread safety within the queue processing code. While in the neighborhood, move all the queue initialization code to a common function. Tested by: Jason Tubnor MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19841 Modified: head/usr.sbin/bhyve/pci_nvme.c Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:20 2020 (r362747) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Jun 29 00:31:24 2020 (r362748) @@ -153,21 +153,21 @@ enum nvme_copy_dir { struct nvme_completion_queue { struct nvme_completion *qbase; + pthread_mutex_t mtx; uint32_t size; uint16_t tail; /* nvme progress */ uint16_t head; /* guest progress */ uint16_t intr_vec; uint32_t intr_en; - pthread_mutex_t mtx; }; struct nvme_submission_queue { struct nvme_command *qbase; + pthread_mutex_t mtx; uint32_t size; uint16_t head; /* nvme progress */ uint16_t tail; /* guest progress */ uint16_t cqid; /* completion queue id */ - int busy; /* queue is being processed */ int qpriority; }; @@ -339,7 +339,63 @@ pci_nvme_toggle_phase(uint16_t *status, int prev) *status |= NVME_STATUS_P; } +/* + * Initialize the requested number or IO Submission and Completion Queues. + * Admin queues are allocated implicitly. + */ static void +pci_nvme_init_queues(struct pci_nvme_softc *sc, uint32_t nsq, uint32_t ncq) +{ + uint32_t i; + + /* + * Allocate and initialize the Submission Queues + */ + if (nsq > NVME_QUEUES) { + WPRINTF("%s: clamping number of SQ from %u to %u", + __func__, nsq, NVME_QUEUES); + nsq = NVME_QUEUES; + } + + sc->num_squeues = nsq; + + sc->submit_queues = calloc(sc->num_squeues + 1, + sizeof(struct nvme_submission_queue)); + if (sc->submit_queues == NULL) { + WPRINTF("%s: SQ allocation failed", __func__); + sc->num_squeues = 0; + } else { + struct nvme_submission_queue *sq = sc->submit_queues; + + for (i = 0; i < sc->num_squeues; i++) + pthread_mutex_init(&sq[i].mtx, NULL); + } + + /* + * Allocate and initialize the Completion Queues + */ + if (ncq > NVME_QUEUES) { + WPRINTF("%s: clamping number of CQ from %u to %u", + __func__, ncq, NVME_QUEUES); + ncq = NVME_QUEUES; + } + + sc->num_cqueues = ncq; + + sc->compl_queues = calloc(sc->num_cqueues + 1, + sizeof(struct nvme_completion_queue)); + if (sc->compl_queues == NULL) { + WPRINTF("%s: CQ allocation failed", __func__); + sc->num_cqueues = 0; + } else { + struct nvme_completion_queue *cq = sc->compl_queues; + + for (i = 0; i < sc->num_cqueues; i++) + pthread_mutex_init(&cq[i].mtx, NULL); + } +} + +static void pci_nvme_init_ctrldata(struct pci_nvme_softc *sc) { struct nvme_controller_data *cd = &sc->ctrldata; @@ -498,6 +554,8 @@ pci_nvme_init_logpages(struct pci_nvme_softc *sc) static void pci_nvme_reset_locked(struct pci_nvme_softc *sc) { + uint32_t i; + DPRINTF("%s", __func__); sc->regs.cap_lo = (ZERO_BASED(sc->max_qentries) & NVME_CAP_LO_REG_MQES_MASK) | @@ -511,44 +569,23 @@ pci_nvme_reset_locked(struct pci_nvme_softc *sc) sc->regs.cc = 0; sc->regs.csts = 0; - sc->num_cqueues = sc->num_squeues = sc->max_queues; - if (sc->submit_queues != NULL) { - for (int i = 0; i < sc->num_squeues + 1; i++) { - /* - * The Admin Submission Queue is at index 0. - * It must not be changed at reset otherwise the - * emulation will be out of sync with the guest. - */ - if (i != 0) { - sc->submit_queues[i].qbase = NULL; - sc->submit_queues[i].size = 0; - sc->submit_queues[i].cqid = 0; - } - sc->submit_queues[i].tail = 0; - sc->submit_queues[i].head = 0; - sc->submit_queues[i].busy = 0; - } - } else - sc->submit_queues = calloc(sc->num_squeues + 1, - sizeof(struct nvme_submission_queue)); + assert(sc->submit_queues != NULL); - if (sc->compl_queues != NULL) { - for (int i = 0; i < sc->num_cqueues + 1; i++) { - /* See Admin Submission Queue note above */ - if (i != 0) { - sc->compl_queues[i].qbase = NULL; - sc->compl_queues[i].size = 0; - } + for (i = 0; i < sc->num_squeues + 1; i++) { + sc->submit_queues[i].qbase = NULL; + sc->submit_queues[i].size = 0; + sc->submit_queues[i].cqid = 0; + sc->submit_queues[i].tail = 0; + sc->submit_queues[i].head = 0; + } - sc->compl_queues[i].tail = 0; - sc->compl_queues[i].head = 0; - } - } else { - sc->compl_queues = calloc(sc->num_cqueues + 1, - sizeof(struct nvme_completion_queue)); + assert(sc->compl_queues != NULL); - for (int i = 0; i < sc->num_cqueues + 1; i++) - pthread_mutex_init(&sc->compl_queues[i].mtx, NULL); + for (i = 0; i < sc->num_cqueues + 1; i++) { + sc->compl_queues[i].qbase = NULL; + sc->compl_queues[i].size = 0; + sc->compl_queues[i].tail = 0; + sc->compl_queues[i].head = 0; } } @@ -1092,14 +1129,9 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u sq = &sc->submit_queues[0]; cq = &sc->compl_queues[0]; - sqhead = atomic_load_acq_short(&sq->head); + pthread_mutex_lock(&sq->mtx); - if (atomic_testandset_int(&sq->busy, 1)) { - DPRINTF("%s SQ busy, head %u, tail %u", - __func__, sqhead, sq->tail); - return; - } - + sqhead = sq->head; DPRINTF("sqhead %u, tail %u", sqhead, sq->tail); while (sqhead != atomic_load_acq_short(&sq->tail)) { @@ -1162,6 +1194,8 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u struct nvme_completion *cp; int phase; + pthread_mutex_lock(&cq->mtx); + cp = &(cq->qbase)[cq->tail]; cp->cdw0 = compl.cdw0; cp->sqid = 0; @@ -1173,16 +1207,18 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u pci_nvme_toggle_phase(&cp->status, phase); cq->tail = (cq->tail + 1) % cq->size; + + pthread_mutex_unlock(&cq->mtx); } } DPRINTF("setting sqhead %u", sqhead); - atomic_store_short(&sq->head, sqhead); - atomic_store_int(&sq->busy, 0); + sq->head = sqhead; if (cq->head != cq->tail) pci_generate_msix(sc->nsc_pi, 0); + pthread_mutex_unlock(&sq->mtx); } static int @@ -1272,7 +1308,7 @@ pci_nvme_append_iov_req(struct pci_nvme_softc *sc, str static void pci_nvme_set_completion(struct pci_nvme_softc *sc, struct nvme_submission_queue *sq, int sqid, uint16_t cid, - uint32_t cdw0, uint16_t status, int ignore_busy) + uint32_t cdw0, uint16_t status) { struct nvme_completion_queue *cq = &sc->compl_queues[sq->cqid]; struct nvme_completion *compl; @@ -1290,7 +1326,7 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc, compl->cdw0 = cdw0; compl->sqid = sqid; - compl->sqhd = atomic_load_acq_short(&sq->head); + compl->sqhd = sq->head; compl->cid = cid; // toggle phase @@ -1375,7 +1411,7 @@ pci_nvme_io_done(struct blockif_req *br, int err) code = err ? NVME_SC_DATA_TRANSFER_ERROR : NVME_SC_SUCCESS; pci_nvme_status_genc(&status, code); - pci_nvme_set_completion(req->sc, sq, req->sqid, req->cid, 0, status, 0); + pci_nvme_set_completion(req->sc, sq, req->sqid, req->cid, 0, status); pci_nvme_release_ioreq(req->sc, req); } @@ -1575,7 +1611,7 @@ pci_nvme_dealloc_sm(struct blockif_req *br, int err) if (done) { pci_nvme_set_completion(sc, req->nvme_sq, req->sqid, - req->cid, 0, status, 0); + req->cid, 0, status); pci_nvme_release_ioreq(sc, req); } } @@ -1677,13 +1713,9 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint /* handle all submissions up to sq->tail index */ sq = &sc->submit_queues[idx]; - if (atomic_testandset_int(&sq->busy, 1)) { - DPRINTF("%s sqid %u busy", __func__, idx); - return; - } + pthread_mutex_lock(&sq->mtx); - sqhead = atomic_load_acq_short(&sq->head); - + sqhead = sq->head; DPRINTF("nvme_handle_io qid %u head %u tail %u cmdlist %p", idx, sqhead, sq->tail, sq->qbase); @@ -1750,14 +1782,15 @@ pci_nvme_handle_io_cmd(struct pci_nvme_softc* sc, uint complete: if (!pending) { pci_nvme_set_completion(sc, sq, idx, cmd->cid, 0, - status, 1); + status); if (req != NULL) pci_nvme_release_ioreq(sc, req); } } - atomic_store_short(&sq->head, sqhead); - atomic_store_int(&sq->busy, 0); + sq->head = sqhead; + + pthread_mutex_unlock(&sq->mtx); } static void @@ -1768,6 +1801,13 @@ pci_nvme_handle_doorbell(struct vmctx *ctx, struct pci idx, is_sq ? "SQ" : "CQ", value & 0xFFFF); if (is_sq) { + if (idx > sc->num_squeues) { + WPRINTF("%s queue index %lu overflow from " + "guest (max %u)", + __func__, idx, sc->num_squeues); + return; + } + atomic_store_short(&sc->submit_queues[idx].tail, (uint16_t)value); @@ -1791,7 +1831,8 @@ pci_nvme_handle_doorbell(struct vmctx *ctx, struct pci return; } - sc->compl_queues[idx].head = (uint16_t)value; + atomic_store_short(&sc->compl_queues[idx].head, + (uint16_t)value); } } @@ -2236,7 +2277,7 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pthread_mutex_init(&sc->mtx, NULL); sem_init(&sc->iosemlock, 0, sc->ioslots); - pci_nvme_reset(sc); + pci_nvme_init_queues(sc, sc->max_queues, sc->max_queues); /* * Controller data depends on Namespace data so initialize Namespace * data first. @@ -2244,6 +2285,8 @@ pci_nvme_init(struct vmctx *ctx, struct pci_devinst *p pci_nvme_init_nsdata(sc, &sc->nsdata, 1, &sc->nvstore); pci_nvme_init_ctrldata(sc); pci_nvme_init_logpages(sc); + + pci_nvme_reset(sc); pci_lintr_request(pi); From owner-svn-src-head@freebsd.org Mon Jun 29 00: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 E69D935A19D; Mon, 29 Jun 2020 00:41:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (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 49w7vq6rjpz46DW; Mon, 29 Jun 2020 00:41:11 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f51.google.com with SMTP id t18so1141541otq.5; Sun, 28 Jun 2020 17:41:11 -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:from:date :message-id:subject:to:cc; bh=RWYOuXaw1MtkZ6zi7huXSZgLxL4j4COiCmO4BkFbcCE=; b=CRm6druXcU0axa5OHFPOxW6tyxSwlhif9zlQhL3ytphvQsOt+pxFQEe4mjC2lxBh67 lOC+V+oMsE+tZ7sAWciS+pEHExmA7u+PC1gmtgWTE6lUxs1lHvbdpp5hYye0zlJKk+ux ZMNkr6TzY27vrQHHpecdkiBMlGJZTJnfrL+qUlMqWPhoxZHjwuKskKuCdmbG153x867X VQbKkLRasppi4RnnT7SCMRwRAv9nQcfQ/ZRXnSiqpo/rgNxr+PrX0sGmSHasbFoQ6why 6nNm0DRe95lCTlglVgPH6CBivJFypDUREZvTgTmrGquW075rd8GJRQQKLSQ0Esf3rFyQ 4DBA== X-Gm-Message-State: AOAM532ToJk4a2U4kEPnXRfu7buu7fNfXVPfdbDZPs0L/j8ZEiLS897U Ko26N6H2ym4M+ISxx1Qa35cV8h4mINvFbrgDl4sVFw== X-Google-Smtp-Source: ABdhPJwYeXRJqqjnVMg1Y4eXIYoa/G52mYjpBxSczJDfBVmkY+h88n4cB1CWJ8cr8kX6jjKnVAwxEXw32MQitvSlnZs= X-Received: by 2002:a9d:523:: with SMTP id 32mr11131971otw.291.1593391270570; Sun, 28 Jun 2020 17:41:10 -0700 (PDT) MIME-Version: 1.0 References: <201901021709.x02H9ZPM004185@repo.freebsd.org> In-Reply-To: <201901021709.x02H9ZPM004185@repo.freebsd.org> From: Alan Somers Date: Sun, 28 Jun 2020 18:40:59 -0600 Message-ID: Subject: Re: svn commit: r342699 - head/sbin/savecore To: Mark Johnston Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 49w7vq6rjpz46DW X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.210.51 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-1.13 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.65)[-0.652]; 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]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-0.40)[-0.401]; RWL_MAILSPIKE_GOOD(0.00)[209.85.210.51:from]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.08)[-0.078]; RCVD_IN_DNSWL_NONE(0.00)[209.85.210.51:from]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] 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: Mon, 29 Jun 2020 00:41:13 -0000 On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: > Author: markj > Date: Wed Jan 2 17:09:35 2019 > New Revision: 342699 > URL: https://svnweb.freebsd.org/changeset/base/342699 > > Log: > Capsicumize savecore(8). > > - Use cap_fileargs(3) to open dump devices after entering capability > mode, and use cap_syslog(3) to log messages. > - Use a relative directory fd to open output files. > - Use zdopen(3) to compress kernel dumps in capability mode. > > Reviewed by: cem, oshogbo > MFC after: 2 months > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D18458 > > Modified: > head/sbin/savecore/Makefile > head/sbin/savecore/savecore.c > > Modified: head/sbin/savecore/savecore.c > > ============================================================================== > --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 > (r342698) > +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 > (r342699) > > +static char ** > +enum_dumpdevs(int *argcp) > +{ > + struct fstab *fsp; > + char **argv; > + int argc, n; > + > + /* > + * We cannot use getfsent(3) in capability mode, so we must > + * scan /etc/fstab and build up a list of candidate devices > + * before proceeding. > + */ > + argc = 0; > + n = 8; > + argv = malloc(n * sizeof(*argv)); > It looks like the memory allocated here > + if (argv == NULL) { > + logmsg(LOG_ERR, "malloc(): %m"); > + exit(1); > + } > + for (;;) { > + fsp = getfsent(); > + if (fsp == NULL) > + break; > + if (strcmp(fsp->fs_vfstype, "swap") != 0 && > + strcmp(fsp->fs_vfstype, "dump") != 0) > + continue; > + if (argc >= n) { > + n *= 2; > + argv = realloc(argv, n * sizeof(*argv)); > and here > + if (argv == NULL) { > + logmsg(LOG_ERR, "realloc(): %m"); > + exit(1); > + } > + } > + argv[argc] = strdup(fsp->fs_spec); > and here is leaked. I can't find any corresponding free. However, neither Valgrind nor Coverity complains. What am I missing? Does this memory sneakily get freed by a subroutine somewhere, or does Capsicum confuse our tools? -Alan From owner-svn-src-head@freebsd.org Mon Jun 29 00:46: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 8F99835A069 for ; Mon, 29 Jun 2020 00:46:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (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 49w82F1LJ3z46RD for ; Mon, 29 Jun 2020 00:46:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x742.google.com with SMTP id z63so13866521qkb.8 for ; Sun, 28 Jun 2020 17:46:45 -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=KH559yMG2AHTIPUMqqE8C/XkufDXw/E/lEG+GhV6a7k=; b=EYdETdSJUEiaDifuqdrfhs+v8cBB6MfIergt0t1G5MhEjbQTnQd0IlZ4hhhCKxv/mq 8KjIGHLn76LwjwwEM0LIoLhy+mDlImt6T1oE4GPYzW3x68hFfzr1rOuWIChTOv4lCoNz osdpgXFgKG4+g6Wzo+iB0gN/U+PiPy3N/Xid5h8odLZnRoI8zhxkd6F6zoBE0XRx15fY rVgue8AfWP5L5ldoHuolhV2uACvuDOPTP/5/P0B4+pylYuVNSSy6W/7BKT0ycn+4gjEC Q8zABCBUmPvzpjhKWrH6YPFa4lfkWA+F1kW2AruI3ffS19ixdFt4RuKFuvBh7VG2smyb AOnQ== 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=KH559yMG2AHTIPUMqqE8C/XkufDXw/E/lEG+GhV6a7k=; b=ic0K0igikCpMTNCHGWnXZfguzrzlj1zduhGs+7zqEuGmXlCVUWU8d38Aavwk6eazmb LBG9qG8tFm/zMZ6DiKwYrZN9Im/LQZ89q0C92OVBrBx2OXJVMnn6EjKd1jIqRWY+r0RY 8MNa+mbma7TfQjgx9b2zPBuCUNWQZEioCm5oMv1AHEDuBAM1V9XSgB1DJR/K10hYsdco GkEMDkcC/ZyxF/vQdyz5UNM1nglgHjgAxr4QKZQRdSKI+wvrn5WhW+80XUKhyv8itGR9 bwYd5X6UwSUaP5O4TDquNDPE3PE4BuzFlNtzrKbbq/CoGH9ET2werJ+s96vGeFCLZfZJ n+Lg== X-Gm-Message-State: AOAM530MqD2Y1YYu8nzDSz4pZnkEWBffl80oXLVn5iZXdMnQp4wgFkCO o7nE7yRxsI+Lwf/t/l2w0EtSpLpdMD90HaYx0NKU3Q== X-Google-Smtp-Source: ABdhPJxbxiWkd6hd/U6RFVad+DYMln81EQWwXDdscZCRNkYCZiyZbKgKJ0XbW03iPBDJk9BXiVcCtCAQpMOZbGGBCnY= X-Received: by 2002:a37:67c8:: with SMTP id b191mr13052990qkc.60.1593391604307; Sun, 28 Jun 2020 17:46:44 -0700 (PDT) MIME-Version: 1.0 References: <201901021709.x02H9ZPM004185@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Sun, 28 Jun 2020 18:46:32 -0600 Message-ID: Subject: Re: svn commit: r342699 - head/sbin/savecore To: Alan Somers Cc: Mark Johnston , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 49w82F1LJ3z46RD X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=EYdETdSJ; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::742) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.64 / 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.85)[-0.853]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.09)[0.094]; NEURAL_HAM_LONG(-0.88)[-0.885]; 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::742: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: Mon, 29 Jun 2020 00:46:46 -0000 On Sun, Jun 28, 2020, 6:41 PM Alan Somers wrote: > On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: > >> Author: markj >> Date: Wed Jan 2 17:09:35 2019 >> New Revision: 342699 >> URL: https://svnweb.freebsd.org/changeset/base/342699 >> >> Log: >> Capsicumize savecore(8). >> >> - Use cap_fileargs(3) to open dump devices after entering capability >> mode, and use cap_syslog(3) to log messages. >> - Use a relative directory fd to open output files. >> - Use zdopen(3) to compress kernel dumps in capability mode. >> >> Reviewed by: cem, oshogbo >> MFC after: 2 months >> Sponsored by: The FreeBSD Foundation >> Differential Revision: https://reviews.freebsd.org/D18458 >> >> Modified: >> head/sbin/savecore/Makefile >> head/sbin/savecore/savecore.c >> >> Modified: head/sbin/savecore/savecore.c >> >> ============================================================================== >> --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 >> (r342698) >> +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 >> (r342699) >> >> +static char ** >> +enum_dumpdevs(int *argcp) >> +{ >> + struct fstab *fsp; >> + char **argv; >> + int argc, n; >> + >> + /* >> + * We cannot use getfsent(3) in capability mode, so we must >> + * scan /etc/fstab and build up a list of candidate devices >> + * before proceeding. >> + */ >> + argc = 0; >> + n = 8; >> + argv = malloc(n * sizeof(*argv)); >> > > It looks like the memory allocated here > > >> + if (argv == NULL) { >> + logmsg(LOG_ERR, "malloc(): %m"); >> + exit(1); >> + } >> + for (;;) { >> + fsp = getfsent(); >> + if (fsp == NULL) >> + break; >> + if (strcmp(fsp->fs_vfstype, "swap") != 0 && >> + strcmp(fsp->fs_vfstype, "dump") != 0) >> + continue; >> + if (argc >= n) { >> + n *= 2; >> + argv = realloc(argv, n * sizeof(*argv)); >> > > and here > > >> + if (argv == NULL) { >> + logmsg(LOG_ERR, "realloc(): %m"); >> + exit(1); >> + } >> + } >> + argv[argc] = strdup(fsp->fs_spec); >> > > and here is leaked. I can't find any corresponding free. However, > neither Valgrind nor Coverity complains. What am I missing? Does this > memory sneakily get freed by a subroutine somewhere, or does Capsicum > confuse our tools? > So the other spots adjusted large, but this one sets one of its elements. Help me understand how that is a leak? I'm sure I'm just confused. Warner > From owner-svn-src-head@freebsd.org Mon Jun 29 00:49: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 6CC0335A513; Mon, 29 Jun 2020 00:49:50 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (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 49w85n2FyYz46sg; Mon, 29 Jun 2020 00:49:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f169.google.com with SMTP id k4so13069238oik.2; Sun, 28 Jun 2020 17:49:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1se5j/jegIz2sk9NM7GqTWB4Ppod3w2V1YbECNIbHFQ=; b=UNf3XwUOB6otK3fIBZqVNG26eZYmpHvGMQOR5yEPmOIDC+wXP6heVTfcDabIdlTwyC vlGwO+y4QVnTYUKWlPc8miONBPzXnH3zjzsgHKbZlIjD5duo/QVdM9Ne6oK9ktkqIXB9 gyBXtJpMOEX5sU6uvP7NFHUpkxmixzi7xyzxXHKOx4w+bCxMngRpOvu8XPJHQBdQb5WI NN56r/n5534YwjdNBj2bsWaTA2b0OfrKXRTKDljDH5aYtPVs2CyXoo5utzOxEh/lBZ6t iHQmBbFEPaIoL1mIn3byF1AyDR+6ViOA7NDrhCKnlTaZI6XkOD7bAGMbTOLYNhwcV6Fu 9nnA== X-Gm-Message-State: AOAM532svIEEsR0AjjWFgZU8pJ0ReUcqDU8AyJzH7QkozwB3TEDgnPj4 gyW6ow89dYvGU7ErTUWZZaD4kAZtZZSgd5Q4U5ABmw== X-Google-Smtp-Source: ABdhPJw4cAKLUZQZwqvvfA45Wb3bOUE+9hU3uqOFZD4mZebojN/m9J0MPIdr4P+sPFfEr/NOdSXMdZjaml2YqbxkrVo= X-Received: by 2002:aca:c391:: with SMTP id t139mr1921570oif.57.1593391787494; Sun, 28 Jun 2020 17:49:47 -0700 (PDT) MIME-Version: 1.0 References: <201901021709.x02H9ZPM004185@repo.freebsd.org> In-Reply-To: From: Alan Somers Date: Sun, 28 Jun 2020 18:49:36 -0600 Message-ID: Subject: Re: svn commit: r342699 - head/sbin/savecore To: Warner Losh Cc: Mark Johnston , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 49w85n2FyYz46sg X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.169 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-1.57 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; NEURAL_HAM_MEDIUM(-0.81)[-0.809]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-0.70)[-0.698]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.06)[-0.059]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.169:from]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.169:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; RCVD_TLS_ALL(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] 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: Mon, 29 Jun 2020 00:49:50 -0000 On Sun, Jun 28, 2020 at 6:46 PM Warner Losh wrote: > > > On Sun, Jun 28, 2020, 6:41 PM Alan Somers wrote: > >> On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: >> >>> Author: markj >>> Date: Wed Jan 2 17:09:35 2019 >>> New Revision: 342699 >>> URL: https://svnweb.freebsd.org/changeset/base/342699 >>> >>> Log: >>> Capsicumize savecore(8). >>> >>> - Use cap_fileargs(3) to open dump devices after entering capability >>> mode, and use cap_syslog(3) to log messages. >>> - Use a relative directory fd to open output files. >>> - Use zdopen(3) to compress kernel dumps in capability mode. >>> >>> Reviewed by: cem, oshogbo >>> MFC after: 2 months >>> Sponsored by: The FreeBSD Foundation >>> Differential Revision: https://reviews.freebsd.org/D18458 >>> >>> Modified: >>> head/sbin/savecore/Makefile >>> head/sbin/savecore/savecore.c >>> >>> Modified: head/sbin/savecore/savecore.c >>> >>> ============================================================================== >>> --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 >>> (r342698) >>> +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 >>> (r342699) >>> >>> +static char ** >>> +enum_dumpdevs(int *argcp) >>> +{ >>> + struct fstab *fsp; >>> + char **argv; >>> + int argc, n; >>> + >>> + /* >>> + * We cannot use getfsent(3) in capability mode, so we must >>> + * scan /etc/fstab and build up a list of candidate devices >>> + * before proceeding. >>> + */ >>> + argc = 0; >>> + n = 8; >>> + argv = malloc(n * sizeof(*argv)); >>> >> >> It looks like the memory allocated here >> >> >>> + if (argv == NULL) { >>> + logmsg(LOG_ERR, "malloc(): %m"); >>> + exit(1); >>> + } >>> + for (;;) { >>> + fsp = getfsent(); >>> + if (fsp == NULL) >>> + break; >>> + if (strcmp(fsp->fs_vfstype, "swap") != 0 && >>> + strcmp(fsp->fs_vfstype, "dump") != 0) >>> + continue; >>> + if (argc >= n) { >>> + n *= 2; >>> + argv = realloc(argv, n * sizeof(*argv)); >>> >> >> and here >> >> >>> + if (argv == NULL) { >>> + logmsg(LOG_ERR, "realloc(): %m"); >>> + exit(1); >>> + } >>> + } >>> + argv[argc] = strdup(fsp->fs_spec); >>> >> >> and here is leaked. I can't find any corresponding free. However, >> neither Valgrind nor Coverity complains. What am I missing? Does this >> memory sneakily get freed by a subroutine somewhere, or does Capsicum >> confuse our tools? >> > > So the other spots adjusted large, but this one sets one of its elements. > Help me understand how that is a leak? I'm sure I'm just confused. > Because strdup itself allocates new memory. strdup's return value is always supposed to be freed. -Alan From owner-svn-src-head@freebsd.org Mon Jun 29 00:55: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 9EEF735A4CD; Mon, 29 Jun 2020 00:55:42 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) (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 49w8DZ27Fpz47Jp; Mon, 29 Jun 2020 00:55:42 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qv1-xf43.google.com with SMTP id e3so637721qvo.10; Sun, 28 Jun 2020 17:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5r054CQPN/H0oJAT5dMqeibmKxzzdMsA8/J10tRWwPo=; b=tkl7cHg1VSWyITWNTclATP3iaQg7FaxuKNGo0Zct9w7oMjFplby1QeUkfxaG9kZfVw ZQob2hHz/AP+vF05i9Jr8aVgtE2WM1e/++55kJvp2nuTWWdHRVWcgzN5a+qfN71Uge+2 4xSVDEloTHCEpjoLdrRlDhyKCjBv4DArh3j/eunwjCH+F6+U50ALxhG6ZBEc+T+pJMkx g4ccb5bdHiBTjIhVaMRcOvLdyVvb0/DeC7GwXtUNdTm1RW2XOXGv00k4B2mk5+btit6k dEafZhJsPjY8Q2xXsbE/IV46B66odoABuru/bH2QSloGujjCfRBE8fGEFavS9WgB2j95 RyfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=5r054CQPN/H0oJAT5dMqeibmKxzzdMsA8/J10tRWwPo=; b=gP6rsPHFE9Csxd4gCBzDVfxG1e9x/DhX1Ggu9ZRnmM9T+PWzy2SJyCLBn9gPbFxedK B3mzJf57UvlvS6A1c5ij728t5Y9b2XFfaAvGxm36RJvu/JsQdAkRark5c4WZG/jmEh2I vx1i4KjIbhS7G0lunOcuUhBJjRTgM8T+XEvJHIqXqQjtx1+WDB2o/vXkIkoiG/saPkxT pBvzQReVamKpmJoTEGQfzN8uBsE/DhBFtin8Fg672ZgLGzAdkltf9d+BEj+oDvbhExF3 Ydkq3gLUXdQcUXot3egVbSCFCb4tIziKG7pdKGjKbCoHcs6ASAtxp4hiPClXYySy2DS3 ZiMA== X-Gm-Message-State: AOAM530JPo2+ujyi9KM8CwY8SDPOGYCxiMnZ1XduwSCvbSgL3siHJrC7 qa0h9SJe1vf9dPxThowNDnwXYCTrCug= X-Google-Smtp-Source: ABdhPJw2QWVn2eED4tUOwJXpzTjNDfvuw4lkd9c3/16oxWHJPHK7xp2L24BOw+ajmVMdLe+3S9fQrA== X-Received: by 2002:a0c:8e8c:: with SMTP id x12mr12856860qvb.55.1593392140873; Sun, 28 Jun 2020 17:55:40 -0700 (PDT) Received: from raichu (bras-base-toroon0560w-grc-20-184-147-206-12.dsl.bell.ca. [184.147.206.12]) by smtp.gmail.com with ESMTPSA id q5sm14436871qtf.12.2020.06.28.17.55.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 17:55:40 -0700 (PDT) Sender: Mark Johnston Date: Sun, 28 Jun 2020 20:55:38 -0400 From: Mark Johnston To: Alan Somers Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r342699 - head/sbin/savecore Message-ID: <20200629005538.GB7202@raichu> References: <201901021709.x02H9ZPM004185@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 49w8DZ27Fpz47Jp 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:2607:f8b0::/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: Mon, 29 Jun 2020 00:55:42 -0000 On Sun, Jun 28, 2020 at 06:40:59PM -0600, Alan Somers wrote: > On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: > > > Author: markj > > Date: Wed Jan 2 17:09:35 2019 > > New Revision: 342699 > > URL: https://svnweb.freebsd.org/changeset/base/342699 > > > > Log: > > Capsicumize savecore(8). > > > > - Use cap_fileargs(3) to open dump devices after entering capability > > mode, and use cap_syslog(3) to log messages. > > - Use a relative directory fd to open output files. > > - Use zdopen(3) to compress kernel dumps in capability mode. > > > > Reviewed by: cem, oshogbo > > MFC after: 2 months > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D18458 > > > > Modified: > > head/sbin/savecore/Makefile > > head/sbin/savecore/savecore.c > > > > Modified: head/sbin/savecore/savecore.c > > > > ============================================================================== > > --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 > > (r342698) > > +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 > > (r342699) > > > > +static char ** > > +enum_dumpdevs(int *argcp) > > +{ > > + struct fstab *fsp; > > + char **argv; > > + int argc, n; > > + > > + /* > > + * We cannot use getfsent(3) in capability mode, so we must > > + * scan /etc/fstab and build up a list of candidate devices > > + * before proceeding. > > + */ > > + argc = 0; > > + n = 8; > > + argv = malloc(n * sizeof(*argv)); > > > > It looks like the memory allocated here > > > > + if (argv == NULL) { > > + logmsg(LOG_ERR, "malloc(): %m"); > > + exit(1); > > + } > > + for (;;) { > > + fsp = getfsent(); > > + if (fsp == NULL) > > + break; > > + if (strcmp(fsp->fs_vfstype, "swap") != 0 && > > + strcmp(fsp->fs_vfstype, "dump") != 0) > > + continue; > > + if (argc >= n) { > > + n *= 2; > > + argv = realloc(argv, n * sizeof(*argv)); > > > > and here > > > > + if (argv == NULL) { > > + logmsg(LOG_ERR, "realloc(): %m"); > > + exit(1); > > + } > > + } > > + argv[argc] = strdup(fsp->fs_spec); > > > > and here is leaked. I can't find any corresponding free. However, neither > Valgrind nor Coverity complains. What am I missing? Does this memory > sneakily get freed by a subroutine somewhere, or does Capsicum confuse our > tools? I'm not sure why Capsicum would change anything. It would be worth testing devel/valgrind-devel with https://reviews.freebsd.org/D25452 applied, to see if it's able to detect that bug. From owner-svn-src-head@freebsd.org Mon Jun 29 03:09: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 B9CC035C07B; Mon, 29 Jun 2020 03:09:16 +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 49wCBh4MLMz4DRJ; Mon, 29 Jun 2020 03:09:16 +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 5B30320BCE; Mon, 29 Jun 2020 03:09:16 +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 05T39Gx5044867; Mon, 29 Jun 2020 03:09:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T39ETZ044859; Mon, 29 Jun 2020 03:09:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006290309.05T39ETZ044859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 29 Jun 2020 03:09:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362769 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 362769 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 03:09:16 -0000 Author: kevans Date: Mon Jun 29 03:09:14 2020 New Revision: 362769 URL: https://svnweb.freebsd.org/changeset/base/362769 Log: linuxolator: implement memfd_create syscall This effectively mirrors our libc implementation, but with minor fudging -- name needs to be copied in from userspace, so we just copy it straight into stack-allocated memfd_name into the correct position rather than allocating memory that needs to be cleaned up. The sealing-related fcntl(2) commands, F_GET_SEALS and F_ADD_SEALS, have also been implemented now that we support them. Note that this implementation is still not quite at feature parity w.r.t. the actual Linux version; some caveats, from my foggy memory: - Need to implement SHM_GROW_ON_WRITE, default for memfd (in progress) - LTP wants the memfd name exposed to fdescfs - Linux allows open() of an fdescfs fd with O_TRUNC to truncate after dup. (?) Interested parties can install and run LTP from ports (devel/linux-ltp) to confirm any fixes. PR: 240874 Reviewed by: kib, trasz Differential Revision: https://reviews.freebsd.org/D21845 Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux32/linux32_dummy.c head/sys/arm64/linux/linux_dummy.c head/sys/compat/linux/linux.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_file.h head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux/linux_dummy.c ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/amd64/linux/linux_dummy.c Mon Jun 29 03:09:14 2020 (r362769) @@ -138,7 +138,6 @@ DUMMY(sched_getattr); /* Linux 3.15: */ DUMMY(kexec_file_load); /* Linux 3.17: */ -DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/amd64/linux32/linux32_dummy.c Mon Jun 29 03:09:14 2020 (r362769) @@ -133,7 +133,6 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.17: */ -DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: head/sys/arm64/linux/linux_dummy.c ============================================================================== --- head/sys/arm64/linux/linux_dummy.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/arm64/linux/linux_dummy.c Mon Jun 29 03:09:14 2020 (r362769) @@ -127,7 +127,6 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.17: */ -DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); Modified: head/sys/compat/linux/linux.c ============================================================================== --- head/sys/compat/linux/linux.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/compat/linux/linux.c Mon Jun 29 03:09:14 2020 (r362769) @@ -551,3 +551,79 @@ linux_dev_shm_destroy(void) destroy_dev(dev_shm_cdev); } + +int +bsd_to_linux_bits_(int value, struct bsd_to_linux_bitmap *bitmap, + size_t mapcnt, int no_value) +{ + int bsd_mask, bsd_value, linux_mask, linux_value; + int linux_ret; + size_t i; + bool applied; + + applied = false; + linux_ret = 0; + for (i = 0; i < mapcnt; ++i) { + bsd_mask = bitmap[i].bsd_mask; + bsd_value = bitmap[i].bsd_value; + if (bsd_mask == 0) + bsd_mask = bsd_value; + + linux_mask = bitmap[i].linux_mask; + linux_value = bitmap[i].linux_value; + if (linux_mask == 0) + linux_mask = linux_value; + + /* + * If a mask larger than just the value is set, we explicitly + * want to make sure that only this bit we mapped within that + * mask is set. + */ + if ((value & bsd_mask) == bsd_value) { + linux_ret = (linux_ret & ~linux_mask) | linux_value; + applied = true; + } + } + + if (!applied) + return (no_value); + return (linux_ret); +} + +int +linux_to_bsd_bits_(int value, struct bsd_to_linux_bitmap *bitmap, + size_t mapcnt, int no_value) +{ + int bsd_mask, bsd_value, linux_mask, linux_value; + int bsd_ret; + size_t i; + bool applied; + + applied = false; + bsd_ret = 0; + for (i = 0; i < mapcnt; ++i) { + bsd_mask = bitmap[i].bsd_mask; + bsd_value = bitmap[i].bsd_value; + if (bsd_mask == 0) + bsd_mask = bsd_value; + + linux_mask = bitmap[i].linux_mask; + linux_value = bitmap[i].linux_value; + if (linux_mask == 0) + linux_mask = linux_value; + + /* + * If a mask larger than just the value is set, we explicitly + * want to make sure that only this bit we mapped within that + * mask is set. + */ + if ((value & linux_mask) == linux_value) { + bsd_ret = (bsd_ret & ~bsd_mask) | bsd_value; + applied = true; + } + } + + if (!applied) + return (no_value); + return (bsd_ret); +} Modified: head/sys/compat/linux/linux.h ============================================================================== --- head/sys/compat/linux/linux.h Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/compat/linux/linux.h Mon Jun 29 03:09:14 2020 (r362769) @@ -148,4 +148,49 @@ extern struct mtx futex_mtx; void linux_dev_shm_create(void); void linux_dev_shm_destroy(void); +/* + * mask=0 is not sensible for this application, so it will be taken to mean + * a mask equivalent to the value. Otherwise, (word & mask) == value maps to + * (word & ~mask) | value in a bitfield for the platform we're converting to. + */ +struct bsd_to_linux_bitmap { + int bsd_mask; + int bsd_value; + int linux_mask; + int linux_value; +}; + +int bsd_to_linux_bits_(int value, struct bsd_to_linux_bitmap *bitmap, + size_t mapcnt, int no_value); +int linux_to_bsd_bits_(int value, struct bsd_to_linux_bitmap *bitmap, + size_t mapcnt, int no_value); + +#define bsd_to_linux_bits(_val, _bmap, _noval) \ + bsd_to_linux_bits_((_val), (_bmap), nitems((_bmap)), (_noval)) + +/* + * These functions are used for simplification of BSD <-> Linux bit conversions. + * Given `value`, a bit field, these functions will walk the given bitmap table + * and set the appropriate bits for the target platform. If any bits were + * successfully converted, then the return value is the equivalent of value + * represented with the bit values appropriate for the target platform. + * Otherwise, the value supplied as `no_value` is returned. + */ +#define linux_to_bsd_bits(_val, _bmap, _noval) \ + linux_to_bsd_bits_((_val), (_bmap), nitems((_bmap)), (_noval)) + +/* + * Easy mapping helpers. BITMAP_EASY_LINUX represents a single bit to be + * translated, and the FreeBSD and Linux values are supplied. BITMAP_1t1_LINUX + * is the extreme version of this, where not only is it a single bit, but the + * name of the macro used to represent the Linux version of a bit literally has + * LINUX_ prepended to the normal name. + */ +#define BITMAP_EASY_LINUX(_name, _linux_name) \ + { \ + .bsd_value = (_name), \ + .linux_value = (_linux_name), \ + } +#define BITMAP_1t1_LINUX(_name) BITMAP_EASY_LINUX(_name, LINUX_##_name) + #endif /* _LINUX_MI_H_ */ Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/compat/linux/linux_file.c Mon Jun 29 03:09:14 2020 (r362769) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -68,6 +69,37 @@ __FBSDID("$FreeBSD$"); static int linux_common_open(struct thread *, int, char *, int, int); static int linux_getdents_error(struct thread *, int, int); +static struct bsd_to_linux_bitmap seal_bitmap[] = { + BITMAP_1t1_LINUX(F_SEAL_SEAL), + BITMAP_1t1_LINUX(F_SEAL_SHRINK), + BITMAP_1t1_LINUX(F_SEAL_GROW), + BITMAP_1t1_LINUX(F_SEAL_WRITE), +}; + +#define MFD_HUGETLB_ENTRY(_size) \ + { \ + .bsd_value = MFD_HUGE_##_size, \ + .linux_value = LINUX_HUGETLB_FLAG_ENCODE_##_size \ + } +static struct bsd_to_linux_bitmap mfd_bitmap[] = { + BITMAP_1t1_LINUX(MFD_CLOEXEC), + BITMAP_1t1_LINUX(MFD_ALLOW_SEALING), + BITMAP_1t1_LINUX(MFD_HUGETLB), + MFD_HUGETLB_ENTRY(64KB), + MFD_HUGETLB_ENTRY(512KB), + MFD_HUGETLB_ENTRY(1MB), + MFD_HUGETLB_ENTRY(2MB), + MFD_HUGETLB_ENTRY(8MB), + MFD_HUGETLB_ENTRY(16MB), + MFD_HUGETLB_ENTRY(32MB), + MFD_HUGETLB_ENTRY(256MB), + MFD_HUGETLB_ENTRY(512MB), + MFD_HUGETLB_ENTRY(1GB), + MFD_HUGETLB_ENTRY(2GB), + MFD_HUGETLB_ENTRY(16GB), +}; +#undef MFD_HUGETLB_ENTRY + #ifdef LINUX_LEGACY_SYSCALLS int linux_creat(struct thread *td, struct linux_creat_args *args) @@ -1371,6 +1403,21 @@ 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)); + /* + * Our F_SEAL_* values match Linux one for maximum compatibility. So we + * only needed to account for different values for fcntl(2) commands. + */ + case LINUX_F_GET_SEALS: + error = kern_fcntl(td, args->fd, F_GET_SEALS, 0); + if (error != 0) + return (error); + td->td_retval[0] = bsd_to_linux_bits(td->td_retval[0], + seal_bitmap, 0); + return (0); + + case LINUX_F_ADD_SEALS: + return (kern_fcntl(td, args->fd, F_ADD_SEALS, + linux_to_bsd_bits(args->arg, seal_bitmap, 0))); default: linux_msg(td, "unsupported fcntl cmd %d\n", args->cmd); return (EINVAL); @@ -1676,3 +1723,46 @@ linux_copy_file_range(struct thread *td, struct linux_ return (error); } +#define LINUX_MEMFD_PREFIX "memfd:" + +int +linux_memfd_create(struct thread *td, struct linux_memfd_create_args *args) +{ + char memfd_name[LINUX_NAME_MAX + 1]; + int error, flags, shmflags, oflags; + + /* + * This is our clever trick to avoid the heap allocation to copy in the + * uname. We don't really need to go this far out of our way, but it + * does keep the rest of this function fairly clean as they don't have + * to worry about cleanup on the way out. + */ + error = copyinstr(args->uname_ptr, + memfd_name + sizeof(LINUX_MEMFD_PREFIX) - 1, + LINUX_NAME_MAX - sizeof(LINUX_MEMFD_PREFIX) - 1, NULL); + if (error != 0) { + if (error == ENAMETOOLONG) + error = EINVAL; + return (error); + } + + memcpy(memfd_name, LINUX_MEMFD_PREFIX, sizeof(LINUX_MEMFD_PREFIX) - 1); + flags = linux_to_bsd_bits(args->flags, mfd_bitmap, 0); + if ((flags & ~(MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_HUGETLB | + MFD_HUGE_MASK)) != 0) + return (EINVAL); + /* Size specified but no HUGETLB. */ + if ((flags & MFD_HUGE_MASK) != 0 && (flags & MFD_HUGETLB) == 0) + return (EINVAL); + /* We don't actually support HUGETLB. */ + if ((flags & MFD_HUGETLB) != 0) + return (ENOSYS); + oflags = O_RDWR; + shmflags = 0; + if ((flags & MFD_CLOEXEC) != 0) + oflags |= O_CLOEXEC; + if ((flags & MFD_ALLOW_SEALING) != 0) + shmflags |= SHM_ALLOW_SEALING; + return (kern_shm_open2(td, SHM_ANON, oflags, 0, shmflags, NULL, + memfd_name)); +} Modified: head/sys/compat/linux/linux_file.h ============================================================================== --- head/sys/compat/linux/linux_file.h Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/compat/linux/linux_file.h Mon Jun 29 03:09:14 2020 (r362769) @@ -118,6 +118,9 @@ #define LINUX_F_SETPIPE_SZ (LINUX_F_SPECIFIC_BASE + 7) #define LINUX_F_GETPIPE_SZ (LINUX_F_SPECIFIC_BASE + 8) +#define LINUX_F_ADD_SEALS (LINUX_F_SPECIFIC_BASE + 9) +#define LINUX_F_GET_SEALS (LINUX_F_SPECIFIC_BASE + 10) + #define LINUX_F_GETLKP 36 #define LINUX_F_SETLKP 37 #define LINUX_F_SETLKPW 38 @@ -145,5 +148,30 @@ #define LINUX_SYNC_FILE_RANGE_WAIT_BEFORE 1 #define LINUX_SYNC_FILE_RANGE_WRITE 2 #define LINUX_SYNC_FILE_RANGE_WAIT_AFTER 4 + +#define LINUX_F_SEAL_SEAL 0x0001 +#define LINUX_F_SEAL_SHRINK 0x0002 +#define LINUX_F_SEAL_GROW 0x0004 +#define LINUX_F_SEAL_WRITE 0x0008 + +#define LINUX_MFD_CLOEXEC 0x0001 +#define LINUX_MFD_ALLOW_SEALING 0x0002 +#define LINUX_MFD_HUGETLB 0x0004 + +#define LINUX_HUGETLB_FLAG_ENCODE_SHIFT 26 +#define LINUX_HUGETLB_FLAG_ENCODE_MASK 0x3f + +#define LINUX_HUGETLB_FLAG_ENCODE_64KB (16 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_512KB (19 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_1MB (20 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_2MB (21 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_8MB (23 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_16MB (24 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_32MB (25 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_256MB (28 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_512MB (29 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_1GB (30 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_2GB (31 << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) +#define LINUX_HUGETLB_FLAG_ENCODE_16GB (34U << LINUX_HUGETLB_FLAG_ENCODE_SHIFT) #endif /* !_LINUX_FILE_H_ */ Modified: head/sys/i386/linux/linux_dummy.c ============================================================================== --- head/sys/i386/linux/linux_dummy.c Mon Jun 29 02:32:07 2020 (r362768) +++ head/sys/i386/linux/linux_dummy.c Mon Jun 29 03:09:14 2020 (r362769) @@ -129,7 +129,6 @@ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); /* Linux 3.17: */ -DUMMY(memfd_create); DUMMY(seccomp); /* Linux 3.18: */ DUMMY(bpf); From owner-svn-src-head@freebsd.org Mon Jun 29 03:23: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 49C4E35C975; Mon, 29 Jun 2020 03:23:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49wCVp1Zm7z4F4t; Mon, 29 Jun 2020 03:23:14 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F332A20FA9; Mon, 29 Jun 2020 03:23:13 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05T3NDu6056731; Mon, 29 Jun 2020 03:23:13 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T3NDIv056730; Mon, 29 Jun 2020 03:23:13 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <202006290323.05T3NDIv056730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Mon, 29 Jun 2020 03:23:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362770 - head/share/ctypedef X-SVN-Group: head X-SVN-Commit-Author: hrs X-SVN-Commit-Paths: head/share/ctypedef X-SVN-Commit-Revision: 362770 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 03:23:14 -0000 Author: hrs Date: Mon Jun 29 03:23:13 2020 New Revision: 362770 URL: https://svnweb.freebsd.org/changeset/base/362770 Log: Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS. PR: 163168 MFC after: 3 days Modified: head/share/ctypedef/ja_JP.eucJP.src Modified: head/share/ctypedef/ja_JP.eucJP.src ============================================================================== --- head/share/ctypedef/ja_JP.eucJP.src Mon Jun 29 03:09:14 2020 (r362769) +++ head/share/ctypedef/ja_JP.eucJP.src Mon Jun 29 03:23:13 2020 (r362770) @@ -49,7 +49,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -73,7 +72,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -85,7 +83,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -101,7 +98,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -126,45 +122,6 @@ upper ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ ;/ ;/ @@ -173,293 +130,86 @@ upper ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ ;/ ;/ @@ -557,19 +307,16 @@ lower ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -587,7 +334,6 @@ lower ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -611,37 +357,6 @@ lower ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ ;/ ;/ @@ -650,667 +365,89 @@ lower ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Jun 29 09:08: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 EC45E343F99; Mon, 29 Jun 2020 09:08:37 +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 49wM9K5yT7z4Ybq; Mon, 29 Jun 2020 09:08:37 +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 9536B25015; Mon, 29 Jun 2020 09:08:37 +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 05T98bSG067075; Mon, 29 Jun 2020 09:08:37 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T98bBk067073; Mon, 29 Jun 2020 09:08:37 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202006290908.05T98bBk067073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 29 Jun 2020 09:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362777 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 362777 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 09:08:38 -0000 Author: andrew Date: Mon Jun 29 09:08:36 2020 New Revision: 362777 URL: https://svnweb.freebsd.org/changeset/base/362777 Log: Create a kernel arm64 ID register view In preparation for using ifuncs in the kernel is is useful to have a common view of the arm64 ID registers across all CPUs. Add this and extract the logic for finding the lower value of two fields to a new helper function. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D25463 Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/include/undefined.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Mon Jun 29 08:14:45 2020 (r362776) +++ head/sys/arm64/arm64/identcpu.c Mon Jun 29 09:08:36 2020 (r362777) @@ -134,6 +134,7 @@ struct cpu_desc { }; static struct cpu_desc cpu_desc[MAXCPU]; +static struct cpu_desc kern_cpu_desc; static struct cpu_desc user_cpu_desc; static u_int cpu_print_regs; #define PRINT_ID_AA64_AFR0 0x00000001 @@ -936,46 +937,109 @@ extract_user_id_field(u_int reg, u_int field_shift, ui return (false); } +bool +get_kernel_reg(u_int reg, uint64_t *val) +{ + int i; + + for (i = 0; i < nitems(user_regs); i++) { + if (user_regs[i].reg == reg) { + *val = CPU_DESC_FIELD(kern_cpu_desc, i); + return (true); + } + } + + return (false); +} + +static uint64_t +update_lower_register(uint64_t val, uint64_t new_val, u_int shift, + int width, bool sign) +{ + uint64_t mask; + uint64_t new_field, old_field; + bool update; + + KASSERT(width > 0 && width < 64, ("%s: Invalid width %d", __func__, + width)); + + mask = (1ul << width) - 1; + new_field = (new_val >> shift) & mask; + old_field = (val >> shift) & mask; + + update = false; + if (sign) { + /* + * The field is signed. Toggle the upper bit so the comparison + * works on unsigned values as this makes positive numbers, + * i.e. those with a 0 bit, larger than negative numbers, + * i.e. those with a 1 bit, in an unsigned comparison. + */ + if ((new_field ^ (1ul << (width - 1))) < + (old_field ^ (1ul << (width - 1)))) + update = true; + } else { + if (new_field < old_field) + update = true; + } + + if (update) { + val &= ~(mask << shift); + val |= new_field << shift; + } + + return (val); +} + static void -update_user_regs(u_int cpu) +update_special_regs(u_int cpu) { struct mrs_field *fields; - uint64_t cur, value; - int i, j, cur_field, new_field; + uint64_t user_reg, kern_reg, value; + int i, j; + if (cpu == 0) { + /* Create a user visible cpu description with safe values */ + memset(&user_cpu_desc, 0, sizeof(user_cpu_desc)); + /* Safe values for these registers */ + user_cpu_desc.id_aa64pfr0 = ID_AA64PFR0_AdvSIMD_NONE | + ID_AA64PFR0_FP_NONE | ID_AA64PFR0_EL1_64 | + ID_AA64PFR0_EL0_64; + user_cpu_desc.id_aa64dfr0 = ID_AA64DFR0_DebugVer_8; + } + for (i = 0; i < nitems(user_regs); i++) { value = CPU_DESC_FIELD(cpu_desc[cpu], i); - if (cpu == 0) - cur = value; - else - cur = CPU_DESC_FIELD(user_cpu_desc, i); + if (cpu == 0) { + kern_reg = value; + user_reg = value; + } else { + kern_reg = CPU_DESC_FIELD(kern_cpu_desc, i); + user_reg = CPU_DESC_FIELD(user_cpu_desc, i); + } fields = user_regs[i].fields; for (j = 0; fields[j].type != 0; j++) { switch (fields[j].type & MRS_TYPE_MASK) { case MRS_EXACT: - cur &= ~(0xfu << fields[j].shift); - cur |= + user_reg &= ~(0xfu << fields[j].shift); + user_reg |= (uint64_t)MRS_EXACT_FIELD(fields[j].type) << fields[j].shift; break; case MRS_LOWER: - new_field = (value >> fields[j].shift) & 0xf; - cur_field = (cur >> fields[j].shift) & 0xf; - if ((fields[j].sign && - (int)new_field < (int)cur_field) || - (!fields[j].sign && - (u_int)new_field < (u_int)cur_field)) { - cur &= ~(0xfu << fields[j].shift); - cur |= new_field << fields[j].shift; - } + user_reg = update_lower_register(user_reg, + value, fields[j].shift, 4, fields[j].sign); break; default: panic("Invalid field type: %d", fields[j].type); } + kern_reg = update_lower_register(kern_reg, value, + fields[j].shift, 4, fields[j].sign); } - CPU_DESC_FIELD(user_cpu_desc, i) = cur; + CPU_DESC_FIELD(kern_cpu_desc, i) = kern_reg; + CPU_DESC_FIELD(user_cpu_desc, i) = user_reg; } } @@ -997,13 +1061,6 @@ identify_cpu_sysinit(void *dummy __unused) u_long hwcap; bool dic, idc; - /* Create a user visible cpu description with safe values */ - memset(&user_cpu_desc, 0, sizeof(user_cpu_desc)); - /* Safe values for these registers */ - user_cpu_desc.id_aa64pfr0 = ID_AA64PFR0_AdvSIMD_NONE | - ID_AA64PFR0_FP_NONE | ID_AA64PFR0_EL1_64 | ID_AA64PFR0_EL0_64; - user_cpu_desc.id_aa64dfr0 = ID_AA64DFR0_DebugVer_8; - dic = (allow_dic != 0); idc = (allow_idc != 0); CPU_FOREACH(cpu) { @@ -1013,7 +1070,7 @@ identify_cpu_sysinit(void *dummy __unused) elf_hwcap = hwcap; else elf_hwcap &= hwcap; - update_user_regs(cpu); + update_special_regs(cpu); if (CTR_DIC_VAL(cpu_desc[cpu].ctr) == 0) dic = false; Modified: head/sys/arm64/include/undefined.h ============================================================================== --- head/sys/arm64/include/undefined.h Mon Jun 29 08:14:45 2020 (r362776) +++ head/sys/arm64/include/undefined.h Mon Jun 29 09:08:36 2020 (r362777) @@ -62,7 +62,10 @@ void undef_init(void); void *install_undef_handler(bool, undef_handler_t); void remove_undef_handler(void *); int undef_insn(u_int, struct trapframe *); + +/* Functions to read the sanitised view of the special registers */ bool extract_user_id_field(u_int, u_int, uint8_t *); +bool get_kernel_reg(u_int, uint64_t *); #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Mon Jun 29 09:37: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 860C534489D; Mon, 29 Jun 2020 09:37:08 +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 49wMpD2zrXz4Zrc; Mon, 29 Jun 2020 09:37:08 +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 49D9124E65; Mon, 29 Jun 2020 09:37:08 +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 05T9b82f085682; Mon, 29 Jun 2020 09:37:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05T9b8aA085681; Mon, 29 Jun 2020 09:37:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202006290937.05T9b8aA085681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 29 Jun 2020 09:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362778 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 362778 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 09:37:08 -0000 Author: andrew Date: Mon Jun 29 09:37:07 2020 New Revision: 362778 URL: https://svnweb.freebsd.org/changeset/base/362778 Log: Fix the spelling of identify in the arm64 identcpu code Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/identcpu.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Mon Jun 29 09:08:36 2020 (r362777) +++ head/sys/arm64/arm64/identcpu.c Mon Jun 29 09:37:07 2020 (r362778) @@ -1096,7 +1096,7 @@ identify_cpu_sysinit(void *dummy __unused) install_undef_handler(true, user_mrs_handler); } -SYSINIT(idenrity_cpu, SI_SUB_SMP, SI_ORDER_ANY, identify_cpu_sysinit, NULL); +SYSINIT(identify_cpu, SI_SUB_SMP, SI_ORDER_ANY, identify_cpu_sysinit, NULL); static u_long parse_cpu_features_hwcap(u_int cpu) From owner-svn-src-head@freebsd.org Mon Jun 29 10:30: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 A450E345632; Mon, 29 Jun 2020 10:30:43 +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 49wP033yJjz4crV; Mon, 29 Jun 2020 10:30:43 +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 6C65425F3C; Mon, 29 Jun 2020 10:30:43 +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 05TAUhCe017720; Mon, 29 Jun 2020 10:30:43 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TAUhZU017719; Mon, 29 Jun 2020 10:30:43 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202006291030.05TAUhZU017719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Mon, 29 Jun 2020 10:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362779 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 362779 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 10:30:43 -0000 Author: gbe (doc committer) Date: Mon Jun 29 10:30:43 2020 New Revision: 362779 URL: https://svnweb.freebsd.org/changeset/base/362779 Log: gre(4): Add a STANDARDS section Expand the mentioned RFC in the SEE ALSO section and reference RFC1701 and RFC1702. PR: 240250 Reviewed by: bcr (mentor) Approved by: bcr (mentor) Obtained from: OpenBSD MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D25504 Modified: head/share/man/man4/gre.4 Modified: head/share/man/man4/gre.4 ============================================================================== --- head/share/man/man4/gre.4 Mon Jun 29 09:37:07 2020 (r362778) +++ head/share/man/man4/gre.4 Mon Jun 29 10:30:43 2020 (r362779) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 24, 2019 +.Dd June 29, 2020 .Dt GRE 4 .Os .Sh NAME @@ -219,8 +219,44 @@ variable to non-zero. .Xr protocols 5 , .Xr ifconfig 8 , .Xr sysctl 8 +.Sh STANDARDS +.Rs +.%A S. Hanks +.%A "T. Li" +.%A D. Farinacci +.%A P. Traina +.%D October 1994 +.%R RFC 1701 +.%T Generic Routing Encapsulation (GRE) +.Re .Pp -A description of GRE encapsulation can be found in RFC 2784 and RFC 2890. +.Rs +.%A S. Hanks +.%A "T. Li" +.%A D. Farinacci +.%A P. Traina +.%D October 1994 +.%R RFC 1702 +.%T Generic Routing Encapsulation over IPv4 networks +.Re +.Pp +.Rs +.%A D. Farinacci +.%A "T. Li" +.%A S. Hanks +.%A D. Meyer +.%A P. Traina +.%D March 2000 +.%R RFC 2784 +.%T Generic Routing Encapsulation (GRE) +.Re +.Pp +.Rs +.%A G. Dommety +.%D September 2000 +.%R RFC 2890 +.%T Key and Sequence Number Extensions to GRE +.Re .Sh AUTHORS .An Andrey V. Elsukov Aq Mt ae@FreeBSD.org .An Heiko W.Rupp Aq Mt hwr@pilhuhn.de From owner-svn-src-head@freebsd.org Mon Jun 29 12:59: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 3214B349125; Mon, 29 Jun 2020 12:59:10 +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 49wSHL0Y0gz3WHm; Mon, 29 Jun 2020 12:59: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 EA04C27B98; Mon, 29 Jun 2020 12:59:09 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05TCx9YH007879; Mon, 29 Jun 2020 12:59:09 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TCx939007877; Mon, 29 Jun 2020 12:59:09 GMT (envelope-from br@FreeBSD.org) Message-Id: <202006291259.05TCx939007877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 29 Jun 2020 12:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362780 - 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: 362780 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 12:59:10 -0000 Author: br Date: Mon Jun 29 12:59:09 2020 New Revision: 362780 URL: https://svnweb.freebsd.org/changeset/base/362780 Log: Coresight: provide device_attach method for FDT bus. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/coresight/coresight_funnel_fdt.c head/sys/arm64/coresight/coresight_replicator_fdt.c Modified: head/sys/arm64/coresight/coresight_funnel_fdt.c ============================================================================== --- head/sys/arm64/coresight/coresight_funnel_fdt.c Mon Jun 29 10:30:43 2020 (r362779) +++ head/sys/arm64/coresight/coresight_funnel_fdt.c Mon Jun 29 12:59:09 2020 (r362780) @@ -93,6 +93,7 @@ funnel_fdt_attach(device_t dev) static device_method_t funnel_fdt_methods[] = { /* Device interface */ DEVMETHOD(device_probe, funnel_fdt_probe), + DEVMETHOD(device_attach, funnel_fdt_attach), DEVMETHOD_END }; Modified: head/sys/arm64/coresight/coresight_replicator_fdt.c ============================================================================== --- head/sys/arm64/coresight/coresight_replicator_fdt.c Mon Jun 29 10:30:43 2020 (r362779) +++ head/sys/arm64/coresight/coresight_replicator_fdt.c Mon Jun 29 12:59:09 2020 (r362780) @@ -68,7 +68,7 @@ replicator_fdt_probe(device_t dev) } static int -replicator_acpi_attach(device_t dev) +replicator_fdt_attach(device_t dev) { struct replicator_softc *sc; @@ -81,6 +81,7 @@ replicator_acpi_attach(device_t dev) static device_method_t replicator_fdt_methods[] = { /* Device interface */ DEVMETHOD(device_probe, replicator_fdt_probe), + DEVMETHOD(device_attach, replicator_fdt_attach), DEVMETHOD_END }; From owner-svn-src-head@freebsd.org Mon Jun 29 13:08: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 42177349379; Mon, 29 Jun 2020 13:08:41 +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 49wSVK0pHLz3Wk8; Mon, 29 Jun 2020 13:08:41 +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 EEBBB27AD4; Mon, 29 Jun 2020 13:08:40 +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 05TD8eL8014020; Mon, 29 Jun 2020 13:08:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TD8eTP014019; Mon, 29 Jun 2020 13:08:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202006291308.05TD8eTP014019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 29 Jun 2020 13:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 362781 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 13:08:41 -0000 Author: hselasky Date: Mon Jun 29 13:08:40 2020 New Revision: 362781 URL: https://svnweb.freebsd.org/changeset/base/362781 Log: Implement is_signed(), type_max() and type_min() function macros in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 12:59:09 2020 (r362780) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 13:08:40 2020 (r362781) @@ -564,4 +564,20 @@ linux_ratelimited(linux_ratelimit_t *rl) #define __is_constexpr(x) \ __builtin_constant_p(x) +#define is_signed(x) (((x)-1 / (x)2) == (x)0) + +#define type_max(x) ( \ + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MAX : UINT64_MAX) : \ + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MAX : UINT32_MAX) : \ + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MAX : UINT16_MAX) : \ + (is_signed(x) ? INT8_MAX : UINT8_MAX) \ +) + +#define type_min(x) ( \ + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MIN : 0) : \ + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MIN : 0) : \ + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MIN : 0) : \ + (is_signed(x) ? INT8_MIN : 0) \ +) + #endif /* _LINUX_KERNEL_H_ */ From owner-svn-src-head@freebsd.org Mon Jun 29 13:30: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 57A2D3499E9; Mon, 29 Jun 2020 13:30:49 +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 49wSzs0qFSz3Y9k; Mon, 29 Jun 2020 13:30:49 +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 0038027FF7; Mon, 29 Jun 2020 13:30:49 +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 05TDUmlk027917; Mon, 29 Jun 2020 13:30:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TDUmTZ027916; Mon, 29 Jun 2020 13:30:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202006291330.05TDUmTZ027916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 29 Jun 2020 13:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362782 - head/contrib/file/magic/Magdir X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/file/magic/Magdir X-SVN-Commit-Revision: 362782 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 13:30:49 -0000 Author: emaste Date: Mon Jun 29 13:30:48 2020 New Revision: 362782 URL: https://svnweb.freebsd.org/changeset/base/362782 Log: Revert r362261, "Re-apply r333944 to unbreak ports" A file update in 2018 broke many ports as it misidentified shared libraries as PIE binaries. r333944 reverted part of the change, restoring ports builds but misidentifying objects in the opposite direction. Earlier this month file 5.39 was imported, and then the change originally from r333944 was recommitted as r362261. However, the issue was fixed upstream, so r362261 serves no purpose. PR: 246960, 247461 [exp-run] Sponsored by: The FreeBSD Foundation Modified: head/contrib/file/magic/Magdir/elf Modified: head/contrib/file/magic/Magdir/elf ============================================================================== --- head/contrib/file/magic/Magdir/elf Mon Jun 29 13:08:40 2020 (r362781) +++ head/contrib/file/magic/Magdir/elf Mon Jun 29 13:30:48 2020 (r362782) @@ -50,8 +50,9 @@ !:mime application/x-object >16 leshort 2 executable, !:mime application/x-executable ->16 leshort 3 shared object, -!:mime application/x-sharedlib +>16 leshort 3 ${x?pie executable:shared object}, + +!:mime application/x-${x?pie-executable:sharedlib} >16 leshort 4 core file, !:mime application/x-coredump # OS-specific From owner-svn-src-head@freebsd.org Mon Jun 29 15:15: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 DE85334B9F8; Mon, 29 Jun 2020 15:15:14 +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 49wWJL5VBrz3dmw; Mon, 29 Jun 2020 15:15:14 +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 A0DB09807; Mon, 29 Jun 2020 15:15:14 +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 05TFFES6094668; Mon, 29 Jun 2020 15:15:14 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TFFEdD094667; Mon, 29 Jun 2020 15:15:14 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202006291515.05TFFEdD094667@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: Mon, 29 Jun 2020 15:15:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362783 - head/usr.bin/hexdump X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/hexdump X-SVN-Commit-Revision: 362783 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 15:15:14 -0000 Author: fernape (ports committer) Date: Mon Jun 29 15:15:14 2020 New Revision: 362783 URL: https://svnweb.freebsd.org/changeset/base/362783 Log: hexdump(1): Add EXAMPLES section * Add examples showing the use of -f, -C, -s, -n * Rework the two already present examples that were *format* examples * Remove .Tn suggested by mandoc(1) * Remove reference to gdb(1) since it is not present in current Approved by: manpages (gbe) Differential Revision: https://reviews.freebsd.org/D25406 Modified: head/usr.bin/hexdump/hexdump.1 Modified: head/usr.bin/hexdump/hexdump.1 ============================================================================== --- head/usr.bin/hexdump/hexdump.1 Mon Jun 29 13:30:48 2020 (r362782) +++ head/usr.bin/hexdump/hexdump.1 Mon Jun 29 15:15:14 2020 (r362783) @@ -28,7 +28,7 @@ .\" @(#)hexdump.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd June 29, 2020 .Dt HEXDUMP 1 .Os .Sh NAME @@ -242,8 +242,7 @@ Output characters in the default character set. Nonprinting characters are displayed as a single .Dq Cm \&. . .It Cm _u -Output US -.Tn ASCII +Output US ASCII characters, with the exception that control characters are displayed using the following, lower-case, names. Characters greater than 0xff, hexadecimal, are displayed as hexadecimal @@ -330,18 +329,59 @@ option. .Sh EXIT STATUS .Ex -std hexdump hd .Sh EXAMPLES -Display the input in perusal format: +Dump input in canonical (hex+ASCII) form: .Bd -literal -offset indent +$ echo "FreeBSD: The power to serve" | hexdump -C +00000000 46 72 65 65 42 53 44 3a 20 54 68 65 20 70 6f 77 |FreeBSD: The pow| +00000010 65 72 20 74 6f 20 73 65 72 76 65 0a |er to serve.| +0000001c +.Ed +.Pp +Same as above but skipping the first 4 bytes of stdin and interpreting only 3 +bytes of input: +.Bd -literal -offset indent +$ echo "FreeBSD: The power to serve" | hexdump -C -s 4 -n 3 +00000004 42 53 44 |BSD| +00000007 +.Ed +.Pp +Assuming a format file named +.Pa format.txt +with the following contents that specify a perusal format: +.Bd -literal -offset indent "%06.6_ao " 12/1 "%3_u " "\et\et" "%_p " "\en" .Ed .Pp -Implement the \-x option: +Dump input in canonical form using the format in +.Pa format.txt : .Bd -literal -offset indent +$ echo "FreeBSD" | hexdump -f format.txt -C +000000 F r e e B S D lf F r e e B S D . +00000000 46 72 65 65 42 53 44 0a |FreeBSD.| +00000008 +.Ed +.Pp +Assuming a format file named +.Pa format.txt +with the following contents that simulate the +.Fl x +option: +.Bd -literal -offset indent "%07.7_Ax\en" "%07.7_ax " 8/2 "%04x " "\en" .Ed +.Pp +Dump input in canonical form using the format in +.Pa format.txt : +.Bd -literal -offset indent +$ echo "FreeBSD: The power to serve" | hexdump -f format.txt -C +0000000 7246 6565 5342 3a44 5420 6568 7020 776f +00000000 46 72 65 65 42 53 44 3a 20 54 68 65 20 70 6f 77 |FreeBSD: The pow| +0000010 7265 7420 206f 6573 7672 0a65 +00000010 65 72 20 74 6f 20 73 65 72 76 65 0a |er to serve.| +0000001c +.Ed .Sh SEE ALSO -.Xr gdb 1 , .Xr od 1 From owner-svn-src-head@freebsd.org Mon Jun 29 15:27: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 62BB134BFC6 for ; Mon, 29 Jun 2020 15:27:41 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (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 49wWZh6ZxPz3fWw for ; Mon, 29 Jun 2020 15:27:39 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x744.google.com with SMTP id z63so15561667qkb.8 for ; Mon, 29 Jun 2020 08:27:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7UvSoQ1JTvo5C6z38ZNTRhGMNOoXVuXvCQGZA+UXWMw=; b=Sj0csJywE9tmP4Ua8oslNmjZ7zqTZKn5bN2ge/O+SuCGdKETBWoho3XPnXlWTr+xga GayD6ukTHwbvTyUq0SWPWOGB3QhlQ8OAUipKhTjhb0q6FMV7GcDJ9qnh/+sMJiT9Z/PD WQvDUFmsSqXuTw6tlfiS2v4epz7ug78/zHRErt1hlgLZaoUDsKMcYCZV9cluZHrwNAXC /J6qWnMeL8Lb4Ip96schS4vI89+zg3v9YJJi42bVDIfXsR7qPFBc2TiKbeGxzyoI/3ch VckckaP5BRLFQeS8eyVdmyujmZwXw5kyvLeI/VDMHAzS2I6Fiaw0fyFIbIvW0xU8Vj5e WELg== 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:references :mime-version:content-disposition:in-reply-to; bh=7UvSoQ1JTvo5C6z38ZNTRhGMNOoXVuXvCQGZA+UXWMw=; b=L8jkNnoREft94tp8hYtSjpEwW0Ty8IGzXIOVQrLTcn1IqNeW/S9xC+MJYCNBmHmRxD L19oVhItWkP/l8tvLtaHcbFJEJvfMBhty7YnKm2AIJgZfsc/FQPxMi6F9898Gi7jQ6lt NrVN4EAF2NjKvjzleb7o5D0YIxkzwC/qtQz1UPbermQGJaHTtw/RL4nQn7xaVol9ytOR mlER4uaB4MoCdXn3ZgigtIJIXLL1PoN49+9Z5/SBfT5HMNmc3lKbjggpS2apSSb8x3zr VHLMLoiLGOwgqxsfFg8lcS2H7iVr18sbvUJ/pp7Ye9TDIZiYGICSuTT1lVGLLpNErDpR MDXw== X-Gm-Message-State: AOAM5305NoMYNe7G5WkzMy/CuqYRXCaw21zkKF2t8HSmYJgrJ/nOo70o zwZdmyX4170oxr/lmmHsuDv5ww== X-Google-Smtp-Source: ABdhPJyNmtiHLo5RqWnsDw0B/2pjxvW9N79axgBGO1J/fhuO1rIkcj69oXVg7g9h2EKDif14/83Gsw== X-Received: by 2002:a37:670a:: with SMTP id b10mr15031664qkc.314.1593444459214; Mon, 29 Jun 2020 08:27:39 -0700 (PDT) Received: from mutt-hbsd (75-148-2-186-WashingtonDC.hfc.comcastbusiness.net. [75.148.2.186]) by smtp.gmail.com with ESMTPSA id y40sm19406277qtc.29.2020.06.29.08.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 08:27:38 -0700 (PDT) Date: Mon, 29 Jun 2020 11:27:17 -0400 From: Shawn Webb To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362769 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux Message-ID: <20200629152717.2ojwnipxkmjaoix2@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202006290309.05T39ETZ044859@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="34h5ghmb2n4ozvpj" Content-Disposition: inline In-Reply-To: <202006290309.05T39ETZ044859@repo.freebsd.org> X-Rspamd-Queue-Id: 49wWZh6ZxPz3fWw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=Sj0csJyw; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::744 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.37 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.03)[-1.027]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-0.99)[-0.987]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.26)[-0.261]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::744:from]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; 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: Mon, 29 Jun 2020 15:27:41 -0000 --34h5ghmb2n4ozvpj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Kyle, On Mon, Jun 29, 2020 at 03:09:14AM +0000, Kyle Evans wrote: > Author: kevans > Date: Mon Jun 29 03:09:14 2020 > New Revision: 362769 > URL: https://svnweb.freebsd.org/changeset/base/362769 >=20 > Log: > linuxolator: implement memfd_create syscall > =20 > This effectively mirrors our libc implementation, but with minor fudgin= g -- > name needs to be copied in from userspace, so we just copy it straight = into > stack-allocated memfd_name into the correct position rather than alloca= ting > memory that needs to be cleaned up. > =20 > The sealing-related fcntl(2) commands, F_GET_SEALS and F_ADD_SEALS, have > also been implemented now that we support them. > =20 > Note that this implementation is still not quite at feature parity w.r.= t. > the actual Linux version; some caveats, from my foggy memory: > =20 > - Need to implement SHM_GROW_ON_WRITE, default for memfd (in progress) > - LTP wants the memfd name exposed to fdescfs > - Linux allows open() of an fdescfs fd with O_TRUNC to truncate after d= up. > (?) > =20 > Interested parties can install and run LTP from ports (devel/linux-ltp)= to > confirm any fixes. > =20 > PR: 240874 > Reviewed by: kib, trasz > Differential Revision: https://reviews.freebsd.org/D21845 RELNOTES? >=20 > Modified: > head/sys/amd64/linux/linux_dummy.c > head/sys/amd64/linux32/linux32_dummy.c > head/sys/arm64/linux/linux_dummy.c > head/sys/compat/linux/linux.c > head/sys/compat/linux/linux.h > head/sys/compat/linux/linux_file.c > head/sys/compat/linux/linux_file.h > head/sys/i386/linux/linux_dummy.c Should __FreeBSD_version be bumped? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --34h5ghmb2n4ozvpj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl76CFAACgkQ/y5nonf4 4fqWNw//chzeoil4ezgEfetcfHXQifcGckup2OpFx002zqhHlCEG8ODHFI/+DchH kIbvBVBuuhv7tM4WL0ofLIDUSz2tTDy+o4/24Cn8RllQ4tmCNiBavzyNNYmCqmKE szJ6JgoHfx4eftxMp65/s0GtQ2t0m5t29zDCJCi9MboNPyyq7ECF5y+srTzeDaES hq3v1gvcaxWeQUBaOCX8zy295c7qG6MLuPWG+5f+/BDHid7uvOGY50XADqVWJ9ha Ev/aDWDcMdPhUisvBt1aQBKcl5MPtBTqjVS7Et7puyIp9E+L2UqOx9XOT0+UjZkv 5BZHBOqokcFGqPVR6OWrGgaqWG5VqeDAbd97ndm9abFKa+DV/zeLtcVkn2kfPlFx cl2TygmtpjS5KEzDCWfe8XZGVrZoFKoatDk6s93QoyBGNl3BdBXKu0UJ4yU3tvKl w6WGYYl7SVm0VSQN9ecv2nsVOcSOTIhdljxALz8TG1znj+MoTRzHnyw825/Cca4x 0n8s1q5acHUD5FytllboQ8zjnGG6M7CVvupS/+TqQsFCzeUsgYcESBgGyU/7VBn4 drpXRCc+z2K2p5SsLtMuUWGqedkxHyMurqOE0yFCnihnn75dkltqv87ynbJrUqB2 GEij8wV46SjF8XDNObC6cvNOj+r7BMxaqtNCe4BRowfBUiCLcAw= =2GjI -----END PGP SIGNATURE----- --34h5ghmb2n4ozvpj-- From owner-svn-src-head@freebsd.org Mon Jun 29 15:27:54 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 3FECD34C302; Mon, 29 Jun 2020 15:27:54 +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 49wWZy0tXYz3fZy; Mon, 29 Jun 2020 15:27:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-274.local (unknown [IPv6:2601:648:8203:2990:9cfd:9ca3:d76c:8d6]) (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 5933717818; Mon, 29 Jun 2020 15:27:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: =?UTF-8?Q?Stefan_E=c3=9fer?= , Eric van Gyzen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, emaste@FreeBSD.org References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@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: Date: Mon, 29 Jun 2020 08:27:51 -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: <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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, 29 Jun 2020 15:27:54 -0000 On 6/28/20 1:28 AM, Stefan Eßer wrote: > I could delete what's currently in contrib/bc and use svn copy to make > the whole contents of vendor/bc/dist available in contrib/bc. The tests > require 1112 KB of space, while the rest of the sources takes up less > than 900 KB. > > I could revert the full import to contrib/bc, but that would also revert > changes to e.g. usr.bin/Makefile and I'd rather remove just what's now > in contrib/bc and then use svn copy to make vendor/bc/dist available > there. The sources from the dist directory can be used unmodified, the > reason for cherry-picking was just that I did not want to import more > than is used at this time ... I do not think you should do a full revert but just fixup contrib/bc. I think it would be good to get advice from emaste@ about what is most Git-conversion-friendly. You might be able to just do a 'svn merge --record-only' to bootstrap the merge info and commit that. Barring that, you might be able to svn rm contrib/bc and then 'svn cp' it from the vendor area. You'd probably have to do that as two separate commits to make use of a URL for the 'svn cp' though which would break the tree for one commit. I suspect just doing the 'merge --record-only' is the simplest method assuming Git handles it ok. I suspect since Git ignores mergeinfo this is fine, but it would be good for Ed to confirm. You can always restore the tests in the future in contrib/bc when you want to add them. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Jun 29 15:46: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 57E3634CACE; Mon, 29 Jun 2020 15:46:45 +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 49wX0j1h4lz3grs; Mon, 29 Jun 2020 15:46:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-274.local (unknown [IPv6:2601:648:8203:2990:58bb:fc02:3149:a222]) (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 9356217829; Mon, 29 Jun 2020 15:46:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r361720 - in head: etc etc/mail usr.sbin/mailwrapper To: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006020238.0522cswW076778@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: <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> Date: Mon, 29 Jun 2020 08:46:43 -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: <202006020238.0522cswW076778@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: Mon, 29 Jun 2020 15:46:45 -0000 On 6/1/20 7:38 PM, Kyle Evans wrote: > Author: kevans > Date: Tue Jun 2 02:38:54 2020 > New Revision: 361720 > URL: https://svnweb.freebsd.org/changeset/base/361720 > > Log: > pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL > > When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that > conflict, and hilarity ensues. There's currently three different places that > we might install mailer.conf: Something about this change has made etcupdate stop updating this file. Perhaps it is now a "plain" FILE instead of a config file, so 'installconfig' no longer installs it? Given that users do edit this file (e.g. if using postfix from ports), it does seem like this should be treated as a config file? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Jun 29 16:52: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 A340B34DFB9; Mon, 29 Jun 2020 16:52:21 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 49wYSN72R8z43vR; Mon, 29 Jun 2020 16:52:20 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id px0zj5lWKYYpxpx10jbeto; Mon, 29 Jun 2020 10:52:19 -0600 X-Authority-Analysis: v=2.3 cv=OubUNx3t c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=nTHF0DUjJn0A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=iUpnydi_MgWrUi0BTRUA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 2DF0825C; Mon, 29 Jun 2020 09:52:16 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id 05TGqF9t005071; Mon, 29 Jun 2020 09:52:15 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id 05TGqFvu005068; Mon, 29 Jun 2020 09:52:15 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202006291652.05TGqFvu005068@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: John Baldwin cc: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r361720 - in head: etc etc/mail usr.sbin/mailwrapper In-reply-to: <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> References: <202006020238.0522cswW076778@repo.freebsd.org> <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> Comments: In-reply-to John Baldwin message dated "Mon, 29 Jun 2020 08:46:43 -0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 29 Jun 2020 09:52:15 -0700 X-CMAE-Envelope: MS4wfEXHJm2v3M8lmyJm7T8P/QWP/cqJuB+zczE16VWkEnkKrvkC0VN2MLXR+AEIlIpL/ztQSUL96XkalqbXqzS0vM+gai3igfgv5cORBxBUtot32hTnn2dP h9O6vfB5GbYklN5arniJQOQhHxO38CdFMUquFkbMZWpGLOLhMYJvbaMJ73vhaHsavyPqf6CFMU8X89MXZJH4jwNChhF4nSzehM/5Whshk4NC/Sdmgn6MiBbz 69LJxsW6FhT7y+QbHSTZKos01TadF5dAOKiqOyMglTwRjtnpYEd4Tf5wJMRwlL3Xj8CRrxasdq/EYiEJu3XRtw== X-Rspamd-Queue-Id: 49wYSN72R8z43vR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; 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: Mon, 29 Jun 2020 16:52:21 -0000 In message <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org>, John Baldwin wri tes: > On 6/1/20 7:38 PM, Kyle Evans wrote: > > Author: kevans > > Date: Tue Jun 2 02:38:54 2020 > > New Revision: 361720 > > URL: https://svnweb.freebsd.org/changeset/base/361720 > > > > Log: > > pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL > > > > When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf th > at > > conflict, and hilarity ensues. There's currently three different places t > hat > > we might install mailer.conf: > > Something about this change has made etcupdate stop updating this file. > Perhaps it is now a "plain" FILE instead of a config file, so 'installconfig' > no longer installs it? Given that users do edit this file (e.g. if using > postfix from ports), it does seem like this should be treated as a config > file? Yes, plain file vs config file. There was a change a couple of months ago by someone else that changed config files to plain files which totally messed up /etc after etcupdate was run. It also affected mergemaster BTW. If pkgbase needs config files to be plain files we might need a knob to make it so when pkgbase is invoking make. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Mon Jun 29 16:54: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 4F57E34E2EA; Mon, 29 Jun 2020 16:54:01 +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 49wYVK1Pndz43yj; Mon, 29 Jun 2020 16:54:01 +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 147D2A5E7; Mon, 29 Jun 2020 16:54:01 +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 05TGs0U7060434; Mon, 29 Jun 2020 16:54:00 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TGs0qK060433; Mon, 29 Jun 2020 16:54:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202006291654.05TGs0qK060433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 29 Jun 2020 16:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362784 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 362784 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 16:54:01 -0000 Author: cem Date: Mon Jun 29 16:54:00 2020 New Revision: 362784 URL: https://svnweb.freebsd.org/changeset/base/362784 Log: vm: Add missing WITNESS warnings for M_WAITOK allocation vm_map_clip_{end,start} and lookup_clip_start allocate memory M_WAITOK for !system_map vm_maps. Add WITNESS warning annotation for !system_map callers who may be holding non-sleepable locks. Reviewed by: markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D25283 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Mon Jun 29 15:15:14 2020 (r362783) +++ head/sys/vm/vm_map.c Mon Jun 29 16:54:00 2020 (r362784) @@ -2379,6 +2379,11 @@ vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, { vm_map_entry_t new_entry; + if (!map->system_map) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "%s: map %p entry %p start 0x%jx", __func__, map, entry, + (uintmax_t)start); + if (start <= entry->start) return; @@ -2409,6 +2414,11 @@ vm_map_lookup_clip_start(vm_map_t map, vm_offset_t sta { vm_map_entry_t entry; + if (!map->system_map) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "%s: map %p start 0x%jx prev %p", __func__, map, + (uintmax_t)start, prev_entry); + if (vm_map_lookup_entry(map, start, prev_entry)) { entry = *prev_entry; vm_map_clip_start(map, entry, start); @@ -2430,6 +2440,11 @@ vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, vm { vm_map_entry_t new_entry; + if (!map->system_map) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "%s: map %p entry %p end 0x%jx", __func__, map, entry, + (uintmax_t)end); + if (end >= entry->end) return; @@ -3725,6 +3740,7 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offs vm_map_entry_t entry, next_entry; VM_MAP_ASSERT_LOCKED(map); + if (start == end) return (KERN_SUCCESS); From owner-svn-src-head@freebsd.org Mon Jun 29 17:00: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 EAA0534E794; Mon, 29 Jun 2020 17:00:30 +0000 (UTC) (envelope-from jhb@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 49wYdp5wTXz44b4; Mon, 29 Jun 2020 17:00:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-274.local (unknown [IPv6:2601:648:8203:2990:58bb:fc02:3149:a222]) (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 2C3EE18515; Mon, 29 Jun 2020 17:00:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r361720 - in head: etc etc/mail usr.sbin/mailwrapper To: Cy Schubert Cc: Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006020238.0522cswW076778@repo.freebsd.org> <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> <202006291652.05TGqFvu005068@slippy.cwsent.com> 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: <4362d678-f62d-9e70-bced-8ade81223be9@FreeBSD.org> Date: Mon, 29 Jun 2020 10:00:28 -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: <202006291652.05TGqFvu005068@slippy.cwsent.com> 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: Mon, 29 Jun 2020 17:00:31 -0000 On 6/29/20 9:52 AM, Cy Schubert wrote: > In message <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org>, John Baldwin > wri > tes: >> On 6/1/20 7:38 PM, Kyle Evans wrote: >>> Author: kevans >>> Date: Tue Jun 2 02:38:54 2020 >>> New Revision: 361720 >>> URL: https://svnweb.freebsd.org/changeset/base/361720 >>> >>> Log: >>> pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL >>> >>> When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf th >> at >>> conflict, and hilarity ensues. There's currently three different places t >> hat >>> we might install mailer.conf: >> >> Something about this change has made etcupdate stop updating this file. >> Perhaps it is now a "plain" FILE instead of a config file, so 'installconfig' >> no longer installs it? Given that users do edit this file (e.g. if using >> postfix from ports), it does seem like this should be treated as a config >> file? > > Yes, plain file vs config file. There was a change a couple of months ago > by someone else that changed config files to plain files which totally > messed up /etc after etcupdate was run. It also affected mergemaster BTW. > > If pkgbase needs config files to be plain files we might need a knob to > make it so when pkgbase is invoking make. pkgbase understands config files I believe, I think it was just a bug in this commit to not set a suitable Makefile variable so mailer.conf is a "config" file. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Jun 29 17:10: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 F2CC734EDDD; Mon, 29 Jun 2020 17:10:03 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49wYrn2j2xz458Z; Mon, 29 Jun 2020 17:10:00 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1593450598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s+W/hGRub6ZRH0gNB7OaWQYidm48iycL9Ncbj9T1YXw=; b=hMVnezBre76XyIIprwOEPqvZ5emJCg7viFa5fn8Q5ut4F9Mgb/jw/iwfP9ikkAPVTFG/YT 0qsFLHaad8v274QeY8spCdYiS+yy+0mNXynRJMKKK4eJR53lcQcJArUb8G7Ms5zfZwGh3+ eht0ipAcFktmhh6Lbr5iQqt3tK40fto= Received: from amy.home (lfbn-idf2-1-900-181.w86-238.abo.wanadoo.fr [86.238.131.181]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 70c2e2e3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 29 Jun 2020 17:09:58 +0000 (UTC) Date: Mon, 29 Jun 2020 19:09:58 +0200 From: Emmanuel Vadot To: Cy Schubert Cc: John Baldwin , Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r361720 - in head: etc etc/mail usr.sbin/mailwrapper Message-Id: <20200629190958.56a010736905355abb924952@bidouilliste.com> In-Reply-To: <202006291652.05TGqFvu005068@slippy.cwsent.com> References: <202006020238.0522cswW076778@repo.freebsd.org> <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> <202006291652.05TGqFvu005068@slippy.cwsent.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49wYrn2j2xz458Z X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=hMVnezBr; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-2.97 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-1.01)[-1.010]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-0.42)[-0.422]; NEURAL_HAM_MEDIUM(-1.03)[-1.034]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; 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: Mon, 29 Jun 2020 17:10:04 -0000 On Mon, 29 Jun 2020 09:52:15 -0700 Cy Schubert wrote: > In message <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org>, John Baldwin > wri > tes: > > On 6/1/20 7:38 PM, Kyle Evans wrote: > > > Author: kevans > > > Date: Tue Jun 2 02:38:54 2020 > > > New Revision: 361720 > > > URL: https://svnweb.freebsd.org/changeset/base/361720 > > > > > > Log: > > > pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL > > > > > > When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf th > > at > > > conflict, and hilarity ensues. There's currently three different places t > > hat > > > we might install mailer.conf: > > > > Something about this change has made etcupdate stop updating this file. > > Perhaps it is now a "plain" FILE instead of a config file, so 'installconfig' > > no longer installs it? Given that users do edit this file (e.g. if using > > postfix from ports), it does seem like this should be treated as a config > > file? > > Yes, plain file vs config file. There was a change a couple of months ago > by someone else that changed config files to plain files which totally > messed up /etc after etcupdate was run. It also affected mergemaster BTW. This was https://svnweb.freebsd.org/base?view=revision&revision=359294 > If pkgbase needs config files to be plain files we might need a knob to > make it so when pkgbase is invoking make. It doesn't, pkg needs to know about config files, the problem with my commit is more an etcupdate/mergemaster problem than a pkgbase one. iirc etcupdate do a make distribution to find new files and diffs and switching a config file from a plain files will cause the file to be installed by installworld so etcupdate thinks that it was deleted. I've tried a bit to fix that in etcupdate but couldn't find a proper way to do it. And no we won't want a knob to have a "pkgbase build", this will cause more problems. > > -- > Cheers, > Cy Schubert > FreeBSD UNIX: Web: https://FreeBSD.org > NTP: Web: https://nwtime.org > > The need of the many outweighs the greed of the few. > > -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Mon Jun 29 17:13: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 D903334EE5D; Mon, 29 Jun 2020 17:13:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49wYwD5NNzz45XN; Mon, 29 Jun 2020 17:13:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 9BAC4187ED; Mon, 29 Jun 2020 17:13:00 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f179.google.com with SMTP id c139so15902253qkg.12; Mon, 29 Jun 2020 10:13:00 -0700 (PDT) X-Gm-Message-State: AOAM530HJvxYbvoUh5buze1WNbv6pdQ5nZPOLRCObN/WKCYIvtVk4nGe 20H/flvo88TBwVp/mgMCAyHgrztEjksOmuaF6oU= X-Google-Smtp-Source: ABdhPJwJv9IR6WuLbwCyEyCviDrK1bmSc1TDpTszvZucQkbUnbXHZXHkXYwbzMIDTkggSh1STNexanLXYgB+wRD+FOk= X-Received: by 2002:a37:bcb:: with SMTP id 194mr16572038qkl.103.1593450780156; Mon, 29 Jun 2020 10:13:00 -0700 (PDT) MIME-Version: 1.0 References: <202006020238.0522cswW076778@repo.freebsd.org> <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> In-Reply-To: <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> From: Kyle Evans Date: Mon, 29 Jun 2020 12:12:48 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361720 - in head: etc etc/mail usr.sbin/mailwrapper 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: Mon, 29 Jun 2020 17:13:00 -0000 On Mon, Jun 29, 2020 at 10:46 AM John Baldwin wrote: > > On 6/1/20 7:38 PM, Kyle Evans wrote: > > Author: kevans > > Date: Tue Jun 2 02:38:54 2020 > > New Revision: 361720 > > URL: https://svnweb.freebsd.org/changeset/base/361720 > > > > Log: > > pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL > > > > When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that > > conflict, and hilarity ensues. There's currently three different places that > > we might install mailer.conf: > > Something about this change has made etcupdate stop updating this file. > Perhaps it is now a "plain" FILE instead of a config file, so 'installconfig' > no longer installs it? Given that users do edit this file (e.g. if using > postfix from ports), it does seem like this should be treated as a config > file? Ah, whoops, this is my bad indeed. :-( I had noticed that the mailwrapper install used FILES instead of CONFS like dma(8), but I forgot to go back and correct the inconsistency. Will fix ASAP. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Mon Jun 29 17:19: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 D983434EE7B; Mon, 29 Jun 2020 17:19:08 +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 49wZ3J5NBqz45Mh; Mon, 29 Jun 2020 17:19:08 +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 9D3C7ACBF; Mon, 29 Jun 2020 17:19:08 +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 05THJ8ZW073183; Mon, 29 Jun 2020 17:19:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05THJ8rp073182; Mon, 29 Jun 2020 17:19:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202006291719.05THJ8rp073182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 29 Jun 2020 17:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362785 - head/lib/csu/arm X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/csu/arm X-SVN-Commit-Revision: 362785 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 17:19:08 -0000 Author: jhb Date: Mon Jun 29 17:19:08 2020 New Revision: 362785 URL: https://svnweb.freebsd.org/changeset/base/362785 Log: Stop using STATIC_CFLAGS. This was added in r293648 to pass -mlong-calls for crt1.o and gcrt1.o. The use of -mlong-calls was removed in r358851 for LLVM 10.0, leaving STATIC_CFLAGS empty. Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25305 Modified: head/lib/csu/arm/Makefile Modified: head/lib/csu/arm/Makefile ============================================================================== --- head/lib/csu/arm/Makefile Mon Jun 29 16:54:00 2020 (r362784) +++ head/lib/csu/arm/Makefile Mon Jun 29 17:19:08 2020 (r362785) @@ -21,13 +21,13 @@ CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_ CLEANFILES+= crtbrand.o ignore_init_note.o crt1_c.o: crt1_c.c - ${CC} ${CFLAGS} ${STATIC_CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1_c.c + ${CC} ${CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1_c.c crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} ${STATIC_CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c + ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} From owner-svn-src-head@freebsd.org Mon Jun 29 17:30: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 5903734F774; Mon, 29 Jun 2020 17:30:05 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 49wZHw1XYCz46M3; Mon, 29 Jun 2020 17:30:03 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id pxbSj67dOYYpxpxbUjbxJ7; Mon, 29 Jun 2020 11:30:02 -0600 X-Authority-Analysis: v=2.3 cv=OubUNx3t c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=nTHF0DUjJn0A:10 a=7ASnObcnAAAA:8 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=RHjebqAHt0weKjOVJqwA:9 a=CjuIK1q_8ugA:10 a=pj5rz7AvTRnaHDIeLm0D:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 1E7192EB; Mon, 29 Jun 2020 10:29:58 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id 05THTw8b005521; Mon, 29 Jun 2020 10:29:58 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id 05THTves005518; Mon, 29 Jun 2020 10:29:57 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202006291729.05THTves005518@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Emmanuel Vadot cc: Cy Schubert , John Baldwin , Kyle Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r361720 - in head: etc etc/mail usr.sbin/mailwrapper In-reply-to: <20200629190958.56a010736905355abb924952@bidouilliste.com> References: <202006020238.0522cswW076778@repo.freebsd.org> <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org> <202006291652.05TGqFvu005068@slippy.cwsent.com> <20200629190958.56a010736905355abb924952@bidouilliste.com> Comments: In-reply-to Emmanuel Vadot message dated "Mon, 29 Jun 2020 19:09:58 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 29 Jun 2020 10:29:57 -0700 X-CMAE-Envelope: MS4wfGhuPn4rCYc6GDIkAJIaY0pscCwMMJKGtUwCbB1STLwdpQj3bhAEapgDMLlFSX7p6met827wmz9aJpJDHblIU0OCcsldpRGkr1s9Z8CKWYWMYlF1KtKH jCPqaYAE6AvjZffm7KqvXwwlW6IMQkf3nCrzXDSfSTkPygUAAHjXSbPHcTCfNql+WVRdacLBEhJJxSDW84NGlfwnYYd3k7T2OmPsIUyqQge4SMk+/TbNplMD SjnfnWPnE/psBlL8tfJNHtX/kfI8HevlZx2rV4H1OpUApU4vfCl3z6wMCFge+rn8Gpsy2C7TG22Yz6vYAdnyYBJ6eQ8R8M1aVmEoQc1KHUua2OM1Ex6mehP4 bGf65VaG X-Rspamd-Queue-Id: 49wZHw1XYCz46M3 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.136.139) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-0.10 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-0.85)[-0.851]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; ARC_NA(0.00)[]; AUTH_NA(1.00)[]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.125.17:received]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.13)[-0.131]; RCPT_COUNT_SEVEN(0.00)[7]; NEURAL_HAM_MEDIUM(-0.42)[-0.419]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.136.139:from] 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, 29 Jun 2020 17:30:05 -0000 In message <20200629190958.56a010736905355abb924952@bidouilliste.com>, Emmanuel Vadot writes: > On Mon, 29 Jun 2020 09:52:15 -0700 > Cy Schubert wrote: > > > In message <475e0172-0a4a-0201-3e2f-9e231b75f3e9@FreeBSD.org>, John Baldwin > > > wri > > tes: > > > On 6/1/20 7:38 PM, Kyle Evans wrote: > > > > Author: kevans > > > > Date: Tue Jun 2 02:38:54 2020 > > > > New Revision: 361720 > > > > URL: https://svnweb.freebsd.org/changeset/base/361720 > > > > > > > > Log: > > > > pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL > > > > > > > > When WITHOUT_SENDMAIL is set, we end up with two different mailer.con > f th > > > at > > > > conflict, and hilarity ensues. There's currently three different plac > es t > > > hat > > > > we might install mailer.conf: > > > > > > Something about this change has made etcupdate stop updating this file. > > > Perhaps it is now a "plain" FILE instead of a config file, so 'installcon > fig' > > > no longer installs it? Given that users do edit this file (e.g. if using > > > postfix from ports), it does seem like this should be treated as a config > > > file? > > > > Yes, plain file vs config file. There was a change a couple of months ago > > by someone else that changed config files to plain files which totally > > messed up /etc after etcupdate was run. It also affected mergemaster BTW. > > This was https://svnweb.freebsd.org/base?view=revision&revision=359294 > > > If pkgbase needs config files to be plain files we might need a knob to > > make it so when pkgbase is invoking make. > > It doesn't, pkg needs to know about config files, the problem with my > commit is more an etcupdate/mergemaster problem than a pkgbase one. > iirc etcupdate do a make distribution to find new files and diffs and > switching a config file from a plain files will cause the file to be > installed by installworld so etcupdate thinks that it was deleted. I've > tried a bit to fix that in etcupdate but couldn't find a proper way to > do it. Mergemaster also does make distribution. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Mon Jun 29 17:43: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 654993500A8; Mon, 29 Jun 2020 17:43:01 +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 49wZZs263Nz47Qm; Mon, 29 Jun 2020 17:43:01 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 27AF318B2E; Mon, 29 Jun 2020 17:43:01 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f178.google.com with SMTP id v19so13456276qtq.10; Mon, 29 Jun 2020 10:43:01 -0700 (PDT) X-Gm-Message-State: AOAM532iDus0sVz9z3hV4DZHZQZcV9thAEpVKG0mv0998v/lHG4NUsQy O2B10af9jdlJiILEfTwXaMRiHnq7Ec5Pojg9KCk= X-Google-Smtp-Source: ABdhPJw/8TJ4pk78leirkf+lMBOzNt4osz72RKXl4mNr1Z688bIqRnZ3m6hpEpEcUr9Vd5yLAeco3ir1YNYNlG+8z7Q= X-Received: by 2002:ac8:691:: with SMTP id f17mr16726262qth.60.1593452580615; Mon, 29 Jun 2020 10:43:00 -0700 (PDT) MIME-Version: 1.0 References: <202006290309.05T39ETZ044859@repo.freebsd.org> <20200629152717.2ojwnipxkmjaoix2@mutt-hbsd> In-Reply-To: <20200629152717.2ojwnipxkmjaoix2@mutt-hbsd> From: Kyle Evans Date: Mon, 29 Jun 2020 12:42:49 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r362769 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux To: Shawn Webb Cc: src-committers , svn-src-all , svn-src-head , =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= 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, 29 Jun 2020 17:43:01 -0000 On Mon, Jun 29, 2020 at 10:27 AM Shawn Webb wrote: > > Hey Kyle, > > On Mon, Jun 29, 2020 at 03:09:14AM +0000, Kyle Evans wrote: > > Author: kevans > > Date: Mon Jun 29 03:09:14 2020 > > New Revision: 362769 > > URL: https://svnweb.freebsd.org/changeset/base/362769 > > > > Log: > > linuxolator: implement memfd_create syscall > > > > This effectively mirrors our libc implementation, but with minor fudging -- > > name needs to be copied in from userspace, so we just copy it straight into > > stack-allocated memfd_name into the correct position rather than allocating > > memory that needs to be cleaned up. > > > > The sealing-related fcntl(2) commands, F_GET_SEALS and F_ADD_SEALS, have > > also been implemented now that we support them. > > > > Note that this implementation is still not quite at feature parity w.r.t. > > the actual Linux version; some caveats, from my foggy memory: > > > > - Need to implement SHM_GROW_ON_WRITE, default for memfd (in progress) > > - LTP wants the memfd name exposed to fdescfs > > - Linux allows open() of an fdescfs fd with O_TRUNC to truncate after dup. > > (?) > > > > Interested parties can install and run LTP from ports (devel/linux-ltp) to > > confirm any fixes. > > > > PR: 240874 > > Reviewed by: kib, trasz > > Differential Revision: https://reviews.freebsd.org/D21845 > > RELNOTES? > > > > > Modified: > > head/sys/amd64/linux/linux_dummy.c > > head/sys/amd64/linux32/linux32_dummy.c > > head/sys/arm64/linux/linux_dummy.c > > head/sys/compat/linux/linux.c > > head/sys/compat/linux/linux.h > > head/sys/compat/linux/linux_file.c > > head/sys/compat/linux/linux_file.h > > head/sys/i386/linux/linux_dummy.c > > Should __FreeBSD_version be bumped? > I'm roping in trasz@, because I'm unsure on either of these points -- I haven't paid attention and don't know if we typically include linux syscalls that we implement in relnotes, and given that this commit only really affects pre-compiled Linux binaries I'm not sure if there's any utility in bumping __FreeBSD_version; presumably ports folks can't do anything differently here, and binaries will work just the same. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Mon Jun 29 17:47: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 63F4534FFBA; Mon, 29 Jun 2020 17:47:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49wZgT217Lz47mp; Mon, 29 Jun 2020 17:47:01 +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 28422B2E2; Mon, 29 Jun 2020 17:47:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05THl1pR091904; Mon, 29 Jun 2020 17:47:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05THl163091903; Mon, 29 Jun 2020 17:47:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006291747.05THl163091903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 29 Jun 2020 17:47:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362786 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362786 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 17:47:01 -0000 Author: kevans Date: Mon Jun 29 17:47:00 2020 New Revision: 362786 URL: https://svnweb.freebsd.org/changeset/base/362786 Log: linux: reposition the comment for bsd_to_linux_bits/linux_to_bsd_bits rpokala notes that splitting the definitions like this is kind of silly, since the comment applies to both. Move the comment up (or the definition down, depending on your perspective on life) accordingly. Reported by: rpokala Modified: head/sys/compat/linux/linux.h Modified: head/sys/compat/linux/linux.h ============================================================================== --- head/sys/compat/linux/linux.h Mon Jun 29 17:19:08 2020 (r362785) +++ head/sys/compat/linux/linux.h Mon Jun 29 17:47:00 2020 (r362786) @@ -165,9 +165,6 @@ int bsd_to_linux_bits_(int value, struct bsd_to_linux_ int linux_to_bsd_bits_(int value, struct bsd_to_linux_bitmap *bitmap, size_t mapcnt, int no_value); -#define bsd_to_linux_bits(_val, _bmap, _noval) \ - bsd_to_linux_bits_((_val), (_bmap), nitems((_bmap)), (_noval)) - /* * These functions are used for simplification of BSD <-> Linux bit conversions. * Given `value`, a bit field, these functions will walk the given bitmap table @@ -176,6 +173,8 @@ int linux_to_bsd_bits_(int value, struct bsd_to_linux_ * represented with the bit values appropriate for the target platform. * Otherwise, the value supplied as `no_value` is returned. */ +#define bsd_to_linux_bits(_val, _bmap, _noval) \ + bsd_to_linux_bits_((_val), (_bmap), nitems((_bmap)), (_noval)) #define linux_to_bsd_bits(_val, _bmap, _noval) \ linux_to_bsd_bits_((_val), (_bmap), nitems((_bmap)), (_noval)) From owner-svn-src-head@freebsd.org Mon Jun 29 17:47: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 2E0FE350146 for ; Mon, 29 Jun 2020 17:47:52 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (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 49wZhR3tWRz47xN for ; Mon, 29 Jun 2020 17:47:51 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x841.google.com with SMTP id v19so13468475qtq.10 for ; Mon, 29 Jun 2020 10:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=H3UE1CsSLolUF//MIGaKxVN18uJC60taaK6CQOj7gpc=; b=UEbZkps+h6WY2bmt7d87tOsx9DutIF+Aj4qc1FuYqPZprNlc0ZJUNou+8RCj0k4wA7 dWtFwA38sbBE7PhuH8CYvYpHNuh/j2fCNaCnvo41Z2SbqT2aXlGqIQ1ECR2qxaY4ck0q 2dyQJ97jnUcf0YVZ04soBadkSJ+uNxzujlf1J2ANINldp7+mw7Vb72w19HpcpsXfRsLy 6rKicPyUiyA7IzsA1uKVwPulHlO+3lpA5zahyEJ+zm4Zcr8UZk7uoAgTR0XVOm5YIOKY DHTPGZgpb0S50qbTixhCB362pBazXb5UmYkiIO2f/DDlGmU+mo8U6la71+OIROAsLr/A md8g== 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:references :mime-version:content-disposition:in-reply-to; bh=H3UE1CsSLolUF//MIGaKxVN18uJC60taaK6CQOj7gpc=; b=TIKMG+LTLhB1suwNL/ARwTiJrsqTlaq2to8k5z+7WU3Yb2RRD9R8ZeTupCRiwseBXa JJyBqpJlf8yNUzOEZokbIapqMzU5OoWpFl9cB2b0PnyidauHyxfPvncDs53f+ti/C0Al 0yL6L9tYGpnB+Hs+WTZ+ryXV1miudQmTVytSDS3yLWJkZUmgj3RMBgAa2TZTkTQliyt0 guaW2Zfqf2VAs5Kj3tYrvJz0pBsyM/btjC5fut059qfrYmWxsJ8CBUOkE7N6ms6JTfRD Ilmxc+eEW8+MchrrGHw5a+SjSdX/sbbc+o2DCjIvAhX1rVIMxzy/JOkFXZ5T0lUxkRzL 4qEg== X-Gm-Message-State: AOAM531+zozX7A6IuwKFQoGZ5WR3F9dJ/syQYdWHUgEkzqcIjekElxE0 82qXMTsSXj4OhfROUPO2qbsMOQ== X-Google-Smtp-Source: ABdhPJzhKyI2MISBRB2VjTI8iv2CLxNjkffI3fbh0vAy07eK2MVkBFniqKgmBJWTZb3hJPFtQxYbnw== X-Received: by 2002:ac8:3981:: with SMTP id v1mr16848003qte.134.1593452870667; Mon, 29 Jun 2020 10:47:50 -0700 (PDT) Received: from mutt-hbsd (75-148-2-186-WashingtonDC.hfc.comcastbusiness.net. [75.148.2.186]) by smtp.gmail.com with ESMTPSA id j7sm388752qtd.53.2020.06.29.10.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 10:47:50 -0700 (PDT) Date: Mon, 29 Jun 2020 13:47:28 -0400 From: Shawn Webb To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head , Edward Tomasz Napiera??a Subject: Re: svn commit: r362769 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux Message-ID: <20200629174728.ln77pjbg65v3kxwf@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202006290309.05T39ETZ044859@repo.freebsd.org> <20200629152717.2ojwnipxkmjaoix2@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2b2d3wgxtc4uresf" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 49wZhR3tWRz47xN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=UEbZkps+; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::841 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.22 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.03)[-1.030]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-0.99)[-0.994]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.10)[-0.095]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::841:from]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; 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: Mon, 29 Jun 2020 17:47:52 -0000 --2b2d3wgxtc4uresf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 29, 2020 at 12:42:49PM -0500, Kyle Evans wrote: > On Mon, Jun 29, 2020 at 10:27 AM Shawn Webb = wrote: > > > > Hey Kyle, > > > > On Mon, Jun 29, 2020 at 03:09:14AM +0000, Kyle Evans wrote: > > > Author: kevans > > > Date: Mon Jun 29 03:09:14 2020 > > > New Revision: 362769 > > > URL: https://svnweb.freebsd.org/changeset/base/362769 > > > > > > Log: > > > linuxolator: implement memfd_create syscall > > > > > > This effectively mirrors our libc implementation, but with minor fu= dging -- > > > name needs to be copied in from userspace, so we just copy it strai= ght into > > > stack-allocated memfd_name into the correct position rather than al= locating > > > memory that needs to be cleaned up. > > > > > > The sealing-related fcntl(2) commands, F_GET_SEALS and F_ADD_SEALS,= have > > > also been implemented now that we support them. > > > > > > Note that this implementation is still not quite at feature parity = w.r.t. > > > the actual Linux version; some caveats, from my foggy memory: > > > > > > - Need to implement SHM_GROW_ON_WRITE, default for memfd (in progre= ss) > > > - LTP wants the memfd name exposed to fdescfs > > > - Linux allows open() of an fdescfs fd with O_TRUNC to truncate aft= er dup. > > > (?) > > > > > > Interested parties can install and run LTP from ports (devel/linux-= ltp) to > > > confirm any fixes. > > > > > > PR: 240874 > > > Reviewed by: kib, trasz > > > Differential Revision: https://reviews.freebsd.org/D21845 > > > > RELNOTES? > > > > > > > > Modified: > > > head/sys/amd64/linux/linux_dummy.c > > > head/sys/amd64/linux32/linux32_dummy.c > > > head/sys/arm64/linux/linux_dummy.c > > > head/sys/compat/linux/linux.c > > > head/sys/compat/linux/linux.h > > > head/sys/compat/linux/linux_file.c > > > head/sys/compat/linux/linux_file.h > > > head/sys/i386/linux/linux_dummy.c > > > > Should __FreeBSD_version be bumped? > > >=20 > I'm roping in trasz@, because I'm unsure on either of these points -- > I haven't paid attention and don't know if we typically include linux > syscalls that we implement in relnotes, and given that this commit > only really affects pre-compiled Linux binaries I'm not sure if > there's any utility in bumping __FreeBSD_version; presumably ports > folks can't do anything differently here, and binaries will work just > the same. Hey Kyle, I assumed as much, but I wasn't entirely sure. I thought I'd just ask anyways. Thanks for the clarification. :) --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --2b2d3wgxtc4uresf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl76KSsACgkQ/y5nonf4 4foVHw/+M7P2PtbrYgTpYcuieXRoHk0M3V8OUFP9v5l/Eof94f+sSvBQqzF5279j 045OkhvaXNeCKpXUxOAy/D0HXQQWNMB4JenMAQHkVEJ/fAnnXmFdtMgzUjEZHPB2 Ka3SyByuwCBarZFQymDpquLFsU8N6IG+yHYPmedXhQnYBchAlHr7oMUfoDLiwF8X SCJCASu5hrKwv1XMWa7HB9xTAmUiG4Qo2Lc8PAQaNVcIWQJJraDJIoI7PylfDi1M mMoVulM90P8GbpkiuxASr9459O5kCk0cVmfvZrtCC0Mc8PwnuF6WLBiSIP9rJMAz I8gDhXTCU62Ds88r7B0JXE+5DzZvTyDKdLDgqTc3+EtzAbIDzy+Tu818XfnBMvAI PrjuTvOdeZBbX09yT+ECKZYlwvJZDdQ5jT2fZbQUH+lVaw66dPNwJrjHJ8IRc9mr IW/ZwFTnqqBSNeOBx2ll/YxEnmG193RuZ9Ikv+d/Ku5LYW7uMOI1vorWnOo+HqFz RUflmxi4N2Iuswq7IRmif9/U4p7L43PjZsPIGguSOop+V6XSj2FaomEDgtV/PoJw 4rJVQRTnYsgmbw3EfkgOMp9ir+jrLwcdnxVRKEbpMokwhL4dpo9Uo6d5V2hyoqHb EiyS7mmQDibV1d87MHxmZPyuTS4+aCKHZ2q+hYg4WU2uVc0XD1U= =dOHS -----END PGP SIGNATURE----- --2b2d3wgxtc4uresf-- From owner-svn-src-head@freebsd.org Mon Jun 29 18:06: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 4A6DD35007E; Mon, 29 Jun 2020 18:06:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49wb5P13tZz48yR; Mon, 29 Jun 2020 18:06:01 +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 07CBBB59E; Mon, 29 Jun 2020 18:06:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05TI60S2004536; Mon, 29 Jun 2020 18:06:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TI60UM004535; Mon, 29 Jun 2020 18:06:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202006291806.05TI60UM004535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 29 Jun 2020 18:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362787 - head/usr.sbin/mailwrapper X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/mailwrapper X-SVN-Commit-Revision: 362787 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 18:06:01 -0000 Author: kevans Date: Mon Jun 29 18:06:00 2020 New Revision: 362787 URL: https://svnweb.freebsd.org/changeset/base/362787 Log: mailwrapper: switch mailer.conf to CONFS This matches what was already being done in dma(8), and should again make this merge with etcupdate/mergemaster. Reported by: jhb Modified: head/usr.sbin/mailwrapper/Makefile Modified: head/usr.sbin/mailwrapper/Makefile ============================================================================== --- head/usr.sbin/mailwrapper/Makefile Mon Jun 29 17:47:00 2020 (r362786) +++ head/usr.sbin/mailwrapper/Makefile Mon Jun 29 18:06:00 2020 (r362787) @@ -31,9 +31,9 @@ SYMLINKS+= ..${BINDIR}/mailwrapper /bin/rmail # dma(8) are installed and simply provide a default that can be changed for an # alternative in ports. .if ${MK_SENDMAIL} != "no" || ${MK_DMAGENT} == "no" -FILES= ${SRCTOP}/etc/mail/mailer.conf -FILESDIR= /etc/mail -FILESMODE= 644 +CONFS= ${SRCTOP}/etc/mail/mailer.conf +CONFSDIR= /etc/mail +CONFSMODE= 644 .endif .endif From owner-svn-src-head@freebsd.org Mon Jun 29 18:09: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 14AFE350898; Mon, 29 Jun 2020 18:09:41 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.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 49wb9c5Hphz491J; Mon, 29 Jun 2020 18:09:40 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f49.google.com with SMTP id c16so18167173ioi.9; Mon, 29 Jun 2020 11:09:40 -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:from:date :message-id:subject:to:cc; bh=MejSuKe3AmvNTNKsMFcqGWoZXcTRclrEvATJNZXssGw=; b=YXfTKHV5/B7+c0xYTnQROcVZBeQXWnu+4bjs6hPbqw3qIopxge2bpn25pYLJVOVfE8 WVNBxg19bxpvWMZz0cdijRfYm5jbgfqCY8UdgYjaZ4ytF43vB1R4Z6Tlbfp1tGUwHxrH yn7zE4x//ZpdQeHeV31d+heO0lWm/CSCdeYBF7VTe4s71T972s3BeyR37+kaG147f1HC F5DBNbCSgNzownbouaePizLKbPJ/ZkWRi1jExULyelIwM6LflNw7o1ayqnnKxgQPMFqq jvxeJYDqz/SZzaOVI/aMx42YBMwJdoGxjDImsqEHsm7CbhQ0FYboA6vZbp7K1BOBjGwH NMwg== X-Gm-Message-State: AOAM532mam4yU5K7IUAGgxg/8ne7FCQKxP8GQc861TvacNB8zm9yt0h7 Zmhb7ZfAK/1PNgyGYjbK66T3in1kn3qDzHI1aExW+g== X-Google-Smtp-Source: ABdhPJwNQcM5gMuhjHSeVK3lgXBfq3Eg3E/V+9/aIQJbIfwGKrwnYCeJ2o32BQiokZHLW+53+ACn8RSQoAwc+DmLlAY= X-Received: by 2002:a5d:9a97:: with SMTP id c23mr6705792iom.179.1593454178659; Mon, 29 Jun 2020 11:09:38 -0700 (PDT) MIME-Version: 1.0 References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> In-Reply-To: From: Ed Maste Date: Mon, 29 Jun 2020 14:09:27 -0400 Message-ID: Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: John Baldwin Cc: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= , Eric van Gyzen , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 49wb9c5Hphz491J 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] 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, 29 Jun 2020 18:09:41 -0000 On Mon, 29 Jun 2020 at 11:27, John Baldwin wrote: > > I suspect just doing the 'merge --record-only' is the simplest method > assuming Git handles it ok. I suspect since Git ignores mergeinfo this > is fine, but it would be good for Ed to confirm. You can always restore > the tests in the future in contrib/bc when you want to add them. I think a --record-only merge is the best approach; in any case we have a number of these in the tree already and Git will have to deal with them. From owner-svn-src-head@freebsd.org Mon Jun 29 19:30: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 251F2353989; Mon, 29 Jun 2020 19:30:36 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49wcz00ByFz4J41; Mon, 29 Jun 2020 19:30:36 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE809C1F1; Mon, 29 Jun 2020 19:30:35 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05TJUZpT054088; Mon, 29 Jun 2020 19:30:35 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TJUZEt054087; Mon, 29 Jun 2020 19:30:35 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202006291930.05TJUZEt054087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 29 Jun 2020 19:30:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362788 - head/lib/libc/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/lib/libc/riscv X-SVN-Commit-Revision: 362788 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 19:30:36 -0000 Author: mhorne Date: Mon Jun 29 19:30:35 2020 New Revision: 362788 URL: https://svnweb.freebsd.org/changeset/base/362788 Log: Fix printf(3) output of long doubles on RISC-V When the RISC-V port was initially committed to FreeBSD, GCC would generate 64-bit long doubles, and the definitions in _fpmath.h reflected that. This was changed to 128-bit in GCC later that year [1], but the definitions were never updated, despite the documented workaround. This causes printf(3) and friends to interpret only the low 64-bits of a long double in ldtoa, thereby printing incorrect values. Update the definitions now that both clang and GCC generate 128-bit long doubles. [1] https://github.com/riscv/riscv-gcc/commit/54b21fc5ae83cefec44bc2caed4a8c664c274ba0 PR: 242067 Reported by: Dennis Clarke MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25420 Modified: head/lib/libc/riscv/_fpmath.h Modified: head/lib/libc/riscv/_fpmath.h ============================================================================== --- head/lib/libc/riscv/_fpmath.h Mon Jun 29 18:06:00 2020 (r362787) +++ head/lib/libc/riscv/_fpmath.h Mon Jun 29 19:30:35 2020 (r362788) @@ -46,19 +46,6 @@ union IEEEl2bits { #define LDBL_IMPLICIT_NBIT #define mask_nbit_l(u) ((void)0) -#define LDBL_MANH_SIZE 20 -#define LDBL_MANL_SIZE 32 - -#define LDBL_TO_ARRAY32(u, a) do { \ - (a)[0] = (uint32_t)(u).bits.manl; \ - (a)[1] = (uint32_t)(u).bits.manh; \ -} while(0) - -/* - * TODO: Due to compiler problem we are temporary using - * LDBL_PREC == 53. Use code below for LDBL_PREC == 113 - */ -#if 0 #define LDBL_MANH_SIZE 48 #define LDBL_MANL_SIZE 64 @@ -68,4 +55,3 @@ union IEEEl2bits { (a)[2] = (uint32_t)(u).bits.manh; \ (a)[3] = (uint32_t)((u).bits.manh >> 32); \ } while(0) -#endif From owner-svn-src-head@freebsd.org Mon Jun 29 20:15: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 46680354506; Mon, 29 Jun 2020 20:15:03 +0000 (UTC) (envelope-from rpokala@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 49wdyH1DYqz4L8Y; Mon, 29 Jun 2020 20:15:03 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.71] (unknown [12.202.168.51]) (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 9370E19D32; Mon, 29 Jun 2020 20:15:02 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.38.20061401 Date: Mon, 29 Jun 2020 13:14:59 -0700 Subject: Re: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux From: Ravi Pokala To: Hans Petter Selasky , , , Message-ID: Thread-Topic: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux References: <202006291308.05TD8eTP014019@repo.freebsd.org> In-Reply-To: <202006291308.05TD8eTP014019@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" 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: Mon, 29 Jun 2020 20:15:03 -0000 -----Original Message----- From: on behalf of Hans Petter Selasky Date: 2020-06-29, Monday at 06:08 To: , , Subject: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux Author: hselasky Date: Mon Jun 29 13:08:40 2020 New Revision: 362781 URL: https://svnweb.freebsd.org/changeset/base/362781 Log: Implement is_signed(), type_max() and type_min() function macros in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 12:59:09 2020 (r362780) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 13:08:40 2020 (r362781) @@ -564,4 +564,20 @@ linux_ratelimited(linux_ratelimit_t *rl) #define __is_constexpr(x) \ __builtin_constant_p(x) Hi Hans, +#define is_signed(x) (((x)-1 / (x)2) == (x)0) It took me several reads to understand this, until I figured out that 'x' is not a variable, it's the name of a *type*. If 'x' is a variable, then '(x)-1' is subtraction, but '(x)2' and '(x)0' are nonsensical. If 'x' is a *type*, then '(x)-1' is typecasting '-1', and similarly for '(x)2' and '(x)0'. So, perhaps a comment, or a better name for 'x'? Thanks, Ravi (rpokala@) +#define type_max(x) ( \ + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MAX : UINT64_MAX) : \ + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MAX : UINT32_MAX) : \ + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MAX : UINT16_MAX) : \ + (is_signed(x) ? INT8_MAX : UINT8_MAX) \ +) + +#define type_min(x) ( \ + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MIN : 0) : \ + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MIN : 0) : \ + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MIN : 0) : \ + (is_signed(x) ? INT8_MIN : 0) \ +) + #endif /* _LINUX_KERNEL_H_ */ From owner-svn-src-head@freebsd.org Mon Jun 29 20:26: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 93CFB354823 for ; Mon, 29 Jun 2020 20:26:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) (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 49wfD21pT3z4M1K for ; Mon, 29 Jun 2020 20:26:58 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x836.google.com with SMTP id z2so13931217qts.5 for ; Mon, 29 Jun 2020 13:26:58 -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=Rmy7dZwkTK1bYLQg/Pld80RFXvuLEQQ2YYkZrrodFn8=; b=ZHIL2eONoPmq4TfX5Vaa7hJrPvBe6+yWIPV4XEtrttGaMl+iell1kCI3ZBX8un2zlw fic3sLYOK87PbbAB9ak3G/WP0C0w/LyVhzgp5zLNNAgrbAyL8gBWjLvMrh7uG0JxW0e9 Y7EqBv2NywddRN9+WBJckFql7im/HfRwRO5ADr8OagMRTIuHHfn89e3TYizjA1WUmhlO U+uYogIDoUbH4OF4rNz/BRWywfn19L9zhgWRM7SHqiLNihhkOSLlcZckOb/GBPv2+JRx p42yj4jS0my1Q2PfaKJ1i7wEchHSk34UoOm8uX+P+vgxBtsoSC/aMHSXwVaCvP9KXWtm 70jw== 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=Rmy7dZwkTK1bYLQg/Pld80RFXvuLEQQ2YYkZrrodFn8=; b=U2WUsXul/pXoF9aOKmkV8TSKPUPVYjSdAd0rlzXvSwCoawql+jzJEerVs3K89QHSHI dIOvIH8/ociEmP15rLq9iEpfnCqWu3AIuTbsXxUTwPuMLvm0tFih82BACFJuwotcfQ87 fXASPqQGAZCGHa8+TSrtHwIrmVpA+oKeU0AvoljH63IpDDZQ7jWni20hYwPNgBxMlwGV w275EUMOcBA1IIEEph4WcMW6sLO0aNh1osnm11ioNH+gJTq3Ft9C2hI0TultNbaEnlSL h0bbDlo+Ia9A+54zg1niKhk9qiX1hw59cscHNOIDieLxn6jH1clbpUOSlDqLOvqyeGLO 044w== X-Gm-Message-State: AOAM530YQTcOC/lXVoLbN7avPHHWBhGCmwnqBrT7i0NwH0KABUH6xuse VMdkaWJX+eHe9IAdZkk0QIMwwuO8RmzaGwiVxUWwUGDC998= X-Google-Smtp-Source: ABdhPJzlKKyNgHS/3h3L04hLNrqYilp5a1tRIdf0toT+hWVGxP9sqLOVxAugC6llE5QNDrsfKu0QNc5gKK8r5yiuL50= X-Received: by 2002:ac8:34e8:: with SMTP id x37mr18184850qtb.291.1593462417047; Mon, 29 Jun 2020 13:26:57 -0700 (PDT) MIME-Version: 1.0 References: <202006291308.05TD8eTP014019@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Mon, 29 Jun 2020 14:26:45 -0600 Message-ID: Subject: Re: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux To: Ravi Pokala Cc: Hans Petter Selasky , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 49wfD21pT3z4M1K X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=ZHIL2eON; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::836) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-2.64 / 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.97)[-0.970]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-0.99)[-0.995]; 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)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.67)[-0.671]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::836: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:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; 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: Mon, 29 Jun 2020 20:26:59 -0000 On Mon, Jun 29, 2020, 2:15 PM Ravi Pokala wrote: > -----Original Message----- > From: on behalf of Hans Petter Selasky > > Date: 2020-06-29, Monday at 06:08 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r362781 - > head/sys/compat/linuxkpi/common/include/linux > > Author: hselasky > Date: Mon Jun 29 13:08:40 2020 > New Revision: 362781 > URL: https://svnweb.freebsd.org/changeset/base/362781 > > Log: > Implement is_signed(), type_max() and type_min() function macros in > the > LinuxKPI. > > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/include/linux/kernel.h > > Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h > > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 > 12:59:09 2020 (r362780) > +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 > 13:08:40 2020 (r362781) > @@ -564,4 +564,20 @@ linux_ratelimited(linux_ratelimit_t *rl) > #define __is_constexpr(x) \ > __builtin_constant_p(x) > > Hi Hans, > > +#define is_signed(x) (((x)-1 / (x)2) == (x)0) > > It took me several reads to understand this, until I figured out that 'x' > is not a variable, it's the name of a *type*. > > If 'x' is a variable, then '(x)-1' is subtraction, but '(x)2' and '(x)0' > are nonsensical. > > If 'x' is a *type*, then '(x)-1' is typecasting '-1', and similarly for > '(x)2' and '(x)0'. > > So, perhaps a comment, or a better name for 'x'? > I had similar thoughts. Maybe 't' instead? Warner Thanks, > > Ravi (rpokala@) > > +#define type_max(x) ( > \ > + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MAX : UINT64_MAX) : \ > + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MAX : UINT32_MAX) : \ > + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MAX : UINT16_MAX) : \ > + (is_signed(x) ? INT8_MAX : UINT8_MAX) \ > +) > + > +#define type_min(x) ( \ > + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MIN : 0) : \ > + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MIN : 0) : \ > + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MIN : 0) : \ > + (is_signed(x) ? INT8_MIN : 0) \ > +) > + > #endif /* _LINUX_KERNEL_H_ */ > > > From owner-svn-src-head@freebsd.org Mon Jun 29 20:30: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 6AEAD353FF0; Mon, 29 Jun 2020 20:30:04 +0000 (UTC) (envelope-from rpokala@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 49wfHc25XQz4MNP; Mon, 29 Jun 2020 20:30:04 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.71] (unknown [12.202.168.51]) (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 63CA619F7E; Mon, 29 Jun 2020 20:30:03 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.38.20061401 Date: Mon, 29 Jun 2020 13:30:00 -0700 Subject: Re: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux From: Ravi Pokala To: Warner Losh , Ravi Pokala CC: Hans Petter Selasky , src-committers , , Message-ID: Thread-Topic: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux References: <202006291308.05TD8eTP014019@repo.freebsd.org> In-Reply-To: Mime-version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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: Mon, 29 Jun 2020 20:30:04 -0000 From: on behalf of Warner Losh Date: 2020-06-29, Monday at 13:26 To: Ravi Pokala Cc: Hans Petter Selasky , src-committers , , Subject: Re: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux On Mon, Jun 29, 2020, 2:15 PM Ravi Pokala wrote: -----Original Message----- From: on behalf of Hans Petter Selasky Date: 2020-06-29, Monday at 06:08 To: , , Subject: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux Author: hselasky Date: Mon Jun 29 13:08:40 2020 New Revision: 362781 URL: https://svnweb.freebsd.org/changeset/base/362781 Log: Implement is_signed(), type_max() and type_min() function macros in the LinuxKPI. MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 12:59:09 2020 (r362780) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon Jun 29 13:08:40 2020 (r362781) @@ -564,4 +564,20 @@ linux_ratelimited(linux_ratelimit_t *rl) #define __is_constexpr(x) \ __builtin_constant_p(x) Hi Hans, +#define is_signed(x) (((x)-1 / (x)2) == (x)0) It took me several reads to understand this, until I figured out that 'x' is not a variable, it's the name of a *type*. If 'x' is a variable, then '(x)-1' is subtraction, but '(x)2' and '(x)0' are nonsensical. If 'x' is a *type*, then '(x)-1' is typecasting '-1', and similarly for '(x)2' and '(x)0'. So, perhaps a comment, or a better name for 'x'? I had similar thoughts. Maybe 't' instead? Letters are cheap now, Warner; we can afford to spell out "type". :-) -Ravi (rpokala@) Warner Thanks, Ravi (rpokala@) +#define type_max(x) ( \ + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MAX : UINT64_MAX) : \ + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MAX : UINT32_MAX) : \ + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MAX : UINT16_MAX) : \ + (is_signed(x) ? INT8_MAX : UINT8_MAX) \ +) + +#define type_min(x) ( \ + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MIN : 0) : \ + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MIN : 0) : \ + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MIN : 0) : \ + (is_signed(x) ? INT8_MIN : 0) \ +) + #endif /* _LINUX_KERNEL_H_ */ From owner-svn-src-head@freebsd.org Mon Jun 29 20:32: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 75331354C62 for ; Mon, 29 Jun 2020 20:32:31 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2k.ore.mailhop.org (outbound2k.ore.mailhop.org [54.148.219.64]) (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 49wfLR15kHz4MnR for ; Mon, 29 Jun 2020 20:32:30 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1593462749; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=kQGK021NYgzVKtbDaycNEgCT7+YWzHQjc+mGzJo7L2mLR4f8qqQbfOMOmCEI1/BKaxeQ6GlHsNFYW QAogdY6vrNeCu7uiBkuZJFRnDCaQMWUxO8Hv91nZdNxaVk7Ghp50PQZggTucy6iH6zoZZGyAobwJhK rOi/V7nMAbMuHUsJ3JRH16fPJSLe5Pdxc+GLRaYWu+ulG9hiyNVWRWBSkYp5QX+kqUycKgJ1im8kNy y66DJHVdl70b+OYnisul0Y8ee4rwOBClc0mMDAvJ5+UMtU4gavDl5ibIXew0JbPwiwX8aK2JrGeX+Y rr+LaXSntW+p1kUDGzFpkCiTcJng6BQ== 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=edzlQBa0SjdUnmITYOE26dMd8XfwDac11RHPxZ1jW/Q=; b=r4o9ykDWlnqld1vIBkchcK4vQkiveFRCKAsHE+2xNXx9XOtroh0gO7NNNC+qqgJHYowg75ijpACUO ysFCqz8XTgET8PnxF0iZPMGLlwlY7eWd8Os0c6KIO4ky22EZLSMooNs7O8v5r5Fg96XIDYx8/pXFO9 iep89xrcvNwZvIOUbi7A/AADWRGXy7Q06XBb4GVp9Pw3+s1KmABEtbKPNCzeUX+jXJ5clGjAuVbrN0 KIFeJ2qb0FV2J7zYUubs/fh+whAquOVrHXwCzW4/Ce2+ZqBq3JPRswgC6z91JwcM5ogFOcF0v9Hkxr x3WG3jINAJudwDCZDu5MBwR9Zi5GaTA== ARC-Authentication-Results: i=1; outbound4.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=edzlQBa0SjdUnmITYOE26dMd8XfwDac11RHPxZ1jW/Q=; b=hv9mh6sQF8LIkhIhVJp/hDuR+b63G0HJIf4vDmOtJiifv1JMDZpRnIWRIayIZOYJRtlFGsIbXzBvW 65Uxomud4BpELP08GjQQcCfEA6bdxC4Z4HSoe64wMNSYfZJnFuqjgUeBBKR2gFAr+MUhQeNx3bf8or hH0I/v7umPNqkqLLFK3Yj/hreJbSmVBzaEEqOsfJukxdlZHQghtkH6Gn64V5P9eJhh1VwHfp1vKS13 LgQJWFLLwk87AnilbiBDrfAVk87PiEGsIvdjyQAhkczxQ5h0RFXTdN/A+/0jfTdXqlazGcKiVJU+j8 JAvHWsw5tpyUnmkn3ja0Pq595gkqidw== X-MHO-RoutePath: aGlwcGll X-MHO-User: a5703780-ba47-11ea-b630-6b8aa7872eb8 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 outbound4.ore.mailhop.org (Halon) with ESMTPSA id a5703780-ba47-11ea-b630-6b8aa7872eb8; Mon, 29 Jun 2020 20:32:28 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 05TKWQb1085970; Mon, 29 Jun 2020 14:32:26 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <24a300c54e94be8e6915c588a25a641ca0620200.camel@freebsd.org> Subject: Re: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux From: Ian Lepore To: Warner Losh , Ravi Pokala Cc: Hans Petter Selasky , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 29 Jun 2020 14:32:26 -0600 In-Reply-To: References: <202006291308.05TD8eTP014019@repo.freebsd.org> 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: 49wfLR15kHz4MnR X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, 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: Mon, 29 Jun 2020 20:32:31 -0000 On Mon, 2020-06-29 at 14:26 -0600, Warner Losh wrote: > On Mon, Jun 29, 2020, 2:15 PM Ravi Pokala > wrote: > > > -----Original Message----- > > From: on behalf of Hans Petter > > Selasky > > > > Date: 2020-06-29, Monday at 06:08 > > To: , , < > > svn-src-head@freebsd.org> > > Subject: svn commit: r362781 - > > head/sys/compat/linuxkpi/common/include/linux > > > > Author: hselasky > > Date: Mon Jun 29 13:08:40 2020 > > New Revision: 362781 > > URL: https://svnweb.freebsd.org/changeset/base/362781 > > > > Log: > > Implement is_signed(), type_max() and type_min() function > > macros in > > the > > LinuxKPI. > > > > MFC after: 1 week > > Sponsored by: Mellanox Technologies > > > > Modified: > > head/sys/compat/linuxkpi/common/include/linux/kernel.h > > > > Modified: > > head/sys/compat/linuxkpi/common/include/linux/kernel.h > > > > =================================================================== > > =========== > > --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon > > Jun 29 > > 12:59:09 2020 (r362780) > > +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon > > Jun 29 > > 13:08:40 2020 (r362781) > > @@ -564,4 +564,20 @@ linux_ratelimited(linux_ratelimit_t *rl) > > #define __is_constexpr(x) \ > > __builtin_constant_p(x) > > > > Hi Hans, > > > > +#define is_signed(x) (((x)-1 / (x)2) == (x)0) > > > > It took me several reads to understand this, until I figured out > > that 'x' > > is not a variable, it's the name of a *type*. > > > > If 'x' is a variable, then '(x)-1' is subtraction, but '(x)2' and > > '(x)0' > > are nonsensical. > > > > If 'x' is a *type*, then '(x)-1' is typecasting '-1', and similarly > > for > > '(x)2' and '(x)0'. > > > > So, perhaps a comment, or a better name for 'x'? > > > > I had similar thoughts. Maybe 't' instead? > Or maybe since there's no one-character restriction on macro variable names, something actually descriptive like 'datatype'. -- Ian > Warner > > Thanks, > > > > Ravi (rpokala@) > > > > +#define type_max(x) ( > > \ > > + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MAX : UINT64_MAX) > > : \ > > + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MAX : UINT32_MAX) > > : \ > > + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MAX : UINT16_MAX) > > : \ > > + (is_signed(x) ? INT8_MAX : UINT8_MAX) \ > > +) > > + > > +#define type_min(x) > > ( \ > > + (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MIN : 0) : \ > > + (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MIN : 0) : \ > > + (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MIN : 0) : \ > > + (is_signed(x) ? INT8_MIN : 0) \ > > +) > > + > > #endif /* _LINUX_KERNEL_H_ */ > > > > > > From owner-svn-src-head@freebsd.org Mon Jun 29 21:11: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 3389835569F; Mon, 29 Jun 2020 21:11:21 +0000 (UTC) (envelope-from se@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 49wgCF0fYqz4R1W; Mon, 29 Jun 2020 21:11:21 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f203300d89053a09d7151ef.dip0.t-ipconnect.de [IPv6:2003:cd:5f20:3300:d890:53a0:9d71:51ef]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 27BA419FA4; Mon, 29 Jun 2020 21:11:20 +0000 (UTC) (envelope-from se@freebsd.org) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: Ed Maste , John Baldwin Cc: Eric van Gyzen , src-committers , svn-src-all , svn-src-head References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> From: =?UTF-8?Q?Stefan_E=c3=9fer?= Autocrypt: addr=se@freebsd.org; keydata= mQENBFVxiRIBCADOLNOZBsqlplHUQ3tG782FNtVT33rQli9EjNt2fhFERHIo4NxHlWBpHLnU b0s4L/eItx7au0i7Gegv01A9LUMwOnAc9EFAm4EW3Wmoa6MYrcP7xDClohg/Y69f7SNpEs3x YATBy+L6NzWZbJjZXD4vqPgZSDuMcLU7BEdJf0f+6h1BJPnGuwHpsSdnnMrZeIM8xQ8PPUVQ L0GZkVojHgNUngJH6e21qDrud0BkdiBcij0M3TCP4GQrJ/YMdurfc8mhueLpwGR2U1W8TYB7 4UY+NLw0McThOCLCxXflIeF/Y7jSB0zxzvb/H3LWkodUTkV57yX9IbUAGA5RKRg9zsUtABEB AAG0J1N0ZWZhbiBFw59lciAoRnJlZUJTRCkgPHNlQGZyZWVic2Qub3JnPokBVAQTAQoAPgIb AwULCQgHAwUVCgkICwUWAwIBAAIeAQIXgBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+q BQkLJQETAAoJEEfrte9a/fVEOeMH/icmdK1eZQvB3U8quJo9VMaZsaTuCMbUE4NThyfsIvIm MCd+rb/yULmMYwqNfjyKB1x4ikR4x+94l+yJoz7K0Usks+eNKDmMGJM6pWWssTigaJubFdVd hVVC+C1QJi7JshYSib08uONoPmO4lv5Az0TDYGtsMzsES2sIlc62c9go5WPGYhQFRbX3Lk6y V6m8OHh+G9XGSj3oPO4UteRwu+SzTdOLunZBWG1wu34+IeZm663D+2gOppQLWpLa2qaTerqw THu377ayZ2B2LPJ5JkvkZeHYPkwDQ+b5PGn0UhfkxPnDVYki5F7qKxvQ5uq1/q9YaCX7mmOl H2yO7tgVsrW5AQ0EVXGJEgEIALEj9qCXMZVucjpcd3QxM/TlUr98m5viEd1z4tCnPUyRWcIC EVtj2h5xMH+2iB0q1+KWhq+NsWtvScmEmfHnsr7dJ1K677OdpDhKVaJk61eeRulFY1R4yb6C 1MMxK+WgYB+vvpG0UeyR0M4uBewcPvRsq4yGUHFQKtLAbMdoPTSryJA+ElnmK1vdY+rPcHgi OIMBZM7ahsPXC0C9K4e5SP9clGyIoMpbfHXdx9q+Rp3zVtlbhyk3BS/xccu/+9pk9ICXL6GR js2sNnJ0wxdU1DsAlC59a5MnSruwiZFwRnkQhr3x6wk97Lg7sLS9jjTnCN7LGlVmSmpOEMy6 uq1AWfUAEQEAAYkBPAQYAQoAJgIbDBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+rBQkL JQEZAAoJEEfrte9a/fVEuesH/2DNxGWnHvWwMyiyhlQtafvDKwEn/wAgR8gHJFodB7emf8rA TnukH7MVttCoHtjN5lvv9RSBHjNTZls5wR/ANlwdRuPQHd8ZGxLe3S6IuUB3zDSwFltLGurO N2kOMhs5mTGyypSa+uw3rtQbUAVYf1oPbiR4FLtiM8FLyEvE95hX5fPq9Qvx9FmN79kmCIEw jDKPqDaUf/OR2fEF0LSIbXHEk4tNqCEwx5DIJ0fp5/z5UzICUAmwxyRs5O/Hre1jzPsMVyud Ml9t7UTOJGKVWwRory1PMnOFxN+iz5/d4FhYSKXF7kfMiFgol4LuWaxJRwbBrr71VGBrRy2a L1nw6Bc= Message-ID: Date: Mon, 29 Jun 2020 23:11:11 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.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: Mon, 29 Jun 2020 21:11:21 -0000 Am 29.06.20 um 20:09 schrieb Ed Maste: > On Mon, 29 Jun 2020 at 11:27, John Baldwin wrote: >> >> I suspect just doing the 'merge --record-only' is the simplest method >> assuming Git handles it ok. I suspect since Git ignores mergeinfo this >> is fine, but it would be good for Ed to confirm. You can always restore >> the tests in the future in contrib/bc when you want to add them. > > I think a --record-only merge is the best approach; in any case we > have a number of these in the tree already and Git will have to deal > with them. Thank you for this advice. There is a new version, which differs only in the man-pages. These used to mention optional features (of which only NLS support is actually optional in the version built on FreeBSD, all other are always compiled in, and I had mentioned to the author that this might irritate FreeBSD users). I have suggested to the author to add SPDX BSD-2-Clause tags, which would change a large fraction of the currently committed files. Is it required to perform the --record-only merge, then? Or would it be OK to import the new release into the vendor branch and then svn copy that version completely (including the tests and other files that I had omitted in the initial import) to contrib? I expect the svn copy without prior svn merge --record-only to result in the same repository state after the conversion to Git, but I do not really know ... Regards, STefan From owner-svn-src-head@freebsd.org Mon Jun 29 21:17: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 878B3355BE8; Mon, 29 Jun 2020 21:17:05 +0000 (UTC) (envelope-from jhb@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 49wgKs35LRz4Rwn; Mon, 29 Jun 2020 21:17:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-274.local (unknown [IPv6:2601:648:8203:2990:b1a7:8995:c1d3:29df]) (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 A8E3F19CA4; Mon, 29 Jun 2020 21:17:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: =?UTF-8?Q?Stefan_E=c3=9fer?= , Ed Maste Cc: Eric van Gyzen , src-committers , svn-src-all , svn-src-head References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@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: <4aa7a1c9-177c-07e3-1cac-70e5ba995363@FreeBSD.org> Date: Mon, 29 Jun 2020 14:17:03 -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: 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, 29 Jun 2020 21:17:05 -0000 On 6/29/20 2:11 PM, Stefan Eßer wrote: > Am 29.06.20 um 20:09 schrieb Ed Maste: >> On Mon, 29 Jun 2020 at 11:27, John Baldwin wrote: >>> >>> I suspect just doing the 'merge --record-only' is the simplest method >>> assuming Git handles it ok. I suspect since Git ignores mergeinfo this >>> is fine, but it would be good for Ed to confirm. You can always restore >>> the tests in the future in contrib/bc when you want to add them. >> >> I think a --record-only merge is the best approach; in any case we >> have a number of these in the tree already and Git will have to deal >> with them. > > Thank you for this advice. > > There is a new version, which differs only in the man-pages. These > used to mention optional features (of which only NLS support is > actually optional in the version built on FreeBSD, all other are > always compiled in, and I had mentioned to the author that this > might irritate FreeBSD users). > > I have suggested to the author to add SPDX BSD-2-Clause tags, which > would change a large fraction of the currently committed files. > > > Is it required to perform the --record-only merge, then? > > Or would it be OK to import the new release into the vendor branch > and then svn copy that version completely (including the tests and > other files that I had omitted in the initial import) to contrib? > > I expect the svn copy without prior svn merge --record-only to > result in the same repository state after the conversion to Git, > but I do not really know ... You can do a --record-only merge now, and then use 'svn merge' to merge in the new version via the normal workflow. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Jun 29 21:35: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 0DC94355DF7; Mon, 29 Jun 2020 21:35:51 +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 49wglV6fyvz4SlW; Mon, 29 Jun 2020 21:35:50 +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 C7EE4DE1A; Mon, 29 Jun 2020 21:35:50 +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 05TLZoAL034399; Mon, 29 Jun 2020 21:35:50 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TLZo2d034398; Mon, 29 Jun 2020 21:35:50 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <202006292135.05TLZo2d034398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Mon, 29 Jun 2020 21:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362789 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362789 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 21:35:51 -0000 Author: gallatin Date: Mon Jun 29 21:35:50 2020 New Revision: 362789 URL: https://svnweb.freebsd.org/changeset/base/362789 Log: Fix a panic when unloading firmware LIST_FOREACH_SAFE() is not safe in the presence of other threads removing list entries when a mutex is released. This is not in the critical path, so just restart the scan each time we drop the lock, rather than using a marker. Reviewed by: jhb, markj Sponsored by: Netflix Modified: head/sys/kern/subr_firmware.c Modified: head/sys/kern/subr_firmware.c ============================================================================== --- head/sys/kern/subr_firmware.c Mon Jun 29 19:30:35 2020 (r362788) +++ head/sys/kern/subr_firmware.c Mon Jun 29 21:35:50 2020 (r362789) @@ -394,14 +394,12 @@ EVENTHANDLER_DEFINE(mountroot, firmware_mountroot, NUL static void unloadentry(void *unused1, int unused2) { - struct priv_fw *fp, *tmp; + struct priv_fw *fp; int err; - bool changed; mtx_lock(&firmware_mtx); - changed = false; restart: - LIST_FOREACH_SAFE(fp, &firmware_table, link, tmp) { + LIST_FOREACH(fp, &firmware_table, link) { if (fp->file == NULL || fp->refcnt != 0 || (fp->flags & FW_UNLOAD) == 0) continue; @@ -412,7 +410,6 @@ restart: * 2. clear FW_UNLOAD so we don't try this entry again. * 3. release the lock while trying to unload the module. */ - changed = true; fp->flags &= ~FW_UNLOAD; /* do not try again */ /* @@ -422,9 +419,11 @@ restart: mtx_unlock(&firmware_mtx); err = linker_release_module(NULL, NULL, fp->file); mtx_lock(&firmware_mtx); - } - if (changed) { - changed = false; + + /* + * When we dropped the lock, another thread could have + * removed an element, so we must restart the scan. + */ goto restart; } mtx_unlock(&firmware_mtx); From owner-svn-src-head@freebsd.org Mon Jun 29 22:12: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 1104C356F61; Mon, 29 Jun 2020 22:12:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49whYg6fPVz4WKJ; Mon, 29 Jun 2020 22:12:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C862CE802; Mon, 29 Jun 2020 22:12:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05TMCNU8058761; Mon, 29 Jun 2020 22:12:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05TMCNYx058759; Mon, 29 Jun 2020 22:12:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202006292212.05TMCNYx058759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 29 Jun 2020 22:12:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362790 - in head: sbin/savecore share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: sbin/savecore share/man/man5 X-SVN-Commit-Revision: 362790 X-SVN-Commit-Repository: base MIME-Version: 1.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, 29 Jun 2020 22:12:24 -0000 Author: asomers Date: Mon Jun 29 22:12:23 2020 New Revision: 362790 URL: https://svnweb.freebsd.org/changeset/base/362790 Log: savecore: accept device names without the /dev/ prefix dumpon has accepted device names without the prefix ever since r291207. Since dumpon and savecore are always paired, they ought to accept the same arguments. Prior to this change, specifying 'dumpdev="da3"' in /etc/rc.conf, for example, would result in dumpon working just fine but savecore complaining that "Dump device does not exist". PR: 247618 Reviewed by: cem, bcr MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D25500 Modified: head/sbin/savecore/savecore.c head/share/man/man5/rc.conf.5 Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Mon Jun 29 21:35:50 2020 (r362789) +++ head/sbin/savecore/savecore.c Mon Jun 29 22:12:23 2020 (r362790) @@ -973,7 +973,45 @@ closefd: close(fddev); } +/* Prepend "/dev/" to any arguments that don't already have it */ static char ** +devify(int argc, char **argv) +{ + char **devs; + int i, l; + + devs = malloc(argc * sizeof(*argv)); + if (devs == NULL) { + logmsg(LOG_ERR, "malloc(): %m"); + exit(1); + } + for (i = 0; i < argc; i++) { + if (strncmp(argv[i], _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) + devs[i] = strdup(argv[i]); + else { + char *fullpath; + + fullpath = malloc(PATH_MAX); + if (fullpath == NULL) { + logmsg(LOG_ERR, "malloc(): %m"); + exit(1); + } + l = snprintf(fullpath, PATH_MAX, "%s%s", _PATH_DEV, + argv[i]); + if (l < 0) { + logmsg(LOG_ERR, "snprintf(): %m"); + exit(1); + } else if (l >= PATH_MAX) { + logmsg(LOG_ERR, "device name too long"); + exit(1); + } + devs[i] = fullpath; + } + } + return (devs); +} + +static char ** enum_dumpdevs(int *argcp) { struct fstab *fsp; @@ -1069,6 +1107,7 @@ main(int argc, char **argv) { cap_rights_t rights; const char *savedir; + char **devs; int i, ch, error, savedirfd; checkfor = compress = clear = force = keep = verbose = 0; @@ -1132,7 +1171,9 @@ main(int argc, char **argv) argv++; } if (argc == 0) - argv = enum_dumpdevs(&argc); + devs = enum_dumpdevs(&argc); + else + devs = devify(argc, argv); savedirfd = open(savedir, O_RDONLY | O_DIRECTORY); if (savedirfd < 0) { @@ -1148,10 +1189,10 @@ main(int argc, char **argv) } /* Enter capability mode. */ - init_caps(argc, argv); + init_caps(argc, devs); for (i = 0; i < argc; i++) - DoFile(savedir, savedirfd, argv[i]); + DoFile(savedir, savedirfd, devs[i]); /* Emit minimal output. */ if (nfound == 0) { Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Mon Jun 29 21:35:50 2020 (r362789) +++ head/share/man/man5/rc.conf.5 Mon Jun 29 22:12:23 2020 (r362790) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2020 +.Dd June 28, 2020 .Dt RC.CONF 5 .Os .Sh NAME @@ -3469,7 +3469,9 @@ the first suitable swap device listed in .Pa /etc/fstab will be used as dump device. Otherwise, the value of this variable is passed as the argument to -.Xr dumpon 8 . +.Xr dumpon 8 +and +.Xr savecore 8 . To disable crash dumps, set this variable to .Dq Li NO . .It Va dumpon_flags From owner-svn-src-head@freebsd.org Mon Jun 29 22:21: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 AE053356FCE; Mon, 29 Jun 2020 22:21:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49whlw40CJz4Wlr; Mon, 29 Jun 2020 22:21:16 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.5] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id B68B81A96B; Mon, 29 Jun 2020 22:21:15 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: =?UTF-8?Q?Stefan_E=c3=9fer?= , Ed Maste , John Baldwin Cc: Eric van Gyzen , src-committers , svn-src-all , svn-src-head References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <0307b190-136c-59d1-bbde-976e6b181868@FreeBSD.org> Date: Mon, 29 Jun 2020 17:21:13 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-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: Mon, 29 Jun 2020 22:21:16 -0000 On 29/06/2020 16:11, Stefan Eßer wrote: > Am 29.06.20 um 20:09 schrieb Ed Maste: >> On Mon, 29 Jun 2020 at 11:27, John Baldwin wrote: >>> I suspect just doing the 'merge --record-only' is the simplest method >>> assuming Git handles it ok. I suspect since Git ignores mergeinfo this >>> is fine, but it would be good for Ed to confirm. You can always restore >>> the tests in the future in contrib/bc when you want to add them. >> I think a --record-only merge is the best approach; in any case we >> have a number of these in the tree already and Git will have to deal >> with them. > Thank you for this advice. > > There is a new version, which differs only in the man-pages. These > used to mention optional features (of which only NLS support is > actually optional in the version built on FreeBSD, all other are > always compiled in, and I had mentioned to the author that this > might irritate FreeBSD users). FWIW, since it was rewritten it would have been actually nice to have it in modern C++. > I have suggested to the author to add SPDX BSD-2-Clause tags, which > would change a large fraction of the currently committed files. We only use the SPDX tags for internal software. For stuff from contrib it is not necessary. > > Is it required to perform the --record-only merge, then? Since you are going to bring it through the vendor area you should keep the merge information yes. > Or would it be OK to import the new release into the vendor branch > and then svn copy that version completely (including the tests and > other files that I had omitted in the initial import) to contrib? > > I expect the svn copy without prior svn merge --record-only to > result in the same repository state after the conversion to Git, > but I do not really know ... It is likely git won't care. cheers, Pedro. From owner-svn-src-head@freebsd.org Tue Jun 30 00:11: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 2E01D359196; Tue, 30 Jun 2020 00:11:33 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oo1-f68.google.com (mail-oo1-f68.google.com [209.85.161.68]) (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 49wlC83Rcyz4cw1; Tue, 30 Jun 2020 00:11:32 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oo1-f68.google.com with SMTP id c4so228724oou.6; Mon, 29 Jun 2020 17:11:32 -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:from:date :message-id:subject:to:cc; bh=yqk1f22U/vatzVGSxSzkVo6fVwY3l789/x7F7fQe98M=; b=ekoPO0eOLB6qLg/unVTbD263yeW15Wp3PNNq4b2E1ef+dJ8PuMnhAEqzAWDQqoc1FC y7VCk+hnu7elP5lcQaOd60K99UeO/Rwz7lxlLlqHyWVk+JauV+uePv4vNCnvn1jN2XH8 qsgVdIN1wZifk1dD63Irf+xEfQE/iHj4h7DSqjgxJ+ijZePuROxEhDj8Fcf85HEr2uWI idsMkQnHPCFdp0Q2hw4l52c82HtiMCIamRVdsaSc+0ut1B+y1OEVtDjEQnwxxZeJ9Tbx xc01y/HliYWV7abfroXweMmN+9fL/heynan/C/898c/WGJ1q3L4BCm5oBPLieJew7QCk 7/kg== X-Gm-Message-State: AOAM532V8joL+q9f4trwMgLMTGDw19l7AVATycO+Asx4bA5OTfdSh9hV M4S6M4hyloT0fukvN64un74YB0iDeFdcUrjcmWhXZU1/ X-Google-Smtp-Source: ABdhPJxcXZdix7Yy4yvZsEek0bKPdiWQQAxqzw0aUrM/3tlkpzLHCch7EPsxIwgpEGprHhiJGP+ulrFIVEtXL1Or0gU= X-Received: by 2002:a4a:b181:: with SMTP id c1mr4514111ooo.74.1593475890765; Mon, 29 Jun 2020 17:11:30 -0700 (PDT) MIME-Version: 1.0 References: <201901021709.x02H9ZPM004185@repo.freebsd.org> <20200629005538.GB7202@raichu> In-Reply-To: <20200629005538.GB7202@raichu> From: Alan Somers Date: Mon, 29 Jun 2020 18:11:19 -0600 Message-ID: Subject: Re: svn commit: r342699 - head/sbin/savecore To: Mark Johnston Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 49wlC83Rcyz4cw1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; 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: Tue, 30 Jun 2020 00:11:33 -0000 On Sun, Jun 28, 2020 at 6:55 PM Mark Johnston wrote: > On Sun, Jun 28, 2020 at 06:40:59PM -0600, Alan Somers wrote: > > On Wed, Jan 2, 2019 at 10:09 AM Mark Johnston wrote: > > > > > Author: markj > > > Date: Wed Jan 2 17:09:35 2019 > > > New Revision: 342699 > > > URL: https://svnweb.freebsd.org/changeset/base/342699 > > > > > > Log: > > > Capsicumize savecore(8). > > > > > > - Use cap_fileargs(3) to open dump devices after entering capability > > > mode, and use cap_syslog(3) to log messages. > > > - Use a relative directory fd to open output files. > > > - Use zdopen(3) to compress kernel dumps in capability mode. > > > > > > Reviewed by: cem, oshogbo > > > MFC after: 2 months > > > Sponsored by: The FreeBSD Foundation > > > Differential Revision: https://reviews.freebsd.org/D18458 > > > > > > Modified: > > > head/sbin/savecore/Makefile > > > head/sbin/savecore/savecore.c > > > > > > Modified: head/sbin/savecore/savecore.c > > > > > > > ============================================================================== > > > --- head/sbin/savecore/savecore.c Wed Jan 2 16:42:07 2019 > > > (r342698) > > > +++ head/sbin/savecore/savecore.c Wed Jan 2 17:09:35 2019 > > > (r342699) > > > > > > +static char ** > > > +enum_dumpdevs(int *argcp) > > > +{ > > > + struct fstab *fsp; > > > + char **argv; > > > + int argc, n; > > > + > > > + /* > > > + * We cannot use getfsent(3) in capability mode, so we must > > > + * scan /etc/fstab and build up a list of candidate devices > > > + * before proceeding. > > > + */ > > > + argc = 0; > > > + n = 8; > > > + argv = malloc(n * sizeof(*argv)); > > > > > > > It looks like the memory allocated here > > > > > > > + if (argv == NULL) { > > > + logmsg(LOG_ERR, "malloc(): %m"); > > > + exit(1); > > > + } > > > + for (;;) { > > > + fsp = getfsent(); > > > + if (fsp == NULL) > > > + break; > > > + if (strcmp(fsp->fs_vfstype, "swap") != 0 && > > > + strcmp(fsp->fs_vfstype, "dump") != 0) > > > + continue; > > > + if (argc >= n) { > > > + n *= 2; > > > + argv = realloc(argv, n * sizeof(*argv)); > > > > > > > and here > > > > > > > + if (argv == NULL) { > > > + logmsg(LOG_ERR, "realloc(): %m"); > > > + exit(1); > > > + } > > > + } > > > + argv[argc] = strdup(fsp->fs_spec); > > > > > > > and here is leaked. I can't find any corresponding free. However, > neither > > Valgrind nor Coverity complains. What am I missing? Does this memory > > sneakily get freed by a subroutine somewhere, or does Capsicum confuse > our > > tools? > > I'm not sure why Capsicum would change anything. It would be worth > testing devel/valgrind-devel with https://reviews.freebsd.org/D25452 > applied, to see if it's able to detect that bug. > Using that new valgrind-devel did not find the leaks. However, it _did_ print a helpful error message explaining why Capsicum interferes. Commenting out caph_enter_casper allowed valgrind to find the leaks. It also found two more than I didn't know about. Thanks for the tip. https://www.valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq -Alan From owner-svn-src-head@freebsd.org Tue Jun 30 06: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 E542F35F94E; Tue, 30 Jun 2020 06:14:34 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49wvG25mh8z3xZh; Tue, 30 Jun 2020 06:14:34 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA209139FB; Tue, 30 Jun 2020 06:14:34 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05U6EYqD056375; Tue, 30 Jun 2020 06:14:34 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05U6EYES056374; Tue, 30 Jun 2020 06:14:34 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <202006300614.05U6EYES056374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Tue, 30 Jun 2020 06:14:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362791 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 362791 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 06:14:35 -0000 Author: cperciva Date: Tue Jun 30 06:14:34 2020 New Revision: 362791 URL: https://svnweb.freebsd.org/changeset/base/362791 Log: Make EC2 AMIs use portsnap and freebsd-update mirrors hosted in AWS This adjusts freebsd-update.conf and portsnap.conf files in EC2 AMIs to point at the new AWS-hosted mirror network. Approved by: re (delphij) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D25498 Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Mon Jun 29 22:12:23 2020 (r362790) +++ head/release/tools/ec2.conf Tue Jun 30 06:14:34 2020 (r362791) @@ -108,6 +108,12 @@ vm_extra_pre_umount() { 's/^#ChallengeResponseAuthentication yes/ChallengeResponseAuthentication no/' \ ${DESTDIR}/etc/ssh/sshd_config + # Use FreeBSD Update and Portsnap mirrors hosted in AWS + sed -i '' -e 's/update.FreeBSD.org/aws.update.FreeBSD.org/' \ + ${DESTDIR}/etc/freebsd-update.conf + sed -i '' -e 's/portsnap.FreeBSD.org/aws.portsnap.FreeBSD.org/' \ + ${DESTDIR}/etc/portsnap.conf + # Use the NTP service provided by Amazon sed -i '' -e 's/^pool/#pool/' \ -e '1,/^#server/s/^#server.*/server 169.254.169.123 iburst/' \ From owner-svn-src-head@freebsd.org Tue Jun 30 07:30: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 49F0E360F7C; Tue, 30 Jun 2020 07:30:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49wwxf6ZfHz42C0; Tue, 30 Jun 2020 07:30:30 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id DE5F82602DF; Tue, 30 Jun 2020 09:30:27 +0200 (CEST) Subject: Re: svn commit: r362781 - head/sys/compat/linuxkpi/common/include/linux To: Ian Lepore , Warner Losh , Ravi Pokala Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006291308.05TD8eTP014019@repo.freebsd.org> <24a300c54e94be8e6915c588a25a641ca0620200.camel@freebsd.org> From: Hans Petter Selasky Message-ID: <5516059a-0168-f1cd-742e-bb7d7a108f67@selasky.org> Date: Tue, 30 Jun 2020 09:30:06 +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: <24a300c54e94be8e6915c588a25a641ca0620200.camel@freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49wwxf6ZfHz42C0 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:24940, ipnet:2a01:4f8::/29, 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: Tue, 30 Jun 2020 07:30:31 -0000 On 2020-06-29 22:32, Ian Lepore wrote: > On Mon, 2020-06-29 at 14:26 -0600, Warner Losh wrote: >> On Mon, Jun 29, 2020, 2:15 PM Ravi Pokala >> wrote: >> >>> -----Original Message----- >>> From: on behalf of Hans Petter >>> Selasky >>> >>> Date: 2020-06-29, Monday at 06:08 >>> To: , , < >>> svn-src-head@freebsd.org> >>> Subject: svn commit: r362781 - >>> head/sys/compat/linuxkpi/common/include/linux >>> >>> Author: hselasky >>> Date: Mon Jun 29 13:08:40 2020 >>> New Revision: 362781 >>> URL: https://svnweb.freebsd.org/changeset/base/362781 >>> >>> Log: >>> Implement is_signed(), type_max() and type_min() function >>> macros in >>> the >>> LinuxKPI. >>> >>> MFC after: 1 week >>> Sponsored by: Mellanox Technologies >>> >>> Modified: >>> head/sys/compat/linuxkpi/common/include/linux/kernel.h >>> >>> Modified: >>> head/sys/compat/linuxkpi/common/include/linux/kernel.h >>> >>> =================================================================== >>> =========== >>> --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon >>> Jun 29 >>> 12:59:09 2020 (r362780) >>> +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Mon >>> Jun 29 >>> 13:08:40 2020 (r362781) >>> @@ -564,4 +564,20 @@ linux_ratelimited(linux_ratelimit_t *rl) >>> #define __is_constexpr(x) \ >>> __builtin_constant_p(x) >>> >>> Hi Hans, >>> >>> +#define is_signed(x) (((x)-1 / (x)2) == (x)0) >>> >>> It took me several reads to understand this, until I figured out >>> that 'x' >>> is not a variable, it's the name of a *type*. >>> >>> If 'x' is a variable, then '(x)-1' is subtraction, but '(x)2' and >>> '(x)0' >>> are nonsensical. >>> >>> If 'x' is a *type*, then '(x)-1' is typecasting '-1', and similarly >>> for >>> '(x)2' and '(x)0'. >>> >>> So, perhaps a comment, or a better name for 'x'? >>> >> >> I had similar thoughts. Maybe 't' instead? >> > > Or maybe since there's no one-character restriction on macro variable > names, something actually descriptive like 'datatype'. > > -- Ian > >> Warner >> >> Thanks, >>> >>> Ravi (rpokala@) >>> Thanks for the feedback. I'll have a look at using a more descriptive name there for the macro argument. --HPS From owner-svn-src-head@freebsd.org Tue Jun 30 08: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 B23B7362ADF; Tue, 30 Jun 2020 08:41:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49wyWf4Kl0z46MZ; Tue, 30 Jun 2020 08:41:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55AEA157A3; Tue, 30 Jun 2020 08:41:34 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05U8fYxT044990; Tue, 30 Jun 2020 08:41:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05U8fYMe044989; Tue, 30 Jun 2020 08:41:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202006300841.05U8fYMe044989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 30 Jun 2020 08:41:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362794 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 362794 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 08:41:34 -0000 Author: hselasky Date: Tue Jun 30 08:41:33 2020 New Revision: 362794 URL: https://svnweb.freebsd.org/changeset/base/362794 Log: Document the is_signed(), type_max() and type_min() function macros in the LinuxKPI. Try to make the function argument more readable. Suggested by: several MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Jun 30 07:37:24 2020 (r362793) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Jun 30 08:41:33 2020 (r362794) @@ -564,20 +564,33 @@ linux_ratelimited(linux_ratelimit_t *rl) #define __is_constexpr(x) \ __builtin_constant_p(x) -#define is_signed(x) (((x)-1 / (x)2) == (x)0) +/* + * The is_signed() macro below returns true if the passed data type is + * signed. Else false is returned. + */ +#define is_signed(datatype) (((datatype)-1 / (datatype)2) == (datatype)0) -#define type_max(x) ( \ - (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MAX : UINT64_MAX) : \ - (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MAX : UINT32_MAX) : \ - (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MAX : UINT16_MAX) : \ - (is_signed(x) ? INT8_MAX : UINT8_MAX) \ +/* + * The type_max() macro below returns the maxium positive value the + * passed data type can hold. + */ +#define type_max(datatype) ( \ + (sizeof(datatype) >= 8) ? (is_signed(datatype) ? INT64_MAX : UINT64_MAX) : \ + (sizeof(datatype) >= 4) ? (is_signed(datatype) ? INT32_MAX : UINT32_MAX) : \ + (sizeof(datatype) >= 2) ? (is_signed(datatype) ? INT16_MAX : UINT16_MAX) : \ + (is_signed(datatype) ? INT8_MAX : UINT8_MAX) \ ) -#define type_min(x) ( \ - (sizeof(x) >= 8) ? (is_signed(x) ? INT64_MIN : 0) : \ - (sizeof(x) >= 4) ? (is_signed(x) ? INT32_MIN : 0) : \ - (sizeof(x) >= 2) ? (is_signed(x) ? INT16_MIN : 0) : \ - (is_signed(x) ? INT8_MIN : 0) \ +/* + * The type_min() macro below returns the minimum value the passed + * data type can hold. For unsigned types the minimum value is always + * zero. For signed types it may vary. + */ +#define type_min(datatype) ( \ + (sizeof(datatype) >= 8) ? (is_signed(datatype) ? INT64_MIN : 0) : \ + (sizeof(datatype) >= 4) ? (is_signed(datatype) ? INT32_MIN : 0) : \ + (sizeof(datatype) >= 2) ? (is_signed(datatype) ? INT16_MIN : 0) : \ + (is_signed(datatype) ? INT8_MIN : 0) \ ) #endif /* _LINUX_KERNEL_H_ */ From owner-svn-src-head@freebsd.org Tue Jun 30 15:56: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 D06C434EFFC; Tue, 30 Jun 2020 15:56:55 +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 49x89z5B6Wz4Zm9; Tue, 30 Jun 2020 15:56:55 +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 920591A3E3; Tue, 30 Jun 2020 15:56:55 +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 05UFutR5016164; Tue, 30 Jun 2020 15:56:55 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UFutOK016162; Tue, 30 Jun 2020 15:56:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006301556.05UFutOK016162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 30 Jun 2020 15:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362801 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 362801 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 15:56:55 -0000 Author: markj Date: Tue Jun 30 15:56:54 2020 New Revision: 362801 URL: https://svnweb.freebsd.org/changeset/base/362801 Log: Remove CRYPTO_TIMING. It was added a very long time ago. It is single-threaded, so only really useful for basic measurements, and in the meantime we've gotten some more sophisticated profiling tools. Reviewed by: cem, delphij, jhb Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D25464 Modified: head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodev.h Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Tue Jun 30 15:53:52 2020 (r362800) +++ head/sys/opencrypto/crypto.c Tue Jun 30 15:56:54 2020 (r362801) @@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$"); * PURPOSE. */ -#define CRYPTO_TIMING /* enable timing support */ - #include "opt_compat.h" #include "opt_ddb.h" @@ -238,12 +236,6 @@ static struct cryptostats cryptostats; SYSCTL_STRUCT(_kern_crypto, OID_AUTO, stats, CTLFLAG_RW, &cryptostats, cryptostats, "Crypto system statistics"); -#ifdef CRYPTO_TIMING -static int crypto_timing = 0; -SYSCTL_INT(_debug, OID_AUTO, crypto_timing, CTLFLAG_RW, - &crypto_timing, 0, "Enable/disable crypto timing support"); -#endif - /* Try to avoid directly exposing the key buffer as a symbol */ static struct keybuf *keybuf; @@ -1409,11 +1401,6 @@ crypto_dispatch(struct cryptop *crp) cryptostats.cs_ops++; -#ifdef CRYPTO_TIMING - if (crypto_timing) - binuptime(&crp->crp_tstamp); -#endif - crp->crp_retw_id = ((uintptr_t)crp->crp_session) % crypto_workers_num; if (CRYPTOP_ASYNC(crp)) { @@ -1647,33 +1634,7 @@ crypto_kinvoke(struct cryptkop *krp) return (0); } -#ifdef CRYPTO_TIMING static void -crypto_tstat(struct cryptotstat *ts, struct bintime *bt) -{ - struct bintime now, delta; - struct timespec t; - uint64_t u; - - binuptime(&now); - u = now.frac; - delta.frac = now.frac - bt->frac; - delta.sec = now.sec - bt->sec; - if (u < delta.frac) - delta.sec--; - bintime2timespec(&delta, &t); - timespecadd(&ts->acc, &t, &ts->acc); - if (timespeccmp(&t, &ts->min, <)) - ts->min = t; - if (timespeccmp(&t, &ts->max, >)) - ts->max = t; - ts->count++; - - *bt = now; -} -#endif - -static void crypto_task_invoke(void *ctx, int pending) { struct cryptocap *cap; @@ -1700,10 +1661,6 @@ crypto_invoke(struct cryptocap *cap, struct cryptop *c KASSERT(crp->crp_session != NULL, ("%s: crp->crp_session == NULL", __func__)); -#ifdef CRYPTO_TIMING - if (crypto_timing) - crypto_tstat(&cryptostats.cs_invoke, &crp->crp_tstamp); -#endif if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) { struct crypto_session_params csp; crypto_session_t nses; @@ -1811,10 +1768,7 @@ crypto_done(struct cryptop *crp) crp->crp_flags |= CRYPTO_F_DONE; if (crp->crp_etype != 0) cryptostats.cs_errs++; -#ifdef CRYPTO_TIMING - if (crypto_timing) - crypto_tstat(&cryptostats.cs_done, &crp->crp_tstamp); -#endif + /* * CBIMM means unconditionally do the callback immediately; * CBIFSYNC means do the callback immediately only if the @@ -1831,20 +1785,7 @@ crypto_done(struct cryptop *crp) * callback routine does very little (e.g. the * /dev/crypto callback method just does a wakeup). */ -#ifdef CRYPTO_TIMING - if (crypto_timing) { - /* - * NB: We must copy the timestamp before - * doing the callback as the cryptop is - * likely to be reclaimed. - */ - struct bintime t = crp->crp_tstamp; - crypto_tstat(&cryptostats.cs_cb, &t); - crp->crp_callback(crp); - crypto_tstat(&cryptostats.cs_finis, &t); - } else -#endif - crp->crp_callback(crp); + crp->crp_callback(crp); } else { struct crypto_ret_worker *ret_worker; bool wake; @@ -2144,22 +2085,8 @@ crypto_ret_proc(struct crypto_ret_worker *ret_worker) /* * Run callbacks unlocked. */ - if (crpt != NULL) { -#ifdef CRYPTO_TIMING - if (crypto_timing) { - /* - * NB: We must copy the timestamp before - * doing the callback as the cryptop is - * likely to be reclaimed. - */ - struct bintime t = crpt->crp_tstamp; - crypto_tstat(&cryptostats.cs_cb, &t); - crpt->crp_callback(crpt); - crypto_tstat(&cryptostats.cs_finis, &t); - } else -#endif - crpt->crp_callback(crpt); - } + if (crpt != NULL) + crpt->crp_callback(crpt); if (krpt != NULL) krpt->krp_callback(krpt); CRYPTO_RETW_LOCK(ret_worker); Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Tue Jun 30 15:53:52 2020 (r362800) +++ head/sys/opencrypto/cryptodev.h Tue Jun 30 15:56:54 2020 (r362801) @@ -326,13 +326,6 @@ struct crypt_kop { #define CIOCFINDDEV _IOWR('c', 108, struct crypt_find_op) #define CIOCCRYPTAEAD _IOWR('c', 109, struct crypt_aead) -struct cryptotstat { - struct timespec acc; /* total accumulated time */ - struct timespec min; /* min time */ - struct timespec max; /* max time */ - u_int32_t count; /* number of observations */ -}; - struct cryptostats { u_int32_t cs_ops; /* symmetric crypto ops submitted */ u_int32_t cs_errs; /* symmetric crypto ops that failed */ @@ -342,16 +335,6 @@ struct cryptostats { u_int32_t cs_rets; /* crypto return thread activations */ u_int32_t cs_blocks; /* symmetric op driver block */ u_int32_t cs_kblocks; /* symmetric op driver block */ - /* - * When CRYPTO_TIMING is defined at compile time and the - * sysctl debug.crypto is set to 1, the crypto system will - * accumulate statistics about how long it takes to process - * crypto requests at various points during processing. - */ - struct cryptotstat cs_invoke; /* crypto_dipsatch -> crypto_invoke */ - struct cryptotstat cs_done; /* crypto_invoke -> crypto_done */ - struct cryptotstat cs_cb; /* crypto_done -> callback */ - struct cryptotstat cs_finis; /* callback -> callback return */ }; #ifdef _KERNEL From owner-svn-src-head@freebsd.org Tue Jun 30 15:57: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 41E7934F0E7; Tue, 30 Jun 2020 15:57:12 +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 49x8BJ0qCtz4ZvH; Tue, 30 Jun 2020 15:57:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00C201A9D7; Tue, 30 Jun 2020 15:57:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05UFvBLr016222; Tue, 30 Jun 2020 15:57:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UFvBPT016221; Tue, 30 Jun 2020 15:57:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006301557.05UFvBPT016221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 30 Jun 2020 15:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362802 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 362802 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 15:57:12 -0000 Author: markj Date: Tue Jun 30 15:57:11 2020 New Revision: 362802 URL: https://svnweb.freebsd.org/changeset/base/362802 Log: Remove unused 32-bit compatibility structures from cryptodev. The counters are exported by a sysctl and have the same width on all platforms anyway. Reviewed by: cem, delphij, jhb Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D25465 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Tue Jun 30 15:56:54 2020 (r362801) +++ head/sys/opencrypto/cryptodev.c Tue Jun 30 15:57:11 2020 (r362802) @@ -117,28 +117,6 @@ struct crypt_kop32 { struct crparam32 crk_param[CRK_MAXPARAM]; }; -struct cryptotstat32 { - struct timespec32 acc; - struct timespec32 min; - struct timespec32 max; - u_int32_t count; -}; - -struct cryptostats32 { - u_int32_t cs_ops; - u_int32_t cs_errs; - u_int32_t cs_kops; - u_int32_t cs_kerrs; - u_int32_t cs_intrs; - u_int32_t cs_rets; - u_int32_t cs_blocks; - u_int32_t cs_kblocks; - struct cryptotstat32 cs_invoke; - struct cryptotstat32 cs_done; - struct cryptotstat32 cs_cb; - struct cryptotstat32 cs_finis; -}; - #define CIOCGSESSION32 _IOWR('c', 101, struct session_op32) #define CIOCCRYPT32 _IOWR('c', 103, struct crypt_op32) #define CIOCKEY32 _IOWR('c', 104, struct crypt_kop32) From owner-svn-src-head@freebsd.org Tue Jun 30 15:58: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 5813434F4AA; Tue, 30 Jun 2020 15:58:31 +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 49x8Cq0nVCz4bF9; Tue, 30 Jun 2020 15:58:31 +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 E42991A3E6; Tue, 30 Jun 2020 15:58:30 +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 05UFwU9X016481; Tue, 30 Jun 2020 15:58:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UFwTfJ016476; Tue, 30 Jun 2020 15:58:29 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202006301558.05UFwTfJ016476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 30 Jun 2020 15:58:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362803 - in head/sys: conf dev/usb/controller mips/mediatek X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: conf dev/usb/controller mips/mediatek X-SVN-Commit-Revision: 362803 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 15:58:31 -0000 Author: andrew Date: Tue Jun 30 15:58:29 2020 New Revision: 362803 URL: https://svnweb.freebsd.org/changeset/base/362803 Log: Add dwc_otg_acpi Create an acpi attachment for the DWC USB OTG device. This is present in the Raspberry Pi 4 in the USB-C port normally used to power the board. Some firmware presents the kernel with ACPI tables rather than FDT so we need an ACPI attachment. Submitted by: Greg V Approved by: hselasky (removal of All rights reserved) Differential Revision: https://reviews.freebsd.org/D25203 Added: head/sys/dev/usb/controller/dwc_otg_acpi.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg_fdt.c head/sys/mips/mediatek/mtk_dotg.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 30 15:57:11 2020 (r362802) +++ head/sys/conf/files Tue Jun 30 15:58:29 2020 (r362803) @@ -3189,6 +3189,7 @@ dev/uart/uart_tty.c optional uart dev/usb/controller/musb_otg.c optional musb dev/usb/controller/dwc_otg.c optional dwcotg dev/usb/controller/dwc_otg_fdt.c optional dwcotg fdt +dev/usb/controller/dwc_otg_acpi.c optional dwcotg acpi dev/usb/controller/ehci.c optional ehci dev/usb/controller/ehci_msm.c optional ehci_msm fdt dev/usb/controller/ehci_pci.c optional ehci pci Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Tue Jun 30 15:57:11 2020 (r362802) +++ head/sys/dev/usb/controller/dwc_otg.c Tue Jun 30 15:58:29 2020 (r362803) @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -3873,12 +3874,40 @@ int dwc_otg_init(struct dwc_otg_softc *sc) { uint32_t temp; + int err; DPRINTF("start\n"); + sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); + sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); + sc->sc_io_size = rman_get_size(sc->sc_io_res); + /* set up the bus structure */ + sc->sc_bus.devices = sc->sc_devices; + sc->sc_bus.devices_max = DWC_OTG_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; sc->sc_bus.usbrev = USB_REV_2_0; sc->sc_bus.methods = &dwc_otg_bus_methods; + + /* get all DMA memory */ + if (usb_bus_mem_alloc_all(&sc->sc_bus, + USB_GET_DMA_TAG(sc->sc_bus.parent), NULL)) { + return (ENOMEM); + } + + sc->sc_bus.bdev = device_add_child(sc->sc_bus.parent, "usbus", -1); + if (sc->sc_bus.bdev == NULL) + return (ENXIO); + + device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); + + err = bus_setup_intr(sc->sc_bus.parent, sc->sc_irq_res, + INTR_TYPE_TTY | INTR_MPSAFE, &dwc_otg_filter_interrupt, + &dwc_otg_interrupt, sc, &sc->sc_intr_hdl); + if (err) { + sc->sc_intr_hdl = NULL; + return (ENXIO); + } usb_callout_init_mtx(&sc->sc_timer, &sc->sc_bus.bus_mtx, 0); Added: head/sys/dev/usb/controller/dwc_otg_acpi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/controller/dwc_otg_acpi.c Tue Jun 30 15:58:29 2020 (r362803) @@ -0,0 +1,184 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2012 Hans Petter Selasky. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_acpi.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +static device_probe_t dwc_otg_probe; +static device_attach_t dwc_otg_attach; +static device_attach_t dwc_otg_detach; + +static char *dwc_otg_ids[] = { + "BCM2848", + NULL +}; + +static int +dwc_otg_probe(device_t dev) +{ + int rv; + + if (acpi_disabled("dwc_otg")) + return (ENXIO); + + rv = ACPI_ID_PROBE(device_get_parent(dev), dev, dwc_otg_ids, NULL); + if (rv > 0) + return (rv); + + device_set_desc(dev, "DWC OTG 2.0 integrated USB controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +dwc_otg_attach(device_t dev) +{ + struct dwc_otg_softc *sc = device_get_softc(dev); + int err; + int rid; + + sc->sc_bus.parent = dev; + + /* assume device mode (this is only used for the Raspberry Pi 4's + * USB-C port, which only works in device mode) */ + sc->sc_mode = DWC_MODE_DEVICE; + + rid = 0; + sc->sc_io_res = + bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + + if (sc->sc_io_res == NULL) + goto error; + + rid = 0; + sc->sc_irq_res = + bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->sc_irq_res == NULL) + goto error; + + err = dwc_otg_init(sc); + if (err == 0) { + err = device_probe_and_attach(sc->sc_bus.bdev); + } + if (err) + goto error; + + return (0); + +error: + dwc_otg_detach(dev); + return (ENXIO); +} + +static int +dwc_otg_detach(device_t dev) +{ + struct dwc_otg_softc *sc = device_get_softc(dev); + + /* during module unload there are lots of children leftover */ + device_delete_children(dev); + + if (sc->sc_irq_res && sc->sc_intr_hdl) { + /* + * only call dwc_otg_uninit() after dwc_otg_init() + */ + dwc_otg_uninit(sc); + + bus_teardown_intr(dev, sc->sc_irq_res, + sc->sc_intr_hdl); + sc->sc_intr_hdl = NULL; + } + /* free IRQ channel, if any */ + if (sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, + sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + /* free memory resource, if any */ + if (sc->sc_io_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, + sc->sc_io_res); + sc->sc_io_res = NULL; + } + usb_bus_mem_free_all(&sc->sc_bus, NULL); + + return (0); +} + +static device_method_t dwc_otg_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, dwc_otg_probe), + DEVMETHOD(device_attach, dwc_otg_attach), + DEVMETHOD(device_detach, dwc_otg_detach), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + + DEVMETHOD_END +}; + +static driver_t dwc_otg_driver = { + .name = "dwcotg", + .methods = dwc_otg_methods, + .size = sizeof(struct dwc_otg_softc), +}; + +static devclass_t dwc_otg_devclass; + +DRIVER_MODULE(dwcotg, acpi, dwc_otg_driver, dwc_otg_devclass, 0, 0); +MODULE_DEPEND(dwcotg, usb, 1, 1, 1); Modified: head/sys/dev/usb/controller/dwc_otg_fdt.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg_fdt.c Tue Jun 30 15:57:11 2020 (r362802) +++ head/sys/dev/usb/controller/dwc_otg_fdt.c Tue Jun 30 15:58:29 2020 (r362803) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2012 Hans Petter Selasky. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -102,11 +102,7 @@ dwc_otg_attach(device_t dev) int err; int rid; - /* initialise some bus fields */ sc->sc_otg.sc_bus.parent = dev; - sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; - sc->sc_otg.sc_bus.devices_max = DWC_OTG_MAX_DEVICES; - sc->sc_otg.sc_bus.dma_bits = 32; /* get USB mode, if any */ if (OF_getprop(ofw_bus_get_node(dev), "dr_mode", @@ -125,24 +121,13 @@ dwc_otg_attach(device_t dev) } } - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus, - USB_GET_DMA_TAG(dev), NULL)) { - return (ENOMEM); - } rid = 0; sc->sc_otg.sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (!(sc->sc_otg.sc_io_res)) { - err = ENOMEM; + if (!(sc->sc_otg.sc_io_res)) goto error; - } - sc->sc_otg.sc_io_tag = rman_get_bustag(sc->sc_otg.sc_io_res); - sc->sc_otg.sc_io_hdl = rman_get_bushandle(sc->sc_otg.sc_io_res); - sc->sc_otg.sc_io_size = rman_get_size(sc->sc_otg.sc_io_res); - /* * brcm,bcm2708-usb FDT provides two interrupts, we need only the USB * interrupt (VC_USB). The latest FDT for it provides an @@ -163,21 +148,12 @@ dwc_otg_attach(device_t dev) if (sc->sc_otg.sc_bus.bdev == NULL) goto error; - device_set_ivars(sc->sc_otg.sc_bus.bdev, &sc->sc_otg.sc_bus); - - err = bus_setup_intr(dev, sc->sc_otg.sc_irq_res, INTR_TYPE_TTY | INTR_MPSAFE, - &dwc_otg_filter_interrupt, &dwc_otg_interrupt, sc, &sc->sc_otg.sc_intr_hdl); - if (err) { - sc->sc_otg.sc_intr_hdl = NULL; - goto error; - } err = dwc_otg_init(&sc->sc_otg); if (err == 0) { err = device_probe_and_attach(sc->sc_otg.sc_bus.bdev); } if (err) goto error; - return (0); Modified: head/sys/mips/mediatek/mtk_dotg.c ============================================================================== --- head/sys/mips/mediatek/mtk_dotg.c Tue Jun 30 15:57:11 2020 (r362802) +++ head/sys/mips/mediatek/mtk_dotg.c Tue Jun 30 15:58:29 2020 (r362803) @@ -96,16 +96,7 @@ dotg_fdt_attach(device_t dev) /* initialise some bus fields */ sc->sc_mode = DWC_MODE_HOST; sc->sc_bus.parent = dev; - sc->sc_bus.devices = sc->sc_devices; - sc->sc_bus.devices_max = DWC_OTG_MAX_DEVICES; - sc->sc_bus.dma_bits = 32; - /* get all DMA memory */ - if (usb_bus_mem_alloc_all(&sc->sc_bus, - USB_GET_DMA_TAG(dev), NULL)) { - printf("No mem\n"); - return (ENOMEM); - } rid = 0; sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -113,9 +104,6 @@ dotg_fdt_attach(device_t dev) printf("Can`t alloc MEM\n"); goto error; } - sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); - sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); - sc->sc_io_size = rman_get_size(sc->sc_io_res); rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, @@ -131,15 +119,6 @@ dotg_fdt_attach(device_t dev) goto error; } device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus); - - err = bus_setup_intr(dev, sc->sc_irq_res, - INTR_TYPE_TTY | INTR_MPSAFE, dwc_otg_filter_interrupt, - dwc_otg_interrupt, sc, &sc->sc_intr_hdl); - if (err) { - sc->sc_intr_hdl = NULL; - printf("Can`t set IRQ handle\n"); - goto error; - } err = dwc_otg_init(sc); if (err) printf("dotg_init fail\n"); From owner-svn-src-head@freebsd.org Tue Jun 30 16:18: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 EE54034F953; Tue, 30 Jun 2020 16:18:09 +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 49x8fT601Rz4cr3; Tue, 30 Jun 2020 16:18:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B0E591AAEB; Tue, 30 Jun 2020 16:18:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05UGI9Wv029467; Tue, 30 Jun 2020 16:18:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UGI9xB029466; Tue, 30 Jun 2020 16:18:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006301618.05UGI9xB029466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 30 Jun 2020 16:18:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362804 - 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: 362804 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 16:18:10 -0000 Author: trasz Date: Tue Jun 30 16:18:09 2020 New Revision: 362804 URL: https://svnweb.freebsd.org/changeset/base/362804 Log: Make linux(4) ignore SA_INTERRUPT. The zsh(1) binary from Bionic uses it. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25499 Modified: head/sys/compat/linux/linux_signal.c Modified: head/sys/compat/linux/linux_signal.c ============================================================================== --- head/sys/compat/linux/linux_signal.c Tue Jun 30 15:58:29 2020 (r362803) +++ head/sys/compat/linux/linux_signal.c Tue Jun 30 16:18:09 2020 (r362804) @@ -102,6 +102,10 @@ linux_to_bsd_sigaction(l_sigaction_t *lsa, struct siga flags &= ~LINUX_SA_RESTART; bsa->sa_flags |= SA_RESTART; } + if (lsa->lsa_flags & LINUX_SA_INTERRUPT) { + flags &= ~LINUX_SA_INTERRUPT; + /* Documented to be a "historical no-op". */ + } if (lsa->lsa_flags & LINUX_SA_ONESHOT) { flags &= ~LINUX_SA_ONESHOT; bsa->sa_flags |= SA_RESETHAND; From owner-svn-src-head@freebsd.org Tue Jun 30 16:23: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 DCB6F34FB6B; Tue, 30 Jun 2020 16:23: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 49x8n45N7vz4dBW; Tue, 30 Jun 2020 16:23: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 9B9DF1B018; Tue, 30 Jun 2020 16:23: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 05UGNqDK035220; Tue, 30 Jun 2020 16:23:52 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UGNq1T035218; Tue, 30 Jun 2020 16:23:52 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202006301623.05UGNq1T035218@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: Tue, 30 Jun 2020 16:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362805 - in head/share/man: man5 man9 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: in head/share/man: man5 man9 X-SVN-Commit-Revision: 362805 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 16:23:52 -0000 Author: 0mp (doc,ports committer) Date: Tue Jun 30 16:23:51 2020 New Revision: 362805 URL: https://svnweb.freebsd.org/changeset/base/362805 Log: Cross-reference style(9) and style.mdoc(5) Suggested by: yuripv MFC after: 3 days Modified: head/share/man/man5/style.mdoc.5 head/share/man/man9/style.9 Modified: head/share/man/man5/style.mdoc.5 ============================================================================== --- head/share/man/man5/style.mdoc.5 Tue Jun 30 16:18:09 2020 (r362804) +++ head/share/man/man5/style.mdoc.5 Tue Jun 30 16:23:51 2020 (r362805) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2019 +.Dd June 30, 2020 .Dt STYLE.MDOC 5 .Os .Sh NAME @@ -242,7 +242,8 @@ that would be rendered as: .Sh SEE ALSO .Xr man 1 , .Xr mandoc 1 , -.Xr mdoc 7 +.Xr mdoc 7 , +.Xr style 9 .Sh HISTORY This manual page first appeared in .Fx 13.0 . Modified: head/share/man/man9/style.9 ============================================================================== --- head/share/man/man9/style.9 Tue Jun 30 16:18:09 2020 (r362804) +++ head/share/man/man9/style.9 Tue Jun 30 16:23:51 2020 (r362805) @@ -25,7 +25,7 @@ .\" From: @(#)style 1.14 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd January 10, 2020 +.Dd June 30, 2020 .Dt STYLE 9 .Os .Sh NAME @@ -916,6 +916,7 @@ indentation rules. .Xr err 3 , .Xr warn 3 , .Xr style.Makefile 5 , +.Xr style.mdoc 5 , .Xr style.lua 9 .Sh HISTORY This manual page is largely based on the From owner-svn-src-head@freebsd.org Tue Jun 30 16:24: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 3811534FD5A; Tue, 30 Jun 2020 16:24:29 +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 49x8nn0jxgz4d6g; Tue, 30 Jun 2020 16:24:29 +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 F0ED51B08E; Tue, 30 Jun 2020 16:24:28 +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 05UGOSWq035294; Tue, 30 Jun 2020 16:24:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UGOS9F035293; Tue, 30 Jun 2020 16:24:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006301624.05UGOS9F035293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 30 Jun 2020 16:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362806 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 362806 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 16:24:29 -0000 Author: trasz Date: Tue Jun 30 16:24:28 2020 New Revision: 362806 URL: https://svnweb.freebsd.org/changeset/base/362806 Log: Make linprocfs(5) create the /proc//task/ directores. This is to silence down some Chromium assertions. PR: kern/240991 Analyzed by: Alex S MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25256 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Tue Jun 30 16:23:51 2020 (r362805) +++ head/sys/compat/linprocfs/linprocfs.c Tue Jun 30 16:24:28 2020 (r362806) @@ -1620,6 +1620,28 @@ out: } /* + * The point of the following two functions is to work around + * an assertion in Chromium; see kern/240991 for details. + */ +static int +linprocfs_dotaskattr(PFS_ATTR_ARGS) +{ + + vap->va_nlink = 3; + return (0); +} + +/* + * Filler function for proc//task/.dummy + */ +static int +linprocfs_dotaskdummy(PFS_FILL_ARGS) +{ + + return (0); +} + +/* * Filler function for proc/sys/kernel/random/uuid */ static int @@ -1758,6 +1780,11 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "auxv", &linprocfs_doauxv, NULL, &procfs_candebug, NULL, PFS_RD|PFS_RAWRD); pfs_create_file(dir, "limits", &linprocfs_doproclimits, + NULL, NULL, NULL, PFS_RD); + + /* /proc//task/... */ + dir = pfs_create_dir(dir, "task", linprocfs_dotaskattr, NULL, NULL, 0); + pfs_create_file(dir, ".dummy", &linprocfs_dotaskdummy, NULL, NULL, NULL, PFS_RD); /* /proc/scsi/... */ From owner-svn-src-head@freebsd.org Tue Jun 30 16:28: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 3CD6A350301; Tue, 30 Jun 2020 16:28:41 +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 49x8tc3LVRz4dV6; Tue, 30 Jun 2020 16:28:40 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ed1-f49.google.com with SMTP id b15so16807796edy.7; Tue, 30 Jun 2020 09:28:40 -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=OIveqn01hp3MZ8rH1Sl0c4FB/QT0VUAFsYZAIm2Zqo8=; b=W3ZIj29SaiP/B5F/98N3jkhXSuViAtkqrOzlcaT445u7wuWSnE+wnC6QkeeRSJEu0H wEfMMoPO6N3TqlREDph7T7xBJQ7k81NRHCVB7Wy/tkT8XCs0qiDJoPEj2f2yq3VkMoEu xabPoiavSh4QP+Y8UOqHc9Sy6FkVbXdp4mzYpti9bWnU63UumgQPjaSK7X1xMFlrpqRR fAD34LxPFEp+jqPh2TAkzwVyaM31mv8YNihkoOdsQu8rWUMssmCEGgGUWlHAGnkx7n49 GRXcmi3gu55/qJXNutuDV4PV3A5gtpGOPfvDxbwBadM9GAnJ62JmDVoK+MDkQOhJNRus 1K7g== X-Gm-Message-State: AOAM532IBi0yRr8z9Uw6vd9XhC+rlMLTJUIJnTnCv+ZzeL6pxOL7moYT q9EVGZs/64ZC8FOOAP70EAICy8Li X-Google-Smtp-Source: ABdhPJyvnlrZPC/SpNCj0qcrvBzXGi+u5nsJyzzldVYwGjy/qfMyfb5vCPGsfJX4ndmoeNRhI5B6Lg== X-Received: by 2002:a05:6402:22f0:: with SMTP id dn16mr24239488edb.83.1593534517538; Tue, 30 Jun 2020 09:28:37 -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 v3sm3342816edj.89.2020.06.30.09.28.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jun 2020 09:28:36 -0700 (PDT) Subject: Re: svn commit: r362806 - head/sys/compat/linprocfs To: Edward Tomasz Napierala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006301624.05UGOS9F035293@repo.freebsd.org> From: Mateusz Piotrowski <0mp@FreeBSD.org> Message-ID: <526e3180-bc4a-b609-b601-80dfa6e3d918@FreeBSD.org> Date: Tue, 30 Jun 2020 18:28:29 +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: <202006301624.05UGOS9F035293@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 49x8tc3LVRz4dV6 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 [-1.80 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; ARC_NA(0.00)[]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-0.99)[-0.994]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-0.90)[-0.899]; NEURAL_SPAM_SHORT(0.10)[0.097]; RCVD_IN_DNSWL_NONE(0.00)[209.85.208.49:from]; 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]; 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: Tue, 30 Jun 2020 16:28:41 -0000 Hi, On 6/30/20 6:24 PM, Edward Tomasz Napierala wrote: > Author: trasz > Date: Tue Jun 30 16:24:28 2020 > New Revision: 362806 > URL: https://svnweb.freebsd.org/changeset/base/362806 > > Log: > Make linprocfs(5) create the /proc//task/ directores. > This is to silence down some Chromium assertions. > > PR: kern/240991 > Analyzed by: Alex S > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D25256 Hmm, could something similar be done to the following warning which is being printed when service fahclient is started (from the biology/linux-foldingathome port): 16:25:39:WARNING:Exception: Failed to open '/proc/bus/pci/devices': Failed to open '/proc/bus/pci/devices': No such file or directory: No such file or directory Cheers! Mateusz From owner-svn-src-head@freebsd.org Tue Jun 30 16:49: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 EBD8A35056A; Tue, 30 Jun 2020 16:49:43 +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 49x9Lv5vRNz4fqy; Tue, 30 Jun 2020 16:49: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 ADDE11B581; Tue, 30 Jun 2020 16:49: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 05UGnhha048282; Tue, 30 Jun 2020 16:49:43 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UGnhMV048281; Tue, 30 Jun 2020 16:49:43 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202006301649.05UGnhMV048281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 30 Jun 2020 16:49:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362807 - head/usr.sbin/sesutil X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.sbin/sesutil X-SVN-Commit-Revision: 362807 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 16:49:44 -0000 Author: trasz Date: Tue Jun 30 16:49:43 2020 New Revision: 362807 URL: https://svnweb.freebsd.org/changeset/base/362807 Log: Fix misplaced voltages/temperatures labels in 'sesutil show'. PR: bin/247384 Reported by: brd MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25353 Modified: head/usr.sbin/sesutil/sesutil.c Modified: head/usr.sbin/sesutil/sesutil.c ============================================================================== --- head/usr.sbin/sesutil/sesutil.c Tue Jun 30 16:24:28 2020 (r362806) +++ head/usr.sbin/sesutil/sesutil.c Tue Jun 30 16:49:43 2020 (r362807) @@ -831,7 +831,7 @@ show(int argc, char **argv __unused) break; case ELMTYP_THERM: if (e_ptr[j].elm_type != prev_type) - xo_emit("\nVoltages: "); + xo_emit("\nTemperatures: "); else xo_emit(", "); prev_type = e_ptr[j].elm_type; @@ -839,7 +839,7 @@ show(int argc, char **argv __unused) break; case ELMTYP_VOM: if (e_ptr[j].elm_type != prev_type) - xo_emit("\nTemperatures: "); + xo_emit("\nVoltages: "); else xo_emit(", "); prev_type = e_ptr[j].elm_type; From owner-svn-src-head@freebsd.org Tue Jun 30 17:16: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 D40D935142A; Tue, 30 Jun 2020 17:16:02 +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 49x9xG5DDFz3Ssw; Tue, 30 Jun 2020 17:16:02 +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 EDC9223297; Tue, 30 Jun 2020 17:16:01 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.38.20061401 Date: Tue, 30 Jun 2020 10:15:57 -0700 Subject: Re: svn commit: r362794 - head/sys/compat/linuxkpi/common/include/linux From: Ravi Pokala To: Hans Petter Selasky , , , Message-ID: <644D442D-18C4-402E-B0F2-ED45D7900538@panasas.com> Thread-Topic: svn commit: r362794 - head/sys/compat/linuxkpi/common/include/linux References: <202006300841.05U8fYMe044989@repo.freebsd.org> In-Reply-To: <202006300841.05U8fYMe044989@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: Tue, 30 Jun 2020 17:16:02 -0000 Thank you! -Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Hans Petter Selasky <= hselasky@FreeBSD.org> Date: 2020-06-30, Tuesday at 01:41 To: , , Subject: svn commit: r362794 - head/sys/compat/linuxkpi/common/include/linu= x Author: hselasky Date: Tue Jun 30 08:41:33 2020 New Revision: 362794 URL: https://svnweb.freebsd.org/changeset/base/362794 Log: Document the is_signed(), type_max() and type_min() function macros i= n the LinuxKPI. Try to make the function argument more readable. Suggested by: several MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.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/compat/linuxkpi/common/include/linux/kernel.h Tue Jun 30 0= 7:37:24 2020 (r362793) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Tue Jun 30 0= 8:41:33 2020 (r362794) @@ -564,20 +564,33 @@ linux_ratelimited(linux_ratelimit_t *rl) #define __is_constexpr(x) \ __builtin_constant_p(x) -#define is_signed(x) (((x)-1 / (x)2) =3D=3D (x)0) +/* + * The is_signed() macro below returns true if the passed data type is + * signed. Else false is returned. + */ +#define is_signed(datatype) (((datatype)-1 / (datatype)2) =3D=3D (datatype= )0) -#define type_max(x) ( \ - (sizeof(x) >=3D 8) ? (is_signed(x) ? INT64_MAX : UINT64_MAX) : \ - (sizeof(x) >=3D 4) ? (is_signed(x) ? INT32_MAX : UINT32_MAX) : \ - (sizeof(x) >=3D 2) ? (is_signed(x) ? INT16_MAX : UINT16_MAX) : \ - (is_signed(x) ? INT8_MAX : UINT8_MAX) \ +/* + * The type_max() macro below returns the maxium positive value the + * passed data type can hold. + */ +#define type_max(datatype) ( \ + (sizeof(datatype) >=3D 8) ? (is_signed(datatype) ? INT64_MAX : UINT64_= MAX) : \ + (sizeof(datatype) >=3D 4) ? (is_signed(datatype) ? INT32_MAX : UINT32_= MAX) : \ + (sizeof(datatype) >=3D 2) ? (is_signed(datatype) ? INT16_MAX : UINT16_= MAX) : \ + (is_signed(datatype) ? INT8_MAX : UINT8_MAX) \ ) -#define type_min(x) ( \ - (sizeof(x) >=3D 8) ? (is_signed(x) ? INT64_MIN : 0) : \ - (sizeof(x) >=3D 4) ? (is_signed(x) ? INT32_MIN : 0) : \ - (sizeof(x) >=3D 2) ? (is_signed(x) ? INT16_MIN : 0) : \ - (is_signed(x) ? INT8_MIN : 0) \ +/* + * The type_min() macro below returns the minimum value the passed + * data type can hold. For unsigned types the minimum value is always + * zero. For signed types it may vary. + */ +#define type_min(datatype) ( \ + (sizeof(datatype) >=3D 8) ? (is_signed(datatype) ? INT64_MIN : 0) : \ + (sizeof(datatype) >=3D 4) ? (is_signed(datatype) ? INT32_MIN : 0) : \ + (sizeof(datatype) >=3D 2) ? (is_signed(datatype) ? INT16_MIN : 0) : \ + (is_signed(datatype) ? INT8_MIN : 0) \ ) #endif /* _LINUX_KERNEL_H_ */ From owner-svn-src-head@freebsd.org Tue Jun 30 17:21: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 006743510FA; Tue, 30 Jun 2020 17:21:29 +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 49xB3X6Jjmz3TNQ; Tue, 30 Jun 2020 17:21:28 +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 BC5941BC82; Tue, 30 Jun 2020 17:21:28 +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 05UHLShs068692; Tue, 30 Jun 2020 17:21:28 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UHLSE7068690; Tue, 30 Jun 2020 17:21:28 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202006301721.05UHLSE7068690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Tue, 30 Jun 2020 17:21:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362808 - head/usr.sbin/iovctl X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/usr.sbin/iovctl X-SVN-Commit-Revision: 362808 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 17:21:29 -0000 Author: gbe (doc committer) Date: Tue Jun 30 17:21:28 2020 New Revision: 362808 URL: https://svnweb.freebsd.org/changeset/base/362808 Log: iovctl(8): Correct a typo in the manpage and correct the SYNOPSIS PR: 246831 Submitted by: Jose Luis Duran Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after: 7 days Modified: head/usr.sbin/iovctl/iovctl.8 head/usr.sbin/iovctl/iovctl.conf.5 Modified: head/usr.sbin/iovctl/iovctl.8 ============================================================================== --- head/usr.sbin/iovctl/iovctl.8 Tue Jun 30 16:49:43 2020 (r362807) +++ head/usr.sbin/iovctl/iovctl.8 Tue Jun 30 17:21:28 2020 (r362808) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 8, 2015 +.Dd May 31, 2020 .Dt IOVCTL 8 .Os .Sh NAME @@ -34,7 +34,7 @@ .Sh SYNOPSIS .Nm .Fl C -.Op Fl f Ar config-file +.Fl f Ar config-file .Op Fl n .Nm .Fl D Modified: head/usr.sbin/iovctl/iovctl.conf.5 ============================================================================== --- head/usr.sbin/iovctl/iovctl.conf.5 Tue Jun 30 16:49:43 2020 (r362807) +++ head/usr.sbin/iovctl/iovctl.conf.5 Tue Jun 30 17:21:28 2020 (r362808) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 8, 2015 +.Dd May 29, 2020 .Dt IOVCTL.CONF 5 .Os .Sh NAME @@ -43,7 +43,7 @@ device. To configure SR-IOV on multiple PF devices, use one configuration file for each PF. The locations of all -.Xr iovctl 9 +.Xr iovctl 8 configuration files are specified in .Xr rc.conf 5 . .Pp From owner-svn-src-head@freebsd.org Tue Jun 30 18:09: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 2864835276D; Tue, 30 Jun 2020 18:09:00 +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 49xC6N0LClz3Wn6; Tue, 30 Jun 2020 18:09:00 +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 DEE521C2A5; Tue, 30 Jun 2020 18:08:59 +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 05UI8x2F098193; Tue, 30 Jun 2020 18:08:59 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UI8xHC098191; Tue, 30 Jun 2020 18:08:59 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202006301808.05UI8xHC098191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Tue, 30 Jun 2020 18:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362809 - head/contrib/mandoc X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/contrib/mandoc X-SVN-Commit-Revision: 362809 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 18:09:00 -0000 Author: gbe (doc committer) Date: Tue Jun 30 18:08:59 2020 New Revision: 362809 URL: https://svnweb.freebsd.org/changeset/base/362809 Log: Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8). PR: 223520, 223521 Reviewed by: bcr (mentor) Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D25521 Modified: head/contrib/mandoc/apropos.1 head/contrib/mandoc/makewhatis.8 Modified: head/contrib/mandoc/apropos.1 ============================================================================== --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020 (r362808) +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020 (r362809) @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 22 2018 $ +.Dd $Mdocdate: June 30 2020 $ .Dt APROPOS 1 .Os .Sh NAME @@ -493,6 +493,12 @@ The options .Fl acfhIKklOTWw appeared in .Ox 5.7 . +.Pp +The +.Nm +utility was integrated into +.Fx 11.1 +as part of the switch to mandoc. .Sh AUTHORS .An -nosplit .An Bill Joy Modified: head/contrib/mandoc/makewhatis.8 ============================================================================== --- head/contrib/mandoc/makewhatis.8 Tue Jun 30 17:21:28 2020 (r362808) +++ head/contrib/mandoc/makewhatis.8 Tue Jun 30 18:08:59 2020 (r362809) @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 17 2017 $ +.Dd $Mdocdate: June 30 2020 $ .Dt MAKEWHATIS 8 .Os .Sh NAME @@ -211,6 +211,12 @@ and the options .Fl aCDnQT in .Ox 5.6 . +.Pp +The +.Nm +utility was integrated into +.Fx 11.1 +as part of the switch to mandoc. .Sh AUTHORS .An -nosplit .An Bill Joy From owner-svn-src-head@freebsd.org Tue Jun 30 20:01: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 CBE9B354F98; Tue, 30 Jun 2020 20:01:35 +0000 (UTC) (envelope-from se@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 49xFcH515Vz3dlN; Tue, 30 Jun 2020 20:01:35 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f203300c91db44f1fdc4079.dip0.t-ipconnect.de [IPv6:2003:cd:5f20:3300:c91d:b44f:1fdc:4079]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id BA7A724812; Tue, 30 Jun 2020 20:01:34 +0000 (UTC) (envelope-from se@freebsd.org) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: Ed Maste , John Baldwin Cc: Eric van Gyzen , src-committers , svn-src-all , svn-src-head References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> From: =?UTF-8?Q?Stefan_E=c3=9fer?= Autocrypt: addr=se@freebsd.org; keydata= mQENBFVxiRIBCADOLNOZBsqlplHUQ3tG782FNtVT33rQli9EjNt2fhFERHIo4NxHlWBpHLnU b0s4L/eItx7au0i7Gegv01A9LUMwOnAc9EFAm4EW3Wmoa6MYrcP7xDClohg/Y69f7SNpEs3x YATBy+L6NzWZbJjZXD4vqPgZSDuMcLU7BEdJf0f+6h1BJPnGuwHpsSdnnMrZeIM8xQ8PPUVQ L0GZkVojHgNUngJH6e21qDrud0BkdiBcij0M3TCP4GQrJ/YMdurfc8mhueLpwGR2U1W8TYB7 4UY+NLw0McThOCLCxXflIeF/Y7jSB0zxzvb/H3LWkodUTkV57yX9IbUAGA5RKRg9zsUtABEB AAG0J1N0ZWZhbiBFw59lciAoRnJlZUJTRCkgPHNlQGZyZWVic2Qub3JnPokBVAQTAQoAPgIb AwULCQgHAwUVCgkICwUWAwIBAAIeAQIXgBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+q BQkLJQETAAoJEEfrte9a/fVEOeMH/icmdK1eZQvB3U8quJo9VMaZsaTuCMbUE4NThyfsIvIm MCd+rb/yULmMYwqNfjyKB1x4ikR4x+94l+yJoz7K0Usks+eNKDmMGJM6pWWssTigaJubFdVd hVVC+C1QJi7JshYSib08uONoPmO4lv5Az0TDYGtsMzsES2sIlc62c9go5WPGYhQFRbX3Lk6y V6m8OHh+G9XGSj3oPO4UteRwu+SzTdOLunZBWG1wu34+IeZm663D+2gOppQLWpLa2qaTerqw THu377ayZ2B2LPJ5JkvkZeHYPkwDQ+b5PGn0UhfkxPnDVYki5F7qKxvQ5uq1/q9YaCX7mmOl H2yO7tgVsrW5AQ0EVXGJEgEIALEj9qCXMZVucjpcd3QxM/TlUr98m5viEd1z4tCnPUyRWcIC EVtj2h5xMH+2iB0q1+KWhq+NsWtvScmEmfHnsr7dJ1K677OdpDhKVaJk61eeRulFY1R4yb6C 1MMxK+WgYB+vvpG0UeyR0M4uBewcPvRsq4yGUHFQKtLAbMdoPTSryJA+ElnmK1vdY+rPcHgi OIMBZM7ahsPXC0C9K4e5SP9clGyIoMpbfHXdx9q+Rp3zVtlbhyk3BS/xccu/+9pk9ICXL6GR js2sNnJ0wxdU1DsAlC59a5MnSruwiZFwRnkQhr3x6wk97Lg7sLS9jjTnCN7LGlVmSmpOEMy6 uq1AWfUAEQEAAYkBPAQYAQoAJgIbDBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+rBQkL JQEZAAoJEEfrte9a/fVEuesH/2DNxGWnHvWwMyiyhlQtafvDKwEn/wAgR8gHJFodB7emf8rA TnukH7MVttCoHtjN5lvv9RSBHjNTZls5wR/ANlwdRuPQHd8ZGxLe3S6IuUB3zDSwFltLGurO N2kOMhs5mTGyypSa+uw3rtQbUAVYf1oPbiR4FLtiM8FLyEvE95hX5fPq9Qvx9FmN79kmCIEw jDKPqDaUf/OR2fEF0LSIbXHEk4tNqCEwx5DIJ0fp5/z5UzICUAmwxyRs5O/Hre1jzPsMVyud Ml9t7UTOJGKVWwRory1PMnOFxN+iz5/d4FhYSKXF7kfMiFgol4LuWaxJRwbBrr71VGBrRy2a L1nw6Bc= Message-ID: <54915302-fad6-730c-8ce7-01c70e97fb6a@freebsd.org> Date: Tue, 30 Jun 2020 22:01:31 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.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: Tue, 30 Jun 2020 20:01:35 -0000 Am 29.06.20 um 20:09 schrieb Ed Maste: > On Mon, 29 Jun 2020 at 11:27, John Baldwin wrote: >> >> I suspect just doing the 'merge --record-only' is the simplest method >> assuming Git handles it ok. I suspect since Git ignores mergeinfo this >> is fine, but it would be good for Ed to confirm. You can always restore >> the tests in the future in contrib/bc when you want to add them. > > I think a --record-only merge is the best approach; in any case we > have a number of these in the tree already and Git will have to deal > with them. $ cd /usr/svn/base/head/contrib/bc $ svn merge --record-only ^/vendor/bc/dist svn: E195016: 'svn+ssh://repo.freebsd.org/base/vendor/bc/dist@362810' must be ancestrally related to 'svn+ssh://repo.freebsd.org/base/head/contrib/bc@362810' Adding the option --ignore-ancestry to the merge command does not help. I have performed a clean check-out of base/head and base/vendor, but the error message stays the same ... SVN info for the relevant directories involved in the merge attempt: $ svn info /usr/svn/base/head/contrib/bc /usr/svn/base/vendor/bc/dist Path: usr/svn/base/head/contrib/bc Working Copy Root Path: /usr/svn/base URL: svn+ssh://repo.freebsd.org/base/head/contrib/bc Relative URL: ^/head/contrib/bc Repository Root: svn+ssh://repo.freebsd.org/base Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f Revision: 362810 Node Kind: directory Schedule: normal Last Changed Author: se Last Changed Rev: 362681 Last Changed Date: 2020-06-27 14:02:01 +0200 (Sat, 27 Jun 2020) Path: usr/svn/base/vendor/bc/dist Working Copy Root Path: /usr/svn/base URL: svn+ssh://repo.freebsd.org/base/vendor/bc/dist Relative URL: ^/vendor/bc/dist Repository Root: svn+ssh://repo.freebsd.org/base Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f Revision: 362810 Node Kind: directory Schedule: normal Last Changed Author: se Last Changed Rev: 362697 Last Changed Date: 2020-06-27 17:03:19 +0200 (Sat, 27 Jun 2020) Any idea how to merge from the vendor area in this situation? Regards, STefan From owner-svn-src-head@freebsd.org Tue Jun 30 21:29: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 BCB2F356441; Tue, 30 Jun 2020 21:29:48 +0000 (UTC) (envelope-from dim@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 49xHZ44djmz405c; Tue, 30 Jun 2020 21:29:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 67F2E24DDE; Tue, 30 Jun 2020 21:29:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [10.10.156.45] (unknown [45.85.81.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 42F873ED49; Tue, 30 Jun 2020 23:29:46 +0200 (CEST) From: Dimitry Andric Message-Id: <41B27C33-D023-453B-9DED-5776BE059F56@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_C8D930B8-E2F6-4776-A006-22D57730CC9F"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... Date: Tue, 30 Jun 2020 23:29:38 +0200 In-Reply-To: <54915302-fad6-730c-8ce7-01c70e97fb6a@freebsd.org> Cc: Ed Maste , John Baldwin , Eric van Gyzen , src-committers , svn-src-all , svn-src-head To: =?utf-8?Q?Stefan_E=C3=9Fer?= References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> <54915302-fad6-730c-8ce7-01c70e97fb6a@freebsd.org> X-Mailer: Apple Mail (2.3445.104.14) 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, 30 Jun 2020 21:29:48 -0000 --Apple-Mail=_C8D930B8-E2F6-4776-A006-22D57730CC9F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 30 Jun 2020, at 22:01, Stefan E=C3=9Fer wrote: >=20 > Am 29.06.20 um 20:09 schrieb Ed Maste: >> On Mon, 29 Jun 2020 at 11:27, John Baldwin wrote: >>>=20 >>> I suspect just doing the 'merge --record-only' is the simplest = method >>> assuming Git handles it ok. I suspect since Git ignores mergeinfo = this >>> is fine, but it would be good for Ed to confirm. You can always = restore >>> the tests in the future in contrib/bc when you want to add them. >>=20 >> I think a --record-only merge is the best approach; in any case we >> have a number of these in the tree already and Git will have to deal >> with them. >=20 > $ cd /usr/svn/base/head/contrib/bc >=20 > $ svn merge --record-only ^/vendor/bc/dist > svn: E195016: 'svn+ssh://repo.freebsd.org/base/vendor/bc/dist@362810' > must be ancestrally related to > 'svn+ssh://repo.freebsd.org/base/head/contrib/bc@362810' This is because you are supposed to commit stuff to ^/base/vendor/xxx first, then svn cp it to ^/head/contrib/xxx, at least from Subversion 1.8 onwards. The 'cp' action establishes the ancestral relation. Some of our older contrib areas were imported using cvs2svn, and these also suffer the same problem, i.e. Subversion complains that the vendor and contrib areas are not ancestrally related. > Adding the option --ignore-ancestry to the merge command does not = help. ... > Any idea how to merge from the vendor area in this situation? As far as I know, you have these alternatives: * Delete the contrib/bc tree, and do a fresh svn cp from the vendor area. You will have to apply any customizations on top again. I did something like this to fixup contrib/libc++ in https://svnweb.freebsd.org/base?view=3Drevision&revision=3D287679 * Figure out the right value of the svn:mergeinfo property, and apply that by hand, using svn propset. This will be tricky, and has to be re-done manually every time you want to merge again. * Merge with Subversion 1.7 or earlier. * Ignore all this, merge patches by hand and wait for the Git transition to be completed. -Dimitry --Apple-Mail=_C8D930B8-E2F6-4776-A006-22D57730CC9F Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXvuuwgAKCRCwXqMKLiCW o0/nAKC8wDBpcrn8hEK5ngW9G+xQoaI4QQCfUMIlHiagagOueHflQU9O7oKbLLQ= =HtSP -----END PGP SIGNATURE----- --Apple-Mail=_C8D930B8-E2F6-4776-A006-22D57730CC9F-- From owner-svn-src-head@freebsd.org Tue Jun 30 21:40: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 EC35F3566E3; Tue, 30 Jun 2020 21:40:35 +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 49xHpW5xPHz40sD; Tue, 30 Jun 2020 21:40:35 +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 966E81EA89; Tue, 30 Jun 2020 21:40:35 +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 05ULeZik026931; Tue, 30 Jun 2020 21:40:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ULeZOE026929; Tue, 30 Jun 2020 21:40:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202006302140.05ULeZOE026929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 30 Jun 2020 21:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362811 - head/usr.sbin/acpi/acpidump X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 362811 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 21:40:36 -0000 Author: mav Date: Tue Jun 30 21:40:34 2020 New Revision: 362811 URL: https://svnweb.freebsd.org/changeset/base/362811 Log: Decode APEI tables (BERT, EINJ, ERST, HEST). MFC after: 2 weeks Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpidump.8 Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Tue Jun 30 19:34:36 2020 (r362810) +++ head/usr.sbin/acpi/acpidump/acpi.c Tue Jun 30 21:40:34 2020 (r362811) @@ -3,6 +3,7 @@ * * Copyright (c) 1998 Doug Rabson * Copyright (c) 2000 Mitsuru IWASAKI + * Copyright (c) 2020 Alexander Motin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -177,23 +178,17 @@ acpi_print_gas(ACPI_GENERIC_ADDRESS *gas) { switch(gas->SpaceId) { case ACPI_GAS_MEMORY: - if (gas->BitWidth <= 32) - printf("0x%08x:%u[%u] (Memory)", - (u_int)gas->Address, gas->BitOffset, - gas->BitWidth); - else - printf("0x%016jx:%u[%u] (Memory)", - (uintmax_t)gas->Address, gas->BitOffset, - gas->BitWidth); + printf("0x%016jx:%u[%u] (Memory)", (uintmax_t)gas->Address, + gas->BitOffset, gas->BitWidth); break; case ACPI_GAS_IO: - printf("0x%02x:%u[%u] (IO)", (u_int)gas->Address, + printf("0x%02jx:%u[%u] (IO)", (uintmax_t)gas->Address, gas->BitOffset, gas->BitWidth); break; case ACPI_GAS_PCI: - printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32), + printf("%x:%x+0x%x:%u[%u] (PCI)", (uint16_t)(gas->Address >> 32), (uint16_t)((gas->Address >> 16) & 0xffff), - (uint16_t)gas->Address); + (uint16_t)gas->Address, gas->BitOffset, gas->BitWidth); break; /* XXX How to handle these below? */ case ACPI_GAS_EMBEDDED: @@ -594,6 +589,269 @@ acpi_handle_madt(ACPI_TABLE_HEADER *sdp) } static void +acpi_handle_bert(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_BERT *bert; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + bert = (ACPI_TABLE_BERT *)sdp; + printf("\tRegionLength=%d\n", bert->RegionLength); + printf("\tAddress=0x%016jx\n", bert->Address); + printf(END_COMMENT); +} + +static void +acpi_print_whea(ACPI_WHEA_HEADER *w) +{ + + printf("\n\tAction=%d\n", w->Action); + printf("\tInstruction=%d\n", w->Instruction); + printf("\tFlags=%02x\n", w->Flags); + printf("\tRegisterRegion="); + acpi_print_gas(&w->RegisterRegion); + printf("\n\tValue=0x%016jx\n", w->Value); + printf("\tMask=0x%016jx\n", w->Mask); +} + +static void +acpi_handle_einj(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_EINJ *einj; + ACPI_WHEA_HEADER *w; + u_int i; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + einj = (ACPI_TABLE_EINJ *)sdp; + printf("\tHeaderLength=%d\n", einj->HeaderLength); + printf("\tFlags=0x%02x\n", einj->Flags); + printf("\tEntries=%d\n", einj->Entries); + w = (ACPI_WHEA_HEADER *)(einj + 1); + for (i = 0; i < MIN(einj->Entries, (sdp->Length - + sizeof(ACPI_TABLE_EINJ)) / sizeof(ACPI_WHEA_HEADER)); i++) + acpi_print_whea(w + i); + printf(END_COMMENT); +} + +static void +acpi_handle_erst(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_ERST *erst; + ACPI_WHEA_HEADER *w; + u_int i; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + erst = (ACPI_TABLE_ERST *)sdp; + printf("\tHeaderLength=%d\n", erst->HeaderLength); + printf("\tEntries=%d\n", erst->Entries); + w = (ACPI_WHEA_HEADER *)(erst + 1); + for (i = 0; i < MIN(erst->Entries, (sdp->Length - + sizeof(ACPI_TABLE_ERST)) / sizeof(ACPI_WHEA_HEADER)); i++) + acpi_print_whea(w + i); + printf(END_COMMENT); +} + +static void +acpi_print_hest_bank(ACPI_HEST_IA_ERROR_BANK *b) +{ + + printf("\tBank:\n"); + printf("\t\tBankNumber=%d\n", b->BankNumber); + printf("\t\tClearStatusOnInit=%d\n", b->ClearStatusOnInit); + printf("\t\tStatusFormat=%d\n", b->StatusFormat); + printf("\t\tControlRegister=%x\n", b->ControlRegister); + printf("\t\tControlData=%jx\n", b->ControlData); + printf("\t\tStatusRegister=%x\n", b->StatusRegister); + printf("\t\tAddressRegister=%x\n", b->AddressRegister); + printf("\t\tMiscRegister=%x\n", b->MiscRegister); +} + +static void +acpi_print_hest_notify(ACPI_HEST_NOTIFY *n) +{ + + printf("\t\tType=%d\n", n->Type); + printf("\t\tLength=%d\n", n->Length); + printf("\t\tConfigWriteEnable=%04x\n", n->ConfigWriteEnable); + printf("\t\tPollInterval=%d\n", n->PollInterval); + printf("\t\tVector=%d\n", n->Vector); + printf("\t\tPollingThresholdValue=%d\n", n->PollingThresholdValue); + printf("\t\tPollingThresholdWindow=%d\n", n->PollingThresholdWindow); + printf("\t\tErrorThresholdValue=%d\n", n->ErrorThresholdValue); + printf("\t\tErrorThresholdWindow=%d\n", n->ErrorThresholdWindow); +} + +static void +acpi_print_hest_aer(ACPI_HEST_AER_COMMON *a) +{ + + printf("\tFlags=%02x\n", a->Flags); + printf("\tEnabled=%d\n", a->Enabled); + printf("\tRecordsToPreallocate=%d\n", a->RecordsToPreallocate); + printf("\tMaxSectionsPerRecord=%d\n", a->MaxSectionsPerRecord); + printf("\tBus=%d\n", a->Bus); + printf("\tDevice=%d\n", a->Device); + printf("\tFunction=%d\n", a->Function); + printf("\tDeviceControl=%d\n", a->DeviceControl); + printf("\tUncorrectableMask=%d\n", a->UncorrectableMask); + printf("\tUncorrectableSeverity=%d\n", a->UncorrectableSeverity); + printf("\tCorrectableMask=%d\n", a->CorrectableMask); + printf("\tAdvancedCapabilities=%d\n", a->AdvancedCapabilities); +} + +static int +acpi_handle_hest_structure(void *addr, int remaining) +{ + ACPI_HEST_HEADER *hdr = addr; + int i; + + if (remaining < (int)sizeof(ACPI_HEST_HEADER)) + return (-1); + + printf("\n\tType=%d\n", hdr->Type); + printf("\tSourceId=%d\n", hdr->SourceId); + switch (hdr->Type) { + case ACPI_HEST_TYPE_IA32_CHECK: { + ACPI_HEST_IA_MACHINE_CHECK *s = addr; + printf("\tFlags=%02x\n", s->Flags); + printf("\tEnabled=%d\n", s->Enabled); + printf("\tRecordsToPreallocate=%d\n", s->RecordsToPreallocate); + printf("\tMaxSectionsPerRecord=%d\n", s->MaxSectionsPerRecord); + printf("\tGlobalCapabilityData=%jd\n", s->GlobalCapabilityData); + printf("\tGlobalControlData=%jd\n", s->GlobalControlData); + printf("\tNumHardwareBanks=%d\n", s->NumHardwareBanks); + for (i = 0; i < s->NumHardwareBanks; i++) { + acpi_print_hest_bank((ACPI_HEST_IA_ERROR_BANK *) + (s + 1) + i); + } + return (sizeof(*s) + s->NumHardwareBanks * + sizeof(ACPI_HEST_IA_ERROR_BANK)); + } + case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: { + ACPI_HEST_IA_CORRECTED *s = addr; + printf("\tFlags=%02x\n", s->Flags); + printf("\tEnabled=%d\n", s->Enabled); + printf("\tRecordsToPreallocate=%d\n", s->RecordsToPreallocate); + printf("\tMaxSectionsPerRecord=%d\n", s->MaxSectionsPerRecord); + printf("\tNotify:\n"); + acpi_print_hest_notify(&s->Notify); + printf("\tNumHardwareBanks=%d\n", s->NumHardwareBanks); + for (i = 0; i < s->NumHardwareBanks; i++) { + acpi_print_hest_bank((ACPI_HEST_IA_ERROR_BANK *) + (s + 1) + i); + } + return (sizeof(*s) + s->NumHardwareBanks * + sizeof(ACPI_HEST_IA_ERROR_BANK)); + } + case ACPI_HEST_TYPE_IA32_NMI: { + ACPI_HEST_IA_NMI *s = addr; + printf("\tRecordsToPreallocate=%d\n", s->RecordsToPreallocate); + printf("\tMaxSectionsPerRecord=%d\n", s->MaxSectionsPerRecord); + printf("\tMaxRawDataLength=%d\n", s->MaxRawDataLength); + return (sizeof(*s)); + } + case ACPI_HEST_TYPE_AER_ROOT_PORT: { + ACPI_HEST_AER_ROOT *s = addr; + acpi_print_hest_aer(&s->Aer); + printf("\tRootErrorCommand=%d\n", s->RootErrorCommand); + return (sizeof(*s)); + } + case ACPI_HEST_TYPE_AER_ENDPOINT: { + ACPI_HEST_AER *s = addr; + acpi_print_hest_aer(&s->Aer); + return (sizeof(*s)); + } + case ACPI_HEST_TYPE_AER_BRIDGE: { + ACPI_HEST_AER_BRIDGE *s = addr; + acpi_print_hest_aer(&s->Aer); + printf("\tUncorrectableMask2=%d\n", s->UncorrectableMask2); + printf("\tUncorrectableSeverity2=%d\n", s->UncorrectableSeverity2); + printf("\tAdvancedCapabilities2=%d\n", s->AdvancedCapabilities2); + return (sizeof(*s)); + } + case ACPI_HEST_TYPE_GENERIC_ERROR: { + ACPI_HEST_GENERIC *s = addr; + printf("\tRelatedSourceId=%d\n", s->RelatedSourceId); + printf("\tEnabled=%d\n", s->Enabled); + printf("\tRecordsToPreallocate=%d\n", s->RecordsToPreallocate); + printf("\tMaxSectionsPerRecord=%d\n", s->MaxSectionsPerRecord); + printf("\tMaxRawDataLength=%d\n", s->MaxRawDataLength); + printf("\tErrorStatusAddress="); + acpi_print_gas(&s->ErrorStatusAddress); + printf("\n"); + printf("\tNotify:\n"); + acpi_print_hest_notify(&s->Notify); + printf("\tErrorBlockLength=%d\n", s->ErrorBlockLength); + return (sizeof(*s)); + } + case ACPI_HEST_TYPE_GENERIC_ERROR_V2: { + ACPI_HEST_GENERIC_V2 *s = addr; + printf("\tRelatedSourceId=%d\n", s->RelatedSourceId); + printf("\tEnabled=%d\n", s->Enabled); + printf("\tRecordsToPreallocate=%d\n", s->RecordsToPreallocate); + printf("\tMaxSectionsPerRecord=%d\n", s->MaxSectionsPerRecord); + printf("\tMaxRawDataLength=%d\n", s->MaxRawDataLength); + printf("\tErrorStatusAddress="); + acpi_print_gas(&s->ErrorStatusAddress); + printf("\n"); + printf("\tNotify:\n"); + acpi_print_hest_notify(&s->Notify); + printf("\tErrorBlockLength=%d\n", s->ErrorBlockLength); + printf("\tReadAckRegister="); + acpi_print_gas(&s->ReadAckRegister); + printf("\n"); + printf("\tReadAckPreserve=%jd\n", s->ReadAckPreserve); + printf("\tReadAckWrite=%jd\n", s->ReadAckWrite); + return (sizeof(*s)); + } + case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: { + ACPI_HEST_IA_DEFERRED_CHECK *s = addr; + printf("\tFlags=%02x\n", s->Flags); + printf("\tEnabled=%d\n", s->Enabled); + printf("\tRecordsToPreallocate=%d\n", s->RecordsToPreallocate); + printf("\tMaxSectionsPerRecord=%d\n", s->MaxSectionsPerRecord); + printf("\tNotify:\n"); + acpi_print_hest_notify(&s->Notify); + printf("\tNumHardwareBanks=%d\n", s->NumHardwareBanks); + for (i = 0; i < s->NumHardwareBanks; i++) { + acpi_print_hest_bank((ACPI_HEST_IA_ERROR_BANK *) + (s + 1) + i); + } + return (sizeof(*s) + s->NumHardwareBanks * + sizeof(ACPI_HEST_IA_ERROR_BANK)); + } + default: + return (-1); + } +} + +static void +acpi_handle_hest(ACPI_TABLE_HEADER *sdp) +{ + char *cp; + int remaining, consumed; + ACPI_TABLE_HEST *hest; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); + hest = (ACPI_TABLE_HEST *)sdp; + printf("\tErrorSourceCount=%d\n", hest->ErrorSourceCount); + + remaining = sdp->Length - sizeof(ACPI_TABLE_HEST); + while (remaining > 0) { + cp = (char *)sdp + sdp->Length - remaining; + consumed = acpi_handle_hest_structure(cp, remaining); + if (consumed <= 0) + break; + else + remaining -= consumed; + } + printf(END_COMMENT); +} + +static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp) { ACPI_TABLE_HPET *hpet; @@ -604,7 +862,7 @@ acpi_handle_hpet(ACPI_TABLE_HEADER *sdp) printf("\tHPET Number=%d\n", hpet->Sequence); printf("\tADDR="); acpi_print_gas(&hpet->Address); - printf("\tHW Rev=0x%x\n", hpet->Id & ACPI_HPET_ID_HARDWARE_REV_ID); + printf("\n\tHW Rev=0x%x\n", hpet->Id & ACPI_HPET_ID_HARDWARE_REV_ID); printf("\tComparators=%d\n", (hpet->Id & ACPI_HPET_ID_COMPARATORS) >> 8); printf("\tCounter Size=%d\n", hpet->Id & ACPI_HPET_ID_COUNT_SIZE_CAP ? @@ -727,13 +985,14 @@ acpi_print_native_lpit(ACPI_LPIT_NATIVE *nl) { printf("\tEntryTrigger="); acpi_print_gas(&nl->EntryTrigger); - printf("\tResidency=%u\n", nl->Residency); + printf("\n\tResidency=%u\n", nl->Residency); printf("\tLatency=%u\n", nl->Latency); if (nl->Header.Flags & ACPI_LPIT_NO_COUNTER) printf("\tResidencyCounter=Not Present"); else { printf("\tResidencyCounter="); acpi_print_gas(&nl->ResidencyCounter); + printf("\n"); } if (nl->CounterFrequency) printf("\tCounterFrequency=%ju\n", nl->CounterFrequency); @@ -1762,10 +2021,18 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) sdp->Signature); continue; } - if (!memcmp(sdp->Signature, ACPI_SIG_FADT, 4)) + if (!memcmp(sdp->Signature, ACPI_SIG_BERT, 4)) + acpi_handle_bert(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_EINJ, 4)) + acpi_handle_einj(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_ERST, 4)) + acpi_handle_erst(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_FADT, 4)) acpi_handle_fadt(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_MADT, 4)) acpi_handle_madt(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_HEST, 4)) + acpi_handle_hest(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_HPET, 4)) acpi_handle_hpet(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_ECDT, 4)) Modified: head/usr.sbin/acpi/acpidump/acpidump.8 ============================================================================== --- head/usr.sbin/acpi/acpidump/acpidump.8 Tue Jun 30 19:34:36 2020 (r362810) +++ head/usr.sbin/acpi/acpidump/acpidump.8 Tue Jun 30 21:40:34 2020 (r362811) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 10, 2018 +.Dd June 29, 2020 .Dt ACPIDUMP 8 .Os .Sh NAME @@ -97,11 +97,15 @@ flag, the utility dumps contents of the following tables: .Pp .Bl -tag -offset indent -width 12345 -compact +.It BERT .It DMAR .It DSDT .It ECDT +.It EINJ +.It ERST .It FACS .It FADT +.It HEST .It HPET .It LPIT .It MADT @@ -109,6 +113,10 @@ utility dumps contents of the following tables: .It NFIT .It RSD PTR .It RSDT +.It SLIT +.It SRAT +.It TCPA +.It TPM2 .It WDDT .El .Pp From owner-svn-src-head@freebsd.org Tue Jun 30 21:48: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 ABFA8356E67; Tue, 30 Jun 2020 21:48:59 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49xJ0C49Xkz41Dx; Tue, 30 Jun 2020 21:48:59 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 594DD1E9B0; Tue, 30 Jun 2020 21:48:59 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05ULmxf3033113; Tue, 30 Jun 2020 21:48:59 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ULmxOR033112; Tue, 30 Jun 2020 21:48:59 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202006302148.05ULmxOR033112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 30 Jun 2020 21:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362812 - head/stand/efi/boot1 X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/boot1 X-SVN-Commit-Revision: 362812 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 21:48:59 -0000 Author: tsoome Date: Tue Jun 30 21:48:58 2020 New Revision: 362812 URL: https://svnweb.freebsd.org/changeset/base/362812 Log: boot1.efi: use malloc family from libsa The zfs reader development did reach to the point where linking boot1, we will get errors about duplicate symbols Malloc, Free, Calloc. We can just use libsa version, just as loader.efi does. The only concern is, libsa zalloc is using fixed size heap region, I did pick 64MB as other stage instances are using, but this size is likely not optimal. In any case, with limited memory setups, we should boot loader.efi directly. Sponsored by: Netflix, Klara Inc. Modified: head/stand/efi/boot1/boot1.c Modified: head/stand/efi/boot1/boot1.c ============================================================================== --- head/stand/efi/boot1/boot1.c Tue Jun 30 21:40:34 2020 (r362811) +++ head/stand/efi/boot1/boot1.c Tue Jun 30 21:48:58 2020 (r362812) @@ -53,43 +53,9 @@ static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID; -/* - * Provide Malloc / Free / Calloc backed by EFIs AllocatePool / FreePool which ensures - * memory is correctly aligned avoiding EFI_INVALID_PARAMETER returns from - * EFI methods. - */ +static EFI_PHYSICAL_ADDRESS heap; +static UINTN heapsize; -void * -Malloc(size_t len, const char *file __unused, int line __unused) -{ - void *out; - - if (BS->AllocatePool(EfiLoaderData, len, &out) == EFI_SUCCESS) - return (out); - - return (NULL); -} - -void -Free(void *buf, const char *file __unused, int line __unused) -{ - if (buf != NULL) - (void)BS->FreePool(buf); -} - -void * -Calloc(size_t n1, size_t n2, const char *file, int line) -{ - size_t bytes; - void *res; - - bytes = n1 * n2; - if ((res = Malloc(bytes, file, line)) != NULL) - bzero(res, bytes); - - return (res); -} - /* * try_boot only returns if it fails to load the loader. If it succeeds * it simply boots, otherwise it returns the status of last EFI call. @@ -201,6 +167,18 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) BS = ST->BootServices; RS = ST->RuntimeServices; + heapsize = 64 * 1024 * 1024; + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, + EFI_SIZE_TO_PAGES(heapsize), &heap); + if (status != EFI_SUCCESS) { + ST->ConOut->OutputString(ST->ConOut, + __DECONST(CHAR16 *, + L"Failed to allocate memory for heap.\r\n")); + BS->Exit(IH, status, 0, NULL); + } + + setheap((void *)(uintptr_t)heap, (void *)(uintptr_t)(heap + heapsize)); + /* Set up the console, so printf works. */ status = BS->LocateProtocol(&ConsoleControlGUID, NULL, (VOID **)&ConsoleControl); @@ -296,6 +274,8 @@ add_device(dev_info_t **devinfop, dev_info_t *devinfo) void efi_exit(EFI_STATUS s) { + + BS->FreePages(heap, EFI_SIZE_TO_PAGES(heapsize)); BS->Exit(IH, s, 0, NULL); } From owner-svn-src-head@freebsd.org Tue Jun 30 21:50: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 27D593570A8; Tue, 30 Jun 2020 21:50:06 +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 49xJ1V0GBZz41nJ; Tue, 30 Jun 2020 21:50:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E08261ECA5; Tue, 30 Jun 2020 21:50:05 +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 05ULo5Ll033261; Tue, 30 Jun 2020 21:50:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05ULo5kI033260; Tue, 30 Jun 2020 21:50:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202006302150.05ULo5kI033260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 30 Jun 2020 21:50:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362813 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362813 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 21:50:06 -0000 Author: tuexen Date: Tue Jun 30 21:50:05 2020 New Revision: 362813 URL: https://svnweb.freebsd.org/changeset/base/362813 Log: Fix a bug introduced in https://svnweb.freebsd.org/changeset/base/362173 Reported by: syzbot+f3a6fccfa6ae9d3ded29@syzkaller.appspotmail.com MFC after: 1 week Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Tue Jun 30 21:48:58 2020 (r362812) +++ head/sys/netinet/sctputil.c Tue Jun 30 21:50:05 2020 (r362813) @@ -5247,7 +5247,11 @@ sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct soc if (holds_lock == 0) { SCTP_INP_RUNLOCK(inp); } - return (laddr->ifa); + if (laddr != NULL) { + return (laddr->ifa); + } else { + return (NULL); + } } uint32_t From owner-svn-src-head@freebsd.org Tue Jun 30 22:01: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 99A1B3572A1; Tue, 30 Jun 2020 22:01:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49xJGV3bDLz42TG; Tue, 30 Jun 2020 22:01:22 +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 5E8BD1EDC9; Tue, 30 Jun 2020 22:01:22 +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 05UM1MFn040903; Tue, 30 Jun 2020 22:01:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05UM1MiH040901; Tue, 30 Jun 2020 22:01:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202006302201.05UM1MiH040901@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 30 Jun 2020 22:01:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362814 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 362814 X-SVN-Commit-Repository: base MIME-Version: 1.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, 30 Jun 2020 22:01:22 -0000 Author: markj Date: Tue Jun 30 22:01:21 2020 New Revision: 362814 URL: https://svnweb.freebsd.org/changeset/base/362814 Log: Convert cryptostats to a counter_u64 array. The global counters were not SMP-friendly. Use per-CPU counters instead. Reviewed by: jhb Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D25466 Modified: head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodev.h Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Tue Jun 30 21:50:05 2020 (r362813) +++ head/sys/opencrypto/crypto.c Tue Jun 30 22:01:21 2020 (r362814) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include @@ -232,10 +232,32 @@ static int crypto_kinvoke(struct cryptkop *krp); static void crypto_task_invoke(void *ctx, int pending); static void crypto_batch_enqueue(struct cryptop *crp); -static struct cryptostats cryptostats; -SYSCTL_STRUCT(_kern_crypto, OID_AUTO, stats, CTLFLAG_RW, &cryptostats, - cryptostats, "Crypto system statistics"); +static counter_u64_t cryptostats[sizeof(struct cryptostats) / sizeof(uint64_t)]; +SYSCTL_COUNTER_U64_ARRAY(_kern_crypto, OID_AUTO, stats, CTLFLAG_RW, + cryptostats, nitems(cryptostats), + "Crypto system statistics"); +#define CRYPTOSTAT_INC(stat) do { \ + counter_u64_add( \ + cryptostats[offsetof(struct cryptostats, stat) / sizeof(uint64_t)],\ + 1); \ +} while (0) + +static void +cryptostats_init(void *arg __unused) +{ + COUNTER_ARRAY_ALLOC(cryptostats, nitems(cryptostats), M_WAITOK); +} +SYSINIT(cryptostats_init, SI_SUB_COUNTER, SI_ORDER_ANY, cryptostats_init, NULL); + +static void +cryptostats_fini(void *arg __unused) +{ + COUNTER_ARRAY_FREE(cryptostats, nitems(cryptostats)); +} +SYSUNINIT(cryptostats_fini, SI_SUB_COUNTER, SI_ORDER_ANY, cryptostats_fini, + NULL); + /* Try to avoid directly exposing the key buffer as a symbol */ static struct keybuf *keybuf; @@ -1399,7 +1421,7 @@ crypto_dispatch(struct cryptop *crp) crp_sanity(crp); #endif - cryptostats.cs_ops++; + CRYPTOSTAT_INC(cs_ops); crp->crp_retw_id = ((uintptr_t)crp->crp_session) % crypto_workers_num; @@ -1460,7 +1482,7 @@ crypto_kdispatch(struct cryptkop *krp) { int error; - cryptostats.cs_kops++; + CRYPTOSTAT_INC(cs_kops); krp->krp_cap = NULL; error = crypto_kinvoke(krp); @@ -1767,7 +1789,7 @@ crypto_done(struct cryptop *crp) ("crypto_done: op already done, flags 0x%x", crp->crp_flags)); crp->crp_flags |= CRYPTO_F_DONE; if (crp->crp_etype != 0) - cryptostats.cs_errs++; + CRYPTOSTAT_INC(cs_errs); /* * CBIMM means unconditionally do the callback immediately; @@ -1839,7 +1861,7 @@ crypto_kdone(struct cryptkop *krp) struct cryptocap *cap; if (krp->krp_status != 0) - cryptostats.cs_kerrs++; + CRYPTOSTAT_INC(cs_kerrs); CRYPTO_DRIVER_LOCK(); cap = krp->krp_cap; KASSERT(cap->cc_koperations > 0, ("cc_koperations == 0")); @@ -1979,7 +2001,7 @@ crypto_proc(void) */ cap->cc_qblocked = 1; TAILQ_INSERT_HEAD(&crp_q, submit, crp_next); - cryptostats.cs_blocks++; + CRYPTOSTAT_INC(cs_blocks); } } @@ -2016,7 +2038,7 @@ crypto_proc(void) */ krp->krp_cap->cc_kqblocked = 1; TAILQ_INSERT_HEAD(&crp_kq, krp, krp_next); - cryptostats.cs_kblocks++; + CRYPTOSTAT_INC(cs_kblocks); } } @@ -2038,7 +2060,7 @@ crypto_proc(void) crp_sleep = 0; if (cryptoproc == NULL) break; - cryptostats.cs_intrs++; + CRYPTOSTAT_INC(cs_intrs); } } CRYPTO_Q_UNLOCK(); @@ -2099,7 +2121,7 @@ crypto_ret_proc(struct crypto_ret_worker *ret_worker) "crypto_ret_wait", 0); if (ret_worker->cryptoretproc == NULL) break; - cryptostats.cs_rets++; + CRYPTOSTAT_INC(cs_rets); } } CRYPTO_RETW_UNLOCK(ret_worker); Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Tue Jun 30 21:50:05 2020 (r362813) +++ head/sys/opencrypto/cryptodev.h Tue Jun 30 22:01:21 2020 (r362814) @@ -327,14 +327,14 @@ struct crypt_kop { #define CIOCCRYPTAEAD _IOWR('c', 109, struct crypt_aead) struct cryptostats { - u_int32_t cs_ops; /* symmetric crypto ops submitted */ - u_int32_t cs_errs; /* symmetric crypto ops that failed */ - u_int32_t cs_kops; /* asymetric/key ops submitted */ - u_int32_t cs_kerrs; /* asymetric/key ops that failed */ - u_int32_t cs_intrs; /* crypto swi thread activations */ - u_int32_t cs_rets; /* crypto return thread activations */ - u_int32_t cs_blocks; /* symmetric op driver block */ - u_int32_t cs_kblocks; /* symmetric op driver block */ + uint64_t cs_ops; /* symmetric crypto ops submitted */ + uint64_t cs_errs; /* symmetric crypto ops that failed */ + uint64_t cs_kops; /* asymetric/key ops submitted */ + uint64_t cs_kerrs; /* asymetric/key ops that failed */ + uint64_t cs_intrs; /* crypto swi thread activations */ + uint64_t cs_rets; /* crypto return thread activations */ + uint64_t cs_blocks; /* symmetric op driver block */ + uint64_t cs_kblocks; /* symmetric op driver block */ }; #ifdef _KERNEL From owner-svn-src-head@freebsd.org Tue Jun 30 22:03: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 D2E973575DA; Tue, 30 Jun 2020 22:03:41 +0000 (UTC) (envelope-from se@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 49xJK95DDRz42bC; Tue, 30 Jun 2020 22:03:41 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f203300c91db44f1fdc4079.dip0.t-ipconnect.de [IPv6:2003:cd:5f20:3300:c91d:b44f:1fdc:4079]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id DFAE525AC7; Tue, 30 Jun 2020 22:03:40 +0000 (UTC) (envelope-from se@freebsd.org) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... To: Dimitry Andric Cc: src-committers , svn-src-all , svn-src-head References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> <54915302-fad6-730c-8ce7-01c70e97fb6a@freebsd.org> <41B27C33-D023-453B-9DED-5776BE059F56@FreeBSD.org> From: =?UTF-8?Q?Stefan_E=c3=9fer?= Autocrypt: addr=se@freebsd.org; keydata= mQENBFVxiRIBCADOLNOZBsqlplHUQ3tG782FNtVT33rQli9EjNt2fhFERHIo4NxHlWBpHLnU b0s4L/eItx7au0i7Gegv01A9LUMwOnAc9EFAm4EW3Wmoa6MYrcP7xDClohg/Y69f7SNpEs3x YATBy+L6NzWZbJjZXD4vqPgZSDuMcLU7BEdJf0f+6h1BJPnGuwHpsSdnnMrZeIM8xQ8PPUVQ L0GZkVojHgNUngJH6e21qDrud0BkdiBcij0M3TCP4GQrJ/YMdurfc8mhueLpwGR2U1W8TYB7 4UY+NLw0McThOCLCxXflIeF/Y7jSB0zxzvb/H3LWkodUTkV57yX9IbUAGA5RKRg9zsUtABEB AAG0J1N0ZWZhbiBFw59lciAoRnJlZUJTRCkgPHNlQGZyZWVic2Qub3JnPokBVAQTAQoAPgIb AwULCQgHAwUVCgkICwUWAwIBAAIeAQIXgBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+q BQkLJQETAAoJEEfrte9a/fVEOeMH/icmdK1eZQvB3U8quJo9VMaZsaTuCMbUE4NThyfsIvIm MCd+rb/yULmMYwqNfjyKB1x4ikR4x+94l+yJoz7K0Usks+eNKDmMGJM6pWWssTigaJubFdVd hVVC+C1QJi7JshYSib08uONoPmO4lv5Az0TDYGtsMzsES2sIlc62c9go5WPGYhQFRbX3Lk6y V6m8OHh+G9XGSj3oPO4UteRwu+SzTdOLunZBWG1wu34+IeZm663D+2gOppQLWpLa2qaTerqw THu377ayZ2B2LPJ5JkvkZeHYPkwDQ+b5PGn0UhfkxPnDVYki5F7qKxvQ5uq1/q9YaCX7mmOl H2yO7tgVsrW5AQ0EVXGJEgEIALEj9qCXMZVucjpcd3QxM/TlUr98m5viEd1z4tCnPUyRWcIC EVtj2h5xMH+2iB0q1+KWhq+NsWtvScmEmfHnsr7dJ1K677OdpDhKVaJk61eeRulFY1R4yb6C 1MMxK+WgYB+vvpG0UeyR0M4uBewcPvRsq4yGUHFQKtLAbMdoPTSryJA+ElnmK1vdY+rPcHgi OIMBZM7ahsPXC0C9K4e5SP9clGyIoMpbfHXdx9q+Rp3zVtlbhyk3BS/xccu/+9pk9ICXL6GR js2sNnJ0wxdU1DsAlC59a5MnSruwiZFwRnkQhr3x6wk97Lg7sLS9jjTnCN7LGlVmSmpOEMy6 uq1AWfUAEQEAAYkBPAQYAQoAJgIbDBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJa8u+rBQkL JQEZAAoJEEfrte9a/fVEuesH/2DNxGWnHvWwMyiyhlQtafvDKwEn/wAgR8gHJFodB7emf8rA TnukH7MVttCoHtjN5lvv9RSBHjNTZls5wR/ANlwdRuPQHd8ZGxLe3S6IuUB3zDSwFltLGurO N2kOMhs5mTGyypSa+uw3rtQbUAVYf1oPbiR4FLtiM8FLyEvE95hX5fPq9Qvx9FmN79kmCIEw jDKPqDaUf/OR2fEF0LSIbXHEk4tNqCEwx5DIJ0fp5/z5UzICUAmwxyRs5O/Hre1jzPsMVyud Ml9t7UTOJGKVWwRory1PMnOFxN+iz5/d4FhYSKXF7kfMiFgol4LuWaxJRwbBrr71VGBrRy2a L1nw6Bc= Message-ID: Date: Wed, 1 Jul 2020 00:03:39 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <41B27C33-D023-453B-9DED-5776BE059F56@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE 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, 30 Jun 2020 22:03:41 -0000 Am 30.06.20 um 23:29 schrieb Dimitry Andric: > On 30 Jun 2020, at 22:01, Stefan Eßer wrote: >> >> Am 29.06.20 um 20:09 schrieb Ed Maste: >>> On Mon, 29 Jun 2020 at 11:27, John Baldwin wrote: >>>> >>>> I suspect just doing the 'merge --record-only' is the simplest method >>>> assuming Git handles it ok. I suspect since Git ignores mergeinfo this >>>> is fine, but it would be good for Ed to confirm. You can always restore >>>> the tests in the future in contrib/bc when you want to add them. >>> >>> I think a --record-only merge is the best approach; in any case we >>> have a number of these in the tree already and Git will have to deal >>> with them. >> >> $ cd /usr/svn/base/head/contrib/bc >> >> $ svn merge --record-only ^/vendor/bc/dist >> svn: E195016: 'svn+ssh://repo.freebsd.org/base/vendor/bc/dist@362810' >> must be ancestrally related to >> 'svn+ssh://repo.freebsd.org/base/head/contrib/bc@362810' > > This is because you are supposed to commit stuff to ^/base/vendor/xxx > first, then svn cp it to ^/head/contrib/xxx, at least from Subversion > 1.8 onwards. The 'cp' action establishes the ancestral relation. Yes, I thought so - the problem I want to fix is the premature import to /contrib and I had been hoping that it was possible to use the --record-only merge to edit the merge history (as suggested by John Baldwin and Ed Maste). > Some of our older contrib areas were imported using cvs2svn, and these > also suffer the same problem, i.e. Subversion complains that the vendor > and contrib areas are not ancestrally related. I see. >> Adding the option --ignore-ancestry to the merge command does not help. > ... >> Any idea how to merge from the vendor area in this situation? > > As far as I know, you have these alternatives: > > * Delete the contrib/bc tree, and do a fresh svn cp from the vendor > area. You will have to apply any customizations on top again. I did > something like this to fixup contrib/libc++ in > https://svnweb.freebsd.org/base?view=revision&revision=287679 Yes, I could delete the files in contrib/bc and then immediately svn copy over the contents of vendor/bc/dist - and I guess that is the only real "clean" way forward. > * Figure out the right value of the svn:mergeinfo property, and apply > that by hand, using svn propset. This will be tricky, and has to be > re-done manually every time you want to merge again. Not my preferred approach ... > * Merge with Subversion 1.7 or earlier. If this would result in a sane state of the repository I might give it a try. > * Ignore all this, merge patches by hand and wait for the Git > transition to be completed. I want to upgrade to the next release and I'm wondering whether it would be possible to just svn copy that new version over from the vendor directory to the contrib directory. The import to the vendor area and the contrib directory have very similar commit messages and thus there would be no loss of commit history. If this is possible and does not cause problems for the SVN repo or the Git conversion, this might be the simplest solution. Thank you for your reply and the clarification of the situation! Best regards, STefan From owner-svn-src-head@freebsd.org Tue Jun 30 22:56: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 A313B3583C9; Tue, 30 Jun 2020 22:56:25 +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 49xKV06PN1z44nC; Tue, 30 Jun 2020 22:56:24 +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 05UMuHRI053766; Tue, 30 Jun 2020 15:56:17 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 05UMuHZY053765; Tue, 30 Jun 2020 15:56:17 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202006302256.05UMuHZY053765@gndrsh.dnsmgr.net> Subject: Re: svn commit: r362809 - head/contrib/mandoc In-Reply-To: <202006301808.05UI8xHC098191@repo.freebsd.org> To: Gordon Bergling Date: Tue, 30 Jun 2020 15:56:17 -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: 49xKV06PN1z44nC 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: Tue, 30 Jun 2020 22:56:25 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: gbe (doc committer) > Date: Tue Jun 30 18:08:59 2020 > New Revision: 362809 > URL: https://svnweb.freebsd.org/changeset/base/362809 > > Log: > Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8). > > PR: 223520, 223521 > Reviewed by: bcr (mentor) > Approved by: bcr (mentor) > Differential Revision: https://reviews.freebsd.org/D25521 > > Modified: > head/contrib/mandoc/apropos.1 > head/contrib/mandoc/makewhatis.8 > > Modified: head/contrib/mandoc/apropos.1 > ============================================================================== > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020 (r362808) > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020 (r362809) > @@ -15,7 +15,7 @@ > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > .\" > -.Dd $Mdocdate: November 22 2018 $ > +.Dd $Mdocdate: June 30 2020 $ > .Dt APROPOS 1 > .Os > .Sh NAME > @@ -493,6 +493,12 @@ The options > .Fl acfhIKklOTWw > appeared in > .Ox 5.7 . > +.Pp > +The > +.Nm > +utility was integrated into > +.Fx 11.1 > +as part of the switch to mandoc. Huh? FreeBSD has had apropos since 1.0 and my 5.4 system clearly has it: freebsd {110}% uname -a FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 #1: Mon Jul 1 17:58:50 PDT 2019 root@pdx.rh.CN85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE i386 pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos /usr/bin/apropos And a man page for it too: APROPOS(1) FreeBSD General Commands Manual APROPOS(1) NAME apropos, whatis -- search the whatis database SYNOPSIS apropos keyword ... whatis keyword ... DESCRIPTION apropos searches a set of database files containing short descriptions of system commands for keywords and displays the result on the standard out- put. whatis displays only complete word matches. keyword really is an extended regular expression, please read grep(1) manual page for more information about its format. DIAGNOSTICS The apropos utility exits 0 on success, and 1 if no keyword matched. SEE ALSO grep(1), makewhatis(1), man(1) FreeBSD 5.4 January 15, 1991 FreeBSD 5.4 > .Sh AUTHORS > .An -nosplit > .An Bill Joy > > Modified: head/contrib/mandoc/makewhatis.8 > ============================================================================== > --- head/contrib/mandoc/makewhatis.8 Tue Jun 30 17:21:28 2020 (r362808) > +++ head/contrib/mandoc/makewhatis.8 Tue Jun 30 18:08:59 2020 (r362809) > @@ -15,7 +15,7 @@ > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > .\" > -.Dd $Mdocdate: May 17 2017 $ > +.Dd $Mdocdate: June 30 2020 $ > .Dt MAKEWHATIS 8 > .Os > .Sh NAME > @@ -211,6 +211,12 @@ and the options > .Fl aCDnQT > in > .Ox 5.6 . > +.Pp > +The > +.Nm > +utility was integrated into > +.Fx 11.1 > +as part of the switch to mandoc. Ditto > .Sh AUTHORS > .An -nosplit > .An Bill Joy > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Jul 1 00:23: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 979DA3595AE; Wed, 1 Jul 2020 00:23:51 +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 49xMQv3sMdz47Th; Wed, 1 Jul 2020 00:23:51 +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 68B592064F; Wed, 1 Jul 2020 00:23:51 +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 0610Npqm031545; Wed, 1 Jul 2020 00:23:51 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0610Nn4w031533; Wed, 1 Jul 2020 00:23:49 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202007010023.0610Nn4w031533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 1 Jul 2020 00:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362815 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362815 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 00:23:51 -0000 Author: adrian Date: Wed Jul 1 00:23:49 2020 New Revision: 362815 URL: https://svnweb.freebsd.org/changeset/base/362815 Log: [net80211] Migrate HT/legacy protection mode and preamble calculation to per-VAP flags The later firmware devices (including iwn!) support multiple configuration contexts for a lot of things, leaving it up to the firmware to decide which channel and vap is active. This allows for things like off-channel p2p sta/ap operation and other weird things. However, net80211 is still focused on a "net80211 drives all" when it comes to driving the NIC, and as part of this history a lot of these options are global and not per-VAP. This is fine when net80211 drives things and all VAPs share a single channel - these parameters importantly really reflect the state of the channel! - but it will increasingly be not fine when we start supporting more weird configurations and more recent NICs. Yeah, recent like iwn/iwm. Anyway - so, migrate all of the HT protection, legacy protection and preamble stuff to be per-VAP. The global flags are still there; they're now calculated in a deferred taskqueue that mirrors the old behaviour. Firmware based drivers which have per-VAP configuration of these parameters can now just listen to the per-VAP options. What do I mean by per-channel? Well, the above configuration parameters really are about interoperation with other devices on the same channel. Eg, HT protection mode will flip to legacy/mixed if it hears ANY BSS that supports non-HT stations or indicates it has non-HT stations associated. So, these flags really should be per-channel rather than per-VAP, and then for things like "do i need short preamble or long preamble?" turn into a "do I need it for this current operating channel". Then any VAP using it can query the channel that it's on, reflecting the real required state. This patch does none of the above paragraph just yet. I'm also cheating a bit - I'm currently not using separate taskqueues for the beacon updates and the per-VAP configuration updates. I can always further split it later if I need to but I didn't think it was SUPER important here. So: * Create vap taskqueue entries for ERP/protection, HT protection and short/long preamble; * Migrate the HT station count, short/long slot station count, etc - into per-VAP variables rather than global; * Fix a bug with my WME work from a while ago which made it per-VAP - do the WME beacon update /after/ the WME update taskqueue runs, not before; * Any time the HT protmode configuration changes or the ERP protection mode config changes - schedule the task, which will call the driver without the net80211 lock held and all correctly serialised; * Use the global flags for beacon IEs and VAP flags for probe responses and other IE situations. The primary consumer of this is ath10k. iwn could use it when sending RXON, but we don't support IBSS or AP modes on it yet, and I'm not yet sure whether it's required in STA mode (ie whether the firmware parses beacons to change protection mode or whether we need to.) Tested: * AR9280, STA/AP * AR9380, DWDS STA+STA/AP * ath10k work, STA/AP * Intel 6235, STA * Various rtwn / run NICs, DWDS STA and STA configurations Modified: head/sys/net80211/ieee80211_ddb.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_node.h head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_power.c head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_proto.h head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_ddb.c ============================================================================== --- head/sys/net80211/ieee80211_ddb.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_ddb.c Wed Jul 1 00:23:49 2020 (r362815) @@ -483,6 +483,17 @@ _db_show_vap(const struct ieee80211vap *vap, int showm if (vap->iv_tdma != NULL) _db_show_tdma("\t", vap->iv_tdma, showprocs); #endif /* IEEE80211_SUPPORT_TDMA */ + + db_printf("\tsta_assoc %u", vap->iv_sta_assoc); + db_printf(" ht_sta_assoc %u", vap->iv_ht_sta_assoc); + db_printf(" ht40_sta_assoc %u", vap->iv_ht40_sta_assoc); + db_printf("\n"); + db_printf(" nonerpsta %u", vap->iv_nonerpsta); + db_printf(" longslotsta %u", vap->iv_longslotsta); + db_printf(" lastnonerp %d", vap->iv_lastnonerp); + db_printf(" lastnonht %d", vap->iv_lastnonht); + db_printf("\n"); + if (showprocs) { DB_PRINTSYM("\t", "iv_key_alloc", vap->iv_key_alloc); DB_PRINTSYM("\t", "iv_key_delete", vap->iv_key_delete); @@ -608,17 +619,8 @@ _db_show_com(const struct ieee80211com *ic, int showva _db_show_node_table("\t", &ic->ic_sta); db_printf("\tprotmode %d", ic->ic_protmode); - db_printf(" nonerpsta %u", ic->ic_nonerpsta); - db_printf(" longslotsta %u", ic->ic_longslotsta); - db_printf(" lastnonerp %d", ic->ic_lastnonerp); - db_printf("\n"); - db_printf("\tsta_assoc %u", ic->ic_sta_assoc); - db_printf(" ht_sta_assoc %u", ic->ic_ht_sta_assoc); - db_printf(" ht40_sta_assoc %u", ic->ic_ht40_sta_assoc); - db_printf("\n"); db_printf("\tcurhtprotmode 0x%x", ic->ic_curhtprotmode); db_printf(" htprotmode %d", ic->ic_htprotmode); - db_printf(" lastnonht %d", ic->ic_lastnonht); db_printf("\n"); db_printf("\tsuperg %p\n", ic->ic_superg); Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_hostap.c Wed Jul 1 00:23:49 2020 (r362815) @@ -206,8 +206,9 @@ hostap_newstate(struct ieee80211vap *vap, enum ieee802 * state and the timeout routines check if the flag * is set before doing anything so this is sufficient. */ - ic->ic_flags_ext &= ~IEEE80211_FEXT_NONERP_PR; - ic->ic_flags_ht &= ~IEEE80211_FHT_NONHT_PR; + vap->iv_flags_ext &= ~IEEE80211_FEXT_NONERP_PR; + vap->iv_flags_ht &= ~IEEE80211_FHT_NONHT_PR; + /* XXX TODO: schedule deferred update? */ /* fall thru... */ case IEEE80211_S_CAC: /* @@ -1812,10 +1813,13 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbu scan.status == 0 && /* NB: on-channel */ ((scan.erp & 0x100) == 0 || /* NB: no ERP, 11b sta*/ (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) { - ic->ic_lastnonerp = ticks; - ic->ic_flags_ext |= IEEE80211_FEXT_NONERP_PR; - if (ic->ic_protmode != IEEE80211_PROT_NONE && - (ic->ic_flags & IEEE80211_F_USEPROT) == 0) { + vap->iv_lastnonerp = ticks; + vap->iv_flags_ext |= IEEE80211_FEXT_NONERP_PR; + /* + * XXX TODO: this may need to check all VAPs? + */ + if (vap->iv_protmode != IEEE80211_PROT_NONE && + (vap->iv_flags & IEEE80211_F_USEPROT) == 0) { IEEE80211_NOTE_FRAME(vap, IEEE80211_MSG_ASSOC, wh, "non-ERP present on channel %d " @@ -1823,8 +1827,8 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbu "enable use of protection", ic->ic_curchan->ic_ieee, scan.erp, scan.chan); - ic->ic_flags |= IEEE80211_F_USEPROT; - ieee80211_notify_erp(ic); + vap->iv_flags |= IEEE80211_F_USEPROT; + ieee80211_vap_update_erp_protmode(vap); } } /* @@ -1844,12 +1848,12 @@ hostap_recv_mgmt(struct ieee80211_node *ni, struct mbu break; } if (scan.htinfo == NULL) { - ieee80211_htprot_update(ic, + ieee80211_htprot_update(vap, IEEE80211_HTINFO_OPMODE_PROTOPT | IEEE80211_HTINFO_NONHT_PRESENT); } else if (ishtmixed(scan.htinfo)) { /* XXX? take NONHT_PRESENT from beacon? */ - ieee80211_htprot_update(ic, + ieee80211_htprot_update(vap, IEEE80211_HTINFO_OPMODE_MIXED | IEEE80211_HTINFO_NONHT_PRESENT); } Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_ht.c Wed Jul 1 00:23:49 2020 (r362815) @@ -270,6 +270,9 @@ ieee80211_ht_vattach(struct ieee80211vap *vap) vap->iv_ampdu_mintraffic[WME_AC_VO] = 32; vap->iv_ampdu_mintraffic[WME_AC_VI] = 32; + vap->iv_htprotmode = IEEE80211_PROT_RTSCTS; + vap->iv_curhtprotmode = IEEE80211_HTINFO_OPMODE_PURE; + if (vap->iv_htcaps & IEEE80211_HTC_HT) { /* * Device is HT capable; enable all HT-related @@ -1509,38 +1512,36 @@ ieee80211_ht_wds_init(struct ieee80211_node *ni) } /* - * Notify hostap vaps of a change in the HTINFO ie. + * Notify a VAP of a change in the HTINFO ie if it's a hostap VAP. + * + * This is to be called from the deferred HT protection update + * task once the flags are updated. */ -static void -htinfo_notify(struct ieee80211com *ic) +void +ieee80211_htinfo_notify(struct ieee80211vap *vap) { - struct ieee80211vap *vap; - int first = 1; - IEEE80211_LOCK_ASSERT(ic); + IEEE80211_LOCK_ASSERT(vap->iv_ic); - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - if (vap->iv_opmode != IEEE80211_M_HOSTAP) - continue; - if (vap->iv_state != IEEE80211_S_RUN || - !IEEE80211_IS_CHAN_HT(vap->iv_bss->ni_chan)) - continue; - if (first) { - IEEE80211_NOTE(vap, - IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, - vap->iv_bss, - "HT bss occupancy change: %d sta, %d ht, " - "%d ht40%s, HT protmode now 0x%x" - , ic->ic_sta_assoc - , ic->ic_ht_sta_assoc - , ic->ic_ht40_sta_assoc - , (ic->ic_flags_ht & IEEE80211_FHT_NONHT_PR) ? - ", non-HT sta present" : "" - , ic->ic_curhtprotmode); - first = 0; - } - ieee80211_beacon_notify(vap, IEEE80211_BEACON_HTINFO); - } + if (vap->iv_opmode != IEEE80211_M_HOSTAP) + return; + if (vap->iv_state != IEEE80211_S_RUN || + !IEEE80211_IS_CHAN_HT(vap->iv_bss->ni_chan)) + return; + + IEEE80211_NOTE(vap, + IEEE80211_MSG_ASSOC | IEEE80211_MSG_11N, + vap->iv_bss, + "HT bss occupancy change: %d sta, %d ht, " + "%d ht40%s, HT protmode now 0x%x" + , vap->iv_sta_assoc + , vap->iv_ht_sta_assoc + , vap->iv_ht40_sta_assoc + , (vap->iv_flags_ht & IEEE80211_FHT_NONHT_PR) ? + ", non-HT sta present" : "" + , vap->iv_curhtprotmode); + + ieee80211_beacon_notify(vap, IEEE80211_BEACON_HTINFO); } /* @@ -1548,26 +1549,28 @@ htinfo_notify(struct ieee80211com *ic) * state and handle updates. */ static void -htinfo_update(struct ieee80211com *ic) +htinfo_update(struct ieee80211vap *vap) { + struct ieee80211com *ic = vap->iv_ic; uint8_t protmode; - if (ic->ic_sta_assoc != ic->ic_ht_sta_assoc) { + if (vap->iv_sta_assoc != vap->iv_ht_sta_assoc) { protmode = IEEE80211_HTINFO_OPMODE_MIXED | IEEE80211_HTINFO_NONHT_PRESENT; - } else if (ic->ic_flags_ht & IEEE80211_FHT_NONHT_PR) { + } else if (vap->iv_flags_ht & IEEE80211_FHT_NONHT_PR) { protmode = IEEE80211_HTINFO_OPMODE_PROTOPT | IEEE80211_HTINFO_NONHT_PRESENT; } else if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && IEEE80211_IS_CHAN_HT40(ic->ic_bsschan) && - ic->ic_sta_assoc != ic->ic_ht40_sta_assoc) { + vap->iv_sta_assoc != vap->iv_ht40_sta_assoc) { protmode = IEEE80211_HTINFO_OPMODE_HT20PR; } else { protmode = IEEE80211_HTINFO_OPMODE_PURE; } - if (protmode != ic->ic_curhtprotmode) { - ic->ic_curhtprotmode = protmode; - htinfo_notify(ic); + if (protmode != vap->iv_curhtprotmode) { + vap->iv_curhtprotmode = protmode; + /* Update VAP with new protection mode */ + ieee80211_vap_update_ht_protmode(vap); } } @@ -1577,16 +1580,16 @@ htinfo_update(struct ieee80211com *ic) void ieee80211_ht_node_join(struct ieee80211_node *ni) { - struct ieee80211com *ic = ni->ni_ic; + struct ieee80211vap *vap = ni->ni_vap; - IEEE80211_LOCK_ASSERT(ic); + IEEE80211_LOCK_ASSERT(vap->iv_ic); if (ni->ni_flags & IEEE80211_NODE_HT) { - ic->ic_ht_sta_assoc++; + vap->iv_ht_sta_assoc++; if (ni->ni_chw == 40) - ic->ic_ht40_sta_assoc++; + vap->iv_ht40_sta_assoc++; } - htinfo_update(ic); + htinfo_update(vap); } /* @@ -1595,16 +1598,16 @@ ieee80211_ht_node_join(struct ieee80211_node *ni) void ieee80211_ht_node_leave(struct ieee80211_node *ni) { - struct ieee80211com *ic = ni->ni_ic; + struct ieee80211vap *vap = ni->ni_vap; - IEEE80211_LOCK_ASSERT(ic); + IEEE80211_LOCK_ASSERT(vap->iv_ic); if (ni->ni_flags & IEEE80211_NODE_HT) { - ic->ic_ht_sta_assoc--; + vap->iv_ht_sta_assoc--; if (ni->ni_chw == 40) - ic->ic_ht40_sta_assoc--; + vap->iv_ht40_sta_assoc--; } - htinfo_update(ic); + htinfo_update(vap); } /* @@ -1618,25 +1621,27 @@ ieee80211_ht_node_leave(struct ieee80211_node *ni) * a higher precedence than PROTOPT (i.e. we will not change * change PROTOPT -> MIXED; only MIXED -> PROTOPT). This * corresponds to how we handle things in htinfo_update. + * */ void -ieee80211_htprot_update(struct ieee80211com *ic, int protmode) +ieee80211_htprot_update(struct ieee80211vap *vap, int protmode) { + struct ieee80211com *ic = vap->iv_ic; #define OPMODE(x) SM(x, IEEE80211_HTINFO_OPMODE) IEEE80211_LOCK(ic); /* track non-HT station presence */ KASSERT(protmode & IEEE80211_HTINFO_NONHT_PRESENT, ("protmode 0x%x", protmode)); - ic->ic_flags_ht |= IEEE80211_FHT_NONHT_PR; - ic->ic_lastnonht = ticks; + vap->iv_flags_ht |= IEEE80211_FHT_NONHT_PR; + vap->iv_lastnonht = ticks; - if (protmode != ic->ic_curhtprotmode && - (OPMODE(ic->ic_curhtprotmode) != IEEE80211_HTINFO_OPMODE_MIXED || + if (protmode != vap->iv_curhtprotmode && + (OPMODE(vap->iv_curhtprotmode) != IEEE80211_HTINFO_OPMODE_MIXED || OPMODE(protmode) == IEEE80211_HTINFO_OPMODE_PROTOPT)) { - /* push beacon update */ - ic->ic_curhtprotmode = protmode; - htinfo_notify(ic); + vap->iv_curhtprotmode = protmode; + /* Update VAP with new protection mode */ + ieee80211_vap_update_ht_protmode(vap); } IEEE80211_UNLOCK(ic); #undef OPMODE @@ -1651,18 +1656,17 @@ ieee80211_htprot_update(struct ieee80211com *ic, int p * gone we time out this condition. */ void -ieee80211_ht_timeout(struct ieee80211com *ic) +ieee80211_ht_timeout(struct ieee80211vap *vap) { - IEEE80211_LOCK_ASSERT(ic); - if ((ic->ic_flags_ht & IEEE80211_FHT_NONHT_PR) && - ieee80211_time_after(ticks, ic->ic_lastnonht + IEEE80211_NONHT_PRESENT_AGE)) { -#if 0 - IEEE80211_NOTE(vap, IEEE80211_MSG_11N, ni, + IEEE80211_LOCK_ASSERT(vap->iv_ic); + + if ((vap->iv_flags_ht & IEEE80211_FHT_NONHT_PR) && + ieee80211_time_after(ticks, vap->iv_lastnonht + IEEE80211_NONHT_PRESENT_AGE)) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_11N, "%s", "time out non-HT STA present on channel"); -#endif - ic->ic_flags_ht &= ~IEEE80211_FHT_NONHT_PR; - htinfo_update(ic); + vap->iv_flags_ht &= ~IEEE80211_FHT_NONHT_PR; + htinfo_update(vap); } } @@ -3507,6 +3511,12 @@ ieee80211_ht_update_beacon(struct ieee80211vap *vap, ht->hi_byte1 |= IEEE80211_HTINFO_TXWIDTH_2040; /* protection mode */ + /* + * XXX TODO: this uses the global flag, not the per-VAP flag. + * Eventually (once the protection modes are done per-channel + * rather than per-VAP) we can flip this over to be per-VAP but + * using the channel protection mode. + */ ht->hi_byte2 = (ht->hi_byte2 &~ PROTMODE) | ic->ic_curhtprotmode; ieee80211_free_node(ni); @@ -3547,7 +3557,11 @@ ieee80211_add_htinfo_body(uint8_t *frm, struct ieee802 if (IEEE80211_IS_CHAN_HT40(ni->ni_chan)) frm[0] |= IEEE80211_HTINFO_TXWIDTH_2040; - frm[1] = ic->ic_curhtprotmode; + /* + * Add current protection mode. Unlike for beacons, + * this will respect the per-VAP flags. + */ + frm[1] = vap->iv_curhtprotmode; frm += 5; Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_ioctl.c Wed Jul 1 00:23:49 2020 (r362815) @@ -851,7 +851,7 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l ireq->i_val = vap->iv_rtsthreshold; break; case IEEE80211_IOC_PROTMODE: - ireq->i_val = ic->ic_protmode; + ireq->i_val = vap->iv_protmode; break; case IEEE80211_IOC_TXPOWER: /* @@ -1097,7 +1097,7 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l error = ieee80211_ioctl_getdevcaps(ic, ireq); break; case IEEE80211_IOC_HTPROTMODE: - ireq->i_val = ic->ic_htprotmode; + ireq->i_val = vap->iv_htprotmode; break; case IEEE80211_IOC_HTCONF: if (vap->iv_flags_ht & IEEE80211_FHT_HT) { @@ -2912,11 +2912,13 @@ ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_l case IEEE80211_IOC_PROTMODE: if (ireq->i_val > IEEE80211_PROT_RTSCTS) return EINVAL; - ic->ic_protmode = (enum ieee80211_protmode)ireq->i_val; + vap->iv_protmode = (enum ieee80211_protmode)ireq->i_val; /* NB: if not operating in 11g this can wait */ if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && IEEE80211_IS_CHAN_ANYG(ic->ic_bsschan)) error = ERESTART; + /* driver callback for protection mode update */ + ieee80211_vap_update_erp_protmode(vap); break; case IEEE80211_IOC_TXPOWER: if ((ic->ic_caps & IEEE80211_C_TXPMGT) == 0) @@ -3384,11 +3386,13 @@ ieee80211_ioctl_set80211(struct ieee80211vap *vap, u_l case IEEE80211_IOC_HTPROTMODE: if (ireq->i_val > IEEE80211_PROT_RTSCTS) return EINVAL; - ic->ic_htprotmode = ireq->i_val ? + vap->iv_htprotmode = ireq->i_val ? IEEE80211_PROT_RTSCTS : IEEE80211_PROT_NONE; /* NB: if not operating in 11n this can wait */ if (isvapht(vap)) error = ERESTART; + /* Notify driver layer of HT protmode changes */ + ieee80211_vap_update_ht_protmode(vap); break; case IEEE80211_IOC_STA_VLAN: error = ieee80211_ioctl_setstavlan(vap, ireq); Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_node.c Wed Jul 1 00:23:49 2020 (r362815) @@ -99,7 +99,7 @@ static void ieee80211_node_table_init(struct ieee80211 static void ieee80211_node_table_reset(struct ieee80211_node_table *, struct ieee80211vap *); static void ieee80211_node_table_cleanup(struct ieee80211_node_table *nt); -static void ieee80211_erp_timeout(struct ieee80211com *); +static void ieee80211_vap_erp_timeout(struct ieee80211vap *); MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state"); MALLOC_DEFINE(M_80211_NODE_IE, "80211nodeie", "802.11 node ie"); @@ -674,7 +674,6 @@ ieee80211_ibss_merge(struct ieee80211_node *ni) { #ifdef IEEE80211_DEBUG struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211com *ic = ni->ni_ic; #endif if (! ieee80211_ibss_merge_check(ni)) @@ -683,9 +682,9 @@ ieee80211_ibss_merge(struct ieee80211_node *ni) IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, "%s: new bssid %s: %s preamble, %s slot time%s\n", __func__, ether_sprintf(ni->ni_bssid), - ic->ic_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long", + vap->iv_flags&IEEE80211_F_SHPREAMBLE ? "short" : "long", vap->iv_flags&IEEE80211_F_SHSLOT ? "short" : "long", - ic->ic_flags&IEEE80211_F_USEPROT ? ", protection" : "" + vap->iv_flags&IEEE80211_F_USEPROT ? ", protection" : "" ); return ieee80211_sta_join1(ieee80211_ref_node(ni)); } @@ -2508,12 +2507,27 @@ ieee80211_drain(struct ieee80211com *ic) } /* + * Per-ieee80211vap inactivity timer callback. + */ +static void +ieee80211_vap_timeout(struct ieee80211vap *vap) +{ + + IEEE80211_LOCK_ASSERT(vap->iv_ic); + + ieee80211_vap_erp_timeout(vap); + ieee80211_ht_timeout(vap); + ieee80211_vht_timeout(vap); +} + +/* * Per-ieee80211com inactivity timer callback. */ void ieee80211_node_timeout(void *arg) { struct ieee80211com *ic = arg; + struct ieee80211vap *vap; /* * Defer timeout processing if a channel switch is pending. @@ -2530,9 +2544,8 @@ ieee80211_node_timeout(void *arg) ieee80211_ageq_age(&ic->ic_stageq, IEEE80211_INACT_WAIT); IEEE80211_LOCK(ic); - ieee80211_erp_timeout(ic); - ieee80211_ht_timeout(ic); - ieee80211_vht_timeout(ic); + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + ieee80211_vap_timeout(vap); IEEE80211_UNLOCK(ic); } callout_reset(&ic->ic_inact, IEEE80211_INACT_WAIT*hz, @@ -2645,7 +2658,12 @@ ieee80211_dump_nodes(struct ieee80211_node_table *nt) (ieee80211_iter_func *) ieee80211_dump_node, nt); } -static void +/* + * Iterate over the VAPs and update their ERP beacon IEs. + * + * Note this must be called from the deferred ERP update task paths. + */ +void ieee80211_notify_erp_locked(struct ieee80211com *ic) { struct ieee80211vap *vap; @@ -2657,14 +2675,6 @@ ieee80211_notify_erp_locked(struct ieee80211com *ic) ieee80211_beacon_notify(vap, IEEE80211_BEACON_ERP); } -void -ieee80211_notify_erp(struct ieee80211com *ic) -{ - IEEE80211_LOCK(ic); - ieee80211_notify_erp_locked(ic); - IEEE80211_UNLOCK(ic); -} - /* * Handle a station joining an 11g network. */ @@ -2684,10 +2694,13 @@ ieee80211_node_join_11g(struct ieee80211_node *ni) * next beacon transmission (per sec. 7.3.1.4 of 11g). */ if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { - ic->ic_longslotsta++; + vap->iv_longslotsta++; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, "station needs long slot time, count %d", - ic->ic_longslotsta); + vap->iv_longslotsta); + /* + * XXX TODO: this may need all VAPs checked! + */ if (!IEEE80211_IS_CHAN_108G(ic->ic_bsschan)) { /* * Don't force slot time when switched to turbo @@ -2703,10 +2716,10 @@ ieee80211_node_join_11g(struct ieee80211_node *ni) * if configured. */ if (!ieee80211_iserp_rateset(&ni->ni_rates)) { - ic->ic_nonerpsta++; + vap->iv_nonerpsta++; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, "station is !ERP, %d non-ERP stations associated", - ic->ic_nonerpsta); + vap->iv_nonerpsta); /* * If station does not support short preamble * then we must enable use of Barker preamble. @@ -2714,20 +2727,21 @@ ieee80211_node_join_11g(struct ieee80211_node *ni) if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) == 0) { IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, "%s", "station needs long preamble"); - ic->ic_flags |= IEEE80211_F_USEBARKER; - ic->ic_flags &= ~IEEE80211_F_SHPREAMBLE; + vap->iv_flags |= IEEE80211_F_USEBARKER; + vap->iv_flags &= ~IEEE80211_F_SHPREAMBLE; + ieee80211_vap_update_preamble(vap); } /* * If protection is configured and this is the first * indication we should use protection, enable it. */ - if (ic->ic_protmode != IEEE80211_PROT_NONE && - ic->ic_nonerpsta == 1 && - (ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0) { + if (vap->iv_protmode != IEEE80211_PROT_NONE && + vap->iv_nonerpsta == 1 && + (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0) { IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_ASSOC, "%s: enable use of protection\n", __func__); - ic->ic_flags |= IEEE80211_F_USEPROT; - ieee80211_notify_erp_locked(ic); + vap->iv_flags |= IEEE80211_F_USEPROT; + ieee80211_vap_update_erp_protmode(vap); } } else ni->ni_flags |= IEEE80211_NODE_ERP; @@ -2762,7 +2776,6 @@ ieee80211_node_join(struct ieee80211_node *ni, int res IEEE80211_LOCK(ic); IEEE80211_AID_SET(vap, ni->ni_associd); vap->iv_sta_assoc++; - ic->ic_sta_assoc++; if (IEEE80211_IS_CHAN_HT(ic->ic_bsschan)) ieee80211_ht_node_join(ni); @@ -2783,9 +2796,9 @@ ieee80211_node_join(struct ieee80211_node *ni, int res IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC | IEEE80211_MSG_DEBUG, ni, "station associated at aid %d: %s preamble, %s slot time%s%s%s%s%s%s%s%s%s", IEEE80211_NODE_AID(ni), - ic->ic_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long", + vap->iv_flags & IEEE80211_F_SHPREAMBLE ? "short" : "long", vap->iv_flags & IEEE80211_F_SHSLOT ? "short" : "long", - ic->ic_flags & IEEE80211_F_USEPROT ? ", protection" : "", + vap->iv_flags & IEEE80211_F_USEPROT ? ", protection" : "", ni->ni_flags & IEEE80211_NODE_QOS ? ", QoS" : "", /* XXX update for VHT string */ ni->ni_flags & IEEE80211_NODE_HT ? @@ -2815,20 +2828,23 @@ ieee80211_node_join(struct ieee80211_node *ni, int res } static void -disable_protection(struct ieee80211com *ic) +disable_protection(struct ieee80211vap *vap) { - KASSERT(ic->ic_nonerpsta == 0 && - (ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0, - ("%d non ERP stations, flags 0x%x", ic->ic_nonerpsta, - ic->ic_flags_ext)); + struct ieee80211com *ic = vap->iv_ic; - ic->ic_flags &= ~IEEE80211_F_USEPROT; + KASSERT(vap->iv_nonerpsta == 0 && + (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0, + ("%d non ERP stations, flags 0x%x", vap->iv_nonerpsta, + vap->iv_flags_ext)); + + vap->iv_flags &= ~IEEE80211_F_USEPROT; /* XXX verify mode? */ if (ic->ic_caps & IEEE80211_C_SHPREAMBLE) { - ic->ic_flags |= IEEE80211_F_SHPREAMBLE; - ic->ic_flags &= ~IEEE80211_F_USEBARKER; + vap->iv_flags |= IEEE80211_F_SHPREAMBLE; + vap->iv_flags &= ~IEEE80211_F_USEBARKER; } - ieee80211_notify_erp_locked(ic); + ieee80211_vap_update_erp_protmode(vap); + ieee80211_vap_update_preamble(vap); } /* @@ -2850,13 +2866,16 @@ ieee80211_node_leave_11g(struct ieee80211_node *ni) * If a long slot station do the slot time bookkeeping. */ if ((ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_SLOTTIME) == 0) { - KASSERT(ic->ic_longslotsta > 0, - ("bogus long slot station count %d", ic->ic_longslotsta)); - ic->ic_longslotsta--; + KASSERT(vap->iv_longslotsta > 0, + ("bogus long slot station count %d", vap->iv_longslotsta)); + vap->iv_longslotsta--; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, "long slot time station leaves, count now %d", - ic->ic_longslotsta); - if (ic->ic_longslotsta == 0) { + vap->iv_longslotsta); + /* + * XXX TODO: this may need all VAPs checked! + */ + if (vap->iv_longslotsta == 0) { /* * Re-enable use of short slot time if supported * and not operating in IBSS mode (per spec). @@ -2875,18 +2894,18 @@ ieee80211_node_leave_11g(struct ieee80211_node *ni) * If a non-ERP station do the protection-related bookkeeping. */ if ((ni->ni_flags & IEEE80211_NODE_ERP) == 0) { - KASSERT(ic->ic_nonerpsta > 0, - ("bogus non-ERP station count %d", ic->ic_nonerpsta)); - ic->ic_nonerpsta--; + KASSERT(vap->iv_nonerpsta > 0, + ("bogus non-ERP station count %d", vap->iv_nonerpsta)); + vap->iv_nonerpsta--; IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_ASSOC, ni, - "non-ERP station leaves, count now %d%s", ic->ic_nonerpsta, - (ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) ? + "non-ERP station leaves, count now %d%s", vap->iv_nonerpsta, + (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) ? " (non-ERP sta present)" : ""); - if (ic->ic_nonerpsta == 0 && - (ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0) { + if (vap->iv_nonerpsta == 0 && + (vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) == 0) { IEEE80211_DPRINTF(ni->ni_vap, IEEE80211_MSG_ASSOC, "%s: disable use of protection\n", __func__); - disable_protection(ic); + disable_protection(vap); } } } @@ -2900,20 +2919,18 @@ ieee80211_node_leave_11g(struct ieee80211_node *ni) * condition. */ static void -ieee80211_erp_timeout(struct ieee80211com *ic) +ieee80211_vap_erp_timeout(struct ieee80211vap *vap) { - IEEE80211_LOCK_ASSERT(ic); + IEEE80211_LOCK_ASSERT(vap->iv_ic); - if ((ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) && - ieee80211_time_after(ticks, ic->ic_lastnonerp + IEEE80211_NONERP_PRESENT_AGE)) { -#if 0 - IEEE80211_NOTE(vap, IEEE80211_MSG_ASSOC, ni, + if ((vap->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) && + ieee80211_time_after(ticks, vap->iv_lastnonerp + IEEE80211_NONERP_PRESENT_AGE)) { + IEEE80211_DPRINTF(vap, IEEE80211_MSG_ASSOC, "%s", "age out non-ERP sta present on channel"); -#endif - ic->ic_flags_ext &= ~IEEE80211_FEXT_NONERP_PR; - if (ic->ic_nonerpsta == 0) - disable_protection(ic); + vap->iv_flags_ext &= ~IEEE80211_FEXT_NONERP_PR; + if (vap->iv_nonerpsta == 0) + disable_protection(vap); } } @@ -2952,7 +2969,6 @@ ieee80211_node_leave(struct ieee80211_node *ni) IEEE80211_LOCK(ic); IEEE80211_AID_CLR(vap, ni->ni_associd); vap->iv_sta_assoc--; - ic->ic_sta_assoc--; if (IEEE80211_IS_CHAN_VHT(ic->ic_bsschan)) ieee80211_vht_node_leave(ni); Modified: head/sys/net80211/ieee80211_node.h ============================================================================== --- head/sys/net80211/ieee80211_node.h Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_node.h Wed Jul 1 00:23:49 2020 (r362815) @@ -479,7 +479,7 @@ int ieee80211_iterate_nodes_vap(struct ieee80211_node_ void ieee80211_iterate_nodes(struct ieee80211_node_table *, ieee80211_iter_func *, void *); -void ieee80211_notify_erp(struct ieee80211com *); +void ieee80211_notify_erp_locked(struct ieee80211com *); void ieee80211_dump_node(struct ieee80211_node_table *, struct ieee80211_node *); void ieee80211_dump_nodes(struct ieee80211_node_table *); Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_output.c Wed Jul 1 00:23:49 2020 (r362815) @@ -2100,15 +2100,34 @@ ieee80211_add_ssid(uint8_t *frm, const uint8_t *ssid, * Add an erp element to a frame. */ static uint8_t * -ieee80211_add_erp(uint8_t *frm, struct ieee80211com *ic) +ieee80211_add_erp(uint8_t *frm, struct ieee80211vap *vap) { + struct ieee80211com *ic = vap->iv_ic; uint8_t erp; *frm++ = IEEE80211_ELEMID_ERP; *frm++ = 1; erp = 0; - if (ic->ic_nonerpsta != 0) + + /* + * TODO: This uses the global flags for now because + * the per-VAP flags are fine for per-VAP, but don't + * take into account which VAPs share the same channel + * and which are on different channels. + * + * ERP and HT/VHT protection mode is a function of + * how many stations are on a channel, not specifically + * the VAP or global. But, until we grow that status, + * the global flag will have to do. + */ + if (ic->ic_flags_ext & IEEE80211_FEXT_NONERP_PR) erp |= IEEE80211_ERP_NON_ERP_PRESENT; + + /* + * TODO: same as above; these should be based not + * on the vap or ic flags, but instead on a combination + * of per-VAP and channels. + */ if (ic->ic_flags & IEEE80211_F_USEPROT) erp |= IEEE80211_ERP_USE_PROTECTION; if (ic->ic_flags & IEEE80211_F_USEBARKER) @@ -2569,7 +2588,6 @@ ieee80211_send_probereq(struct ieee80211_node *ni, uint16_t ieee80211_getcapinfo(struct ieee80211vap *vap, struct ieee80211_channel *chan) { - struct ieee80211com *ic = vap->iv_ic; uint16_t capinfo; KASSERT(vap->iv_opmode != IEEE80211_M_STA, ("station mode")); @@ -2582,7 +2600,7 @@ ieee80211_getcapinfo(struct ieee80211vap *vap, struct capinfo = 0; if (vap->iv_flags & IEEE80211_F_PRIVACY) capinfo |= IEEE80211_CAPINFO_PRIVACY; - if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && + if ((vap->iv_flags & IEEE80211_F_SHPREAMBLE) && IEEE80211_IS_CHAN_2GHZ(chan)) capinfo |= IEEE80211_CAPINFO_SHORT_PREAMBLE; if (vap->iv_flags & IEEE80211_F_SHSLOT) @@ -2761,7 +2779,7 @@ ieee80211_send_mgmt(struct ieee80211_node *ni, int typ * NB: Some 11a AP's reject the request when * short preamble is set. */ - if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) && + if ((vap->iv_flags & IEEE80211_F_SHPREAMBLE) && IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan)) capinfo |= IEEE80211_CAPINFO_SHORT_PREAMBLE; if (IEEE80211_IS_CHAN_ANYG(ic->ic_curchan) && @@ -3098,7 +3116,7 @@ ieee80211_alloc_proberesp(struct ieee80211_node *bss, } } if (IEEE80211_IS_CHAN_ANYG(bss->ni_chan)) - frm = ieee80211_add_erp(frm, ic); + frm = ieee80211_add_erp(frm, vap); frm = ieee80211_add_xrates(frm, rs); frm = ieee80211_add_rsn(frm, vap); /* @@ -3268,6 +3286,7 @@ ieee80211_alloc_prot(struct ieee80211_node *ni, const uint8_t rate, int prot) { struct ieee80211com *ic = ni->ni_ic; + struct ieee80211vap *vap = ni->ni_vap; const struct ieee80211_frame *wh; struct mbuf *mprot; uint16_t dur; @@ -3279,7 +3298,7 @@ ieee80211_alloc_prot(struct ieee80211_node *ni, const wh = mtod(m, const struct ieee80211_frame *); pktlen = m->m_pkthdr.len + IEEE80211_CRC_LEN; - isshort = (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0; + isshort = (vap->iv_flags & IEEE80211_F_SHPREAMBLE) != 0; dur = ieee80211_compute_duration(ic->ic_rt, pktlen, rate, isshort) + ieee80211_ack_duration(ic->ic_rt, rate, isshort); @@ -3288,7 +3307,7 @@ ieee80211_alloc_prot(struct ieee80211_node *ni, const dur += ieee80211_ack_duration(ic->ic_rt, rate, isshort); mprot = ieee80211_alloc_rts(ic, wh->i_addr1, wh->i_addr2, dur); } else - mprot = ieee80211_alloc_cts(ic, ni->ni_vap->iv_myaddr, dur); + mprot = ieee80211_alloc_cts(ic, vap->iv_myaddr, dur); return (mprot); } @@ -3496,7 +3515,7 @@ ieee80211_beacon_construct(struct mbuf *m, uint8_t *fr if (IEEE80211_IS_CHAN_ANYG(ni->ni_chan)) { bo->bo_erp = frm; - frm = ieee80211_add_erp(frm, ic); + frm = ieee80211_add_erp(frm, vap); } frm = ieee80211_add_xrates(frm, rs); frm = ieee80211_add_rsn(frm, vap); @@ -3981,7 +4000,7 @@ ieee80211_beacon_update(struct ieee80211_node *ni, str /* * ERP element needs updating. */ - (void) ieee80211_add_erp(bo->bo_erp, ic); + (void) ieee80211_add_erp(bo->bo_erp, vap); clrbit(bo->bo_flags, IEEE80211_BEACON_ERP); } #ifdef IEEE80211_SUPPORT_SUPERG Modified: head/sys/net80211/ieee80211_power.c ============================================================================== --- head/sys/net80211/ieee80211_power.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_power.c Wed Jul 1 00:23:49 2020 (r362815) @@ -335,7 +335,7 @@ ieee80211_pwrsave(struct ieee80211_node *ni, struct mb if (psq->psq_len >= psq->psq_maxlen) { psq->psq_drops++; IEEE80211_PSQ_UNLOCK(psq); - IEEE80211_NOTE(vap, IEEE80211_MSG_ANY, ni, + IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni, "pwr save q overflow, drops %d (size %d)", psq->psq_drops, psq->psq_len); #ifdef IEEE80211_DEBUG Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Tue Jun 30 22:01:21 2020 (r362814) +++ head/sys/net80211/ieee80211_proto.c Wed Jul 1 00:23:49 2020 (r362815) @@ -246,6 +246,9 @@ static void update_chw(void *, int); static void vap_update_wme(void *, int); static void vap_update_slot(void *, int); static void restart_vaps(void *, int); +static void vap_update_erp_protmode(void *, int); +static void vap_update_preamble(void *, int); +static void vap_update_ht_protmode(void *, int); static void ieee80211_newstate_cb(void *, int); static int @@ -275,7 +278,7 @@ ieee80211_proto_attach(struct ieee80211com *ic) max_hdr = max_linkhdr + max_protohdr; max_datalen = MHLEN - max_hdr; } - ic->ic_protmode = IEEE80211_PROT_CTSONLY; + //ic->ic_protmode = IEEE80211_PROT_CTSONLY; TASK_INIT(&ic->ic_parent_task, 0, parent_updown, ic); TASK_INIT(&ic->ic_mcast_task, 0, update_mcast, ic); @@ -342,6 +345,9 @@ ieee80211_proto_vattach(struct ieee80211vap *vap) TASK_INIT(&vap->iv_swbmiss_task, 0, beacon_swmiss, vap); TASK_INIT(&vap->iv_wme_task, 0, vap_update_wme, vap); TASK_INIT(&vap->iv_slot_task, 0, vap_update_slot, vap); + TASK_INIT(&vap->iv_erp_protmode_task, 0, vap_update_erp_protmode, vap); + TASK_INIT(&vap->iv_ht_protmode_task, 0, vap_update_ht_protmode, vap); + TASK_INIT(&vap->iv_preamble_task, 0, vap_update_preamble, vap); /* * Install default tx rate handling: no fixed rate, lowest * supported rate for mgmt and multicast frames. Default @@ -388,6 +394,7 @@ ieee80211_proto_vattach(struct ieee80211vap *vap) vap->iv_update_beacon = null_update_beacon; vap->iv_deliver_data = ieee80211_deliver_data; + vap->iv_protmode = IEEE80211_PROT_CTSONLY; /* attach support for operating mode */ ic->ic_vattach[vap->iv_opmode](vap); @@ -763,7 +770,23 @@ ieee80211_vap_reset_erp(struct ieee80211vap *vap) { struct ieee80211com *ic = vap->iv_ic; + vap->iv_nonerpsta = 0; + vap->iv_longslotsta = 0; + + vap->iv_flags &= ~IEEE80211_F_USEPROT; /* + * Set short preamble and ERP barker-preamble flags. + */ + if (IEEE80211_IS_CHAN_A(ic->ic_curchan) || + (vap->iv_caps & IEEE80211_C_SHPREAMBLE)) { + vap->iv_flags |= IEEE80211_F_SHPREAMBLE; + vap->iv_flags &= ~IEEE80211_F_USEBARKER; + } else { + vap->iv_flags &= ~IEEE80211_F_SHPREAMBLE; + vap->iv_flags |= IEEE80211_F_USEBARKER; + } + + /* * Short slot time is enabled only when operating in 11g * and not in an IBSS. We must also honor whether or not * the driver is capable of doing it. @@ -778,13 +801,15 @@ ieee80211_vap_reset_erp(struct ieee80211vap *vap) /* * Reset 11g-related state. + * + * Note this resets the global state and a caller should schedule + * a re-check of all the VAPs after setup to update said state. */ void ieee80211_reset_erp(struct ieee80211com *ic) { +#if 0 ic->ic_flags &= ~IEEE80211_F_USEPROT; - ic->ic_nonerpsta = 0; - ic->ic_longslotsta = 0; /* * Set short preamble and ERP barker-preamble flags. */ @@ -796,6 +821,8 @@ ieee80211_reset_erp(struct ieee80211com *ic) ic->ic_flags &= ~IEEE80211_F_SHPREAMBLE; ic->ic_flags |= IEEE80211_F_USEBARKER; } +#endif + /* XXX TODO: schedule a new per-VAP ERP calculation */ } /* @@ -812,6 +839,9 @@ ieee80211_reset_erp(struct ieee80211com *ic) * If the per-VAP method is not called then the global flags will be * flipped into sync with the VAPs; ic_flags IEEE80211_F_SHSLOT will * be set only if all of the vaps will have it set. + * + * Look at the comments for vap_update_erp_protmode() for more + * background; this assumes all VAPs are on the same channel. */ static void vap_update_slot(void *arg, int npending) @@ -848,7 +878,6 @@ vap_update_slot(void *arg, int npending) else num_lgslot++; } - IEEE80211_UNLOCK(ic); /* * It looks backwards but - if the number of short slot VAPs @@ -860,6 +889,7 @@ vap_update_slot(void *arg, int npending) ic->ic_flags &= ~IEEE80211_F_SHSLOT; else if (num_lgslot == 0) ic->ic_flags |= IEEE80211_F_SHSLOT; + IEEE80211_UNLOCK(ic); /* * Call the driver with our new global slot time flags. @@ -869,6 +899,293 @@ vap_update_slot(void *arg, int npending) } /* + * Deferred ERP protmode update. + * + * This currently calculates the global ERP protection mode flag + * based on each of the VAPs. Any VAP with it enabled is enough + * for the global flag to be enabled. All VAPs with it disabled + * is enough for it to be disabled. + * + * This may make sense right now for the supported hardware where + * net80211 is controlling the single channel configuration, but + * offload firmware that's doing channel changes (eg off-channel + * TDLS, off-channel STA, off-channel P2P STA/AP) may get some + * silly looking flag updates. + * + * Ideally the protection mode calculation is done based on the + * channel, and all VAPs using that channel will inherit it. + * But until that's what net80211 does, this wil have to do. + */ +static void +vap_update_erp_protmode(void *arg, int npending) +{ + struct ieee80211vap *vap = arg; + struct ieee80211com *ic = vap->iv_ic; + struct ieee80211vap *iv; + int enable_protmode = 0; + int non_erp_present = 0; + + /* + * Iterate over all of the VAPs to calculate the overlapping + * ERP protection mode configuration and ERP present math. + * + * For now we assume that if a driver can handle this per-VAP + * then it'll ignore the ic->ic_protmode variant and instead + * will look at the vap related flags. + */ + IEEE80211_LOCK(ic); + TAILQ_FOREACH(iv, &ic->ic_vaps, iv_next) { + if (iv->iv_flags & IEEE80211_F_USEPROT) + enable_protmode = 1; + if (iv->iv_flags_ext & IEEE80211_FEXT_NONERP_PR) + non_erp_present = 1; + } + + if (enable_protmode) + ic->ic_flags |= IEEE80211_F_USEPROT; + else + ic->ic_flags &= ~IEEE80211_F_USEPROT; + + if (non_erp_present) + ic->ic_flags_ext |= IEEE80211_FEXT_NONERP_PR; + else + ic->ic_flags_ext &= ~IEEE80211_FEXT_NONERP_PR; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Jul 1 00:24: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 E5DD8359899; Wed, 1 Jul 2020 00:24:56 +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 49xMS85pQlz47vg; Wed, 1 Jul 2020 00:24:56 +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 AA6C1208C4; Wed, 1 Jul 2020 00:24:56 +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 0610OuSg031637; Wed, 1 Jul 2020 00:24:56 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0610Ou1V031633; Wed, 1 Jul 2020 00:24:56 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202007010024.0610Ou1V031633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 1 Jul 2020 00:24:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362816 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 362816 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 00:24:57 -0000 Author: adrian Date: Wed Jul 1 00:24:55 2020 New Revision: 362816 URL: https://svnweb.freebsd.org/changeset/base/362816 Log: [net80211] Commit files missing in the previous commit These belong to my previous commit, but apparently I typed ieee80211_vhf.[ch] and forgot ht.h. Le oops. Modified: head/sys/net80211/ieee80211_ht.h head/sys/net80211/ieee80211_vht.c head/sys/net80211/ieee80211_vht.h Modified: head/sys/net80211/ieee80211_ht.h ============================================================================== --- head/sys/net80211/ieee80211_ht.h Wed Jul 1 00:23:49 2020 (r362815) +++ head/sys/net80211/ieee80211_ht.h Wed Jul 1 00:24:55 2020 (r362816) @@ -210,8 +210,8 @@ struct ieee80211_channel *ieee80211_ht_adjust_channel( void ieee80211_ht_wds_init(struct ieee80211_node *); void ieee80211_ht_node_join(struct ieee80211_node *); void ieee80211_ht_node_leave(struct ieee80211_node *); -void ieee80211_htprot_update(struct ieee80211com *, int protmode); -void ieee80211_ht_timeout(struct ieee80211com *); +void ieee80211_htprot_update(struct ieee80211vap *, int protmode); +void ieee80211_ht_timeout(struct ieee80211vap *); void ieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *); void ieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *); void ieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *, @@ -241,5 +241,6 @@ void ieee80211_ampdu_rx_stop_ext(struct ieee80211_node int ieee80211_ampdu_tx_request_ext(struct ieee80211_node *ni, int tid); int ieee80211_ampdu_tx_request_active_ext(struct ieee80211_node *ni, int tid, int status); +void ieee80211_htinfo_notify(struct ieee80211vap *vap); #endif /* _NET80211_IEEE80211_HT_H_ */ Modified: head/sys/net80211/ieee80211_vht.c ============================================================================== --- head/sys/net80211/ieee80211_vht.c Wed Jul 1 00:23:49 2020 (r362815) +++ head/sys/net80211/ieee80211_vht.c Wed Jul 1 00:24:55 2020 (r362816) @@ -312,7 +312,7 @@ ieee80211_setup_vht_rates(struct ieee80211_node *ni, } void -ieee80211_vht_timeout(struct ieee80211com *ic) +ieee80211_vht_timeout(struct ieee80211vap *vap) { } Modified: head/sys/net80211/ieee80211_vht.h ============================================================================== --- head/sys/net80211/ieee80211_vht.h Wed Jul 1 00:23:49 2020 (r362815) +++ head/sys/net80211/ieee80211_vht.h Wed Jul 1 00:24:55 2020 (r362816) @@ -45,7 +45,7 @@ int ieee80211_vht_updateparams(struct ieee80211_node * void ieee80211_setup_vht_rates(struct ieee80211_node *, const uint8_t *, const uint8_t *); -void ieee80211_vht_timeout(struct ieee80211com *ic); +void ieee80211_vht_timeout(struct ieee80211vap *vap); void ieee80211_vht_node_join(struct ieee80211_node *ni); void ieee80211_vht_node_leave(struct ieee80211_node *ni); From owner-svn-src-head@freebsd.org Wed Jul 1 00:33: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 B7199359D49; Wed, 1 Jul 2020 00:33:18 +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 49xMdp498Yz48Rk; Wed, 1 Jul 2020 00:33:18 +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 7214120B9B; Wed, 1 Jul 2020 00:33:18 +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 0610XINM037438; Wed, 1 Jul 2020 00:33:18 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0610XGUm037426; Wed, 1 Jul 2020 00:33:16 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202007010033.0610XGUm037426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Wed, 1 Jul 2020 00:33:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362817 - in head/sys: arm/freescale/imx arm64/conf arm64/freescale arm64/freescale/imx arm64/freescale/imx/clk conf dev/ffec dev/uart modules/dtb/imx8 X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm/freescale/imx arm64/conf arm64/freescale arm64/freescale/imx arm64/freescale/imx/clk conf dev/ffec dev/uart modules/dtb/imx8 X-SVN-Commit-Revision: 362817 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 00:33:18 -0000 Author: gonzo Date: Wed Jul 1 00:33:16 2020 New Revision: 362817 URL: https://svnweb.freebsd.org/changeset/base/362817 Log: Add i.MX 8M Quad support - Add CCM driver and clocks implementations for i.MX 8M - Add GPC driver for iMX8 - Add clock tree for i.MX 8M Quad - Add clocks support and new compat strings (where required) for existing i.MX 6 UART, I2C, and GPIO drivers - Enable aarch64-compatible drivers form i.MX 6 in arm64 GENERIC kernel config - Add dtb/imx8 kernel module with DTBs for Nitrogen8M and iMX8MQ EVK With this patch both Nitrogen8M and iMX8MQ EVK boot with NFS root up to multiuser login prompt Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D25274 Added: head/sys/arm64/freescale/ head/sys/arm64/freescale/imx/ head/sys/arm64/freescale/imx/clk/ head/sys/arm64/freescale/imx/clk/imx_clk_composite.c (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_composite.h (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.c (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.h (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_gate.c (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_gate.h (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_mux.c (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_mux.h (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_sscg_pll.c (contents, props changed) head/sys/arm64/freescale/imx/clk/imx_clk_sscg_pll.h (contents, props changed) head/sys/arm64/freescale/imx/imx7gpc.c (contents, props changed) head/sys/arm64/freescale/imx/imx8mq_ccm.c (contents, props changed) head/sys/arm64/freescale/imx/imx8mq_ccm.h (contents, props changed) head/sys/arm64/freescale/imx/imx_ccm_clk.h (contents, props changed) head/sys/modules/dtb/imx8/ head/sys/modules/dtb/imx8/Makefile (contents, props changed) Modified: head/sys/arm/freescale/imx/imx_gpio.c head/sys/arm/freescale/imx/imx_i2c.c head/sys/arm/freescale/imx/imx_iomux.c head/sys/arm64/conf/GENERIC head/sys/conf/files head/sys/conf/files.arm64 head/sys/conf/options.arm64 head/sys/dev/ffec/if_ffec.c head/sys/dev/uart/uart_dev_imx.c Modified: head/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpio.c Wed Jul 1 00:24:55 2020 (r362816) +++ head/sys/arm/freescale/imx/imx_gpio.c Wed Jul 1 00:33:16 2020 (r362817) @@ -57,6 +57,14 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(EXT_RESOURCES) && defined(__aarch64__) +#define IMX_ENABLE_CLOCKS +#endif + +#ifdef IMX_ENABLE_CLOCKS +#include +#endif + #include "gpio_if.h" #ifdef INTRNG @@ -119,13 +127,17 @@ struct imx51_gpio_softc { #ifdef INTRNG struct gpio_irqsrc gpio_pic_irqsrc[NGPIO]; #endif +#ifdef IMX_ENABLE_CLOCKS + clk_t clk; +#endif }; static struct ofw_compat_data compat_data[] = { - {"fsl,imx6q-gpio", 1}, - {"fsl,imx53-gpio", 1}, - {"fsl,imx51-gpio", 1}, - {NULL, 0} + {"fsl,imx8mq-gpio", 1}, + {"fsl,imx6q-gpio", 1}, + {"fsl,imx53-gpio", 1}, + {"fsl,imx51-gpio", 1}, + {NULL, 0} }; static struct resource_spec imx_gpio_spec[] = { @@ -788,6 +800,9 @@ imx51_gpio_attach(device_t dev) { struct imx51_gpio_softc *sc; int i, irq, unit; +#ifdef IMX_ENABLE_CLOCKS + int err; +#endif sc = device_get_softc(dev); sc->dev = dev; @@ -795,6 +810,19 @@ imx51_gpio_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(sc->dev), NULL, MTX_SPIN); +#ifdef IMX_ENABLE_CLOCKS + if (clk_get_by_ofw_index(sc->dev, 0, 0, &sc->clk) != 0) { + device_printf(dev, "could not get clock"); + return (ENOENT); + } + + err = clk_enable(sc->clk); + if (err != 0) { + device_printf(sc->dev, "could not enable ipg clock\n"); + return (err); + } +#endif + if (bus_alloc_resources(dev, imx_gpio_spec, sc->sc_res)) { device_printf(dev, "could not allocate resources\n"); bus_release_resources(dev, imx_gpio_spec, sc->sc_res); @@ -850,8 +878,19 @@ imx51_gpio_detach(device_t dev) { int irq; struct imx51_gpio_softc *sc; +#ifdef IMX_ENABLE_CLOCKS + int error; +#endif sc = device_get_softc(dev); + +#ifdef IMX_ENABLE_CLOCKS + error = clk_disable(sc->clk); + if (error != 0) { + device_printf(sc->dev, "could not disable ipg clock\n"); + return (error); + } +#endif gpiobus_detach_bus(dev); for (irq = 0; irq < NUM_IRQRES; irq++) { Modified: head/sys/arm/freescale/imx/imx_i2c.c ============================================================================== --- head/sys/arm/freescale/imx/imx_i2c.c Wed Jul 1 00:24:55 2020 (r362816) +++ head/sys/arm/freescale/imx/imx_i2c.c Wed Jul 1 00:33:16 2020 (r362817) @@ -73,6 +73,14 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(EXT_RESOURCES) && defined(__aarch64__) +#define IMX_ENABLE_CLOCKS +#endif + +#ifdef IMX_ENABLE_CLOCKS +#include +#endif + #define I2C_ADDR_REG 0x00 /* I2C slave address register */ #define I2C_FDR_REG 0x04 /* I2C frequency divider register */ #define I2C_CONTROL_REG 0x08 /* I2C control register */ @@ -125,6 +133,7 @@ static struct clkdiv clkdiv_table[] = { }; static struct ofw_compat_data compat_data[] = { + {"fsl,imx21-i2c", 1}, {"fsl,imx6q-i2c", 1}, {"fsl,imx-i2c", 1}, {NULL, 0} @@ -141,6 +150,9 @@ struct i2c_softc { gpio_pin_t rb_sdapin; u_int debug; u_int slave; +#ifdef IMX_ENABLE_CLOCKS + clk_t ipgclk; +#endif }; #define DEVICE_DEBUGF(sc, lvl, fmt, args...) \ @@ -385,6 +397,19 @@ i2c_attach(device_t dev) sc->dev = dev; sc->rid = 0; +#ifdef IMX_ENABLE_CLOCKS + if (clk_get_by_ofw_index(sc->dev, 0, 0, &sc->ipgclk) != 0) { + device_printf(dev, "could not get ipg clock"); + return (ENOENT); + } + + err = clk_enable(sc->ipgclk); + if (err != 0) { + device_printf(sc->dev, "could not enable ipg clock\n"); + return (err); + } +#endif + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid, RF_ACTIVE); if (sc->res == NULL) { @@ -459,6 +484,14 @@ i2c_detach(device_t dev) sc = device_get_softc(dev); +#ifdef IMX_ENABLE_CLOCKS + error = clk_disable(sc->ipgclk); + if (error != 0) { + device_printf(sc->dev, "could not disable ipg clock\n"); + return (error); + } +#endif + if ((error = bus_generic_detach(sc->dev)) != 0) { device_printf(sc->dev, "cannot detach child devices\n"); return (error); @@ -571,6 +604,10 @@ i2c_reset(device_t dev, u_char speed, u_char addr, u_c { struct i2c_softc *sc; u_int busfreq, div, i, ipgfreq; +#ifdef IMX_ENABLE_CLOCKS + int err; + uint64_t freq; +#endif sc = device_get_softc(dev); @@ -580,7 +617,16 @@ i2c_reset(device_t dev, u_char speed, u_char addr, u_c * Look up the divisor that gives the nearest speed that doesn't exceed * the configured value for the bus. */ +#ifdef IMX_ENABLE_CLOCKS + err = clk_get_freq(sc->ipgclk, &freq); + if (err != 0) { + device_printf(sc->dev, "cannot get frequency\n"); + return (err); + } + ipgfreq = (int32_t)freq; +#else ipgfreq = imx_ccm_ipg_hz(); +#endif busfreq = IICBUS_GET_FREQUENCY(sc->iicbus, speed); div = howmany(ipgfreq, busfreq); for (i = 0; i < nitems(clkdiv_table); i++) { Modified: head/sys/arm/freescale/imx/imx_iomux.c ============================================================================== --- head/sys/arm/freescale/imx/imx_iomux.c Wed Jul 1 00:24:55 2020 (r362816) +++ head/sys/arm/freescale/imx/imx_iomux.c Wed Jul 1 00:33:16 2020 (r362817) @@ -76,6 +76,7 @@ struct iomux_softc { static struct iomux_softc *iomux_sc; static struct ofw_compat_data compat_data[] = { + {"fsl,imx8mq-iomuxc", true}, {"fsl,imx6dl-iomuxc", true}, {"fsl,imx6q-iomuxc", true}, {"fsl,imx6sl-iomuxc", true}, Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Wed Jul 1 00:24:55 2020 (r362816) +++ head/sys/arm64/conf/GENERIC Wed Jul 1 00:33:16 2020 (r362817) @@ -113,6 +113,7 @@ options SOC_ALLWINNER_A64 options SOC_ALLWINNER_H5 options SOC_ALLWINNER_H6 options SOC_CAVM_THUNDERX +options SOC_FREESCALE_IMX8 options SOC_HISI_HI6220 options SOC_INTEL_STRATIX10 options SOC_BRCM_BCM2837 @@ -172,6 +173,7 @@ device al_eth # Annapurna Alpine Ethernet NIC device dwc_rk # Rockchip Designware device dwc_socfpga # Altera SOCFPGA Ethernet MAC device genet # Broadcom on RPi4 +device ffec # iMX FFEC # Etherswitch devices device etherswitch # Enable etherswitch support @@ -205,6 +207,7 @@ device rk_emmcphy # Serial (COM) ports device uart # Generic UART driver +device uart_imx # iMX8 UART device uart_msm # Qualcomm MSM UART driver device uart_mu # RPI3 aux port device uart_mvebu # Armada 3700 UART driver @@ -265,6 +268,7 @@ device rk_i2c # RockChip I2C controller device syr827 # Silergy SYR827 PMIC device sy8106a # SY8106A Buck Regulator device vf_i2c # Freescale Vybrid I2C controller +device fsliic # Freescale iMX I2C controller # Clock and reset controllers device aw_ccu # Allwinner clock controller @@ -352,4 +356,4 @@ options FDT device acpi # DTBs -makeoptions MODULES_EXTRA="dtb/allwinner dtb/mv dtb/rockchip dtb/rpi" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/imx8 dtb/mv dtb/rockchip dtb/rpi" Added: head/sys/arm64/freescale/imx/clk/imx_clk_composite.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/freescale/imx/clk/imx_clk_composite.c Wed Jul 1 00:33:16 2020 (r362817) @@ -0,0 +1,309 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include + +#include "clkdev_if.h" + +#define TARGET_ROOT_ENABLE (1 << 28) +#define TARGET_ROOT_MUX(n) ((n) << 24) +#define TARGET_ROOT_MUX_MASK (7 << 24) +#define TARGET_ROOT_MUX_SHIFT 24 +#define TARGET_ROOT_PRE_PODF(n) ((((n) - 1) & 0x7) << 16) +#define TARGET_ROOT_PRE_PODF_MASK (0x7 << 16) +#define TARGET_ROOT_PRE_PODF_SHIFT 16 +#define TARGET_ROOT_PRE_PODF_MAX 7 +#define TARGET_ROOT_POST_PODF(n) ((((n) - 1) & 0x3f) << 0) +#define TARGET_ROOT_POST_PODF_MASK (0x3f << 0) +#define TARGET_ROOT_POST_PODF_SHIFT 0 +#define TARGET_ROOT_POST_PODF_MAX 0x3f + +struct imx_clk_composite_sc { + uint32_t offset; + uint32_t flags; +}; + +#define WRITE4(_clk, off, val) \ + CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) +#define READ4(_clk, off, val) \ + CLKDEV_READ_4(clknode_get_device(_clk), off, val) +#define DEVICE_LOCK(_clk) \ + CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) +#define DEVICE_UNLOCK(_clk) \ + CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) + +#define IMX_CLK_COMPOSITE_MASK_SHIFT 16 + +#if 0 +#define dprintf(format, arg...) \ + printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) +#else +#define dprintf(format, arg...) +#endif + +static int +imx_clk_composite_init(struct clknode *clk, device_t dev) +{ + struct imx_clk_composite_sc *sc; + uint32_t val, idx; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + DEVICE_UNLOCK(clk); + idx = (val & TARGET_ROOT_MUX_MASK) >> TARGET_ROOT_MUX_SHIFT; + + clknode_init_parent_idx(clk, idx); + + return (0); +} + +static int +imx_clk_composite_set_gate(struct clknode *clk, bool enable) +{ + struct imx_clk_composite_sc *sc; + uint32_t val = 0; + + sc = clknode_get_softc(clk); + + dprintf("%sabling gate\n", enable ? "En" : "Dis"); + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + if (enable) + val |= TARGET_ROOT_ENABLE; + else + val &= ~(TARGET_ROOT_ENABLE); + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + return (0); +} + +static int +imx_clk_composite_set_mux(struct clknode *clk, int index) +{ + struct imx_clk_composite_sc *sc; + uint32_t val = 0; + + sc = clknode_get_softc(clk); + + dprintf("Set mux to %d\n", index); + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + val &= ~(TARGET_ROOT_MUX_MASK); + val |= TARGET_ROOT_MUX(index); + WRITE4(clk, sc->offset, val); + DEVICE_UNLOCK(clk); + + return (0); +} + +static int +imx_clk_composite_recalc(struct clknode *clk, uint64_t *freq) +{ + struct imx_clk_composite_sc *sc; + uint32_t reg, pre_div, post_div; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, ®); + DEVICE_UNLOCK(clk); + + pre_div = ((reg & TARGET_ROOT_PRE_PODF_MASK) + >> TARGET_ROOT_PRE_PODF_SHIFT) + 1; + post_div = ((reg & TARGET_ROOT_POST_PODF_MASK) + >> TARGET_ROOT_POST_PODF_SHIFT) + 1; + + dprintf("parent_freq=%ju, div=%u\n", *freq, div); + *freq = *freq / pre_div / post_div; + dprintf("Final freq=%ju\n", *freq); + return (0); +} + +static int +imx_clk_composite_find_best(uint64_t fparent, uint64_t ftarget, + uint32_t *pre_div, uint32_t *post_div, int flags) +{ + uint32_t prediv, postdiv, best_prediv, best_postdiv; + int64_t diff, best_diff; + uint64_t cur; + + best_diff = INT64_MAX; + for (prediv = 1; prediv <= TARGET_ROOT_PRE_PODF_MAX + 1; prediv++) { + for (postdiv = 1; postdiv <= TARGET_ROOT_POST_PODF_MAX + 1; postdiv++) { + cur= fparent / prediv / postdiv; + diff = (int64_t)ftarget - (int64_t)cur; + if (flags & CLK_SET_ROUND_DOWN) { + if (diff >= 0 && diff < best_diff) { + best_diff = diff; + best_prediv = prediv; + best_postdiv = postdiv; + } + } + else if (flags & CLK_SET_ROUND_UP) { + if (diff <= 0 && abs(diff) < best_diff) { + best_diff = diff; + best_prediv = prediv; + best_postdiv = postdiv; + } + } + else { + if (abs(diff) < best_diff) { + best_diff = abs(diff); + best_prediv = prediv; + best_postdiv = postdiv; + } + } + } + } + + if (best_diff == INT64_MAX) + return (ERANGE); + + *pre_div = best_prediv; + *post_div = best_postdiv; + + return (0); +} + +static int +imx_clk_composite_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, + int flags, int *stop) +{ + struct imx_clk_composite_sc *sc; + struct clknode *p_clk; + const char **p_names; + int p_idx, best_parent; + int64_t best_diff, diff; + int32_t best_pre_div, best_post_div, pre_div, post_div; + uint64_t cur, best; + uint32_t val; + + sc = clknode_get_softc(clk); + dprintf("Finding best parent/div for target freq of %ju\n", *fout); + p_names = clknode_get_parent_names(clk); + + best_diff = 0; + + for (p_idx = 0; p_idx != clknode_get_parents_num(clk); p_idx++) { + p_clk = clknode_find_by_name(p_names[p_idx]); + clknode_get_freq(p_clk, &fparent); + dprintf("Testing with parent %s (%d) at freq %ju\n", + clknode_get_name(p_clk), p_idx, fparent); + + if (!imx_clk_composite_find_best(fparent, *fout, &pre_div, &post_div, sc->flags)) + continue; + cur = fparent / pre_div / post_div; + diff = abs((int64_t)*fout - (int64_t)cur); + if (diff < best_diff) { + best = cur; + best_diff = diff; + best_pre_div = pre_div; + best_post_div = pre_div; + best_parent = p_idx; + dprintf("Best parent so far %s (%d) with best freq at " + "%ju\n", clknode_get_name(p_clk), p_idx, best); + } + } + + *stop = 1; + if (best_diff == INT64_MAX) + return (ERANGE); + + if ((flags & CLK_SET_DRYRUN) != 0) { + *fout = best; + return (0); + } + + p_idx = clknode_get_parent_idx(clk); + if (p_idx != best_parent) { + dprintf("Switching parent index from %d to %d\n", p_idx, + best_parent); + clknode_set_parent_by_idx(clk, best_parent); + } + + dprintf("Setting dividers to pre=%d, post=%d\n", best_pre_div, best_post_div); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset, &val); + val &= ~(TARGET_ROOT_PRE_PODF_MASK | TARGET_ROOT_POST_PODF_MASK); + val |= TARGET_ROOT_PRE_PODF(pre_div); + val |= TARGET_ROOT_POST_PODF(post_div); + DEVICE_UNLOCK(clk); + + *fout = best; + return (0); +} + +static clknode_method_t imx_clk_composite_clknode_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, imx_clk_composite_init), + CLKNODEMETHOD(clknode_set_gate, imx_clk_composite_set_gate), + CLKNODEMETHOD(clknode_set_mux, imx_clk_composite_set_mux), + CLKNODEMETHOD(clknode_recalc_freq, imx_clk_composite_recalc), + CLKNODEMETHOD(clknode_set_freq, imx_clk_composite_set_freq), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(imx_clk_composite_clknode, imx_clk_composite_clknode_class, + imx_clk_composite_clknode_methods, sizeof(struct imx_clk_composite_sc), + clknode_class); + +int +imx_clk_composite_register(struct clkdom *clkdom, + struct imx_clk_composite_def *clkdef) +{ + struct clknode *clk; + struct imx_clk_composite_sc *sc; + + clk = clknode_create(clkdom, &imx_clk_composite_clknode_class, + &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + + sc->offset = clkdef->offset; + sc->flags = clkdef->flags; + + clknode_register(clkdom, clk); + + return (0); +} Added: head/sys/arm64/freescale/imx/clk/imx_clk_composite.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/freescale/imx/clk/imx_clk_composite.h Wed Jul 1 00:33:16 2020 (r362817) @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2018 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _IMX_CLK_COMPOSITE_H_ +#define _IMX_CLK_COMPOSITE_H_ + +#include + +struct imx_clk_composite_def { + struct clknode_init_def clkdef; + + uint32_t offset; + uint32_t flags; +}; + +int imx_clk_composite_register(struct clkdom *clkdom, + struct imx_clk_composite_def *clkdef); + +#endif /* _IMX_CLK_COMPOSITE_H_ */ Added: head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.c Wed Jul 1 00:33:16 2020 (r362817) @@ -0,0 +1,177 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Oleksandr Tymoshenko + * + * 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 ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include + +#include "clkdev_if.h" + +struct imx_clk_frac_pll_sc { + uint32_t offset; +}; + +#define WRITE4(_clk, off, val) \ + CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) +#define READ4(_clk, off, val) \ + CLKDEV_READ_4(clknode_get_device(_clk), off, val) +#define DEVICE_LOCK(_clk) \ + CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) +#define DEVICE_UNLOCK(_clk) \ + CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) + +#define CFG0 0 +#define CFG0_PLL_LOCK (1 << 31) +#define CFG0_PD (1 << 19) +#define CFG0_BYPASS (1 << 14) +#define CFG0_NEWDIV_VAL (1 << 12) +#define CFG0_NEWDIV_ACK (1 << 11) +#define CFG0_OUTPUT_DIV_MASK (0x1f << 0) +#define CFG0_OUTPUT_DIV_SHIFT 0 +#define CFG1 4 +#define CFG1_FRAC_DIV_MASK (0xffffff << 7) +#define CFG1_FRAC_DIV_SHIFT 7 +#define CFG1_INT_DIV_MASK (0x7f << 0) +#define CFG1_INT_DIV_SHIFT 0 + +#if 0 +#define dprintf(format, arg...) \ + printf("%s:(%s)" format, __func__, clknode_get_name(clk), arg) +#else +#define dprintf(format, arg...) +#endif + +static int +imx_clk_frac_pll_init(struct clknode *clk, device_t dev) +{ + + clknode_init_parent_idx(clk, 0); + return (0); +} + +static int +imx_clk_frac_pll_set_gate(struct clknode *clk, bool enable) +{ + struct imx_clk_frac_pll_sc *sc; + uint32_t cfg0; + int timeout; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset + CFG0, &cfg0); + if (enable) + cfg0 &= ~(CFG0_PD); + else + cfg0 |= CFG0_PD; + WRITE4(clk, sc->offset + CFG0, cfg0); + + /* Wait for PLL to lock */ + if (enable && ((cfg0 & CFG0_BYPASS) == 0)) { + for (timeout = 1000; timeout; timeout--) { + READ4(clk, sc->offset + CFG0, &cfg0); + if (cfg0 & CFG0_PLL_LOCK) + break; + DELAY(1); + } + } + + DEVICE_UNLOCK(clk); + + return (0); +} + +static int +imx_clk_frac_pll_recalc(struct clknode *clk, uint64_t *freq) +{ + struct imx_clk_frac_pll_sc *sc; + uint32_t cfg0, cfg1; + uint64_t div, divfi, divff, divf_val; + + sc = clknode_get_softc(clk); + + DEVICE_LOCK(clk); + READ4(clk, sc->offset + CFG0, &cfg0); + READ4(clk, sc->offset + CFG1, &cfg1); + DEVICE_UNLOCK(clk); + + div = (cfg0 & CFG0_OUTPUT_DIV_MASK) >> CFG0_OUTPUT_DIV_SHIFT; + div = (div + 1) * 2; + divff = (cfg1 & CFG1_FRAC_DIV_MASK) >> CFG1_FRAC_DIV_SHIFT; + divfi = (cfg1 & CFG1_INT_DIV_MASK) >> CFG1_INT_DIV_SHIFT; + + /* PLL is bypassed */ + if (cfg0 & CFG0_BYPASS) + return (0); + + divf_val = 1 + divfi + (divff/0x1000000); + *freq = *freq * 8 * divf_val / div; + + return (0); +} + +static clknode_method_t imx_clk_frac_pll_clknode_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, imx_clk_frac_pll_init), + CLKNODEMETHOD(clknode_set_gate, imx_clk_frac_pll_set_gate), + CLKNODEMETHOD(clknode_recalc_freq, imx_clk_frac_pll_recalc), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(imx_clk_frac_pll_clknode, imx_clk_frac_pll_clknode_class, + imx_clk_frac_pll_clknode_methods, sizeof(struct imx_clk_frac_pll_sc), + clknode_class); + +int +imx_clk_frac_pll_register(struct clkdom *clkdom, + struct imx_clk_frac_pll_def *clkdef) +{ + struct clknode *clk; + struct imx_clk_frac_pll_sc *sc; + + clk = clknode_create(clkdom, &imx_clk_frac_pll_clknode_class, + &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + + sc->offset = clkdef->offset; + + clknode_register(clkdom, clk); + + return (0); +} Added: head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/freescale/imx/clk/imx_clk_frac_pll.h Wed Jul 1 00:33:16 2020 (r362817) @@ -0,0 +1,42 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Oleksandr Tymoshenko + * + * 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 _IMX_CLK_FRAC_PLL_H_ +#define _IMX_CLK_FRAC_PLL_H_ + +#include + +struct imx_clk_frac_pll_def { + struct clknode_init_def clkdef; + uint32_t offset; +}; + +int imx_clk_frac_pll_register(struct clkdom *clkdom, struct imx_clk_frac_pll_def *clkdef); + +#endif /* _IMX_CLK_FRAC_PLL_H_ */ Added: head/sys/arm64/freescale/imx/clk/imx_clk_gate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/freescale/imx/clk/imx_clk_gate.c Wed Jul 1 00:33:16 2020 (r362817) @@ -0,0 +1,117 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2016 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include + +#include + +#include "clkdev_if.h" + +#define WR4(_clk, off, val) \ + CLKDEV_WRITE_4(clknode_get_device(_clk), off, val) +#define RD4(_clk, off, val) \ + CLKDEV_READ_4(clknode_get_device(_clk), off, val) +#define MD4(_clk, off, clr, set ) \ + CLKDEV_MODIFY_4(clknode_get_device(_clk), off, clr, set) +#define DEVICE_LOCK(_clk) \ + CLKDEV_DEVICE_LOCK(clknode_get_device(_clk)) +#define DEVICE_UNLOCK(_clk) \ + CLKDEV_DEVICE_UNLOCK(clknode_get_device(_clk)) + +static int imx_clk_gate_init(struct clknode *clk, device_t dev); +static int imx_clk_gate_set_gate(struct clknode *clk, bool enable); +struct imx_clk_gate_sc { + uint32_t offset; + uint32_t shift; + uint32_t mask; + int gate_flags; +}; + +static clknode_method_t imx_clk_gate_methods[] = { + /* Device interface */ + CLKNODEMETHOD(clknode_init, imx_clk_gate_init), + CLKNODEMETHOD(clknode_set_gate, imx_clk_gate_set_gate), + CLKNODEMETHOD_END +}; +DEFINE_CLASS_1(imx_clk_gate, imx_clk_gate_class, imx_clk_gate_methods, + sizeof(struct imx_clk_gate_sc), clknode_class); + +static int +imx_clk_gate_init(struct clknode *clk, device_t dev) +{ + + clknode_init_parent_idx(clk, 0); + return(0); +} + +static int +imx_clk_gate_set_gate(struct clknode *clk, bool enable) +{ + uint32_t reg; + struct imx_clk_gate_sc *sc; + int rv; + + sc = clknode_get_softc(clk); + DEVICE_LOCK(clk); + rv = MD4(clk, sc->offset, sc->mask << sc->shift, + (enable ? sc->mask : 0) << sc->shift); + if (rv != 0) { + DEVICE_UNLOCK(clk); + return (rv); + } + RD4(clk, sc->offset, ®); + DEVICE_UNLOCK(clk); + return(0); +} + +int +imx_clk_gate_register(struct clkdom *clkdom, struct imx_clk_gate_def *clkdef) +{ + struct clknode *clk; + struct imx_clk_gate_sc *sc; + + clk = clknode_create(clkdom, &imx_clk_gate_class, &clkdef->clkdef); + if (clk == NULL) + return (1); + + sc = clknode_get_softc(clk); + sc->offset = clkdef->offset; + sc->shift = clkdef->shift; + sc->mask = clkdef->mask; + sc->gate_flags = clkdef->gate_flags; + + clknode_register(clkdom, clk); + return (0); +} Added: head/sys/arm64/freescale/imx/clk/imx_clk_gate.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/freescale/imx/clk/imx_clk_gate.h Wed Jul 1 00:33:16 2020 (r362817) @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2018 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _IMX_CLK_GATE_H_ +#define _IMX_CLK_GATE_H_ + +#include + +struct imx_clk_gate_def { + struct clknode_init_def clkdef; + uint32_t offset; + uint32_t shift; + uint32_t mask; + int gate_flags; +}; + +int imx_clk_gate_register(struct clkdom *clkdom, struct imx_clk_gate_def *clkdef); + +#endif /* _IMX_CLK_GATE_H_ */ Added: head/sys/arm64/freescale/imx/clk/imx_clk_mux.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/freescale/imx/clk/imx_clk_mux.c Wed Jul 1 00:33:16 2020 (r362817) @@ -0,0 +1,138 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2016 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Jul 1 00:59: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 3963A359BD4; Wed, 1 Jul 2020 00:59:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49xND10TG6z48yD; Wed, 1 Jul 2020 00:59:29 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E435720B6E; Wed, 1 Jul 2020 00:59:28 +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 0610xSnJ050329; Wed, 1 Jul 2020 00:59:28 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0610xSZL050327; Wed, 1 Jul 2020 00:59:28 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202007010059.0610xSZL050327@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 1 Jul 2020 00:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362818 - in head/secure/lib: libcrypto libssl X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/secure/lib: libcrypto libssl X-SVN-Commit-Revision: 362818 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 00:59:29 -0000 Author: cem Date: Wed Jul 1 00:59:28 2020 New Revision: 362818 URL: https://svnweb.freebsd.org/changeset/base/362818 Log: Replace OPENSSL_NO_SSL3_METHODs with dummies SSLv3 has been deprecated since 2015 (and broken since 2014: "POODLE"); it should not have shipped in FreeBSD 11 (2016) or 12 (2018). No one should use it, and if they must, they can use some implementation outside of base. There are three symbols removed with OPENSSL_NO_SSL3_METHOD: SSLv3_client_method SSLv3_method SSLv3_server_method These symbols exist to request an explicit SSLv3 connection to a server. There is no good reason for an application to link or invoke these symbols instead of TLS_method(), et al (née SSLv23_method, et al). Applications that do so have broken cryptography. Define these symbols for some pedantic definition of ABI stability, but remove the functionality again (r361392) after r362620. Reviewed by: gordon, jhb (earlier-but-equivalent version both) Discussed with: bjk, kib Differential Revision: https://reviews.freebsd.org/D25493 Added: head/secure/lib/libssl/dummy_abi.c (contents, props changed) Modified: head/secure/lib/libcrypto/opensslconf.h.in head/secure/lib/libssl/Makefile Modified: head/secure/lib/libcrypto/opensslconf.h.in ============================================================================== --- head/secure/lib/libcrypto/opensslconf.h.in Wed Jul 1 00:33:16 2020 (r362817) +++ head/secure/lib/libcrypto/opensslconf.h.in Wed Jul 1 00:59:28 2020 (r362818) @@ -79,6 +79,9 @@ extern "C" { #ifndef OPENSSL_NO_SSL3 # define OPENSSL_NO_SSL3 #endif +#ifndef OPENSSL_NO_SSL3_METHOD +# define OPENSSL_NO_SSL3_METHOD +#endif #ifndef OPENSSL_NO_UBSAN # define OPENSSL_NO_UBSAN #endif Modified: head/secure/lib/libssl/Makefile ============================================================================== --- head/secure/lib/libssl/Makefile Wed Jul 1 00:33:16 2020 (r362817) +++ head/secure/lib/libssl/Makefile Wed Jul 1 00:59:28 2020 (r362818) @@ -22,6 +22,8 @@ SRCS+= ssl3_record.c ssl3_record_tls13.c SRCS+= extensions.c extensions_clnt.c extensions_cust.c extensions_srvr.c SRCS+= statem.c statem_clnt.c statem_dtls.c statem_lib.c statem_srvr.c +SRCS+= dummy_abi.c + LIBADD= crypto CFLAGS+= -I${LCRYPTO_SRC}/ssl Added: head/secure/lib/libssl/dummy_abi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/secure/lib/libssl/dummy_abi.c Wed Jul 1 00:59:28 2020 (r362818) @@ -0,0 +1,46 @@ +/* This file is in the public domain. */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +static inline void +__SSLv3_dummy_method_impl(void) +{ + static const char warning[] = "SSLv3 use is deprecated.\n"; + static bool once = false; + + if (once) + return; + + once = true; + write(STDERR_FILENO, warning, sizeof(warning) - 1); +} + +const SSL_METHOD * +__SSLv3_method_fbsd12(void) +{ + __SSLv3_dummy_method_impl(); + return (NULL); +} +__sym_compat(SSLv3_method, __SSLv3_method_fbsd12, OPENSSL_1_1_0); + +const SSL_METHOD * +__SSLv3_client_method_fbsd12(void) +{ + __SSLv3_dummy_method_impl(); + return (NULL); +} +__sym_compat(SSLv3_client_method, __SSLv3_client_method_fbsd12, OPENSSL_1_1_0); + +const SSL_METHOD * +__SSLv3_server_method_fbsd12(void) +{ + __SSLv3_dummy_method_impl(); + return (NULL); +} +__sym_compat(SSLv3_server_method, __SSLv3_server_method_fbsd12, OPENSSL_1_1_0); From owner-svn-src-head@freebsd.org Wed Jul 1 02:16: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 9271D35ACF6; Wed, 1 Jul 2020 02:16: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 49xPx23Mxjz4DMX; Wed, 1 Jul 2020 02:16:38 +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 39AAE21C5D; Wed, 1 Jul 2020 02:16:38 +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 0612GcCg000116; Wed, 1 Jul 2020 02:16:38 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0612Gb1U000111; Wed, 1 Jul 2020 02:16:37 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202007010216.0612Gb1U000111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 1 Jul 2020 02:16:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362823 - in head/sys: amd64/conf conf geom/part i386/conf X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/conf conf geom/part i386/conf X-SVN-Commit-Revision: 362823 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 02:16:38 -0000 Author: cem Date: Wed Jul 1 02:16:36 2020 New Revision: 362823 URL: https://svnweb.freebsd.org/changeset/base/362823 Log: geom(4): Kill GEOM_PART_EBR_COMPAT option Take advantage of Warner's nice new real GEOM aliasing system and use it for aliased partition names that actually work. Our canonical EBR partition name is the weird, not-default-on-x86-prior-to- this-revision "da1p4+00001234." However, if compatibility mode (tunable kern.geom.part.ebr.compat_aliases) is enabled (1, default), we continue to provide the alias names like "da1p5" in addition to the weird canonical names. Naming partition providers was just one aspect of the COMPAT knob; in addition it limited mutability, in part because it did not preserve existing EBR header content aside from that of LBA 0. This change saves the EBR header for LBA 0, as well as for every EBR partition encountered. That way, when we write out the EBR partition table on modification, we can restore any bootloader or other metadata in both LBA0 (the first data-containing EBR may start after 0) as well as every logical EBR we read from the disk, and only update the geometry metadata and linked list pointers that describe the actual partitioning. (This change does not add support for the 'bootcode' verb to EBR.) PR: 232463 Reported by: Manish Jain Discussed with: ae (no objection) Relnotes: maybe Differential Revision: https://reviews.freebsd.org/D24939 Modified: head/sys/amd64/conf/DEFAULTS head/sys/conf/NOTES head/sys/conf/options head/sys/geom/part/g_part_ebr.c head/sys/i386/conf/DEFAULTS Modified: head/sys/amd64/conf/DEFAULTS ============================================================================== --- head/sys/amd64/conf/DEFAULTS Wed Jul 1 02:13:16 2020 (r362822) +++ head/sys/amd64/conf/DEFAULTS Wed Jul 1 02:16:36 2020 (r362823) @@ -18,7 +18,6 @@ device uart_ns8250 # Default partitioning schemes options GEOM_PART_BSD options GEOM_PART_EBR -options GEOM_PART_EBR_COMPAT options GEOM_PART_MBR options GEOM_PART_GPT Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Jul 1 02:13:16 2020 (r362822) +++ head/sys/conf/NOTES Wed Jul 1 02:16:36 2020 (r362823) @@ -171,7 +171,6 @@ options GEOM_PART_APM # Apple partitioning options GEOM_PART_BSD # BSD disklabel options GEOM_PART_BSD64 # BSD disklabel64 options GEOM_PART_EBR # Extended Boot Records -options GEOM_PART_EBR_COMPAT # Backward compatible partition names options GEOM_PART_GPT # GPT partitioning options GEOM_PART_LDM # Logical Disk Manager options GEOM_PART_MBR # MBR partitioning Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Wed Jul 1 02:13:16 2020 (r362822) +++ head/sys/conf/options Wed Jul 1 02:16:36 2020 (r362823) @@ -125,7 +125,6 @@ GEOM_PART_APM opt_geom.h GEOM_PART_BSD opt_geom.h GEOM_PART_BSD64 opt_geom.h GEOM_PART_EBR opt_geom.h -GEOM_PART_EBR_COMPAT opt_geom.h GEOM_PART_GPT opt_geom.h GEOM_PART_LDM opt_geom.h GEOM_PART_MBR opt_geom.h Modified: head/sys/geom/part/g_part_ebr.c ============================================================================== --- head/sys/geom/part/g_part_ebr.c Wed Jul 1 02:13:16 2020 (r362822) +++ head/sys/geom/part/g_part_ebr.c Wed Jul 1 02:16:36 2020 (r362823) @@ -52,40 +52,48 @@ __FBSDID("$FreeBSD$"); FEATURE(geom_part_ebr, "GEOM partitioning class for extended boot records support"); -#if defined(GEOM_PART_EBR_COMPAT) FEATURE(geom_part_ebr_compat, "GEOM EBR partitioning class: backward-compatible partition names"); -#endif +SYSCTL_DECL(_kern_geom_part); +static SYSCTL_NODE(_kern_geom_part, OID_AUTO, ebr, CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, "GEOM_PART_EBR Extended Boot Record"); + +static bool compat_aliases = true; +SYSCTL_BOOL(_kern_geom_part_ebr, OID_AUTO, compat_aliases, + CTLFLAG_RDTUN, &compat_aliases, 0, + "Set non-zero to enable EBR compatibility alias names (e.g., ada0p5)"); + +#define EBRNAMFMT "+%08u" #define EBRSIZE 512 struct g_part_ebr_table { struct g_part_table base; -#ifndef GEOM_PART_EBR_COMPAT - u_char ebr[EBRSIZE]; -#endif + u_char lba0_ebr[EBRSIZE]; }; struct g_part_ebr_entry { struct g_part_entry base; struct dos_partition ent; + u_char ebr[EBRSIZE]; + u_int ebr_compat_idx; }; static int g_part_ebr_add(struct g_part_table *, struct g_part_entry *, struct g_part_parms *); +static void g_part_ebr_add_alias(struct g_part_table *, struct g_provider *, + struct g_part_entry *, const char *); static int g_part_ebr_create(struct g_part_table *, struct g_part_parms *); static int g_part_ebr_destroy(struct g_part_table *, struct g_part_parms *); static void g_part_ebr_dumpconf(struct g_part_table *, struct g_part_entry *, struct sbuf *, const char *); static int g_part_ebr_dumpto(struct g_part_table *, struct g_part_entry *); -#if defined(GEOM_PART_EBR_COMPAT) -static void g_part_ebr_fullname(struct g_part_table *, struct g_part_entry *, - struct sbuf *, const char *); -#endif static int g_part_ebr_modify(struct g_part_table *, struct g_part_entry *, struct g_part_parms *); static const char *g_part_ebr_name(struct g_part_table *, struct g_part_entry *, char *, size_t); +static struct g_provider *g_part_ebr_new_provider(struct g_part_table *, + struct g_geom *, struct g_part_entry *, const char *); static int g_part_ebr_precheck(struct g_part_table *, enum g_part_ctl, struct g_part_parms *); static int g_part_ebr_probe(struct g_part_table *, struct g_consumer *); @@ -100,15 +108,14 @@ static int g_part_ebr_resize(struct g_part_table *, st static kobj_method_t g_part_ebr_methods[] = { KOBJMETHOD(g_part_add, g_part_ebr_add), + KOBJMETHOD(g_part_add_alias, g_part_ebr_add_alias), KOBJMETHOD(g_part_create, g_part_ebr_create), KOBJMETHOD(g_part_destroy, g_part_ebr_destroy), KOBJMETHOD(g_part_dumpconf, g_part_ebr_dumpconf), KOBJMETHOD(g_part_dumpto, g_part_ebr_dumpto), -#if defined(GEOM_PART_EBR_COMPAT) - KOBJMETHOD(g_part_fullname, g_part_ebr_fullname), -#endif KOBJMETHOD(g_part_modify, g_part_ebr_modify), KOBJMETHOD(g_part_name, g_part_ebr_name), + KOBJMETHOD(g_part_new_provider, g_part_ebr_new_provider), KOBJMETHOD(g_part_precheck, g_part_ebr_precheck), KOBJMETHOD(g_part_probe, g_part_ebr_probe), KOBJMETHOD(g_part_read, g_part_ebr_read), @@ -171,7 +178,7 @@ ebr_entry_link(struct g_part_table *table, uint32_t st buf[0] = 0 /* dp_flag */; ebr_set_chs(table, start, &buf[3] /* dp_scyl */, &buf[1] /* dp_shd */, &buf[2] /* dp_ssect */); - buf[4] = 5 /* dp_typ */; + buf[4] = DOSPTYP_EXT /* dp_typ */; ebr_set_chs(table, end, &buf[7] /* dp_ecyl */, &buf[5] /* dp_ehd */, &buf[6] /* dp_esect */); le32enc(buf + 8, start); @@ -249,7 +256,9 @@ g_part_ebr_add(struct g_part_table *basetable, struct { struct g_provider *pp; struct g_part_ebr_entry *entry; + struct g_part_entry *iter; uint32_t start, size; + u_int idx; if (gpp->gpp_parms & G_PART_PARM_LABEL) return (EINVAL); @@ -276,9 +285,48 @@ g_part_ebr_add(struct g_part_table *basetable, struct &entry->ent.dp_shd, &entry->ent.dp_ssect); ebr_set_chs(basetable, baseentry->gpe_end, &entry->ent.dp_ecyl, &entry->ent.dp_ehd, &entry->ent.dp_esect); + + if (compat_aliases) { + idx = 5; + LIST_FOREACH(iter, &basetable->gpt_entry, gpe_entry) + idx++; + entry->ebr_compat_idx = idx; + } return (ebr_parse_type(gpp->gpp_type, &entry->ent.dp_typ)); } +static void +g_part_ebr_add_alias(struct g_part_table *table, struct g_provider *pp, + struct g_part_entry *baseentry, const char *pfx) +{ + struct g_part_ebr_entry *entry; + + g_provider_add_alias(pp, "%s%s" EBRNAMFMT, pfx, g_part_separator, + baseentry->gpe_index); + if (compat_aliases) { + entry = (struct g_part_ebr_entry *)baseentry; + g_provider_add_alias(pp, "%.*s%u", (int)strlen(pfx) - 1, pfx, + entry->ebr_compat_idx); + } +} + +static struct g_provider * +g_part_ebr_new_provider(struct g_part_table *table, struct g_geom *gp, + struct g_part_entry *baseentry, const char *pfx) +{ + struct g_part_ebr_entry *entry; + struct g_provider *pp; + + pp = g_new_providerf(gp, "%s%s" EBRNAMFMT, pfx, g_part_separator, + baseentry->gpe_index); + if (compat_aliases) { + entry = (struct g_part_ebr_entry *)baseentry; + g_provider_add_alias(pp, "%.*s%u", (int)strlen(pfx) - 1, pfx, + entry->ebr_compat_idx); + } + return (pp); +} + static int g_part_ebr_create(struct g_part_table *basetable, struct g_part_parms *gpp) { @@ -358,24 +406,6 @@ g_part_ebr_dumpto(struct g_part_table *table, struct g entry->ent.dp_typ == DOSPTYP_LINSWP) ? 1 : 0); } -#if defined(GEOM_PART_EBR_COMPAT) -static void -g_part_ebr_fullname(struct g_part_table *table, struct g_part_entry *entry, - struct sbuf *sb, const char *pfx) -{ - struct g_part_entry *iter; - u_int idx; - - idx = 5; - LIST_FOREACH(iter, &table->gpt_entry, gpe_entry) { - if (iter == entry) - break; - idx++; - } - sbuf_printf(sb, "%.*s%u", (int)strlen(pfx) - 1, pfx, idx); -} -#endif - static int g_part_ebr_modify(struct g_part_table *basetable, struct g_part_entry *baseentry, struct g_part_parms *gpp) @@ -409,8 +439,7 @@ static const char * g_part_ebr_name(struct g_part_table *table, struct g_part_entry *entry, char *buf, size_t bufsz) { - - snprintf(buf, bufsz, "+%08u", entry->gpe_index); + snprintf(buf, bufsz, EBRNAMFMT, entry->gpe_index); return (buf); } @@ -418,11 +447,6 @@ static int g_part_ebr_precheck(struct g_part_table *table, enum g_part_ctl req, struct g_part_parms *gpp) { -#if defined(GEOM_PART_EBR_COMPAT) - if (req == G_PART_CTL_DESTROY) - return (0); - return (ECANCELED); -#else /* * The index is a function of the start of the partition. * This is not something the user can override, nor is it @@ -432,7 +456,6 @@ g_part_ebr_precheck(struct g_part_table *table, enum g if (req == G_PART_CTL_ADD) gpp->gpp_index = (gpp->gpp_start / table->gpt_sectors) + 1; return (0); -#endif } static int @@ -501,9 +524,10 @@ g_part_ebr_read(struct g_part_table *basetable, struct struct g_part_ebr_entry *entry; u_char *buf; off_t ofs, msize; - u_int lba; + u_int lba, idx; int error, index; + idx = 5; pp = cp->provider; table = (struct g_part_ebr_table *)basetable; msize = MIN(pp->mediasize / pp->sectorsize, UINT32_MAX); @@ -525,18 +549,21 @@ g_part_ebr_read(struct g_part_table *basetable, struct printf("GEOM: %s: invalid entries in the EBR ignored.\n", pp->name); } -#ifndef GEOM_PART_EBR_COMPAT - /* Save the first EBR, it can contain a boot code */ + /* + * Preserve EBR, it can contain boot code or other metadata we + * are ignorant of. + */ if (lba == 0) - bcopy(buf, table->ebr, sizeof(table->ebr)); -#endif - g_free(buf); + memcpy(table->lba0_ebr, buf, sizeof(table->lba0_ebr)); - if (ent[0].dp_typ == 0) + if (ent[0].dp_typ == 0) { + g_free(buf); break; + } if (ent[0].dp_typ == 5 && ent[1].dp_typ == 0) { lba = ent[0].dp_start; + g_free(buf); continue; } @@ -547,6 +574,10 @@ g_part_ebr_read(struct g_part_table *basetable, struct pp->sectorsize; entry = (struct g_part_ebr_entry *)baseentry; entry->ent = ent[0]; + memcpy(entry->ebr, buf, sizeof(entry->ebr)); + if (compat_aliases) + entry->ebr_compat_idx = idx++; + g_free(buf); if (ent[1].dp_typ == 0) break; @@ -618,9 +649,7 @@ g_part_ebr_type(struct g_part_table *basetable, struct static int g_part_ebr_write(struct g_part_table *basetable, struct g_consumer *cp) { -#ifndef GEOM_PART_EBR_COMPAT struct g_part_ebr_table *table; -#endif struct g_provider *pp; struct g_part_entry *baseentry, *next; struct g_part_ebr_entry *entry; @@ -630,10 +659,10 @@ g_part_ebr_write(struct g_part_table *basetable, struc pp = cp->provider; buf = g_malloc(pp->sectorsize, M_WAITOK | M_ZERO); -#ifndef GEOM_PART_EBR_COMPAT table = (struct g_part_ebr_table *)basetable; - bcopy(table->ebr, buf, DOSPARTOFF); -#endif + + _Static_assert(DOSPARTOFF <= sizeof(table->lba0_ebr), ""); + memcpy(buf, table->lba0_ebr, DOSPARTOFF); le16enc(buf + DOSMAGICOFFSET, DOSMAGIC); baseentry = LIST_FIRST(&basetable->gpt_entry); @@ -661,6 +690,9 @@ g_part_ebr_write(struct g_part_table *basetable, struc do { entry = (struct g_part_ebr_entry *)baseentry; + _Static_assert(DOSPARTOFF <= sizeof(entry->ebr), ""); + memcpy(buf, entry->ebr, DOSPARTOFF); + p = buf + DOSPARTOFF; p[0] = entry->ent.dp_flag; p[1] = entry->ent.dp_shd; @@ -686,10 +718,6 @@ g_part_ebr_write(struct g_part_table *basetable, struc error = g_write_data(cp, baseentry->gpe_start * pp->sectorsize, buf, pp->sectorsize); -#ifndef GEOM_PART_EBR_COMPAT - if (baseentry->gpe_start == 0) - bzero(buf, DOSPARTOFF); -#endif baseentry = next; } while (!error && baseentry != NULL); Modified: head/sys/i386/conf/DEFAULTS ============================================================================== --- head/sys/i386/conf/DEFAULTS Wed Jul 1 02:13:16 2020 (r362822) +++ head/sys/i386/conf/DEFAULTS Wed Jul 1 02:16:36 2020 (r362823) @@ -19,7 +19,6 @@ device uart_ns8250 # Default partitioning schemes options GEOM_PART_BSD options GEOM_PART_EBR -options GEOM_PART_EBR_COMPAT options GEOM_PART_MBR options GEOM_PART_GPT From owner-svn-src-head@freebsd.org Wed Jul 1 02:32: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 E637435B45F; Wed, 1 Jul 2020 02:32:42 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49xQHZ5rQTz4FYs; Wed, 1 Jul 2020 02:32:42 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC9172230C; Wed, 1 Jul 2020 02:32:42 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0612Wg6L012325; Wed, 1 Jul 2020 02:32:42 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0612WfAp012320; Wed, 1 Jul 2020 02:32:41 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202007010232.0612WfAp012320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Wed, 1 Jul 2020 02:32:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362824 - in head: lib/libifconfig sbin/ifconfig sys/net X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in head: lib/libifconfig sbin/ifconfig sys/net X-SVN-Commit-Revision: 362824 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 02:32:43 -0000 Author: freqlabs Date: Wed Jul 1 02:32:41 2020 New Revision: 362824 URL: https://svnweb.freebsd.org/changeset/base/362824 Log: libifconfig: Add function to get bridge status The new function operates similarly to ifconfig_lagg_get_lagg_status and likewise is accompanied by a function to free the bridge status data structure. I have included in this patch the relocation of some strings describing STP parameters and the PV2ID macro from ifconfig into net/if_bridgevar.h as they are useful for consumers of libifconfig. Reviewed by: kp, melifaro, mmacy Approved by: mmacy (mentor) MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25460 Added: head/lib/libifconfig/libifconfig_bridge.c (contents, props changed) Modified: head/lib/libifconfig/Makefile head/lib/libifconfig/libifconfig.h head/sbin/ifconfig/ifbridge.c head/sys/net/if_bridgevar.h Modified: head/lib/libifconfig/Makefile ============================================================================== --- head/lib/libifconfig/Makefile Wed Jul 1 02:16:36 2020 (r362823) +++ head/lib/libifconfig/Makefile Wed Jul 1 02:32:41 2020 (r362824) @@ -6,9 +6,14 @@ INTERNALLIB= true SHLIBDIR?= /lib SHLIB_MAJOR= 1 -SRCS= libifconfig.c libifconfig_carp.c libifconfig_inet.c -SRCS+= libifconfig_inet6.c libifconfig_internal.c libifconfig_lagg.c -SRCS+= libifconfig_media.c +SRCS= libifconfig.c \ + libifconfig_bridge.c \ + libifconfig_carp.c \ + libifconfig_inet.c \ + libifconfig_inet6.c \ + libifconfig_internal.c \ + libifconfig_lagg.c \ + libifconfig_media.c # If libifconfig become public uncomment those two lines #INCSDIR= ${INCLUDEDIR} Modified: head/lib/libifconfig/libifconfig.h ============================================================================== --- head/lib/libifconfig/libifconfig.h Wed Jul 1 02:16:36 2020 (r362823) +++ head/lib/libifconfig/libifconfig.h Wed Jul 1 02:32:41 2020 (r362824) @@ -49,12 +49,23 @@ typedef struct ifconfig_handle ifconfig_handle_t; struct carpreq; struct ifaddrs; +struct ifbropreq; +struct ifbreq; struct in6_ndireq; struct lagg_reqall; struct lagg_reqflags; struct lagg_reqopts; struct lagg_reqport; +/** Stores extra info associated with a bridge(4) interface */ +struct ifconfig_bridge_status { + struct ifbropreq *params; /**< current operational parameters */ + struct ifbreq *members; /**< list of bridge members */ + size_t members_count; /**< how many member interfaces */ + uint32_t cache_size; /**< size of address cache */ + uint32_t cache_lifetime; /**< address cache entry lifetime */ +}; + struct ifconfig_capabilities { /** Current capabilities (ifconfig prints this as 'options')*/ int curcap; @@ -217,6 +228,16 @@ int ifconfig_inet_get_addrinfo(ifconfig_handle_t *h, int ifconfig_inet6_get_addrinfo(ifconfig_handle_t *h, const char *name, struct ifaddrs *ifa, struct ifconfig_inet6_addr *addr); +/** Retrieve additional information about a bridge(4) interface */ +int ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h, + const char *name, struct ifconfig_bridge_status **bridge); + +/** Frees the structure returned by ifconfig_bridge_get_bridge_status. Does + * nothing if the argument is NULL + * @param bridge Pointer to the structure to free + */ +void ifconfig_bridge_free_bridge_status(struct ifconfig_bridge_status *bridge); + /** Retrieve additional information about a lagg(4) interface */ int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h, const char *name, struct ifconfig_lagg_status **lagg_status); @@ -225,8 +246,8 @@ int ifconfig_lagg_get_lagg_status(ifconfig_handle_t *h int ifconfig_lagg_get_laggport_status(ifconfig_handle_t *h, const char *name, struct lagg_reqport *rp); -/** Frees the structure returned by ifconfig_lagg_get_status. Does nothing if - * the argument is NULL +/** Frees the structure returned by ifconfig_lagg_get_lagg_status. Does + * nothing if the argument is NULL * @param laggstat Pointer to the structure to free */ void ifconfig_lagg_free_lagg_status(struct ifconfig_lagg_status *laggstat); Added: head/lib/libifconfig/libifconfig_bridge.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libifconfig/libifconfig_bridge.c Wed Jul 1 02:32:41 2020 (r362824) @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2020, Ryan Moeller + * + * 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 REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "libifconfig.h" +#include "libifconfig_internal.h" + +/* Internal structure used for allocations and frees */ +struct _ifconfig_bridge_status { + struct ifconfig_bridge_status inner; /* wrapped bridge status */ + struct ifbropreq params; /* operational parameters */ +}; + +static int +ifconfig_bridge_ioctlwrap(ifconfig_handle_t *h, const char *name, + unsigned long cmd, void *arg, size_t arglen, bool set) +{ + struct ifdrv ifd = { 0 }; + unsigned long req = set ? SIOCSDRVSPEC : SIOCGDRVSPEC; + + strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); + ifd.ifd_cmd = cmd; + ifd.ifd_data = arg; + ifd.ifd_len = arglen; + + return (ifconfig_ioctlwrap(h, AF_LOCAL, req, &ifd)); +} + +int +ifconfig_bridge_get_bridge_status(ifconfig_handle_t *h, + const char *name, struct ifconfig_bridge_status **bridgep) +{ + struct ifbifconf members; + struct ifbrparam cache_param; + struct _ifconfig_bridge_status *bridge; + char *buf; + + *bridgep = NULL; + + bridge = calloc(1, sizeof(struct _ifconfig_bridge_status)); + if (bridge == NULL) { + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); + } + bridge->inner.params = &bridge->params; + + if (ifconfig_bridge_ioctlwrap(h, name, BRDGGCACHE, + &cache_param, sizeof(cache_param), false) != 0) { + free(bridge); + return (-1); + } + bridge->inner.cache_size = cache_param.ifbrp_csize; + + if (ifconfig_bridge_ioctlwrap(h, name, BRDGGTO, + &cache_param, sizeof(cache_param), false) != 0) { + free(bridge); + return (-1); + } + bridge->inner.cache_lifetime = cache_param.ifbrp_ctime; + + if (ifconfig_bridge_ioctlwrap(h, name, BRDGPARAM, + &bridge->params, sizeof(bridge->params), false) != 0) { + free(bridge); + return (-1); + } + + members.ifbic_buf = NULL; + for (size_t len = 8192; + (buf = realloc(members.ifbic_buf, len)) != NULL; + len *= 2) { + members.ifbic_buf = buf; + members.ifbic_len = len; + if (ifconfig_bridge_ioctlwrap(h, name, BRDGGIFS, + &members, sizeof(members), false) != 0) { + free(buf); + free(bridge); + return (-1); + } + if (members.ifbic_len <= len) + break; + } + if (buf == NULL) { + free(members.ifbic_buf); + free(bridge); + h->error.errtype = OTHER; + h->error.errcode = ENOMEM; + return (-1); + } + bridge->inner.members = members.ifbic_req; + bridge->inner.members_count = + members.ifbic_len / sizeof(*members.ifbic_req); + + *bridgep = &bridge->inner; + + return (0); +} + +void +ifconfig_bridge_free_bridge_status(struct ifconfig_bridge_status *bridge) +{ + if (bridge != NULL) { + free(bridge->members); + free(bridge); + } +} Modified: head/sbin/ifconfig/ifbridge.c ============================================================================== --- head/sbin/ifconfig/ifbridge.c Wed Jul 1 02:16:36 2020 (r362823) +++ head/sbin/ifconfig/ifbridge.c Wed Jul 1 02:32:41 2020 (r362824) @@ -63,36 +63,9 @@ static const char rcsid[] = #include "ifconfig.h" -#define PV2ID(pv, epri, eaddr) do { \ - epri = pv >> 48; \ - eaddr[0] = pv >> 40; \ - eaddr[1] = pv >> 32; \ - eaddr[2] = pv >> 24; \ - eaddr[3] = pv >> 16; \ - eaddr[4] = pv >> 8; \ - eaddr[5] = pv >> 0; \ -} while (0) - -static const char *stpstates[] = { - "disabled", - "listening", - "learning", - "forwarding", - "blocking", - "discarding" -}; -static const char *stpproto[] = { - "stp", - "-", - "rstp" -}; -static const char *stproles[] = { - "disabled", - "root", - "designated", - "alternate", - "backup" -}; +static const char *stpstates[] = { STP_STATES }; +static const char *stpproto[] = { STP_PROTOS }; +static const char *stproles[] = { STP_ROLES }; static int get_val(const char *cp, u_long *valp) Modified: head/sys/net/if_bridgevar.h ============================================================================== --- head/sys/net/if_bridgevar.h Wed Jul 1 02:16:36 2020 (r362823) +++ head/sys/net/if_bridgevar.h Wed Jul 1 02:32:41 2020 (r362824) @@ -269,6 +269,36 @@ struct ifbpstpconf { #define ifbpstp_req ifbpstp_ifbpstpu.ifbpstpu_req }; +#define STP_STATES \ + "disabled", \ + "listening", \ + "learning", \ + "forwarding", \ + "blocking", \ + "discarding" + +#define STP_PROTOS \ + "stp" \ + "-" \ + "rstp" + +#define STP_ROLES \ + "disabled" \ + "root" \ + "designated" \ + "alternate" \ + "backup" + +#define PV2ID(pv, epri, eaddr) do { \ + epri = pv >> 48; \ + eaddr[0] = pv >> 40; \ + eaddr[1] = pv >> 32; \ + eaddr[2] = pv >> 24; \ + eaddr[3] = pv >> 16; \ + eaddr[4] = pv >> 8; \ + eaddr[5] = pv >> 0; \ +} while (0) + #ifdef _KERNEL #define BRIDGE_INPUT(_ifp, _m) do { \ From owner-svn-src-head@freebsd.org Wed Jul 1 03:47: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 076DA35C46D; Wed, 1 Jul 2020 03:47:00 +0000 (UTC) (envelope-from csjp@ion.sqrt.ca) Received: from ion.sqrt.ca (ion.sqrt.ca [192.73.242.220]) by mx1.freebsd.org (Postfix) with ESMTP id 49xRxG5c1Fz4JBy; Wed, 1 Jul 2020 03:46:58 +0000 (UTC) (envelope-from csjp@ion.sqrt.ca) Received: by ion.sqrt.ca (Postfix, from userid 1000) id 8EFCA81A16; Tue, 30 Jun 2020 20:46:52 -0700 (PDT) Date: Tue, 30 Jun 2020 20:46:52 -0700 From: csjp@ion.sqrt.ca To: "Piotr P. Stefaniak" Cc: "Christian S.J. Peron" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r358181 - head/usr.sbin/pstat Message-ID: <20200701034652.GA1094@ion.sqrt.ca> References: <202002202112.01KLCAKx000852@repo.freebsd.org> <20200622215315.GC28243@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200622215315.GC28243@freefall.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Rspamd-Queue-Id: 49xRxG5c1Fz4JBy X-Spamd-Bar: +++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of csjp@ion.sqrt.ca has no SPF policy when checking 192.73.242.220) smtp.mailfrom=csjp@ion.sqrt.ca X-Spamd-Result: default: False [3.08 / 15.00]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.42)[0.416]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[sqrt.ca]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.92)[0.921]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_SPAM_LONG(0.85)[0.848]; FROM_NO_DN(0.00)[]; R_SPF_NA(0.00)[no SPF record]; 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:36236, ipnet:192.73.242.0/24, country:US]; MID_RHS_MATCH_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: Wed, 01 Jul 2020 03:47:00 -0000 Piotr, Thanks for the heads up. I will fix this shortly. On Mon, Jun 22, 2020 at 11:53:15PM +0200, Piotr P. Stefaniak wrote: > On 2020-02-20 21:12:10, Christian S.J. Peron wrote: > >Author: csjp > >Date: Thu Feb 20 21:12:10 2020 > >New Revision: 358181 > >URL: https://svnweb.freebsd.org/changeset/base/358181 > > > >Log: > > - Implement -h (human readable) for the size of the underlying block disk. > > Currently, the size of the swap device is unconditionally reported using > > blocks, even if -h has been used. > > - While here, switch to CONVERT_BLOCKS() instead of CONVERT() which will > > avoid overflowing size counters (in human readable form see: r196244) > > - Update the column headers to reflect that a size is being reported instead > > of the block size units being used > > > > Before: > > > > $ swapinfo > > Device 1K-blocks Used Avail Capacity > > /dev/gpt/swapfs 1048576 0 1048576 0% > > In the above, the "1K-blocks" and "1048576" line up because both the > header and the value have field width of hlen which is always set by > getbsize(&hlen, &blocksize). In other words, the header name sets the > width for the column. It is especially apparent when you compare output > with BLOCKSIZE=1000000000 and BLOCKSIZE=1K. > > > After: > > > > $ swapinfo -h > > Device Size Used Avail Capacity > > /dev/gpt/swapfs 1.0G 0B 1.0G 0% > > Here the width for the header is sizeof "Size" and the width for values > of the size is 8, so the header and the values don't make up a column. > > Since field width for all values of Size, Used, and Avail are hardcoded > to 8 as well as the column headers, I think the best suggestion I can > give is to change it like this: > > @@ -475,7 +475,7 @@ print_swap_header(void) > if (humanflag) { > header = SIZEHDR; > - hlen = sizeof(SIZEHDR); > + hlen = 8; /* as the hardcoded field width of values */ > } else { > header = getbsize(&hlen, &blocksize); > } > > Although 8 seems to me a bit high. And too bad that humanize_number() is > locale-agnostic. > > > Differential Revision: https://reviews.freebsd.org/D23758 > > Reviewed by: kevans > > MFC after: 3 weeks > > > >Modified: > > head/usr.sbin/pstat/pstat.c From owner-svn-src-head@freebsd.org Wed Jul 1 04:00: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 7BC8C35CEFA; Wed, 1 Jul 2020 04:00:55 +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 49xSFM2jFsz4JqY; Wed, 1 Jul 2020 04:00:55 +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 40DBC22E7F; Wed, 1 Jul 2020 04:00:55 +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 06140tqF063882; Wed, 1 Jul 2020 04:00:55 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06140tZb063881; Wed, 1 Jul 2020 04:00:55 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202007010400.06140tZb063881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Wed, 1 Jul 2020 04:00:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362825 - head/sys/netgraph/bluetooth/socket X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: head/sys/netgraph/bluetooth/socket X-SVN-Commit-Revision: 362825 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 04:00:55 -0000 Author: takawata Date: Wed Jul 1 04:00:54 2020 New Revision: 362825 URL: https://svnweb.freebsd.org/changeset/base/362825 Log: Allow some Bluetooth LE related HCI request to non-root user. PR: 247588 Reported by: Greg V (greg@unrelenting.technology) Reviewed by: emax Differential Revision: https://reviews.freebsd.org/D25516 Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c ============================================================================== --- head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c Wed Jul 1 02:32:41 2020 (r362824) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c Wed Jul 1 04:00:54 2020 (r362825) @@ -861,6 +861,7 @@ ng_btsocket_hci_raw_init(void) bit_set(f, NG_HCI_OCF_READ_IAC_LAP - 1); bit_set(f, NG_HCI_OCF_READ_PAGE_SCAN_PERIOD - 1); bit_set(f, NG_HCI_OCF_READ_PAGE_SCAN - 1); + bit_set(f, NG_HCI_OCF_READ_LE_HOST_SUPPORTED -1); /* Commands - Informational */ f = ng_btsocket_hci_raw_sec_filter->commands[NG_HCI_OGF_INFO - 1]; @@ -881,6 +882,11 @@ ng_btsocket_hci_raw_init(void) bit_set(f, NG_HCI_OCF_READ_LOOPBACK_MODE - 1); /*Commands - LE*/ f = ng_btsocket_hci_raw_sec_filter->commands[NG_HCI_OGF_LE -1]; + bit_set(f, NG_HCI_OCF_LE_SET_SCAN_ENABLE - 1); + bit_set(f, NG_HCI_OCF_LE_SET_SCAN_PARAMETERS - 1); + bit_set(f, NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES - 1); + bit_set(f, NG_HCI_OCF_LE_READ_BUFFER_SIZE - 1); + bit_set(f, NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE - 1); } /* ng_btsocket_hci_raw_init */ From owner-svn-src-head@freebsd.org Wed Jul 1 05:56: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 0823A362FE9; Wed, 1 Jul 2020 05:56:30 +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 49xVpj6Jqfz3y2Q; Wed, 1 Jul 2020 05:56:29 +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 B7A2D24B04; Wed, 1 Jul 2020 05:56:29 +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 0615uTe8036133; Wed, 1 Jul 2020 05:56:29 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0615uTEb036131; Wed, 1 Jul 2020 05:56:29 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007010556.0615uTEb036131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 1 Jul 2020 05:56:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362827 - 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: 362827 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 05:56:30 -0000 Author: mjg Date: Wed Jul 1 05:56:29 2020 New Revision: 362827 URL: https://svnweb.freebsd.org/changeset/base/362827 Log: vfs: protect vnodes with smr vget_prep_smr and vhold_smr can be used to ref a vnode while within vfs_smr section, allowing consumers to get away without locking. See vhold_smr and vdropl for comments explaining caveats. Reviewed by: kib Testec by: pho Differential Revision: https://reviews.freebsd.org/D23913 Modified: head/sys/kern/vfs_subr.c head/sys/sys/vnode.h Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Jul 1 04:12:41 2020 (r362826) +++ head/sys/kern/vfs_subr.c Wed Jul 1 05:56:29 2020 (r362827) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -238,6 +239,8 @@ static uma_zone_t buf_trie_zone; static uma_zone_t vnode_zone; static uma_zone_t vnodepoll_zone; +__read_frequently smr_t vfs_smr; + /* * The workitem queue. * @@ -661,7 +664,8 @@ vntblinit(void *dummy __unused) vnode_list_reclaim_marker = vn_alloc_marker(NULL); TAILQ_INSERT_HEAD(&vnode_list, vnode_list_reclaim_marker, v_vnodelist); vnode_zone = uma_zcreate("VNODE", sizeof (struct vnode), NULL, NULL, - vnode_init, vnode_fini, UMA_ALIGN_PTR, 0); + vnode_init, vnode_fini, UMA_ALIGN_PTR, UMA_ZONE_SMR); + vfs_smr = uma_zone_get_smr(vnode_zone); vnodepoll_zone = uma_zcreate("VNODEPOLL", sizeof (struct vpollinfo), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); /* @@ -1603,7 +1607,7 @@ alloc: if (vnlru_under(rnumvnodes, vlowat)) vnlru_kick(); mtx_unlock(&vnode_list_mtx); - return (uma_zalloc(vnode_zone, M_WAITOK)); + return (uma_zalloc_smr(vnode_zone, M_WAITOK)); } static struct vnode * @@ -1619,7 +1623,7 @@ vn_alloc(struct mount *mp) return (vn_alloc_hard(mp)); } - return (uma_zalloc(vnode_zone, M_WAITOK)); + return (uma_zalloc_smr(vnode_zone, M_WAITOK)); } static void @@ -1627,7 +1631,7 @@ vn_free(struct vnode *vp) { atomic_subtract_long(&numvnodes, 1); - uma_zfree(vnode_zone, vp); + uma_zfree_smr(vnode_zone, vp); } /* @@ -1758,7 +1762,7 @@ freevnode(struct vnode *vp) CTR2(KTR_VFS, "%s: destroying the vnode %p", __func__, vp); bo = &vp->v_bufobj; VNASSERT(vp->v_data == NULL, vp, ("cleaned vnode isn't")); - VNASSERT(vp->v_holdcnt == 0, vp, ("Non-zero hold count")); + VNPASS(vp->v_holdcnt == VHOLD_NO_SMR, vp); VNASSERT(vp->v_usecount == 0, vp, ("Non-zero use count")); VNASSERT(vp->v_writecount == 0, vp, ("Non-zero write count")); VNASSERT(bo->bo_numoutput == 0, vp, ("Clean vnode has pending I/O's")); @@ -2848,8 +2852,30 @@ v_decr_devcount(struct vnode *vp) * * holdcnt can be manipulated using atomics without holding any locks, * except when transitioning 1<->0, in which case the interlock is held. + * + * Consumers which don't guarantee liveness of the vnode can use SMR to + * try to get a reference. Note this operation can fail since the vnode + * may be awaiting getting freed by the time they get to it. */ enum vgetstate +vget_prep_smr(struct vnode *vp) +{ + enum vgetstate vs; + + VFS_SMR_ASSERT_ENTERED(); + + if (refcount_acquire_if_not_zero(&vp->v_usecount)) { + vs = VGET_USECOUNT; + } else { + if (vhold_smr(vp)) + vs = VGET_HOLDCNT; + else + vs = VGET_NONE; + } + return (vs); +} + +enum vgetstate vget_prep(struct vnode *vp) { enum vgetstate vs; @@ -2919,6 +2945,7 @@ vget_finish(struct vnode *vp, int flags, enum vgetstat ASSERT_VI_LOCKED(vp, __func__); else ASSERT_VI_UNLOCKED(vp, __func__); + VNPASS(vs == VGET_HOLDCNT || vs == VGET_USECOUNT, vp); VNPASS(vp->v_holdcnt > 0, vp); VNPASS(vs == VGET_HOLDCNT || vp->v_usecount > 0, vp); @@ -3380,7 +3407,8 @@ vhold(struct vnode *vp) CTR2(KTR_VFS, "%s: vp %p", __func__, vp); old = atomic_fetchadd_int(&vp->v_holdcnt, 1); - VNASSERT(old >= 0, vp, ("%s: wrong hold count %d", __func__, old)); + VNASSERT(old >= 0 && (old & VHOLD_ALL_FLAGS) == 0, vp, + ("%s: wrong hold count %d", __func__, old)); if (old != 0) return; critical_enter(); @@ -3405,12 +3433,40 @@ vholdnz(struct vnode *vp) CTR2(KTR_VFS, "%s: vp %p", __func__, vp); #ifdef INVARIANTS int old = atomic_fetchadd_int(&vp->v_holdcnt, 1); - VNASSERT(old > 0, vp, ("%s: wrong hold count %d", __func__, old)); + VNASSERT(old > 0 && (old & VHOLD_ALL_FLAGS) == 0, vp, + ("%s: wrong hold count %d", __func__, old)); #else atomic_add_int(&vp->v_holdcnt, 1); #endif } +/* + * Grab a hold count as long as the vnode is not getting freed. + * + * Only use this routine if vfs smr is the only protection you have against + * freeing the vnode. + */ +bool +vhold_smr(struct vnode *vp) +{ + int count; + + VFS_SMR_ASSERT_ENTERED(); + + count = atomic_load_int(&vp->v_holdcnt); + for (;;) { + if (count & VHOLD_NO_SMR) { + VNASSERT((count & ~VHOLD_NO_SMR) == 0, vp, + ("non-zero hold count with flags %d\n", count)); + return (false); + } + + VNASSERT(count >= 0, vp, ("invalid hold count %d\n", count)); + if (atomic_fcmpset_int(&vp->v_holdcnt, &count, count + 1)) + return (true); + } +} + static void __noinline vdbatch_process(struct vdbatch *vd) { @@ -3581,11 +3637,25 @@ vdropl(struct vnode *vp) VI_UNLOCK(vp); return; } - if (VN_IS_DOOMED(vp)) { - freevnode(vp); + if (!VN_IS_DOOMED(vp)) { + vdrop_deactivate(vp); return; } - vdrop_deactivate(vp); + /* + * We may be racing against vhold_smr. + * + * If they win we can just pretend we never got this far, they will + * vdrop later. + */ + if (!atomic_cmpset_int(&vp->v_holdcnt, 0, VHOLD_NO_SMR)) { + /* + * We lost the aforementioned race. Note that any subsequent + * access is invalid as they might have managed to vdropl on + * their own. + */ + return; + } + freevnode(vp); } /* @@ -4041,20 +4111,25 @@ static const char * const typename[] = {"VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD", "VMARKER"}; +_Static_assert((VHOLD_ALL_FLAGS & ~VHOLD_NO_SMR) == 0, + "new hold count flag not added to vn_printf"); + void vn_printf(struct vnode *vp, const char *fmt, ...) { va_list ap; char buf[256], buf2[16]; u_long flags; + u_int holdcnt; va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); printf("%p: ", (void *)vp); printf("type %s\n", typename[vp->v_type]); + holdcnt = atomic_load_int(&vp->v_holdcnt); printf(" usecount %d, writecount %d, refcount %d", - vp->v_usecount, vp->v_writecount, vp->v_holdcnt); + vp->v_usecount, vp->v_writecount, holdcnt & ~VHOLD_ALL_FLAGS); switch (vp->v_type) { case VDIR: printf(" mountedhere %p\n", vp->v_mountedhere); @@ -4072,6 +4147,12 @@ vn_printf(struct vnode *vp, const char *fmt, ...) printf("\n"); break; } + buf[0] = '\0'; + buf[1] = '\0'; + if (holdcnt & VHOLD_NO_SMR) + strlcat(buf, "|VHOLD_NO_SMR", sizeof(buf)); + printf(" hold count flags (%s)\n", buf + 1); + buf[0] = '\0'; buf[1] = '\0'; if (vp->v_irflag & VIRF_DOOMED) Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Wed Jul 1 04:12:41 2020 (r362826) +++ head/sys/sys/vnode.h Wed Jul 1 05:56:29 2020 (r362827) @@ -58,7 +58,7 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD, VMARKER }; -enum vgetstate { VGET_HOLDCNT, VGET_USECOUNT }; +enum vgetstate { VGET_NONE, VGET_HOLDCNT, VGET_USECOUNT }; /* * Each underlying filesystem allocates its own private area and hangs * it from v_data. If non-null, this area is freed in getnewvnode(). @@ -236,6 +236,9 @@ struct xvnode { * VIRF_DOOMED is doubly protected by the interlock and vnode lock. Both * are required for writing but the status may be checked with either. */ +#define VHOLD_NO_SMR (1<<29) /* Disable vhold_smr */ +#define VHOLD_ALL_FLAGS (VHOLD_NO_SMR) + #define VIRF_DOOMED 0x0001 /* This vnode is being recycled */ #define VI_TEXT_REF 0x0001 /* Text ref grabbed use ref */ @@ -657,12 +660,14 @@ void vdrop(struct vnode *); void vdropl(struct vnode *); int vflush(struct mount *mp, int rootrefs, int flags, struct thread *td); int vget(struct vnode *vp, int flags, struct thread *td); +enum vgetstate vget_prep_smr(struct vnode *vp); enum vgetstate vget_prep(struct vnode *vp); int vget_finish(struct vnode *vp, int flags, enum vgetstate vs); void vgone(struct vnode *vp); void vhold(struct vnode *); void vholdl(struct vnode *); void vholdnz(struct vnode *); +bool vhold_smr(struct vnode *); void vinactive(struct vnode *vp); int vinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo); int vtruncbuf(struct vnode *vp, off_t length, int blksize); @@ -973,6 +978,16 @@ int vn_dir_check_exec(struct vnode *vp, struct compone #define VFS_VOP_VECTOR_REGISTER(vnodeops) \ SYSINIT(vfs_vector_##vnodeops##_f, SI_SUB_VFS, SI_ORDER_ANY, \ vfs_vector_op_register, &vnodeops) + +#define VFS_SMR_DECLARE \ + extern smr_t vfs_smr + +#define VFS_SMR() vfs_smr +#define vfs_smr_enter() smr_enter(VFS_SMR()) +#define vfs_smr_exit() smr_exit(VFS_SMR()) +#define VFS_SMR_ASSERT_ENTERED() SMR_ASSERT_ENTERED(VFS_SMR()) +#define VFS_SMR_ASSERT_NOT_ENTERED() SMR_ASSERT_NOT_ENTERED(VFS_SMR()) +#define VFS_SMR_ZONE_SET(zone) uma_zone_set_smr((zone), VFS_SMR()) #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Wed Jul 1 05:59: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 94C283633B9; Wed, 1 Jul 2020 05:59:09 +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 49xVsn3Gcqz3y2G; Wed, 1 Jul 2020 05:59:09 +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 536A4244E0; Wed, 1 Jul 2020 05:59:09 +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 0615x94R036297; Wed, 1 Jul 2020 05:59:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0615x9Da036296; Wed, 1 Jul 2020 05:59:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007010559.0615x9Da036296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 1 Jul 2020 05:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362828 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362828 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 05:59:09 -0000 Author: mjg Date: Wed Jul 1 05:59:08 2020 New Revision: 362828 URL: https://svnweb.freebsd.org/changeset/base/362828 Log: cache: lockless forward lookup with smr This eliminates the need to take bucket locks in the common case. Concurrent lookup utilizng the same vnodes is still bottlenecked on referencing and locking path components, this will be taken care of separately. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D23913 Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Wed Jul 1 05:56:29 2020 (r362827) +++ head/sys/kern/vfs_cache.c Wed Jul 1 05:59:08 2020 (r362828) @@ -56,11 +56,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include +#include #ifdef KTRACE #include #endif @@ -104,7 +106,7 @@ SDT_PROBE_DEFINE2(vfs, namecache, shrink_negative, don */ struct namecache { - LIST_ENTRY(namecache) nc_hash; /* hash chain */ + CK_LIST_ENTRY(namecache) nc_hash;/* hash chain */ LIST_ENTRY(namecache) nc_src; /* source vnode list */ TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ struct vnode *nc_dvp; /* vnode of parent of name */ @@ -143,7 +145,26 @@ struct namecache_ts { #define NCF_DVDROP 0x10 #define NCF_NEGATIVE 0x20 #define NCF_HOTNEGATIVE 0x40 +#define NCF_INVALID 0x80 +static bool +cache_ncp_invalid(struct namecache *ncp) +{ + + atomic_thread_fence_acq(); + return ((ncp->nc_flag & NCF_INVALID) != 0); +} + +static void +cache_ncp_invalidate(struct namecache *ncp) +{ + + atomic_thread_fence_rel(); + KASSERT((ncp->nc_flag & NCF_INVALID) == 0, + ("%s: entry %p already invalid", __func__, ncp)); + ncp->nc_flag |= NCF_INVALID; +} + /* * Name caching works as follows: * @@ -192,12 +213,14 @@ struct namecache_ts { * the first node, locking everything in order and revalidating the state. */ +VFS_SMR_DECLARE; + /* * Structures associated with name caching. */ #define NCHHASH(hash) \ (&nchashtbl[(hash) & nchash]) -static __read_mostly LIST_HEAD(nchashhead, namecache) *nchashtbl;/* Hash Table */ +static __read_mostly CK_LIST_HEAD(nchashhead, namecache) *nchashtbl;/* Hash Table */ static u_long __read_mostly nchash; /* size of hash table */ SYSCTL_ULONG(_debug, OID_AUTO, nchash, CTLFLAG_RD, &nchash, 0, "Size of namecache hash table"); @@ -275,15 +298,15 @@ cache_alloc(int len, int ts) if (__predict_false(ts)) { if (len <= CACHE_PATH_CUTOFF) - ncp_ts = uma_zalloc(cache_zone_small_ts, M_WAITOK); + ncp_ts = uma_zalloc_smr(cache_zone_small_ts, M_WAITOK); else - ncp_ts = uma_zalloc(cache_zone_large_ts, M_WAITOK); + ncp_ts = uma_zalloc_smr(cache_zone_large_ts, M_WAITOK); ncp = &ncp_ts->nc_nc; } else { if (len <= CACHE_PATH_CUTOFF) - ncp = uma_zalloc(cache_zone_small, M_WAITOK); + ncp = uma_zalloc_smr(cache_zone_small, M_WAITOK); else - ncp = uma_zalloc(cache_zone_large, M_WAITOK); + ncp = uma_zalloc_smr(cache_zone_large, M_WAITOK); } return (ncp); } @@ -300,14 +323,14 @@ cache_free(struct namecache *ncp) if (__predict_false(ncp->nc_flag & NCF_TS)) { ncp_ts = __containerof(ncp, struct namecache_ts, nc_nc); if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) - uma_zfree(cache_zone_small_ts, ncp_ts); + uma_zfree_smr(cache_zone_small_ts, ncp_ts); else - uma_zfree(cache_zone_large_ts, ncp_ts); + uma_zfree_smr(cache_zone_large_ts, ncp_ts); } else { if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) - uma_zfree(cache_zone_small, ncp); + uma_zfree_smr(cache_zone_small, ncp); else - uma_zfree(cache_zone_large, ncp); + uma_zfree_smr(cache_zone_large, ncp); } } @@ -606,7 +629,7 @@ retry: } /* Scan hash tables counting entries */ for (ncpp = nchashtbl, i = 0; i < n_nchash; ncpp++, i++) - LIST_FOREACH(ncp, ncpp, nc_hash) + CK_LIST_FOREACH(ncp, ncpp, nc_hash) cntbuf[i]++; cache_unlock_all_buckets(); for (error = 0, i = 0; i < n_nchash; i++) @@ -639,7 +662,7 @@ sysctl_debug_hashstat_nchash(SYSCTL_HANDLER_ARGS) /* Scan hash tables for applicable entries */ for (ncpp = nchashtbl; n_nchash > 0; n_nchash--, ncpp++) { count = 0; - LIST_FOREACH(ncp, ncpp, nc_hash) { + CK_LIST_FOREACH(ncp, ncpp, nc_hash) { count++; } if (count) @@ -860,7 +883,10 @@ cache_zap_locked(struct namecache *ncp, bool neg_locke CTR2(KTR_VFS, "cache_zap(%p) vp %p", ncp, (ncp->nc_flag & NCF_NEGATIVE) ? NULL : ncp->nc_vp); - LIST_REMOVE(ncp, nc_hash); + + cache_ncp_invalidate(ncp); + + CK_LIST_REMOVE(ncp, nc_hash); if (!(ncp->nc_flag & NCF_NEGATIVE)) { SDT_PROBE3(vfs, namecache, zap, done, ncp->nc_dvp, ncp->nc_name, ncp->nc_vp); @@ -1013,7 +1039,7 @@ cache_zap_unlocked_bucket(struct namecache *ncp, struc cache_sort_vnodes(&dvlp, &vlp); cache_lock_vnodes(dvlp, vlp); rw_wlock(blp); - LIST_FOREACH(rncp, (NCHHASH(hash)), nc_hash) { + CK_LIST_FOREACH(rncp, (NCHHASH(hash)), nc_hash) { if (rncp == ncp && rncp->nc_dvp == dvp && rncp->nc_nlen == cnp->cn_namelen && !bcmp(rncp->nc_name, cnp->cn_nameptr, rncp->nc_nlen)) @@ -1225,12 +1251,12 @@ retry_dotdot: hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); blp = HASH2BUCKETLOCK(hash); retry: - if (LIST_EMPTY(NCHHASH(hash))) + if (CK_LIST_EMPTY(NCHHASH(hash))) goto out_no_entry; rw_wlock(blp); - LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { + CK_LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { counter_u64_add(numchecks, 1); if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) @@ -1305,6 +1331,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st uint32_t hash; enum vgetstate vs; int error, ltype; + bool try_smr, doing_smr; #ifdef DEBUG_CACHE if (__predict_false(!doingcache)) { @@ -1321,7 +1348,11 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st if ((cnp->cn_flags & MAKEENTRY) == 0) return (cache_lookup_nomakeentry(dvp, vpp, cnp, tsp, ticksp)); + try_smr = true; + if (cnp->cn_nameiop == CREATE) + try_smr = false; retry: + doing_smr = false; blp = NULL; dvlp = NULL; error = 0; @@ -1361,10 +1392,17 @@ retry: } hash = cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp); - blp = HASH2BUCKETLOCK(hash); - rw_rlock(blp); +retry_hashed: + if (try_smr) { + vfs_smr_enter(); + doing_smr = true; + try_smr = false; + } else { + blp = HASH2BUCKETLOCK(hash); + rw_rlock(blp); + } - LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { + CK_LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { counter_u64_add(numchecks, 1); if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) @@ -1373,7 +1411,10 @@ retry: /* We failed to find an entry */ if (__predict_false(ncp == NULL)) { - rw_runlock(blp); + if (doing_smr) + vfs_smr_exit(); + else + rw_runlock(blp); SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, NULL); counter_u64_add(nummiss, 1); @@ -1402,8 +1443,22 @@ success: ltype = VOP_ISLOCKED(dvp); VOP_UNLOCK(dvp); } - vs = vget_prep(*vpp); - cache_lookup_unlock(blp, dvlp); + if (doing_smr) { + if (cache_ncp_invalid(ncp)) { + vfs_smr_exit(); + *vpp = NULL; + goto retry; + } + vs = vget_prep_smr(*vpp); + vfs_smr_exit(); + if (vs == VGET_NONE) { + *vpp = NULL; + goto retry; + } + } else { + vs = vget_prep(*vpp); + cache_lookup_unlock(blp, dvlp); + } error = vget_finish(*vpp, cnp->cn_lkflags, vs); if (cnp->cn_flags & ISDOTDOT) { vn_lock(dvp, ltype | LK_RETRY); @@ -1427,21 +1482,37 @@ success: negative_success: /* We found a negative match, and want to create it, so purge */ if (cnp->cn_nameiop == CREATE) { + MPASS(!doing_smr); counter_u64_add(numnegzaps, 1); goto zap_and_exit; } + if (doing_smr) { + if ((ncp->nc_flag & NCF_HOTNEGATIVE) == 0) { + /* + * We need to take locks to promote the entry. + */ + vfs_smr_exit(); + doing_smr = false; + goto retry_hashed; + } + } else { + cache_negative_hit(ncp); + } counter_u64_add(numneghits, 1); - cache_negative_hit(ncp); if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); cache_out_ts(ncp, tsp, ticksp); - cache_lookup_unlock(blp, dvlp); + if (doing_smr) + vfs_smr_exit(); + else + cache_lookup_unlock(blp, dvlp); return (ENOENT); zap_and_exit: + MPASS(!doing_smr); if (blp != NULL) error = cache_zap_rlocked_bucket(ncp, cnp, hash, blp); else @@ -1775,7 +1846,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, * the same path name. */ ncpp = NCHHASH(hash); - LIST_FOREACH(n2, ncpp, nc_hash) { + CK_LIST_FOREACH(n2, ncpp, nc_hash) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { @@ -1840,12 +1911,6 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, } /* - * Insert the new namecache entry into the appropriate chain - * within the cache entries table. - */ - LIST_INSERT_HEAD(ncpp, ncp, nc_hash); - - /* * If the entry is "negative", we place it into the * "negative" cache queue, otherwise, we place it into the * destination vnode's cache entries queue. @@ -1861,6 +1926,14 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, SDT_PROBE2(vfs, namecache, enter_negative, done, dvp, ncp->nc_name); } + + atomic_thread_fence_rel(); + /* + * Insert the new namecache entry into the appropriate chain + * within the cache entries table. + */ + CK_LIST_INSERT_HEAD(ncpp, ncp, nc_hash); + cache_enter_unlock(&cel); if (numneg * ncnegfactor > lnumcache) cache_negative_zap_one(); @@ -1908,6 +1981,11 @@ nchinit(void *dummy __unused) NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache_ts), UMA_ZONE_ZINIT); + VFS_SMR_ZONE_SET(cache_zone_small); + VFS_SMR_ZONE_SET(cache_zone_small_ts); + VFS_SMR_ZONE_SET(cache_zone_large); + VFS_SMR_ZONE_SET(cache_zone_large_ts); + ncsize = desiredvnodes * ncsizefactor; nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); ncbuckethash = cache_roundup_2(mp_ncpus * mp_ncpus) - 1; @@ -1973,11 +2051,11 @@ cache_changesize(u_long newmaxvnodes) nchashtbl = new_nchashtbl; nchash = new_nchash; for (i = 0; i <= old_nchash; i++) { - while ((ncp = LIST_FIRST(&old_nchashtbl[i])) != NULL) { + while ((ncp = CK_LIST_FIRST(&old_nchashtbl[i])) != NULL) { hash = cache_get_hash(ncp->nc_name, ncp->nc_nlen, ncp->nc_dvp); - LIST_REMOVE(ncp, nc_hash); - LIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash); + CK_LIST_REMOVE(ncp, nc_hash); + CK_LIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash); } } ncsize = newncsize; @@ -2091,7 +2169,7 @@ cache_purgevfs(struct mount *mp, bool force) for (j = i; j < n_nchash; j += numbucketlocks) { retry: bucket = &nchashtbl[j]; - LIST_FOREACH_SAFE(ncp, bucket, nc_hash, nnp) { + CK_LIST_FOREACH_SAFE(ncp, bucket, nc_hash, nnp) { cache_assert_bucket_locked(ncp, RA_WLOCKED); if (ncp->nc_dvp->v_mount != mp) continue; From owner-svn-src-head@freebsd.org Wed Jul 1 06:43: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 EF1FD364AE9; Wed, 1 Jul 2020 06:43:11 +0000 (UTC) (envelope-from dim@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 49xWrb62fRz417v; Wed, 1 Jul 2020 06:43:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 9A483297F1; Wed, 1 Jul 2020 06:43:11 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [10.10.156.45] (unknown [45.85.81.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 907F73EBF1; Wed, 1 Jul 2020 08:43:09 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_3C88A624-DCD5-40D9-914D-7ED2C75C30C5"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Subject: Re: svn commit: r362681 - in head: contrib/bc contrib/bc/gen contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/src/history contrib/b... Date: Wed, 1 Jul 2020 08:43:01 +0200 In-Reply-To: Cc: src-committers , svn-src-all , svn-src-head To: =?utf-8?Q?Stefan_E=C3=9Fer?= References: <202006271202.05RC22oR085945@repo.freebsd.org> <2b7f0d0f-e243-9c9c-f1c0-e700e0bf6d48@FreeBSD.org> <577b1bd1-598a-d3f9-3c23-537b9747612a@vangyzen.net> <8670f956-1ed4-2b87-ee64-d04bc37d6810@freebsd.org> <54915302-fad6-730c-8ce7-01c70e97fb6a@freebsd.org> <41B27C33-D023-453B-9DED-5776BE059F56@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.14) 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, 01 Jul 2020 06:43:12 -0000 --Apple-Mail=_3C88A624-DCD5-40D9-914D-7ED2C75C30C5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 1 Jul 2020, at 00:03, Stefan E=C3=9Fer wrote: >=20 > Am 30.06.20 um 23:29 schrieb Dimitry Andric: ... >> This is because you are supposed to commit stuff to ^/base/vendor/xxx >> first, then svn cp it to ^/head/contrib/xxx, at least from Subversion >> 1.8 onwards. The 'cp' action establishes the ancestral relation. >=20 > Yes, I thought so - the problem I want to fix is the premature import > to /contrib and I had been hoping that it was possible to use the > --record-only merge to edit the merge history (as suggested by John > Baldwin and Ed Maste). I have never been able to find a way to 'force' the ancestral relation after the fact. Subversion does not seem to expose this as a user-manipulable property. The --record-only option does what it says, i.e. not actually merging but only updating the svn:mergeinfo property, but it will still only work on ancestrally related objects. > I want to upgrade to the next release and I'm wondering whether it > would be possible to just svn copy that new version over from the > vendor directory to the contrib directory. The import to the vendor > area and the contrib directory have very similar commit messages and > thus there would be no loss of commit history. If you don't have many (or no) customizations, then indeed it will be fairly easy. In one commit, you can svn rm the old version, and svn cp the new version from the vendor area. Subversion will later show the directory to have been "Replaced". There are lots of examples of this in the tree, and I would hope the Git converter can handle it, or there will be much more trouble. :) -Dimitry --Apple-Mail=_3C88A624-DCD5-40D9-914D-7ED2C75C30C5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXvwwdQAKCRCwXqMKLiCW oxLDAKDAtnHYXklpnJnWzDsOL1G0M0392ACfUvf+NS6GVg7/qr+O6OotJwIucKI= =nynS -----END PGP SIGNATURE----- --Apple-Mail=_3C88A624-DCD5-40D9-914D-7ED2C75C30C5-- From owner-svn-src-head@freebsd.org Wed Jul 1 07:49: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 08125366090; Wed, 1 Jul 2020 07:49:23 +0000 (UTC) (envelope-from gbe@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 49xYJy6TvBz4498; Wed, 1 Jul 2020 07:49:22 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p548612f6.dip0.t-ipconnect.de [84.134.18.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 6542529B93; Wed, 1 Jul 2020 07:49:22 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Wed, 1 Jul 2020 09:49:20 +0200 From: Gordon Bergling To: rgrimes@freebsd.org Cc: Gordon Bergling , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362809 - head/contrib/mandoc Message-ID: <20200701074920.GB72275@lion.0xfce3.net> References: <202006301808.05UI8xHC098191@repo.freebsd.org> <202006302256.05UMuHZY053765@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202006302256.05UMuHZY053765@gndrsh.dnsmgr.net> X-Url: X-Operating-System: FreeBSD 12.1-STABLE amd64 X-Host-Uptime: 9:32AM up 20:58, 4 users, load averages: 4.72, 4.93, 4.91 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, 01 Jul 2020 07:49:23 -0000 On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: gbe (doc committer) > > Date: Tue Jun 30 18:08:59 2020 > > New Revision: 362809 > > URL: https://svnweb.freebsd.org/changeset/base/362809 > > > > Log: > > Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8). > > > > PR: 223520, 223521 > > Reviewed by: bcr (mentor) > > Approved by: bcr (mentor) > > Differential Revision: https://reviews.freebsd.org/D25521 > > > > Modified: > > head/contrib/mandoc/apropos.1 > > head/contrib/mandoc/makewhatis.8 > > > > Modified: head/contrib/mandoc/apropos.1 > > ============================================================================== > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020 (r362808) > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020 (r362809) > > @@ -15,7 +15,7 @@ > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > .\" > > -.Dd $Mdocdate: November 22 2018 $ > > +.Dd $Mdocdate: June 30 2020 $ > > .Dt APROPOS 1 > > .Os > > .Sh NAME > > @@ -493,6 +493,12 @@ The options > > .Fl acfhIKklOTWw > > appeared in > > .Ox 5.7 . > > +.Pp > > +The > > +.Nm > > +utility was integrated into > > +.Fx 11.1 > > +as part of the switch to mandoc. > > Huh? FreeBSD has had apropos since 1.0 and my 5.4 system clearly has it: > freebsd {110}% uname -a > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 #1: Mon Jul 1 17:58:50 PDT 2019 root@pdx.rh.CN85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE i386 > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos > /usr/bin/apropos > > And a man page for it too: > APROPOS(1) FreeBSD General Commands Manual APROPOS(1) > > NAME > apropos, whatis -- search the whatis database > > SYNOPSIS > apropos keyword ... > whatis keyword ... > > DESCRIPTION > apropos searches a set of database files containing short descriptions of > system commands for keywords and displays the result on the standard out- > put. whatis displays only complete word matches. > > keyword really is an extended regular expression, please read grep(1) > manual page for more information about its format. > > DIAGNOSTICS > The apropos utility exits 0 on success, and 1 if no keyword matched. > > SEE ALSO > grep(1), makewhatis(1), man(1) > > FreeBSD 5.4 January 15, 1991 FreeBSD 5.4 > > > .Sh AUTHORS > > .An -nosplit > > .An Bill Joy > > That is true, but the version of 'apropos' we have currently in base is based on mandoc, which was imported around September 2018. Due to the nature of contributed code I thought it would be best to document only the history when it was integrated into FreeSBD. The same applies for 'makewhatis'. > > Modified: head/contrib/mandoc/makewhatis.8 > > ============================================================================== > > --- head/contrib/mandoc/makewhatis.8 Tue Jun 30 17:21:28 2020 (r362808) > > +++ head/contrib/mandoc/makewhatis.8 Tue Jun 30 18:08:59 2020 (r362809) > > @@ -15,7 +15,7 @@ > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > .\" > > -.Dd $Mdocdate: May 17 2017 $ > > +.Dd $Mdocdate: June 30 2020 $ > > .Dt MAKEWHATIS 8 > > .Os > > .Sh NAME > > @@ -211,6 +211,12 @@ and the options > > .Fl aCDnQT > > in > > .Ox 5.6 . > > +.Pp > > +The > > +.Nm > > +utility was integrated into > > +.Fx 11.1 > > +as part of the switch to mandoc. > > Ditto > > > .Sh AUTHORS > > .An -nosplit > > .An Bill Joy --Gordon From owner-svn-src-head@freebsd.org Wed Jul 1 08:23: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 659CF3670CF; Wed, 1 Jul 2020 08:23:58 +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 49xZ4t24Q2z46KN; Wed, 1 Jul 2020 08:23:58 +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 2BD9526595; Wed, 1 Jul 2020 08:23:58 +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 0618NvQe028771; Wed, 1 Jul 2020 08:23:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0618Nvcu028770; Wed, 1 Jul 2020 08:23:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202007010823.0618Nvcu028770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 1 Jul 2020 08:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362829 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 362829 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 08:23:58 -0000 Author: hselasky Date: Wed Jul 1 08:23:57 2020 New Revision: 362829 URL: https://svnweb.freebsd.org/changeset/base/362829 Log: The "pid" field in the LinuxKPI task struct is typically set to the thread ID and not the process ID. Make sure the linux_task_exiting() function uses tdfind() to lookup the BSD procedure structure pointer by the "pid" field, and only fallback to pfind() when no match is found! This makes linux_task_exiting() in line with the rest of the code. Differential Revision: https://reviews.freebsd.org/D25509 Submitted by: Greg V MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/src/linux_current.c Modified: head/sys/compat/linuxkpi/common/src/linux_current.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul 1 05:59:08 2020 (r362828) +++ head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul 1 08:23:57 2020 (r362829) @@ -219,11 +219,21 @@ linux_get_pid_task(pid_t pid) bool linux_task_exiting(struct task_struct *task) { + struct thread *td; struct proc *p; bool ret; ret = false; - p = pfind(task->pid); + + /* try to find corresponding thread */ + td = tdfind(task->pid, -1); + if (td != NULL) { + p = td->td_proc; + } else { + /* try to find corresponding procedure */ + p = pfind(task->pid); + } + if (p != NULL) { if ((p->p_flag & P_WEXIT) != 0) ret = true; From owner-svn-src-head@freebsd.org Wed Jul 1 08:58: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 20086367F50; Wed, 1 Jul 2020 08:58:10 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49xZrJ66jCz48nT; Wed, 1 Jul 2020 08:58:08 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id 0618vrgC071372 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Jul 2020 18:57:58 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id 0618vlmj024318 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 1 Jul 2020 18:57:47 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id 0618vlpq024317; Wed, 1 Jul 2020 18:57:47 +1000 (AEST) (envelope-from peter) Date: Wed, 1 Jul 2020 18:57:47 +1000 From: Peter Jeremy To: Oleksandr Tymoshenko Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362736 - head/sys/arm64/rockchip Message-ID: <20200701085747.GA23928@server.rulingia.com> References: <202006282111.05SLBAAq025544@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9amGYk9869ThD9tj" Content-Disposition: inline In-Reply-To: <202006282111.05SLBAAq025544@repo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 49xZrJ66jCz48nT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-4.65 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.978]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+mx]; DMARC_NA(0.00)[rulingia.com]; NEURAL_HAM_LONG(-1.01)[-1.010]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.26)[-0.263]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; 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, 01 Jul 2020 08:58:10 -0000 --9amGYk9869ThD9tj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-Jun-28 21:11:10 +0000, Oleksandr Tymoshenko wro= te: >Log: > Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC > =20 > For 1000Mb mode to work reliably TX/RX delays need to be configured > between the TX/RX clock and the respective signals on the PHY > to compensate for differing trace lengths on the PCB. This breaks (at least) diskless booting on my Rock64. During boot, I normally see: regulator: shutting down unused regulators uhub1: 1 port with 1 removable, self powered uhub0: 2 ports with 2 removable, self powered uhub2: 1 port with 1 removable, self powered uhub3: 1 port with 1 removable, self powered dwc0: link state changed to DOWN NFS ROOT: 192.168.12.200:/tank/rock64 dwc0: link state changed to UP Warning: no time-of-day clock registered, system time will not be set accur= ately Warning: no time-of-day clock registered, system time will not be set accur= ately start_init: trying /sbin/init With r362736, I see: setting RK3328 RX/TX delays: 24/36 =2E.. regulator: shutting down unused regulators uhub0: 1 port with 1 removable, self powered uhub3: 2 ports with 2 removable, self powered uhub2: 1 port with 1 removable, self powered uhub1: 1 port with 1 removable, self powered dwc0: link state changed to DOWN NFS ROOT: 192.168.12.200:/tank/rock64 dwc0: link state changed to UP dwc0: link state changed to DOWN dwc0: link state changed to UP [Nothing further until I push the reset button] The system doesn't respond to pings so I suspect the network is dead. Normally, it runs 1000baseT . --=20 Peter Jeremy --9amGYk9869ThD9tj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE2M6l8vfIeOACl4uUHZIUommfjLIFAl78UAVfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEQ4 Q0VBNUYyRjdDODc4RTAwMjk3OEI5NDFEOTIxNEEyNjk5RjhDQjIACgkQHZIUommf jLJfCxAAp42gUhKQr/PQ/BfVuzfbV2xQFi+5D9LBHjqfHkTsqpVUpBZOVXqnrq86 xS9hA8G7cCK4yfOZkez4Ui/8dXHnvq1G+4l5MCIzq+slIecxYghNh0hP2R4M2MZS 00tFeJsJjtdGDIf7VWb9ObzSXJklO10BocWYJX4lId04s3Su9jIO/4zI38EY2Gsw S+LSOhE3NtfauhEr6HrDQqcY1Q5zF4DhIplIy/cyD7RmiHGj0FoU6gemluUTUTxU CWIvyNmzD9GzqJZKwlMe3d6W81uerO0wUT/zyhnobKbc4SnqypjjAduBwnBkMdmj rRYJnLKBxrxFL1ssJ8pApVMgidEs5Aej8g0VI1ZH4TdR5sxPRO6J7ihpJXNzbAzg 5wL3HazxRhseOE+x9OZs/+tes/hLFppTSi0sgAqYrcYAMKMeAKbm8LcFdf2raSqw WUeVI9kIKnCsqUH1JCp8rNVONaAKeAa5ysbbx6AZIJV9K/SSTQ4V7h5OB+WlHD7Y to/Nk1NbFl3viD/TDuxMg9ye/1W+2p3J4SfruU4JO3l7w9f5AVWS7dUV9pyBtHp4 G7/FvCt2BIzdSnYMKs5wB31tVKc7b94AN/1itbFO9scORU+cVOP5pBcpxpoFMEt0 vAGf+sVajoLRYYEj2rwkdgZvXKtiKu4AG9YH99Y/EbkkdCTcFs0= =sO7g -----END PGP SIGNATURE----- --9amGYk9869ThD9tj-- From owner-svn-src-head@freebsd.org Wed Jul 1 09:15: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 2E2D9348A72; Wed, 1 Jul 2020 09:15:39 +0000 (UTC) (envelope-from bz@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 49xbDW0SX5z49kY; Wed, 1 Jul 2020 09:15:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id CC6862A451; Wed, 1 Jul 2020 09:15:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id DECB08D4A164; Wed, 1 Jul 2020 09:15:36 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 5A43DE707B7; Wed, 1 Jul 2020 09:15:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id SZsb-rHruLxT; Wed, 1 Jul 2020 09:15:35 +0000 (UTC) Received: from [192.168.124.1] (unknown [IPv6:fde9:577b:c1a9:4902:70bb:cf29:9220:f82a]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 1C909E707AD; Wed, 1 Jul 2020 09:15:35 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Adrian Chadd" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362815 - head/sys/net80211 Date: Wed, 01 Jul 2020 09:15:34 +0000 X-Mailer: MailMate (2.0BETAr6146) Message-ID: <00AB847F-F2D5-4CC2-B911-648A3D605CF1@FreeBSD.org> In-Reply-To: <202007010023.0610Nn4w031533@repo.freebsd.org> References: <202007010023.0610Nn4w031533@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed 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, 01 Jul 2020 09:15:39 -0000 On 1 Jul 2020, at 0:23, Adrian Chadd wrote: > Author: adrian > Date: Wed Jul 1 00:23:49 2020 > New Revision: 362815 > URL: https://svnweb.freebsd.org/changeset/base/362815 > > Log: > [net80211] Migrate HT/legacy protection mode and preamble > calculation to per-VAP flags can you please put these changes into Phabricator with adequate time to get the reviewed in the future? /bz From owner-svn-src-head@freebsd.org Wed Jul 1 09:21: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 B083F348D8E; Wed, 1 Jul 2020 09:21:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49xbMQ0nssz4BbP; Wed, 1 Jul 2020 09:21:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id 0619LNt9072763 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 1 Jul 2020 12:21:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0619LNt9072763 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id 0619LND1072762; Wed, 1 Jul 2020 12:21:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Jul 2020 12:21:23 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362829 - head/sys/compat/linuxkpi/common/src Message-ID: <20200701092123.GI32126@kib.kiev.ua> References: <202007010823.0618Nvcu028770@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202007010823.0618Nvcu028770@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 49xbMQ0nssz4BbP 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:6939, ipnet:2001:470::/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: Wed, 01 Jul 2020 09:21:38 -0000 On Wed, Jul 01, 2020 at 08:23:57AM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Wed Jul 1 08:23:57 2020 > New Revision: 362829 > URL: https://svnweb.freebsd.org/changeset/base/362829 > > Log: > The "pid" field in the LinuxKPI task struct is typically set to the thread ID > and not the process ID. Make sure the linux_task_exiting() function uses tdfind() > to lookup the BSD procedure structure pointer by the "pid" field, and only > fallback to pfind() when no match is found! This makes linux_task_exiting() > in line with the rest of the code. > > Differential Revision: https://reviews.freebsd.org/D25509 > Submitted by: Greg V > MFC after: 1 week > Sponsored by: Mellanox Technologies > > Modified: > head/sys/compat/linuxkpi/common/src/linux_current.c > > Modified: head/sys/compat/linuxkpi/common/src/linux_current.c > ============================================================================== > --- head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul 1 05:59:08 2020 (r362828) > +++ head/sys/compat/linuxkpi/common/src/linux_current.c Wed Jul 1 08:23:57 2020 (r362829) > @@ -219,11 +219,21 @@ linux_get_pid_task(pid_t pid) > bool > linux_task_exiting(struct task_struct *task) > { > + struct thread *td; > struct proc *p; > bool ret; > > ret = false; > - p = pfind(task->pid); > + > + /* try to find corresponding thread */ > + td = tdfind(task->pid, -1); > + if (td != NULL) { > + p = td->td_proc; > + } else { > + /* try to find corresponding procedure */ > + p = pfind(task->pid); > + } > + > if (p != NULL) { > if ((p->p_flag & P_WEXIT) != 0) > ret = true; It should be expressed as pget(pid, 0); instead of duplicating. From owner-svn-src-head@freebsd.org Wed Jul 1 09:35:54 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 0F210349233; Wed, 1 Jul 2020 09:35:54 +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 49xbgq0rcbz4CHH; Wed, 1 Jul 2020 09:35:50 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 468F6260A6D; Wed, 1 Jul 2020 11:35:43 +0200 (CEST) Subject: Re: svn commit: r362829 - head/sys/compat/linuxkpi/common/src To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202007010823.0618Nvcu028770@repo.freebsd.org> <20200701092123.GI32126@kib.kiev.ua> From: Hans Petter Selasky Message-ID: <6478a8b2-9bfc-a671-4087-c2de92fea239@selasky.org> Date: Wed, 1 Jul 2020 11:35:21 +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: <20200701092123.GI32126@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49xbgq0rcbz4CHH 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.64 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(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.20)[+a:mail.turbocat.net]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.03)[-1.028]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.43)[-0.434]; NEURAL_HAM_MEDIUM(-0.88)[-0.877]; FREEMAIL_TO(0.00)[gmail.com]; 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: Wed, 01 Jul 2020 09:35:54 -0000 On 2020-07-01 11:21, Konstantin Belousov wrote: > It should be expressed as pget(pid, 0); instead of duplicating. Hi, Currently the LinuxKPI style is to use tdfind() and pfind(). If you look at linux_current.c you see multiple uses of the exact same syntax. Quickly looking at the pget() implementation, I see it doesn't expand to exactly tdfind() and pfind(). pget() uses pfind_tid() which looks overkill compared to tdfind(). tdfind() uses a hash-table lookup, while pfind_tid() doesn't .... I'm confused. --HPS From owner-svn-src-head@freebsd.org Wed Jul 1 10:30: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 B284934AEA7; Wed, 1 Jul 2020 10:30:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49xctz4Zj4z4GTV; Wed, 1 Jul 2020 10:30:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id 061AUSQO089540 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 1 Jul 2020 13:30:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 061AUSQO089540 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id 061AUSPm089539; Wed, 1 Jul 2020 13:30:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Jul 2020 13:30:28 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362829 - head/sys/compat/linuxkpi/common/src Message-ID: <20200701103028.GJ32126@kib.kiev.ua> References: <202007010823.0618Nvcu028770@repo.freebsd.org> <20200701092123.GI32126@kib.kiev.ua> <6478a8b2-9bfc-a671-4087-c2de92fea239@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6478a8b2-9bfc-a671-4087-c2de92fea239@selasky.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 49xctz4Zj4z4GTV X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [0.40 / 15.00]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_SPAM_SHORT(0.03)[0.028]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(0.29)[0.294]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.08)[0.079]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] 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, 01 Jul 2020 10:30:36 -0000 On Wed, Jul 01, 2020 at 11:35:21AM +0200, Hans Petter Selasky wrote: > On 2020-07-01 11:21, Konstantin Belousov wrote: > > It should be expressed as pget(pid, 0); instead of duplicating. > > Hi, > > Currently the LinuxKPI style is to use tdfind() and pfind(). If you look at > linux_current.c you see multiple uses of the exact same syntax. > > Quickly looking at the pget() implementation, I see it doesn't expand to > exactly tdfind() and pfind(). pget() uses pfind_tid() which looks overkill > compared to tdfind(). tdfind() uses a hash-table lookup, while pfind_tid() > doesn't .... I'm confused. It is trivial to change pget() to use tdfind(), https://reviews.freebsd.org/D25532 I see no point in repeating the same pfind/tdfind calls, better to convert them to pget(), and have this code in one intended place. the sam From owner-svn-src-head@freebsd.org Wed Jul 1 10:37: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 D3D9F34B211; Wed, 1 Jul 2020 10:37:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49xd2X5HQyz4H9C; Wed, 1 Jul 2020 10:37:08 +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 95E5127AB7; Wed, 1 Jul 2020 10:37:08 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 061Ab8lj010660; Wed, 1 Jul 2020 10:37:08 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061Ab8GI010659; Wed, 1 Jul 2020 10:37:08 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202007011037.061Ab8GI010659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 1 Jul 2020 10:37:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362833 - 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: 362833 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 10:37:08 -0000 Author: trasz Date: Wed Jul 1 10:37:08 2020 New Revision: 362833 URL: https://svnweb.freebsd.org/changeset/base/362833 Log: Rework linux accept(2). This makes the code flow easier to follow, and fixes a bug where calling accept(2) could result in closing fd 0. Note that the code still contains a number of problems: it makes assumptions about l_sockaddr_in being the same as sockaddr_in, the EFAULT-related code looks like it doesn't work at all, and the socket type check is racy. Those will be addressed later on; I'm trying to work in small steps to avoid breaking one thing while fixing another. It fixes Redis, among other things. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25461 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Wed Jul 1 09:35:33 2020 (r362832) +++ head/sys/compat/linux/linux_socket.c Wed Jul 1 10:37:08 2020 (r362833) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -611,17 +612,19 @@ linux_accept_common(struct thread *td, int s, l_uintpt { struct l_sockaddr *lsa; struct sockaddr *sa; - struct file *fp; + struct file *fp, *fp1; int bflags, len; struct socket *so; int error, error1; bflags = 0; + fp = NULL; + sa = NULL; + error = linux_set_socket_flags(flags, &bflags); if (error != 0) return (error); - sa = NULL; if (PTRIN(addr) == NULL) { len = 0; error = kern_accept4(td, s, NULL, NULL, bflags, NULL); @@ -632,48 +635,54 @@ linux_accept_common(struct thread *td, int s, l_uintpt if (len < 0) return (EINVAL); error = kern_accept4(td, s, &sa, &len, bflags, &fp); - if (error == 0) - fdrop(fp, td); } + /* + * Translate errno values into ones used by Linux. + */ if (error != 0) { /* * XXX. This is wrong, different sockaddr structures * have different sizes. */ - if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) - { - error = EINVAL; - goto out; - } - if (error == EINVAL) { - error1 = getsock_cap(td, s, &cap_accept_rights, &fp, NULL, NULL); + switch (error) { + case EFAULT: + if (namelen != sizeof(struct sockaddr_in)) + error = EINVAL; + break; + case EINVAL: + error1 = getsock_cap(td, s, &cap_accept_rights, &fp1, NULL, NULL); if (error1 != 0) { error = error1; - goto out; + break; } - so = fp->f_data; + so = fp1->f_data; if (so->so_type == SOCK_DGRAM) error = EOPNOTSUPP; - fdrop(fp, td); + fdrop(fp1, td); + break; } - goto out; + return (error); } - if (len != 0 && error == 0) { + if (len != 0) { error = bsd_to_linux_sockaddr(sa, &lsa, len); if (error == 0) error = copyout(lsa, PTRIN(addr), len); free(lsa, M_SONAME); - } - free(sa, M_SONAME); + /* + * XXX: We should also copyout the len, shouldn't we? + */ -out: - if (error != 0) { - (void)kern_close(td, td->td_retval[0]); - td->td_retval[0] = 0; + if (error != 0) { + fdclose(td, fp, td->td_retval[0]); + td->td_retval[0] = 0; + } } + if (fp != NULL) + fdrop(fp, td); + free(sa, M_SONAME); return (error); } From owner-svn-src-head@freebsd.org Wed Jul 1 10:56: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 4AA7F34B273; Wed, 1 Jul 2020 10:56:38 +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 49xdT152k1z4J64; Wed, 1 Jul 2020 10:56:37 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 5277B2600F2; Wed, 1 Jul 2020 12:56:34 +0200 (CEST) Subject: Re: svn commit: r362829 - head/sys/compat/linuxkpi/common/src To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202007010823.0618Nvcu028770@repo.freebsd.org> <20200701092123.GI32126@kib.kiev.ua> <6478a8b2-9bfc-a671-4087-c2de92fea239@selasky.org> <20200701103028.GJ32126@kib.kiev.ua> From: Hans Petter Selasky Message-ID: <6563154f-cd07-8468-e4fa-2d23aba4f908@selasky.org> Date: Wed, 1 Jul 2020 12:56:12 +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: <20200701103028.GJ32126@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49xdT152k1z4J64 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.80 / 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]; NEURAL_HAM_LONG(-0.94)[-0.941]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_MEDIUM(-0.88)[-0.877]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.68)[-0.683]; FREEMAIL_TO(0.00)[gmail.com]; 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: Wed, 01 Jul 2020 10:56:38 -0000 On 2020-07-01 12:30, Konstantin Belousov wrote: > I see no point in repeating the same pfind/tdfind calls, better to convert > them to pget(), and have this code in one intended place. I wonder if we can convert all cases in linux_current.c to use pget(). Could you have a look too? --HPS From owner-svn-src-head@freebsd.org Wed Jul 1 12:03: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 A8A8134E335; Wed, 1 Jul 2020 12:03:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49xfyj2n8Vz4N65; Wed, 1 Jul 2020 12:03:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id 061C3nic010329 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 1 Jul 2020 15:03:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 061C3nic010329 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id 061C3nN5010328; Wed, 1 Jul 2020 15:03:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Jul 2020 15:03:49 +0300 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362829 - head/sys/compat/linuxkpi/common/src Message-ID: <20200701120349.GK32126@kib.kiev.ua> References: <202007010823.0618Nvcu028770@repo.freebsd.org> <20200701092123.GI32126@kib.kiev.ua> <6478a8b2-9bfc-a671-4087-c2de92fea239@selasky.org> <20200701103028.GJ32126@kib.kiev.ua> <6563154f-cd07-8468-e4fa-2d23aba4f908@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6563154f-cd07-8468-e4fa-2d23aba4f908@selasky.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 49xfyj2n8Vz4N65 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [0.41 / 15.00]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_SPAM_SHORT(0.04)[0.037]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(0.29)[0.291]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.08)[0.078]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] 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, 01 Jul 2020 12:03:58 -0000 On Wed, Jul 01, 2020 at 12:56:12PM +0200, Hans Petter Selasky wrote: > On 2020-07-01 12:30, Konstantin Belousov wrote: > > I see no point in repeating the same pfind/tdfind calls, better to convert > > them to pget(), and have this code in one intended place. > > I wonder if we can convert all cases in linux_current.c to use pget(). Could > you have a look too? Other uses in linux_current.c are not suitable for pget(). In case linux_pid_task()/linux_get_pid_task() were passed a tid instead of pid, current code returns lkpi_task for the specified thread. In other words, if using pget(), we would need to find the thread after the call, which makes no sense. On the other hand, there are at least two aspects that can be improved. First, the functions are too similar to require separating body. Second, distinction between pid and tid is static and if we are passed pid, it makes no sense to call tdfind() on it. https://reviews.freebsd.org/D25534 From owner-svn-src-head@freebsd.org Wed Jul 1 12:07: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 02EFA34E1C6; Wed, 1 Jul 2020 12:07:29 +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 49xg2m6FxNz4N9j; Wed, 1 Jul 2020 12:07:28 +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 B9FBE8E3B; Wed, 1 Jul 2020 12:07:28 +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 061C7STa066007; Wed, 1 Jul 2020 12:07:28 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061C7SIW066006; Wed, 1 Jul 2020 12:07:28 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202007011207.061C7SIW066006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 1 Jul 2020 12:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362834 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362834 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 12:07:29 -0000 Author: andrew Date: Wed Jul 1 12:07:28 2020 New Revision: 362834 URL: https://svnweb.freebsd.org/changeset/base/362834 Log: Simplify the flow when getting/setting an isrc Rather than unlocking and returning we can just perform the needed action only when the interrupt source is valid and reuse the unlock in both the valid irq and invalid irq cases. Sponsored by: Innovate UK Modified: head/sys/kern/subr_intr.c Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Wed Jul 1 10:37:08 2020 (r362833) +++ head/sys/kern/subr_intr.c Wed Jul 1 12:07:28 2020 (r362834) @@ -1517,13 +1517,12 @@ intr_map_get_isrc(u_int res_id) { struct intr_irqsrc *isrc; + isrc = NULL; mtx_lock(&irq_map_lock); - if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) { - mtx_unlock(&irq_map_lock); - return (NULL); - } - isrc = irq_map[res_id]->isrc; + if (res_id < irq_map_count && irq_map[res_id] != NULL) + isrc = irq_map[res_id]->isrc; mtx_unlock(&irq_map_lock); + return (isrc); } @@ -1532,11 +1531,8 @@ intr_map_set_isrc(u_int res_id, struct intr_irqsrc *is { mtx_lock(&irq_map_lock); - if ((res_id >= irq_map_count) || (irq_map[res_id] == NULL)) { - mtx_unlock(&irq_map_lock); - return; - } - irq_map[res_id]->isrc = isrc; + if (res_id < irq_map_count && irq_map[res_id] != NULL) + irq_map[res_id]->isrc = isrc; mtx_unlock(&irq_map_lock); } From owner-svn-src-head@freebsd.org Wed Jul 1 12:47:54 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 D9A4734F50B; Wed, 1 Jul 2020 12:47:54 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49xgxP5VKCz4QHW; Wed, 1 Jul 2020 12:47:53 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id 061ClhEL072317 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Jul 2020 22:47:49 +1000 (AEST) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id 061ClcLG031814 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 1 Jul 2020 22:47:38 +1000 (AEST) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id 061Clcwk031813; Wed, 1 Jul 2020 22:47:38 +1000 (AEST) (envelope-from peter) Date: Wed, 1 Jul 2020 22:47:38 +1000 From: Peter Jeremy To: Oleksandr Tymoshenko Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362736 - head/sys/arm64/rockchip Message-ID: <20200701124738.GA30133@server.rulingia.com> References: <202006282111.05SLBAAq025544@repo.freebsd.org> <20200701085747.GA23928@server.rulingia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH" Content-Disposition: inline In-Reply-To: <20200701085747.GA23928@server.rulingia.com> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 49xgxP5VKCz4QHW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-4.27 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.98)[-0.978]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+mx]; DMARC_NA(0.00)[rulingia.com]; NEURAL_SPAM_SHORT(0.10)[0.098]; NEURAL_HAM_LONG(-0.99)[-0.991]; RCVD_COUNT_THREE(0.00)[3]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; 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, 01 Jul 2020 12:47:54 -0000 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-Jul-01 18:57:47 +1000, Peter Jeremy wro= te: >On 2020-Jun-28 21:11:10 +0000, Oleksandr Tymoshenko wr= ote: >>Log: >> Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC >> =20 >> For 1000Mb mode to work reliably TX/RX delays need to be configured >> between the TX/RX clock and the respective signals on the PHY >> to compensate for differing trace lengths on the PCB. > >This breaks (at least) diskless booting on my Rock64. I've studied the RK3328 TRM[1] and the RK3328 code following r362736 matches[2] the GRF_MAC_CON0/1 documentation on p201-203 (though p574 says the delay line is configured via GRF_SOC_CON3 - which doesn't match the documentation on GRF_SOC_CON3 on p175-177). That suggests that the delay values in the FDT are incorrect. Unfortunately, the TRM doesn't include any details on how to configure the delay values so it's difficult to adjust the numbers in the FDT. One possible explanation I have is that there are (at least) 2 different Rock64 variants. Later versions have increased the RGMII bus voltage to improve GigE reliability. I initially had problems with GigE reliability and mod'd my Rock64[3] to use the higher RGMII bus voltage - which made it rock solid at GigE. It's possible that different variants need different delay values, due to different track skew or different driver behaviour at different bus voltages. [1] Rockchip_RK3328TRM_V1.1-Part1-20170321.pdf [2] There's one typo: RK3328_GRF_MAC_CON0_TX_MASK instead of RK3328_GRF_MAC_CON0_RX_MASK but the values are the same). [3] Move 1 resistor to change a pull-up to a pull-down --=20 Peter Jeremy --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE2M6l8vfIeOACl4uUHZIUommfjLIFAl78heRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEQ4 Q0VBNUYyRjdDODc4RTAwMjk3OEI5NDFEOTIxNEEyNjk5RjhDQjIACgkQHZIUommf jLKjRg//VBZR1ceAFb5TF8jsqW7bKXRYwQr8ahPj8hCQ3LSYaFjzryb3XsW1HlxH U8RJ9gor+mw3XdNyEuAZ8Sxwm5BxHi97sAPC0ndgeIVBtuTTD2goD5452EP2+5eh 57Gj4TPoQVB7vVFp6lyHC7Om2+Xs81UKjmEAU8/nNVK1uFST9MsOhp9p37cDL9BO gusuUOKXhPdMzvXEOL9ermD5+FmHGioYY7yI7E1R05ZvSCHP94IyfM7SnEaXzWxJ ZfdPqWz16Sqh6iUN4I80Ywjdg9cxegPpqcJ2I+d+QY7o+xHMt3lmXlfqwlFhEPUm liea8BG5NX0UOs/8WohM6QU4gYW4D10C28DtoYT4tUSTyslwSs8jyGWPVBYLex1h JdE0zOzkTqfsS/qfPO7B2rsocoOxJAzaCNpWVcvbHQTdmBrl0pVUMFHG9yDIOdUG N+0c5u5Zdat7vntwCxSIl93T4apoZ0H/bhlZv3dKXBP2py8QOapqSZpg9frS2oqH /Q+1Ix2LwD4tqR1JaLa+Hs9mBkeG0a5mX8WjsN2Hac0EEJ+UbokSa0YRnYtvlcOJ YZPihCeHugjkJ6QMIT7DI09sDkjP4FzA7lM1+uj13dLmmH7noSXFYRxUTtdhfSQq eSvapqplE1/4KmxTWInFY9gtkOZe+Vig7nyDyofI7lS//RPT4uQ= =U/Kh -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH-- From owner-svn-src-head@freebsd.org Wed Jul 1 14:51: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 6C0F03544CA; Wed, 1 Jul 2020 14:51:21 +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 49xkgr6c2rz4bGF; Wed, 1 Jul 2020 14:51:20 +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 061EpIN9056898; Wed, 1 Jul 2020 07:51:18 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 061EpIYF056897; Wed, 1 Jul 2020 07:51:18 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202007011451.061EpIYF056897@gndrsh.dnsmgr.net> Subject: Re: svn commit: r362809 - head/contrib/mandoc In-Reply-To: <20200701074920.GB72275@lion.0xfce3.net> To: Gordon Bergling Date: Wed, 1 Jul 2020 07:51:18 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49xkgr6c2rz4bGF 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: Wed, 01 Jul 2020 14:51:21 -0000 > On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote: > > [ Charset UTF-8 unsupported, converting... ] > > > Author: gbe (doc committer) > > > Date: Tue Jun 30 18:08:59 2020 > > > New Revision: 362809 > > > URL: https://svnweb.freebsd.org/changeset/base/362809 > > > > > > Log: > > > Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8). > > > > > > PR: 223520, 223521 > > > Reviewed by: bcr (mentor) > > > Approved by: bcr (mentor) > > > Differential Revision: https://reviews.freebsd.org/D25521 > > > > > > Modified: > > > head/contrib/mandoc/apropos.1 > > > head/contrib/mandoc/makewhatis.8 > > > > > > Modified: head/contrib/mandoc/apropos.1 > > > ============================================================================== > > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020 (r362808) > > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020 (r362809) > > > @@ -15,7 +15,7 @@ > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > .\" > > > -.Dd $Mdocdate: November 22 2018 $ > > > +.Dd $Mdocdate: June 30 2020 $ > > > .Dt APROPOS 1 > > > .Os > > > .Sh NAME > > > @@ -493,6 +493,12 @@ The options > > > .Fl acfhIKklOTWw > > > appeared in > > > .Ox 5.7 . > > > +.Pp > > > +The > > > +.Nm > > > +utility was integrated into > > > +.Fx 11.1 > > > +as part of the switch to mandoc. > > > > Huh? FreeBSD has had apropos since 1.0 and my 5.4 system clearly has it: > > freebsd {110}% uname -a > > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 #1: Mon Jul 1 17:58:50 PDT 2019 root@pdx.rh.CN85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE i386 > > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos > > /usr/bin/apropos > > > > And a man page for it too: > > APROPOS(1) FreeBSD General Commands Manual APROPOS(1) > > > > NAME > > apropos, whatis -- search the whatis database > > > > SYNOPSIS > > apropos keyword ... > > whatis keyword ... > > > > DESCRIPTION > > apropos searches a set of database files containing short descriptions of > > system commands for keywords and displays the result on the standard out- > > put. whatis displays only complete word matches. > > > > keyword really is an extended regular expression, please read grep(1) > > manual page for more information about its format. > > > > DIAGNOSTICS > > The apropos utility exits 0 on success, and 1 if no keyword matched. > > > > SEE ALSO > > grep(1), makewhatis(1), man(1) > > > > FreeBSD 5.4 January 15, 1991 FreeBSD 5.4 > > > > > .Sh AUTHORS > > > .An -nosplit > > > .An Bill Joy > > > > > That is true, but the version of 'apropos' we have currently in base is based on mandoc, > which was imported around September 2018. Due to the nature of contributed code I > thought it would be best to document only the history when it was integrated into > FreeSBD. The same applies for 'makewhatis'. That is not what has been done in other places when code is changed/replaced, the HISTORY section is not specific to "FreeBSD's version" of this function. We often have "An ls command appeared in Version 1 AT&T UNIX." Our source code and man page is not from that, but that is the history of ls. This *could* be amended and *should* be amended to reflect that apropos, and makewhatis got *updated* by a switch to the mandoc versions, but it is misleading to say it was intergrated with the switch to mandoc as that implies it did not exist before this action. > > > > Modified: head/contrib/mandoc/makewhatis.8 > > > ============================================================================== > > > --- head/contrib/mandoc/makewhatis.8 Tue Jun 30 17:21:28 2020 (r362808) > > > +++ head/contrib/mandoc/makewhatis.8 Tue Jun 30 18:08:59 2020 (r362809) > > > @@ -15,7 +15,7 @@ > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > .\" > > > -.Dd $Mdocdate: May 17 2017 $ > > > +.Dd $Mdocdate: June 30 2020 $ > > > .Dt MAKEWHATIS 8 > > > .Os > > > .Sh NAME > > > @@ -211,6 +211,12 @@ and the options > > > .Fl aCDnQT > > > in > > > .Ox 5.6 . > > > +.Pp > > > +The > > > +.Nm > > > +utility was integrated into > > > +.Fx 11.1 > > > +as part of the switch to mandoc. > > > > Ditto > > > > > .Sh AUTHORS > > > .An -nosplit > > > .An Bill Joy > > --Gordon > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Jul 1 15:17: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 EB97D354F09; Wed, 1 Jul 2020 15:17:46 +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 49xlGL5tzPz4cpW; Wed, 1 Jul 2020 15:17:46 +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 A8DC3B70E; Wed, 1 Jul 2020 15:17:46 +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 061FHk0X084139; Wed, 1 Jul 2020 15:17:46 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061FHk9B084136; Wed, 1 Jul 2020 15:17:46 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202007011517.061FHk9B084136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 1 Jul 2020 15:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362837 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 362837 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 15:17:47 -0000 Author: andrew Date: Wed Jul 1 15:17:45 2020 New Revision: 362837 URL: https://svnweb.freebsd.org/changeset/base/362837 Log: Read the arm64 ID registers earlier in the boot process. Also move parsing the registers to just after the secondary CPUs have started. This means the kernel register view from all CPUs is available after the CPU SYSINITs have finished, e.g. for use by ifunc resolvers. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D25505 Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/arm64/mp_machdep.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Wed Jul 1 15:02:56 2020 (r362836) +++ head/sys/arm64/arm64/identcpu.c Wed Jul 1 15:17:45 2020 (r362837) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -static int ident_lock; static void print_cpu_features(u_int cpu); static u_long parse_cpu_features_hwcap(u_int cpu); @@ -67,6 +66,8 @@ static int allow_idc = 1; SYSCTL_INT(_machdep_cache, OID_AUTO, allow_idc, CTLFLAG_RDTUN, &allow_idc, 0, "Allow optimizations based on the IDC cache bit"); +static void check_cpu_regs(u_int cpu); + /* * The default implementation of I-cache sync assumes we have an * aliasing cache until we know otherwise. @@ -1063,8 +1064,9 @@ identify_cpu_sysinit(void *dummy __unused) dic = (allow_dic != 0); idc = (allow_idc != 0); + CPU_FOREACH(cpu) { - print_cpu_features(cpu); + check_cpu_regs(cpu); hwcap = parse_cpu_features_hwcap(cpu); if (elf_hwcap == 0) elf_hwcap = hwcap; @@ -1096,8 +1098,18 @@ identify_cpu_sysinit(void *dummy __unused) install_undef_handler(true, user_mrs_handler); } -SYSINIT(identify_cpu, SI_SUB_SMP, SI_ORDER_ANY, identify_cpu_sysinit, NULL); +SYSINIT(identify_cpu, SI_SUB_CPU, SI_ORDER_ANY, identify_cpu_sysinit, NULL); +static void +cpu_features_sysinit(void *dummy __unused) +{ + u_int cpu; + + CPU_FOREACH(cpu) + print_cpu_features(cpu); +} +SYSINIT(cpu_features, SI_SUB_SMP, SI_ORDER_ANY, cpu_features_sysinit, NULL); + static u_long parse_cpu_features_hwcap(u_int cpu) { @@ -1468,7 +1480,8 @@ identify_cpu(void) if (impl_id == cpu_implementers[i].impl_id || cpu_implementers[i].impl_id == 0) { cpu_desc[cpu].cpu_impl = impl_id; - cpu_desc[cpu].cpu_impl_name = cpu_implementers[i].impl_name; + cpu_desc[cpu].cpu_impl_name = + cpu_implementers[i].impl_name; cpu_partsp = cpu_implementers[i].cpu_parts; break; } @@ -1505,77 +1518,68 @@ identify_cpu(void) cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1); cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1); cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1); +} - if (cpu != 0) { - /* - * This code must run on one cpu at a time, but we are - * not scheduling on the current core so implement a - * simple spinlock. - */ - while (atomic_cmpset_acq_int(&ident_lock, 0, 1) == 0) - __asm __volatile("wfe" ::: "memory"); +static void +check_cpu_regs(u_int cpu) +{ - switch (cpu_aff_levels) { - case 0: - if (CPU_AFF0(cpu_desc[cpu].mpidr) != - CPU_AFF0(cpu_desc[0].mpidr)) - cpu_aff_levels = 1; - /* FALLTHROUGH */ - case 1: - if (CPU_AFF1(cpu_desc[cpu].mpidr) != - CPU_AFF1(cpu_desc[0].mpidr)) - cpu_aff_levels = 2; - /* FALLTHROUGH */ - case 2: - if (CPU_AFF2(cpu_desc[cpu].mpidr) != - CPU_AFF2(cpu_desc[0].mpidr)) - cpu_aff_levels = 3; - /* FALLTHROUGH */ - case 3: - if (CPU_AFF3(cpu_desc[cpu].mpidr) != - CPU_AFF3(cpu_desc[0].mpidr)) - cpu_aff_levels = 4; - break; - } + switch (cpu_aff_levels) { + case 0: + if (CPU_AFF0(cpu_desc[cpu].mpidr) != + CPU_AFF0(cpu_desc[0].mpidr)) + cpu_aff_levels = 1; + /* FALLTHROUGH */ + case 1: + if (CPU_AFF1(cpu_desc[cpu].mpidr) != + CPU_AFF1(cpu_desc[0].mpidr)) + cpu_aff_levels = 2; + /* FALLTHROUGH */ + case 2: + if (CPU_AFF2(cpu_desc[cpu].mpidr) != + CPU_AFF2(cpu_desc[0].mpidr)) + cpu_aff_levels = 3; + /* FALLTHROUGH */ + case 3: + if (CPU_AFF3(cpu_desc[cpu].mpidr) != + CPU_AFF3(cpu_desc[0].mpidr)) + cpu_aff_levels = 4; + break; + } - if (cpu_desc[cpu].id_aa64afr0 != cpu_desc[0].id_aa64afr0) - cpu_print_regs |= PRINT_ID_AA64_AFR0; - if (cpu_desc[cpu].id_aa64afr1 != cpu_desc[0].id_aa64afr1) - cpu_print_regs |= PRINT_ID_AA64_AFR1; + if (cpu_desc[cpu].id_aa64afr0 != cpu_desc[0].id_aa64afr0) + cpu_print_regs |= PRINT_ID_AA64_AFR0; + if (cpu_desc[cpu].id_aa64afr1 != cpu_desc[0].id_aa64afr1) + cpu_print_regs |= PRINT_ID_AA64_AFR1; - if (cpu_desc[cpu].id_aa64dfr0 != cpu_desc[0].id_aa64dfr0) - cpu_print_regs |= PRINT_ID_AA64_DFR0; - if (cpu_desc[cpu].id_aa64dfr1 != cpu_desc[0].id_aa64dfr1) - cpu_print_regs |= PRINT_ID_AA64_DFR1; + if (cpu_desc[cpu].id_aa64dfr0 != cpu_desc[0].id_aa64dfr0) + cpu_print_regs |= PRINT_ID_AA64_DFR0; + if (cpu_desc[cpu].id_aa64dfr1 != cpu_desc[0].id_aa64dfr1) + cpu_print_regs |= PRINT_ID_AA64_DFR1; - if (cpu_desc[cpu].id_aa64isar0 != cpu_desc[0].id_aa64isar0) - cpu_print_regs |= PRINT_ID_AA64_ISAR0; - if (cpu_desc[cpu].id_aa64isar1 != cpu_desc[0].id_aa64isar1) - cpu_print_regs |= PRINT_ID_AA64_ISAR1; + if (cpu_desc[cpu].id_aa64isar0 != cpu_desc[0].id_aa64isar0) + cpu_print_regs |= PRINT_ID_AA64_ISAR0; + if (cpu_desc[cpu].id_aa64isar1 != cpu_desc[0].id_aa64isar1) + cpu_print_regs |= PRINT_ID_AA64_ISAR1; - if (cpu_desc[cpu].id_aa64mmfr0 != cpu_desc[0].id_aa64mmfr0) - cpu_print_regs |= PRINT_ID_AA64_MMFR0; - if (cpu_desc[cpu].id_aa64mmfr1 != cpu_desc[0].id_aa64mmfr1) - cpu_print_regs |= PRINT_ID_AA64_MMFR1; - if (cpu_desc[cpu].id_aa64mmfr2 != cpu_desc[0].id_aa64mmfr2) - cpu_print_regs |= PRINT_ID_AA64_MMFR2; + if (cpu_desc[cpu].id_aa64mmfr0 != cpu_desc[0].id_aa64mmfr0) + cpu_print_regs |= PRINT_ID_AA64_MMFR0; + if (cpu_desc[cpu].id_aa64mmfr1 != cpu_desc[0].id_aa64mmfr1) + cpu_print_regs |= PRINT_ID_AA64_MMFR1; + if (cpu_desc[cpu].id_aa64mmfr2 != cpu_desc[0].id_aa64mmfr2) + cpu_print_regs |= PRINT_ID_AA64_MMFR2; - if (cpu_desc[cpu].id_aa64pfr0 != cpu_desc[0].id_aa64pfr0) - cpu_print_regs |= PRINT_ID_AA64_PFR0; - if (cpu_desc[cpu].id_aa64pfr1 != cpu_desc[0].id_aa64pfr1) - cpu_print_regs |= PRINT_ID_AA64_PFR1; + if (cpu_desc[cpu].id_aa64pfr0 != cpu_desc[0].id_aa64pfr0) + cpu_print_regs |= PRINT_ID_AA64_PFR0; + if (cpu_desc[cpu].id_aa64pfr1 != cpu_desc[0].id_aa64pfr1) + cpu_print_regs |= PRINT_ID_AA64_PFR1; - if (cpu_desc[cpu].ctr != cpu_desc[0].ctr) { - /* - * If the cache type register is different we may - * have a different l1 cache type. - */ - identify_cache(cpu_desc[cpu].ctr); - cpu_print_regs |= PRINT_CTR_EL0; - } - - /* Wake up the other CPUs */ - atomic_store_rel_int(&ident_lock, 0); - __asm __volatile("sev" ::: "memory"); + if (cpu_desc[cpu].ctr != cpu_desc[0].ctr) { + /* + * If the cache type register is different we may + * have a different l1 cache type. + */ + identify_cache(cpu_desc[cpu].ctr); + cpu_print_regs |= PRINT_CTR_EL0; } } Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Wed Jul 1 15:02:56 2020 (r362836) +++ head/sys/arm64/arm64/mp_machdep.c Wed Jul 1 15:17:45 2020 (r362837) @@ -212,6 +212,19 @@ init_secondary(uint64_t cpu) "mov x18, %0 \n" "msr tpidr_el1, %0" :: "r"(pcpup)); + /* + * Identify current CPU. This is necessary to setup + * affinity registers and to provide support for + * runtime chip identification. + * + * We need this before signalling the CPU is ready to + * let the boot CPU use the results. + */ + identify_cpu(); + + /* Ensure the stores in identify_cpu have completed */ + atomic_thread_fence_acq_rel(); + /* Signal the BSP and spin until it has released all APs. */ atomic_add_int(&aps_started, 1); while (!atomic_load_int(&aps_ready)) @@ -227,12 +240,6 @@ init_secondary(uint64_t cpu) ("pmap0 doesn't match cpu %ld's ttbr0", cpu)); pcpup->pc_curpmap = pmap0; - /* - * Identify current CPU. This is necessary to setup - * affinity registers and to provide support for - * runtime chip identification. - */ - identify_cpu(); install_cpu_errata(); intr_pic_init_secondary(); From owner-svn-src-head@freebsd.org Wed Jul 1 15:30: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 50CC9355292; Wed, 1 Jul 2020 15:30:28 +0000 (UTC) (envelope-from bofh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49xlY01VbGz4dbY; Wed, 1 Jul 2020 15:30:28 +0000 (UTC) (envelope-from bofh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17A62B986; Wed, 1 Jul 2020 15:30:28 +0000 (UTC) (envelope-from bofh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 061FURia090553; Wed, 1 Jul 2020 15:30:27 GMT (envelope-from bofh@FreeBSD.org) Received: (from bofh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061FURT5090552; Wed, 1 Jul 2020 15:30:27 GMT (envelope-from bofh@FreeBSD.org) Message-Id: <202007011530.061FURT5090552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bofh set sender to bofh@FreeBSD.org using -f From: Muhammad Moinur Rahman Date: Wed, 1 Jul 2020 15:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362839 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: bofh X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 362839 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 15:30:28 -0000 Author: bofh (ports committer) Date: Wed Jul 1 15:30:27 2020 New Revision: 362839 URL: https://svnweb.freebsd.org/changeset/base/362839 Log: Update with the members of the 11th core team, core.xi - Update the core-secretary role. - Update the comment to mention that the sorting is done based on FreeBSD login name Reported by: bofh (with core-secretary@ hat on) Reviewed by: bcr Approved by: bcr Differential Revision: https://reviews.freebsd.org/D25526 Modified: head/share/misc/organization.dot Modified: head/share/misc/organization.dot ============================================================================== --- head/share/misc/organization.dot Wed Jul 1 15:27:34 2020 (r362838) +++ head/share/misc/organization.dot Wed Jul 1 15:30:27 2020 (r362839) @@ -23,10 +23,10 @@ _devel [label="FreeBSD Developers"] _admin [label="FreeBSD Infrastructure Administrators"] _misc [label="Miscellaneous Hats"] -# Development teams go here alphabetically sorted +# Development teams go here alphabetically sorted by FreeBSD login name -core [label="Core Team\ncore@FreeBSD.org\nallanjude, bcr, brooks,\nimp, hrs, jeff,\njhb, kmoore, seanc"] -coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\njrm"] +core [label="Core Team\ncore@FreeBSD.org\nbapt, emaste, gnn,\nimp, hrs, kevans,\nmarkj, scottl, seanc"] +coresecretary [label="Core Team Secretary\ncore-secretary@FreeBSD.org\nbofh"] doccommitters [label="Doc/www Committers\ndoc-committers@FreeBSD.org"] doceng [label="Documentation Engineering Team\ndoceng@FreeBSD.org\nbcr, gabor, gjb, hrs,\nblackend, ryusuke, wblock"] portscommitters [label="Ports Committers\nports-committers@FreeBSD.org"] From owner-svn-src-head@freebsd.org Wed Jul 1 15:42: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 641ED35567F; Wed, 1 Jul 2020 15:42:49 +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 49xlqF1xm2z4g1B; Wed, 1 Jul 2020 15:42:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2759BBC61; Wed, 1 Jul 2020 15:42:49 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 061FgnYR002927; Wed, 1 Jul 2020 15:42:49 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061FgnbC002926; Wed, 1 Jul 2020 15:42:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202007011542.061FgnbC002926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 1 Jul 2020 15:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362840 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 362840 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 15:42:49 -0000 Author: markj Date: Wed Jul 1 15:42:48 2020 New Revision: 362840 URL: https://svnweb.freebsd.org/changeset/base/362840 Log: Fix a possible next-hop refcount leak when handling IPSec traffic. It may be possible to fix this by deferring the lookup, but let's keep the initial change simple to make MFCs easier. PR: 246951 Reviewed by: melifaro MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25519 Modified: head/sys/netinet/ip_input.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Wed Jul 1 15:30:27 2020 (r362839) +++ head/sys/netinet/ip_input.c Wed Jul 1 15:42:48 2020 (r362840) @@ -1028,6 +1028,7 @@ ip_forward(struct mbuf *m, int srcrt) if (IPSEC_ENABLED(ipv4)) { if ((error = IPSEC_FORWARD(ipv4, m)) != 0) { /* mbuf consumed by IPsec */ + RO_NHFREE(&ro); m_freem(mcopy); if (error != EINPROGRESS) IPSTAT_INC(ips_cantforward); From owner-svn-src-head@freebsd.org Wed Jul 1 16:17: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 6D48C3564A5; Wed, 1 Jul 2020 16:17:52 +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 49xmbh2FnQz4j2w; Wed, 1 Jul 2020 16:17:52 +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 30CE0BD74; Wed, 1 Jul 2020 16:17:52 +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 061GHqj6021586; Wed, 1 Jul 2020 16:17:52 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061GHpi7021585; Wed, 1 Jul 2020 16:17:51 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202007011617.061GHpi7021585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 1 Jul 2020 16:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362841 - 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: 362841 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 16:17:52 -0000 Author: andrew Date: Wed Jul 1 16:17:51 2020 New Revision: 362841 URL: https://svnweb.freebsd.org/changeset/base/362841 Log: Move ID reading signatures to a better header The functions to read the common user and kernel ID registers should be in cpu.h rather than undefined.h as they are related to CPU details and used by undefined instruction handlers. Sponsored by: Innovate UK Modified: head/sys/arm64/include/cpu.h head/sys/arm64/include/undefined.h Modified: head/sys/arm64/include/cpu.h ============================================================================== --- head/sys/arm64/include/cpu.h Wed Jul 1 15:42:48 2020 (r362840) +++ head/sys/arm64/include/cpu.h Wed Jul 1 16:17:51 2020 (r362841) @@ -171,6 +171,10 @@ void identify_cpu(void); void install_cpu_errata(void); void swi_vm(void *v); +/* Functions to read the sanitised view of the special registers */ +bool extract_user_id_field(u_int, u_int, uint8_t *); +bool get_kernel_reg(u_int, uint64_t *); + #define CPU_AFFINITY(cpu) __cpu_affinity[(cpu)] #define CPU_CURRENT_SOCKET \ (CPU_AFF2(CPU_AFFINITY(PCPU_GET(cpuid)))) Modified: head/sys/arm64/include/undefined.h ============================================================================== --- head/sys/arm64/include/undefined.h Wed Jul 1 15:42:48 2020 (r362840) +++ head/sys/arm64/include/undefined.h Wed Jul 1 16:17:51 2020 (r362841) @@ -63,10 +63,6 @@ void *install_undef_handler(bool, undef_handler_t); void remove_undef_handler(void *); int undef_insn(u_int, struct trapframe *); -/* Functions to read the sanitised view of the special registers */ -bool extract_user_id_field(u_int, u_int, uint8_t *); -bool get_kernel_reg(u_int, uint64_t *); - #endif /* _KERNEL */ #endif From owner-svn-src-head@freebsd.org Wed Jul 1 16:33: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 B376F356D68; Wed, 1 Jul 2020 16:33:33 +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 49xmxn4GsQz4kPc; Wed, 1 Jul 2020 16:33:33 +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 5EF97C249; Wed, 1 Jul 2020 16:33:33 +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 061GXXB2033919; Wed, 1 Jul 2020 16:33:33 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061GXX8n033918; Wed, 1 Jul 2020 16:33:33 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202007011633.061GXX8n033918@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: Wed, 1 Jul 2020 16:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362843 - head/usr.bin/printf X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/printf X-SVN-Commit-Revision: 362843 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 16:33:33 -0000 Author: fernape (ports committer) Date: Wed Jul 1 16:33:32 2020 New Revision: 362843 URL: https://svnweb.freebsd.org/changeset/base/362843 Log: printf(1): Add EXAMPLES section * Small addition with four simple examples * While here, remove three obsolete .Tn macros Approved by: manpages (gbe) Differential Revision: https://reviews.freebsd.org/D25462 Modified: head/usr.bin/printf/printf.1 Modified: head/usr.bin/printf/printf.1 ============================================================================== --- head/usr.bin/printf/printf.1 Wed Jul 1 16:18:35 2020 (r362842) +++ head/usr.bin/printf/printf.1 Wed Jul 1 16:33:32 2020 (r362843) @@ -31,7 +31,7 @@ .\" @(#)printf.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd July 29, 2019 +.Dd July 1, 2020 .Dt PRINTF 1 .Os .Sh NAME @@ -316,12 +316,48 @@ Consult the manual page. .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Print the string +.Qq hello : +.Bd -literal -offset indent +$ printf "%s\en" hello +hello +.Ed +.Pp +Same as above, but notice that the format string is not quoted and hence we +do not get the expected behavior: +.Bd -literal -offset indent +$ printf %s\en hello +hellon$ +.Ed +.Pp +Print arguments forcing sign only for the first argument: +.Bd -literal -offset indent +$ printf "%+d\en%d\en%d\en" 1 -2 13 ++1 +-2 +13 +.Ed +.Pp +Same as above, but the single format string will be applied to the three +arguments: +.Bd -literal -offset indent +$ printf "%+d\en" 1 -2 13 ++1 +-2 ++13 +.Ed +.Pp +Print number using only two digits after the decimal point: +.Bd -literal -offset indent +$ printf "%.2f\en" 31.7456 +31.75 +.Ed .Sh COMPATIBILITY The traditional .Bx behavior of converting arguments of numeric formats not beginning -with a digit to the -.Tn ASCII +with a digit to the ASCII code of the first character is not supported. .Sh SEE ALSO .Xr builtin 1 , @@ -343,8 +379,7 @@ It is modeled after the standard library function, .Xr printf 3 . .Sh CAVEATS -.Tn ANSI -hexadecimal character constants were deliberately not provided. +ANSI hexadecimal character constants were deliberately not provided. .Pp Trying to print a dash ("-") as the first character causes .Nm @@ -364,10 +399,8 @@ and formats with a precision may not operate as expected. .Sh BUGS -Since the floating point numbers are translated from -.Tn ASCII -to floating-point and -then back again, floating-point precision may be lost. +Since the floating point numbers are translated from ASCII +to floating-point and then back again, floating-point precision may be lost. (By default, the number is translated to an IEEE-754 double-precision value before being printed. The From owner-svn-src-head@freebsd.org Wed Jul 1 16:57: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 AB4E53574CF; Wed, 1 Jul 2020 16:57:58 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49xnTy47gtz4lqt; Wed, 1 Jul 2020 16:57:58 +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 72B48C6CD; Wed, 1 Jul 2020 16:57:58 +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 061GvwDK046276; Wed, 1 Jul 2020 16:57:58 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061Gvv9V046272; Wed, 1 Jul 2020 16:57:57 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202007011657.061Gvv9V046272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 1 Jul 2020 16:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362845 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 362845 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 16:57:58 -0000 Author: andrew Date: Wed Jul 1 16:57:57 2020 New Revision: 362845 URL: https://svnweb.freebsd.org/changeset/base/362845 Log: Read the CPU 0 arm64 ID registers early in initarm We also update the kernel view early in the boot. This will allow the use of the common kernel view in ifunc resolvers. Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/identcpu.c head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/cpu.h Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Wed Jul 1 16:37:08 2020 (r362844) +++ head/sys/arm64/arm64/identcpu.c Wed Jul 1 16:57:57 2020 (r362845) @@ -992,7 +992,7 @@ update_lower_register(uint64_t val, uint64_t new_val, return (val); } -static void +void update_special_regs(u_int cpu) { struct mrs_field *fields; @@ -1072,7 +1072,8 @@ identify_cpu_sysinit(void *dummy __unused) elf_hwcap = hwcap; else elf_hwcap &= hwcap; - update_special_regs(cpu); + if (cpu != 0) + update_special_regs(cpu); if (CTR_DIC_VAL(cpu_desc[cpu].ctr) == 0) dic = false; @@ -1457,23 +1458,15 @@ identify_cache(uint64_t ctr) } void -identify_cpu(void) +identify_cpu(u_int cpu) { u_int midr; u_int impl_id; u_int part_id; - u_int cpu; size_t i; const struct cpu_parts *cpu_partsp = NULL; - cpu = PCPU_GET(cpuid); midr = get_midr(); - - /* - * Store midr to pcpu to allow fast reading - * from EL0, EL1 and assembly code. - */ - PCPU_SET(midr, midr); impl_id = CPU_IMPL(midr); for (i = 0; i < nitems(cpu_implementers); i++) { Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Wed Jul 1 16:37:08 2020 (r362844) +++ head/sys/arm64/arm64/machdep.c Wed Jul 1 16:57:57 2020 (r362845) @@ -172,7 +172,6 @@ cpu_startup(void *dummy) { undef_init(); - identify_cpu(); install_cpu_errata(); vm_ksubmap_init(&kmi); @@ -1138,6 +1137,9 @@ initarm(struct arm64_bootparams *abp) if (kmdp == NULL) kmdp = preload_search_by_type("elf64 kernel"); + identify_cpu(0); + update_special_regs(0); + link_elf_ireloc(kmdp); try_load_dtb(kmdp); @@ -1181,6 +1183,7 @@ initarm(struct arm64_bootparams *abp) "msr tpidr_el1, %0" :: "r"(pcpup)); PCPU_SET(curthread, &thread0); + PCPU_SET(midr, get_midr()); /* Do basic tuning, hz etc */ init_param1(); Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Wed Jul 1 16:37:08 2020 (r362844) +++ head/sys/arm64/arm64/mp_machdep.c Wed Jul 1 16:57:57 2020 (r362845) @@ -220,7 +220,7 @@ init_secondary(uint64_t cpu) * We need this before signalling the CPU is ready to * let the boot CPU use the results. */ - identify_cpu(); + identify_cpu(cpu); /* Ensure the stores in identify_cpu have completed */ atomic_thread_fence_acq_rel(); @@ -229,6 +229,8 @@ init_secondary(uint64_t cpu) atomic_add_int(&aps_started, 1); while (!atomic_load_int(&aps_ready)) __asm __volatile("wfe"); + + pcpup->pc_midr = get_midr(); /* Initialize curthread */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); Modified: head/sys/arm64/include/cpu.h ============================================================================== --- head/sys/arm64/include/cpu.h Wed Jul 1 16:37:08 2020 (r362844) +++ head/sys/arm64/include/cpu.h Wed Jul 1 16:57:57 2020 (r362845) @@ -167,11 +167,12 @@ void cpu_halt(void) __dead2; void cpu_reset(void) __dead2; void fork_trampoline(void); void identify_cache(uint64_t); -void identify_cpu(void); +void identify_cpu(u_int); void install_cpu_errata(void); void swi_vm(void *v); /* Functions to read the sanitised view of the special registers */ +void update_special_regs(u_int); bool extract_user_id_field(u_int, u_int, uint8_t *); bool get_kernel_reg(u_int, uint64_t *); From owner-svn-src-head@freebsd.org Wed Jul 1 17:17: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 E726B357E0E; Wed, 1 Jul 2020 17:17:06 +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 49xnw25f8cz4mYC; Wed, 1 Jul 2020 17:17:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5146CBB5; Wed, 1 Jul 2020 17:17:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 061HH6DK058859; Wed, 1 Jul 2020 17:17:06 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061HH663058858; Wed, 1 Jul 2020 17:17:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202007011717.061HH663058858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 1 Jul 2020 17:17:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362846 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 362846 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 17:17:07 -0000 Author: tuexen Date: Wed Jul 1 17:17:06 2020 New Revision: 362846 URL: https://svnweb.freebsd.org/changeset/base/362846 Log: Fix the cleanup handling in a error path for TCP BBR. Reported by: syzbot+df7899c55c4cc52f5447@syzkaller.appspotmail.com Reviewed by: rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D25486 Modified: head/sys/netinet/tcp_stacks/bbr.c Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Wed Jul 1 16:57:57 2020 (r362845) +++ head/sys/netinet/tcp_stacks/bbr.c Wed Jul 1 17:17:06 2020 (r362846) @@ -13381,6 +13381,8 @@ send: */ BBR_STAT_INC(bbr_offset_drop); tcp_set_inp_to_drop(inp, EFAULT); + SOCKBUF_UNLOCK(sb); + (void)m_free(m); return (0); } len = rsm->r_end - rsm->r_start; From owner-svn-src-head@freebsd.org Wed Jul 1 17:58: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 2F75F358984 for ; Wed, 1 Jul 2020 17:58:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (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 49xpqY3CG9z4q2P for ; Wed, 1 Jul 2020 17:58:17 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x742.google.com with SMTP id k18so23032274qke.4 for ; Wed, 01 Jul 2020 10:58:17 -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=zK2mp7as19TY0bM7dKiFssSoEEzdDZT2O09pawz+Kw4=; b=2TUVY0z/sBPwlxDAFcFx3caHaYP+vzBP0RaSwDH9VaOB+2XPFE8IzdQjMzOhsmtWn/ 1VAeOP/d3VnVlHWKzikd93sYgJ7Rnk4xNQ9Kjs8ki9doL5Yz4+mE7vB9sBHvPAIp0/bd EA6sR3JjTdor1P/XbR9jXoeIrFojxhV9pf6C006Zn2MrAlA9lfPZ+XglLmxVgz68HrAR o1WHH7Kkl0ni8rObjz0VX1Soe+csUKAqtkY48g/XPeaq3TaeGL/lM0JuwRgLJ/2KpG/f OGtd9PTq5rOrQWza6mZ+bFctuw2/J0DOwlzTIaMtRo5QGqs1Rrs6SVV4nYQDXofZnnkI /EuA== 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=zK2mp7as19TY0bM7dKiFssSoEEzdDZT2O09pawz+Kw4=; b=Nbt068aC7dErvMaUO6/gtSS9X5FbQKP4StdGBJUBpcsaT47OUv8PBQQdsnge6Deeu/ KnYCZyJ/HLPEMa2mczUal3yutIkFIqfr35Sf1Ogj5Ux6z7OJ7OhDS2Z7CTC3YHBpynqr 96wa+6jfo4qz+5JHRbZpws3bGBkg1NDHDPBCI+XghMTSf6S0zeOilXgmfjdlMufPKVs+ BFAIMlE8KUY8Hxh1G3O7Cmjifj1IMpYg/WGhmPhAr+Tca1Smviw3QSUtgDw5IUp6E9xA 4VRw9E0aVpbV0MHXhkdp8434itA0b8rXSL/hr4+gH1Hdf9NKnm//pxSSPPluxz2VEgJO AwMQ== X-Gm-Message-State: AOAM533CPfieSujdF0dRBLQwmtsUuIe5mAPRpvXeWuQeaqUuR8UIFHDX fZ5UIJAvzsaJUJIhWxBdd4q5KU428FpLqa4seFxsEg== X-Google-Smtp-Source: ABdhPJyFbdtAZyegVnRBIeRr7xdhLuVSubzjyqk9vGdS1B//OzLaRChebIWMdALaLkAtYn8rGEfYXB1yWTXnZ674aqk= X-Received: by 2002:a37:741:: with SMTP id 62mr26073690qkh.495.1593626296457; Wed, 01 Jul 2020 10:58:16 -0700 (PDT) MIME-Version: 1.0 References: <20200701074920.GB72275@lion.0xfce3.net> <202007011451.061EpIYF056897@gndrsh.dnsmgr.net> In-Reply-To: <202007011451.061EpIYF056897@gndrsh.dnsmgr.net> From: Warner Losh Date: Wed, 1 Jul 2020 11:58:05 -0600 Message-ID: Subject: Re: svn commit: r362809 - head/contrib/mandoc To: "Rodney W. Grimes" Cc: Gordon Bergling , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 49xpqY3CG9z4q2P X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=2TUVY0z/; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::742) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.71 / 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.75)[-0.754]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.01)[0.006]; NEURAL_HAM_LONG(-0.96)[-0.961]; 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::742: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:~]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; 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: Wed, 01 Jul 2020 17:58:18 -0000 On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes wrote: > > On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote: > > > [ Charset UTF-8 unsupported, converting... ] > > > > Author: gbe (doc committer) > > > > Date: Tue Jun 30 18:08:59 2020 > > > > New Revision: 362809 > > > > URL: https://svnweb.freebsd.org/changeset/base/362809 > > > > > > > > Log: > > > > Mention FreeBSD in the HISTORY sections of apropos(1) and > makewhatis(8). > > > > > > > > PR: 223520, 223521 > > > > Reviewed by: bcr (mentor) > > > > Approved by: bcr (mentor) > > > > Differential Revision: https://reviews.freebsd.org/D25521 > > > > > > > > Modified: > > > > head/contrib/mandoc/apropos.1 > > > > head/contrib/mandoc/makewhatis.8 > > > > > > > > Modified: head/contrib/mandoc/apropos.1 > > > > > ============================================================================== > > > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020 > (r362808) > > > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020 > (r362809) > > > > @@ -15,7 +15,7 @@ > > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > ARISING OUT OF > > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > > .\" > > > > -.Dd $Mdocdate: November 22 2018 $ > > > > +.Dd $Mdocdate: June 30 2020 $ > > > > .Dt APROPOS 1 > > > > .Os > > > > .Sh NAME > > > > @@ -493,6 +493,12 @@ The options > > > > .Fl acfhIKklOTWw > > > > appeared in > > > > .Ox 5.7 . > > > > +.Pp > > > > +The > > > > +.Nm > > > > +utility was integrated into > > > > +.Fx 11.1 > > > > +as part of the switch to mandoc. > > > > > > Huh? FreeBSD has had apropos since 1.0 and my 5.4 system clearly has > it: > > > freebsd {110}% uname -a > > > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 > #1: Mon Jul 1 17:58:50 PDT 2019 root@pdx.rh.CN85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE > i386 > > > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos > > > /usr/bin/apropos > > > > > > And a man page for it too: > > > APROPOS(1) FreeBSD General Commands Manual > APROPOS(1) > > > > > > NAME > > > apropos, whatis -- search the whatis database > > > > > > SYNOPSIS > > > apropos keyword ... > > > whatis keyword ... > > > > > > DESCRIPTION > > > apropos searches a set of database files containing short > descriptions of > > > system commands for keywords and displays the result on the > standard out- > > > put. whatis displays only complete word matches. > > > > > > keyword really is an extended regular expression, please read > grep(1) > > > manual page for more information about its format. > > > > > > DIAGNOSTICS > > > The apropos utility exits 0 on success, and 1 if no keyword > matched. > > > > > > SEE ALSO > > > grep(1), makewhatis(1), man(1) > > > > > > FreeBSD 5.4 January 15, 1991 > FreeBSD 5.4 > > > > > > > .Sh AUTHORS > > > > .An -nosplit > > > > .An Bill Joy > > > > > > > > That is true, but the version of 'apropos' we have currently in base is > based on mandoc, > > which was imported around September 2018. Due to the nature of > contributed code I > > thought it would be best to document only the history when it was > integrated into > > FreeSBD. The same applies for 'makewhatis'. > > That is not what has been done in other places when code is > changed/replaced, > the HISTORY section is not specific to "FreeBSD's version" of this > function. > > We often have "An ls command appeared in Version 1 AT&T UNIX." Our source > code and man page is not from that, but that is the history of ls. > > This *could* be amended and *should* be amended to reflect that apropos, > and makewhatis got *updated* by a switch to the mandoc versions, but it > is misleading to say it was intergrated with the switch to mandoc as that > implies it did not exist before this action. > I tend to agree with Rod here. These appeared in X the first time, but noting they were replaced in version X with Y is the best way to address the current provenance of the code... Warner > > > > > > Modified: head/contrib/mandoc/makewhatis.8 > > > > > ============================================================================== > > > > --- head/contrib/mandoc/makewhatis.8 Tue Jun 30 17:21:28 2020 > (r362808) > > > > +++ head/contrib/mandoc/makewhatis.8 Tue Jun 30 18:08:59 2020 > (r362809) > > > > @@ -15,7 +15,7 @@ > > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > ARISING OUT OF > > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > > .\" > > > > -.Dd $Mdocdate: May 17 2017 $ > > > > +.Dd $Mdocdate: June 30 2020 $ > > > > .Dt MAKEWHATIS 8 > > > > .Os > > > > .Sh NAME > > > > @@ -211,6 +211,12 @@ and the options > > > > .Fl aCDnQT > > > > in > > > > .Ox 5.6 . > > > > +.Pp > > > > +The > > > > +.Nm > > > > +utility was integrated into > > > > +.Fx 11.1 > > > > +as part of the switch to mandoc. > > > > > > Ditto > > > > > > > .Sh AUTHORS > > > > .An -nosplit > > > > .An Bill Joy > > > > --Gordon > > > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-head@freebsd.org Wed Jul 1 19:11: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 1713E3598C9; Wed, 1 Jul 2020 19:11: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 49xrRV6pJtz4tGD; Wed, 1 Jul 2020 19:11:02 +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 CCC1AE254; Wed, 1 Jul 2020 19:11:02 +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 061JB2bo029669; Wed, 1 Jul 2020 19:11:02 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061JB29a029668; Wed, 1 Jul 2020 19:11:02 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202007011911.061JB29a029668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 1 Jul 2020 19:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362851 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 362851 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 19:11:03 -0000 Author: kp Date: Wed Jul 1 19:11:02 2020 New Revision: 362851 URL: https://svnweb.freebsd.org/changeset/base/362851 Log: riscv: Log missing registers in dump_regs() If we panic we dump the registers for debugging. This is very useful, but it missed several registers (ra, sp, gp and tp). Log these as well. Especially the return address value is extremely useful. Sponsored by: Axiado Modified: head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/riscv/trap.c ============================================================================== --- head/sys/riscv/riscv/trap.c Wed Jul 1 18:10:37 2020 (r362850) +++ head/sys/riscv/riscv/trap.c Wed Jul 1 19:11:02 2020 (r362851) @@ -147,6 +147,11 @@ dump_regs(struct trapframe *frame) for (i = 0; i < n; i++) printf("a[%d] == 0x%016lx\n", i, frame->tf_a[i]); + printf("ra == 0x%016lx\n", frame->tf_ra); + printf("sp == 0x%016lx\n", frame->tf_sp); + printf("gp == 0x%016lx\n", frame->tf_gp); + printf("tp == 0x%016lx\n", frame->tf_tp); + printf("sepc == 0x%016lx\n", frame->tf_sepc); printf("sstatus == 0x%016lx\n", frame->tf_sstatus); } From owner-svn-src-head@freebsd.org Wed Jul 1 19:12: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 11E0A359BB8; Wed, 1 Jul 2020 19:12:48 +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 49xrTW6j7kz4tYD; Wed, 1 Jul 2020 19:12:47 +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 C9727DFEE; Wed, 1 Jul 2020 19:12:47 +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 061JCltg032864; Wed, 1 Jul 2020 19:12:47 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061JCl7g032863; Wed, 1 Jul 2020 19:12:47 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202007011912.061JCl7g032863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 1 Jul 2020 19:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362852 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 362852 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 19:12:48 -0000 Author: kp Date: Wed Jul 1 19:12:47 2020 New Revision: 362852 URL: https://svnweb.freebsd.org/changeset/base/362852 Log: riscv locore.S: load constant prior to loop A very minor micro-optimization; t0 is not clobbered between the loop top and bottom and there appear to be no other branches to this label. Submitted by: Nathaniel Filardo Reviewed by: mhorne Differential Revision: https://reviews.freebsd.org/D25524 Modified: head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Wed Jul 1 19:11:02 2020 (r362851) +++ head/sys/riscv/riscv/locore.S Wed Jul 1 19:12:47 2020 (r362852) @@ -139,8 +139,8 @@ pagetables: li t2, 512 /* Build 512 entries */ add t3, t4, t2 li t5, 0 -1: li t0, (PTE_KERN | PTE_X) +1: slli t2, t4, PTE_PPN1_S /* << PTE_PPN1_S */ or t5, t0, t2 sd t5, (s1) /* Store PTE entry to position */ From owner-svn-src-head@freebsd.org Wed Jul 1 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 EA359359F12; Wed, 1 Jul 2020 19:15:43 +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 49xrXv5yFYz4tfH; Wed, 1 Jul 2020 19:15:43 +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 AFAC8E26D; Wed, 1 Jul 2020 19:15:43 +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 061JFhCG033041; Wed, 1 Jul 2020 19:15:43 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 061JFhhu033038; Wed, 1 Jul 2020 19:15:43 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202007011915.061JFhhu033038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 1 Jul 2020 19:15:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362853 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 362853 X-SVN-Commit-Repository: base MIME-Version: 1.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, 01 Jul 2020 19:15:44 -0000 Author: kp Date: Wed Jul 1 19:15:43 2020 New Revision: 362853 URL: https://svnweb.freebsd.org/changeset/base/362853 Log: riscv pmap: zero reserved pte bits in ppn The top 10 bits of a pte are reserved by specification[1] and are not part of the PPN. [1] 'Volume II: RISC-V Privileged Architectures V20190608-Priv-MSU-Ratified', '4.4.1 Addressing and Memory Protection', page 72: "The PTE format for Sv39 is shown in Figure 4.18. ... Bits 63–54 are reserved for future use and must be zeroed by software for forward compatibility." Submitted by: Nathaniel Filardo Reviewed by: kp, mhorne Differential Revision: https://reviews.freebsd.org/D25523 Modified: head/sys/riscv/include/pte.h head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/include/pte.h ============================================================================== --- head/sys/riscv/include/pte.h Wed Jul 1 19:12:47 2020 (r362852) +++ head/sys/riscv/include/pte.h Wed Jul 1 19:15:43 2020 (r362853) @@ -83,6 +83,9 @@ typedef uint64_t pn_t; /* page number */ #define PTE_PROMOTE (PTE_V | PTE_RWX | PTE_D | PTE_A | PTE_G | PTE_U | \ PTE_SW_MANAGED | PTE_SW_WIRED) +/* Bits 63 - 54 are reserved for future use. */ +#define PTE_HI_MASK 0xFFC0000000000000ULL + #define PTE_PPN0_S 10 #define PTE_PPN1_S 19 #define PTE_PPN2_S 28 Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Wed Jul 1 19:12:47 2020 (r362852) +++ head/sys/riscv/riscv/pmap.c Wed Jul 1 19:15:43 2020 (r362853) @@ -339,7 +339,8 @@ pagezero(void *p) #define pmap_l2_index(va) (((va) >> L2_SHIFT) & Ln_ADDR_MASK) #define pmap_l3_index(va) (((va) >> L3_SHIFT) & Ln_ADDR_MASK) -#define PTE_TO_PHYS(pte) ((pte >> PTE_PPN0_S) * PAGE_SIZE) +#define PTE_TO_PHYS(pte) \ + ((((pte) & ~PTE_HI_MASK) >> PTE_PPN0_S) * PAGE_SIZE) static __inline pd_entry_t * pmap_l1(pmap_t pmap, vm_offset_t va) From owner-svn-src-head@freebsd.org Wed Jul 1 21:28: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 C4DDC35C3CA; Wed, 1 Jul 2020 21:28:49 +0000 (UTC) (envelope-from gbe@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 49xvVT4tSZz3YXX; Wed, 1 Jul 2020 21:28:49 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p548612f6.dip0.t-ipconnect.de [84.134.18.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id 2D8B6100FD; Wed, 1 Jul 2020 21:28:49 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Wed, 1 Jul 2020 23:28:47 +0200 From: Gordon Bergling To: Warner Losh Cc: "Rodney W. Grimes" , Gordon Bergling , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r362809 - head/contrib/mandoc Message-ID: <20200701212847.GA1751@lion.0xfce3.net> References: <20200701074920.GB72275@lion.0xfce3.net> <202007011451.061EpIYF056897@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: X-Operating-System: FreeBSD 12.1-STABLE amd64 X-Host-Uptime: 11:17PM up 10:49, 5 users, load averages: 1.08, 1.04, 1.02 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, 01 Jul 2020 21:28:49 -0000 On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote: > On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes > wrote: > > > > On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote: > > > > [ Charset UTF-8 unsupported, converting... ] > > > > > Author: gbe (doc committer) > > > > > Date: Tue Jun 30 18:08:59 2020 > > > > > New Revision: 362809 > > > > > URL: https://svnweb.freebsd.org/changeset/base/362809 > > > > > > > > > > Log: > > > > > Mention FreeBSD in the HISTORY sections of apropos(1) and > > makewhatis(8). > > > > > > > > > > PR: 223520, 223521 > > > > > Reviewed by: bcr (mentor) > > > > > Approved by: bcr (mentor) > > > > > Differential Revision: https://reviews.freebsd.org/D25521 > > > > > > > > > > Modified: > > > > > head/contrib/mandoc/apropos.1 > > > > > head/contrib/mandoc/makewhatis.8 > > > > > > > > > > Modified: head/contrib/mandoc/apropos.1 > > > > > > > ============================================================================== > > > > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020 > > (r362808) > > > > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020 > > (r362809) > > > > > @@ -15,7 +15,7 @@ > > > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > > ARISING OUT OF > > > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > > > .\" > > > > > -.Dd $Mdocdate: November 22 2018 $ > > > > > +.Dd $Mdocdate: June 30 2020 $ > > > > > .Dt APROPOS 1 > > > > > .Os > > > > > .Sh NAME > > > > > @@ -493,6 +493,12 @@ The options > > > > > .Fl acfhIKklOTWw > > > > > appeared in > > > > > .Ox 5.7 . > > > > > +.Pp > > > > > +The > > > > > +.Nm > > > > > +utility was integrated into > > > > > +.Fx 11.1 > > > > > +as part of the switch to mandoc. > > > > > > > > Huh? FreeBSD has had apropos since 1.0 and my 5.4 system clearly has > > it: > > > > freebsd {110}% uname -a > > > > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 > > #1: Mon Jul 1 17:58:50 PDT 2019 root@pdx.rh.CN85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE > > i386 > > > > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos > > > > /usr/bin/apropos > > > > > > > > And a man page for it too: > > > > APROPOS(1) FreeBSD General Commands Manual > > APROPOS(1) > > > > > > > > NAME > > > > apropos, whatis -- search the whatis database > > > > > > > > SYNOPSIS > > > > apropos keyword ... > > > > whatis keyword ... > > > > > > > > DESCRIPTION > > > > apropos searches a set of database files containing short > > descriptions of > > > > system commands for keywords and displays the result on the > > standard out- > > > > put. whatis displays only complete word matches. > > > > > > > > keyword really is an extended regular expression, please read > > grep(1) > > > > manual page for more information about its format. > > > > > > > > DIAGNOSTICS > > > > The apropos utility exits 0 on success, and 1 if no keyword > > matched. > > > > > > > > SEE ALSO > > > > grep(1), makewhatis(1), man(1) > > > > > > > > FreeBSD 5.4 January 15, 1991 > > FreeBSD 5.4 > > > > > > > > > .Sh AUTHORS > > > > > .An -nosplit > > > > > .An Bill Joy > > > > > > > > > > > That is true, but the version of 'apropos' we have currently in base is > > based on mandoc, > > > which was imported around September 2018. Due to the nature of > > contributed code I > > > thought it would be best to document only the history when it was > > integrated into > > > FreeSBD. The same applies for 'makewhatis'. > > > > That is not what has been done in other places when code is > > changed/replaced, > > the HISTORY section is not specific to "FreeBSD's version" of this > > function. > > > > We often have "An ls command appeared in Version 1 AT&T UNIX." Our source > > code and man page is not from that, but that is the history of ls. > > > > This *could* be amended and *should* be amended to reflect that apropos, > > and makewhatis got *updated* by a switch to the mandoc versions, but it > > is misleading to say it was intergrated with the switch to mandoc as that > > implies it did not exist before this action. > > > > I tend to agree with Rod here. These appeared in X the first time, but > noting they were replaced in version X with Y is the best way to address > the current provenance of the code... > > Warner OK, I see your arguments. How about the following addition for HISTORY section, The apropos utility was integrated into FreeBSD 11.1 as part of the switch to mandoc. Before the switch to mandoc apropos was available since FreeBSD 1.0. Any suggestions on how to describe the history more precise are very welcome. --Gordon > > > > > Modified: head/contrib/mandoc/makewhatis.8 > > > > > > > ============================================================================== > > > > > --- head/contrib/mandoc/makewhatis.8 Tue Jun 30 17:21:28 2020 > > (r362808) > > > > > +++ head/contrib/mandoc/makewhatis.8 Tue Jun 30 18:08:59 2020 > > (r362809) > > > > > @@ -15,7 +15,7 @@ > > > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > > ARISING OUT OF > > > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > > > .\" > > > > > -.Dd $Mdocdate: May 17 2017 $ > > > > > +.Dd $Mdocdate: June 30 2020 $ > > > > > .Dt MAKEWHATIS 8 > > > > > .Os > > > > > .Sh NAME > > > > > @@ -211,6 +211,12 @@ and the options > > > > > .Fl aCDnQT > > > > > in > > > > > .Ox 5.6 . > > > > > +.Pp > > > > > +The > > > > > +.Nm > > > > > +utility was integrated into > > > > > +.Fx 11.1 > > > > > +as part of the switch to mandoc. > > > > > > > > Ditto > > > > > > > > > .Sh AUTHORS > > > > > .An -nosplit > > > > > .An Bill Joy > > -- > > Rod Grimes > > rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Jul 1 23:07: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 565D235E0DA; Wed, 1 Jul 2020 23:07:22 +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 49xxh95DRcz3g6v; Wed, 1 Jul 2020 23:07:21 +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 061N7DUh058638; Wed, 1 Jul 2020 16:07:13 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 061N7Cpk058637; Wed, 1 Jul 2020 16:07:13 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202007012307.061N7Cpk058637@gndrsh.dnsmgr.net> Subject: Re: svn commit: r362809 - head/contrib/mandoc In-Reply-To: <20200701212847.GA1751@lion.0xfce3.net> To: Gordon Bergling Date: Wed, 1 Jul 2020 16:07:12 -0700 (PDT) CC: Warner Losh , "Rodney W. Grimes" , src-committers , svn-src-all , svn-src-head Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49xxh95DRcz3g6v 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: Wed, 01 Jul 2020 23:07:22 -0000 > On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote: > > On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes > > wrote: > > > > > > On Tue, Jun 30, 2020 at 03:56:17PM -0700, Rodney W. Grimes wrote: > > > > > [ Charset UTF-8 unsupported, converting... ] > > > > > > Author: gbe (doc committer) > > > > > > Date: Tue Jun 30 18:08:59 2020 > > > > > > New Revision: 362809 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/362809 > > > > > > > > > > > > Log: > > > > > > Mention FreeBSD in the HISTORY sections of apropos(1) and > > > makewhatis(8). > > > > > > > > > > > > PR: 223520, 223521 > > > > > > Reviewed by: bcr (mentor) > > > > > > Approved by: bcr (mentor) > > > > > > Differential Revision: https://reviews.freebsd.org/D25521 > > > > > > > > > > > > Modified: > > > > > > head/contrib/mandoc/apropos.1 > > > > > > head/contrib/mandoc/makewhatis.8 > > > > > > > > > > > > Modified: head/contrib/mandoc/apropos.1 > > > > > > > > > ============================================================================== > > > > > > --- head/contrib/mandoc/apropos.1 Tue Jun 30 17:21:28 2020 > > > (r362808) > > > > > > +++ head/contrib/mandoc/apropos.1 Tue Jun 30 18:08:59 2020 > > > (r362809) > > > > > > @@ -15,7 +15,7 @@ > > > > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > > > ARISING OUT OF > > > > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > > > > .\" > > > > > > -.Dd $Mdocdate: November 22 2018 $ > > > > > > +.Dd $Mdocdate: June 30 2020 $ > > > > > > .Dt APROPOS 1 > > > > > > .Os > > > > > > .Sh NAME > > > > > > @@ -493,6 +493,12 @@ The options > > > > > > .Fl acfhIKklOTWw > > > > > > appeared in > > > > > > .Ox 5.7 . > > > > > > +.Pp > > > > > > +The > > > > > > +.Nm > > > > > > +utility was integrated into > > > > > > +.Fx 11.1 > > > > > > +as part of the switch to mandoc. > > > > > > > > > > Huh? FreeBSD has had apropos since 1.0 and my 5.4 system clearly has > > > it: > > > > > freebsd {110}% uname -a > > > > > FreeBSD pdx.rh.CN85.dnsmgr.net 5.4-RELEASE-p8 FreeBSD 5.4-RELEASE-p8 > > > #1: Mon Jul 1 17:58:50 PDT 2019 root@pdx.rh.CN85.dnsmgr.net:/usr/src/sys/i386/compile/PDXMXPIE > > > i386 > > > > > pdx.rh.CN85.dnsmgr.net:freebsd {111}% which apropos > > > > > /usr/bin/apropos > > > > > > > > > > And a man page for it too: > > > > > APROPOS(1) FreeBSD General Commands Manual > > > APROPOS(1) > > > > > > > > > > NAME > > > > > apropos, whatis -- search the whatis database > > > > > > > > > > SYNOPSIS > > > > > apropos keyword ... > > > > > whatis keyword ... > > > > > > > > > > DESCRIPTION > > > > > apropos searches a set of database files containing short > > > descriptions of > > > > > system commands for keywords and displays the result on the > > > standard out- > > > > > put. whatis displays only complete word matches. > > > > > > > > > > keyword really is an extended regular expression, please read > > > grep(1) > > > > > manual page for more information about its format. > > > > > > > > > > DIAGNOSTICS > > > > > The apropos utility exits 0 on success, and 1 if no keyword > > > matched. > > > > > > > > > > SEE ALSO > > > > > grep(1), makewhatis(1), man(1) > > > > > > > > > > FreeBSD 5.4 January 15, 1991 > > > FreeBSD 5.4 > > > > > > > > > > > .Sh AUTHORS > > > > > > .An -nosplit > > > > > > .An Bill Joy > > > > > > > > > > > > > > That is true, but the version of 'apropos' we have currently in base is > > > based on mandoc, > > > > which was imported around September 2018. Due to the nature of > > > contributed code I > > > > thought it would be best to document only the history when it was > > > integrated into > > > > FreeSBD. The same applies for 'makewhatis'. > > > > > > That is not what has been done in other places when code is > > > changed/replaced, > > > the HISTORY section is not specific to "FreeBSD's version" of this > > > function. > > > > > > We often have "An ls command appeared in Version 1 AT&T UNIX." Our source > > > code and man page is not from that, but that is the history of ls. > > > > > > This *could* be amended and *should* be amended to reflect that apropos, > > > and makewhatis got *updated* by a switch to the mandoc versions, but it > > > is misleading to say it was intergrated with the switch to mandoc as that > > > implies it did not exist before this action. > > > > > > > I tend to agree with Rod here. These appeared in X the first time, but > > noting they were replaced in version X with Y is the best way to address > > the current provenance of the code... > > > > Warner > > OK, I see your arguments. How about the following addition for HISTORY section, > > The apropos utility was integrated into FreeBSD 11.1 as part of the > switch to mandoc. Before the switch to mandoc apropos was available since > FreeBSD 1.0. This still implies that it originated with the switch to mandoc, though there is other context that indicates it did not. There is already a pretty good history section there, I am not sure what your trying to clarify. Even the Authors section reflects the history accurately. I do not see that this is adding any great value to the HISTORY for either apropos or makewhatis. > > Any suggestions on how to describe the history more precise are very welcome. The history appears to be described accurately already. > --Gordon > > > > > > > Modified: head/contrib/mandoc/makewhatis.8 > > > > > > > > > ============================================================================== > > > > > > --- head/contrib/mandoc/makewhatis.8 Tue Jun 30 17:21:28 2020 > > > (r362808) > > > > > > +++ head/contrib/mandoc/makewhatis.8 Tue Jun 30 18:08:59 2020 > > > (r362809) > > > > > > @@ -15,7 +15,7 @@ > > > > > > .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, > > > ARISING OUT OF > > > > > > .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > > > > > > .\" > > > > > > -.Dd $Mdocdate: May 17 2017 $ > > > > > > +.Dd $Mdocdate: June 30 2020 $ > > > > > > .Dt MAKEWHATIS 8 > > > > > > .Os > > > > > > .Sh NAME > > > > > > @@ -211,6 +211,12 @@ and the options > > > > > > .Fl aCDnQT > > > > > > in > > > > > > .Ox 5.6 . > > > > > > +.Pp > > > > > > +The > > > > > > +.Nm > > > > > > +utility was integrated into > > > > > > +.Fx 11.1 > > > > > > +as part of the switch to mandoc. > > > > > > > > > > Ditto > > > > > > > > > > > .Sh AUTHORS > > > > > > .An -nosplit > > > > > > .An Bill Joy > > > -- > > > Rod Grimes > > > rgrimes@freebsd.org > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Jul 1 23:42: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 83B6835E895; Wed, 1 Jul 2020 23:42:13 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49xySP31Hhz3yrH; Wed, 1 Jul 2020 23:42:13 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 4FA241CB71; Wed, 1 Jul 2020 23:42:13 +0000 (UTC) Date: Wed, 1 Jul 2020 23:42:13 +0000 From: Alexey Dokuchaev To: Gordon Bergling Cc: Warner Losh , "Rodney W. Grimes" , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r362809 - head/contrib/mandoc Message-ID: <20200701234213.GA54023@FreeBSD.org> References: <20200701074920.GB72275@lion.0xfce3.net> <202007011451.061EpIYF056897@gndrsh.dnsmgr.net> <20200701212847.GA1751@lion.0xfce3.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200701212847.GA1751@lion.0xfce3.net> 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, 01 Jul 2020 23:42:13 -0000 On Wed, Jul 01, 2020 at 11:28:47PM +0200, Gordon Bergling wrote: > On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote: > > On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes wrote: > > > ... > > > We often have "An ls command appeared in Version 1 AT&T UNIX." Our source > > > code and man page is not from that, but that is the history of ls. > > > > > > This *could* be amended and *should* be amended to reflect that apropos, > > > and makewhatis got *updated* by a switch to the mandoc versions, but it > > > is misleading to say it was intergrated with the switch to mandoc as that > > > implies it did not exist before this action. > > > > I tend to agree with Rod here. These appeared in X the first time, but > > noting they were replaced in version X with Y is the best way to address > > the current provenance of the code... > > OK, I see your arguments. How about the following addition for HISTORY section, > > The apropos utility was integrated into FreeBSD 11.1 as part of the > switch to mandoc. Before the switch to mandoc apropos was available since > FreeBSD 1.0. It should be the other way around: "The apropos utility appeared in FreeBSD 1.0. Since FreeBSD 11.1 it is based on mandoc implementation." ./danfe From owner-svn-src-head@freebsd.org Thu Jul 2 00:01: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 2AA2635E564; Thu, 2 Jul 2020 00:01:04 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49xyt66Q63z40Xs; Thu, 2 Jul 2020 00:01:02 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 062010cc058838; Wed, 1 Jul 2020 17:01:00 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 062010DA058837; Wed, 1 Jul 2020 17:01:00 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202007020001.062010DA058837@gndrsh.dnsmgr.net> Subject: Re: svn commit: r362809 - head/contrib/mandoc In-Reply-To: <20200701234213.GA54023@FreeBSD.org> To: Alexey Dokuchaev Date: Wed, 1 Jul 2020 17:01:00 -0700 (PDT) CC: Gordon Bergling , Warner Losh , "Rodney W. Grimes" , src-committers , svn-src-all , svn-src-head Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49xyt66Q63z40Xs X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [2.63 / 15.00]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.10)[0.101]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.76)[0.757]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_SPAM_LONG(0.87)[0.873]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_TLS_LAST(0.00)[]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_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: Thu, 02 Jul 2020 00:01:04 -0000 > On Wed, Jul 01, 2020 at 11:28:47PM +0200, Gordon Bergling wrote: > > On Wed, Jul 01, 2020 at 11:58:05AM -0600, Warner Losh wrote: > > > On Wed, Jul 1, 2020 at 8:51 AM Rodney W. Grimes wrote: > > > > ... > > > > We often have "An ls command appeared in Version 1 AT&T UNIX." Our source > > > > code and man page is not from that, but that is the history of ls. > > > > > > > > This *could* be amended and *should* be amended to reflect that apropos, > > > > and makewhatis got *updated* by a switch to the mandoc versions, but it > > > > is misleading to say it was intergrated with the switch to mandoc as that > > > > implies it did not exist before this action. > > > > > > I tend to agree with Rod here. These appeared in X the first time, but > > > noting they were replaced in version X with Y is the best way to address > > > the current provenance of the code... > > > > OK, I see your arguments. How about the following addition for HISTORY section, > > > > The apropos utility was integrated into FreeBSD 11.1 as part of the > > switch to mandoc. Before the switch to mandoc apropos was available since > > FreeBSD 1.0. > > It should be the other way around: > > "The apropos utility appeared in FreeBSD 1.0. Since FreeBSD 11.1 > it is based on mandoc implementation." Thats good, but realize the page already contains history that reads like: HISTORY Part of the functionality of whatis was already provided by the former manwhere utility in 1BSD. The apropos and whatis utilities first ap- peared in 2BSD. They were rewritten from scratch for OpenBSD 5.6. The -M option and the MANPATH variable first appeared in 4.3BSD; -m in 4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for apropos and in OpenBSD 5.6 for whatis. The options -acfhIKklOTWw appeared in OpenBSD 5.7. And further contains: UTHORS Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis in February 1979. The current version was written by Kristaps Dzonsons and Ingo Schwarze . So the history is rich and complete, do we really need to say when we incorporated this into FreeBSD from OpenBSD's mandoc in the manual page? > ./danfe -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu Jul 2 00:06: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 5B45535EFB9; Thu, 2 Jul 2020 00:06:13 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49xz051YbDz41Fb; Thu, 2 Jul 2020 00:06:13 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 2D4121D31A; Thu, 2 Jul 2020 00:06:13 +0000 (UTC) Date: Thu, 2 Jul 2020 00:06:13 +0000 From: Alexey Dokuchaev To: rgrimes@freebsd.org Cc: Gordon Bergling , Warner Losh , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r362809 - head/contrib/mandoc Message-ID: <20200702000613.GA93146@FreeBSD.org> References: <20200701234213.GA54023@FreeBSD.org> <202007020001.062010DA058837@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202007020001.062010DA058837@gndrsh.dnsmgr.net> 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, 02 Jul 2020 00:06:13 -0000 On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote: > Thats good, but realize the page already contains history that > reads like: > > HISTORY > Part of the functionality of whatis was already provided by the former > manwhere utility in 1BSD. The apropos and whatis utilities first ap- > peared in 2BSD. They were rewritten from scratch for OpenBSD 5.6. > > The -M option and the MANPATH variable first appeared in 4.3BSD; -m in > 4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for apropos > and in OpenBSD 5.6 for whatis. The options -acfhIKklOTWw appeared in > OpenBSD 5.7. > > And further contains: > > AUTHORS > Bill Joy wrote manwhere in 1977 and the original BSD apropos and whatis > in February 1979. The current version was written by Kristaps Dzonsons > and Ingo Schwarze . > > So the history is rich and complete, do we really need to say when we > incorporated this into FreeBSD from OpenBSD's mandoc in the manual page? Ah, in this case, the only thing lacking from the current version is mention of FreeBSD 11.1. Sorry for not checking with that before writing my reply. My main point, however, was that reverse chronological order looks strange. ./danfe From owner-svn-src-head@freebsd.org Thu Jul 2 07:03: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 43C4A34B0D0; Thu, 2 Jul 2020 07:03:16 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49y8FJ16f8z4Psq; Thu, 2 Jul 2020 07:03:16 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A69316C3D; Thu, 2 Jul 2020 07:03:16 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06273FIu071287; Thu, 2 Jul 2020 07:03:15 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06273FoX071286; Thu, 2 Jul 2020 07:03:15 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202007020703.06273FoX071286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 2 Jul 2020 07:03:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362883 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 362883 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 07:03:16 -0000 Author: tsoome Date: Thu Jul 2 07:03:15 2020 New Revision: 362883 URL: https://svnweb.freebsd.org/changeset/base/362883 Log: loader: potential memory leak and check return values Need to free nvlist before return from vdev_from_nvlist(). Sponsored by: Netflix, Klara Inc. Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Thu Jul 2 01:10:18 2020 (r362882) +++ head/stand/libsa/zfs/zfsimpl.c Thu Jul 2 07:03:15 2020 (r362883) @@ -1111,14 +1111,20 @@ vdev_from_nvlist(spa_t *spa, uint64_t top_guid, const return (rc); } rc = vdev_init(guid, kids, &vdev); - if (rc != 0) + if (rc != 0) { + nvlist_destroy(kids); return (rc); + } vdev->v_spa = spa; vdev->v_top = top_vdev; vdev_insert(top_vdev, vdev); rc = nvlist_next(kids); + if (rc != 0) { + nvlist_destroy(kids); + return (rc); + } } } else { /* @@ -1228,6 +1234,8 @@ vdev_update_from_nvlist(uint64_t top_guid, const nvlis vdev_set_initial_state(vdev, kids); rc = nvlist_next(kids); + if (rc != 0) + break; } } else { rc = 0; @@ -1290,7 +1298,9 @@ vdev_init_from_nvlist(spa_t *spa, const nvlist_t *nvli rc = vdev_update_from_nvlist(guid, kids); if (rc != 0) break; - nvlist_next(kids); + rc = nvlist_next(kids); + if (rc != 0) + break; } nvlist_destroy(kids); From owner-svn-src-head@freebsd.org Thu Jul 2 07:15: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 0D39234B602; Thu, 2 Jul 2020 07:15:49 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49y8Wm6Jphz4QCC; Thu, 2 Jul 2020 07:15:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC75F170FD; Thu, 2 Jul 2020 07:15:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0627FmVt077554; Thu, 2 Jul 2020 07:15:48 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0627FmYF077553; Thu, 2 Jul 2020 07:15:48 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202007020715.0627FmYF077553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 2 Jul 2020 07:15:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362884 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 362884 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 07:15:49 -0000 Author: tsoome Date: Thu Jul 2 07:15:48 2020 New Revision: 362884 URL: https://svnweb.freebsd.org/changeset/base/362884 Log: loader: zfs reader does not need BOOT2 bits After switching zfsloader to use full libsa, we do not need spa_get_primary() and spa_get_primary_vdev() any more. Sponsored by: Netflix, Klara Inc. Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Thu Jul 2 07:03:15 2020 (r362883) +++ head/stand/libsa/zfs/zfsimpl.c Thu Jul 2 07:15:48 2020 (r362884) @@ -1336,34 +1336,6 @@ spa_find_by_name(const char *name) return (NULL); } -#ifdef BOOT2 -static spa_t * -spa_get_primary(void) -{ - - return (STAILQ_FIRST(&zfs_pools)); -} - -static vdev_t * -spa_get_primary_vdev(const spa_t *spa) -{ - vdev_t *vdev; - vdev_t *kid; - - if (spa == NULL) - spa = spa_get_primary(); - if (spa == NULL) - return (NULL); - vdev = spa->spa_root_vdev; - if (vdev == NULL) - return (NULL); - for (kid = STAILQ_FIRST(&vdev->v_children); kid != NULL; - kid = STAILQ_FIRST(&vdev->v_children)) - vdev = kid; - return (vdev); -} -#endif - static spa_t * spa_create(uint64_t guid, const char *name) { From owner-svn-src-head@freebsd.org Thu Jul 2 10:40: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 953413514EE; Thu, 2 Jul 2020 10:40:48 +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 49yF4J3TKCz4f0c; Thu, 2 Jul 2020 10:40:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A9C5195ED; Thu, 2 Jul 2020 10:40:48 +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 062AemSi002537; Thu, 2 Jul 2020 10:40:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062AemlD002519; Thu, 2 Jul 2020 10:40:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202007021040.062AemlD002519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jul 2020 10:40:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362885 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362885 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 10:40:48 -0000 Author: kib Date: Thu Jul 2 10:40:47 2020 New Revision: 362885 URL: https://svnweb.freebsd.org/changeset/base/362885 Log: Use tdfind() in pget(). Reviewed by: jhb, hselasky Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25532 Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Thu Jul 2 07:15:48 2020 (r362884) +++ head/sys/kern/kern_proc.c Thu Jul 2 10:40:47 2020 (r362885) @@ -455,30 +455,6 @@ pfind_any(pid_t pid) return (_pfind(pid, true)); } -static struct proc * -pfind_tid(pid_t tid) -{ - struct proc *p; - struct thread *td; - - sx_slock(&allproc_lock); - FOREACH_PROC_IN_SYSTEM(p) { - PROC_LOCK(p); - if (p->p_state == PRS_NEW) { - PROC_UNLOCK(p); - continue; - } - FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_tid == tid) - goto found; - } - PROC_UNLOCK(p); - } -found: - sx_sunlock(&allproc_lock); - return (p); -} - /* * Locate a process group by number. * The caller must hold proctree_lock. @@ -506,6 +482,7 @@ int pget(pid_t pid, int flags, struct proc **pp) { struct proc *p; + struct thread *td1; int error; p = curproc; @@ -519,7 +496,9 @@ pget(pid_t pid, int flags, struct proc **pp) else p = pfind(pid); } else if ((flags & PGET_NOTID) == 0) { - p = pfind_tid(pid); + td1 = tdfind(pid, -1); + if (td1 != NULL) + p = td1->td_proc; } if (p == NULL) return (ESRCH); From owner-svn-src-head@freebsd.org Thu Jul 2 10:42: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 EAF9F351664; Thu, 2 Jul 2020 10:42: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 49yF6p5yv6z4fL2; Thu, 2 Jul 2020 10:42: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 9673119903; Thu, 2 Jul 2020 10:42: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 062AgwVe007275; Thu, 2 Jul 2020 10:42:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062AgwhG007274; Thu, 2 Jul 2020 10:42:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202007021042.062AgwhG007274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jul 2020 10:42:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362886 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 362886 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 10:42:59 -0000 Author: kib Date: Thu Jul 2 10:42:58 2020 New Revision: 362886 URL: https://svnweb.freebsd.org/changeset/base/362886 Log: linuxkpi: improvements for linux_pid_task() and linux_get_pid_task(). Unify functions bodies. Do not call tdfind() if pid is passed, and do not call pfind() if tid is supplied. Reviewed by: hselasky Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25534 Modified: head/sys/compat/linuxkpi/common/src/linux_current.c Modified: head/sys/compat/linuxkpi/common/src/linux_current.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_current.c Thu Jul 2 10:40:47 2020 (r362885) +++ head/sys/compat/linuxkpi/common/src/linux_current.c Thu Jul 2 10:42:58 2020 (r362886) @@ -155,65 +155,52 @@ linuxkpi_thread_dtor(void *arg __unused, struct thread put_task_struct(ts); } -struct task_struct * -linux_pid_task(pid_t pid) +static struct task_struct * +linux_get_pid_task_int(pid_t pid, const bool do_get) { struct thread *td; struct proc *p; + struct task_struct *ts; - /* try to find corresponding thread */ - td = tdfind(pid, -1); - if (td != NULL) { - struct task_struct *ts = td->td_lkpi_task; - PROC_UNLOCK(td->td_proc); - return (ts); - } - - /* try to find corresponding procedure */ - p = pfind(pid); - if (p != NULL) { - FOREACH_THREAD_IN_PROC(p, td) { - struct task_struct *ts = td->td_lkpi_task; - if (ts != NULL) { - PROC_UNLOCK(p); - return (ts); + if (pid > PID_MAX) { + /* try to find corresponding thread */ + td = tdfind(pid, -1); + if (td != NULL) { + ts = td->td_lkpi_task; + if (do_get && ts != NULL) + get_task_struct(ts); + PROC_UNLOCK(td->td_proc); + return (ts); + } + } else { + /* try to find corresponding procedure */ + p = pfind(pid); + if (p != NULL) { + FOREACH_THREAD_IN_PROC(p, td) { + ts = td->td_lkpi_task; + if (ts != NULL) { + if (do_get) + get_task_struct(ts); + PROC_UNLOCK(p); + return (ts); + } } + PROC_UNLOCK(p); } - PROC_UNLOCK(p); } return (NULL); } struct task_struct * -linux_get_pid_task(pid_t pid) +linux_pid_task(pid_t pid) { - struct thread *td; - struct proc *p; + return (linux_get_pid_task_int(pid, false)); +} - /* try to find corresponding thread */ - td = tdfind(pid, -1); - if (td != NULL) { - struct task_struct *ts = td->td_lkpi_task; - if (ts != NULL) - get_task_struct(ts); - PROC_UNLOCK(td->td_proc); - return (ts); - } - - /* try to find corresponding procedure */ - p = pfind(pid); - if (p != NULL) { - FOREACH_THREAD_IN_PROC(p, td) { - struct task_struct *ts = td->td_lkpi_task; - if (ts != NULL) { - get_task_struct(ts); - PROC_UNLOCK(p); - return (ts); - } - } - PROC_UNLOCK(p); - } - return (NULL); +struct task_struct * +linux_get_pid_task(pid_t pid) +{ + return (linux_get_pid_task_int(pid, true)); } bool From owner-svn-src-head@freebsd.org Thu Jul 2 10:44: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 58DE5351C02; Thu, 2 Jul 2020 10:44:46 +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 49yF8t1m4lz4fZJ; Thu, 2 Jul 2020 10:44: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 1FD5119335; Thu, 2 Jul 2020 10:44: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 062AikLB007425; Thu, 2 Jul 2020 10:44:46 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062Aij2U007424; Thu, 2 Jul 2020 10:44:45 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202007021044.062Aij2U007424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 2 Jul 2020 10:44:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362887 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 362887 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 10:44:46 -0000 Author: kib Date: Thu Jul 2 10:44:45 2020 New Revision: 362887 URL: https://svnweb.freebsd.org/changeset/base/362887 Log: mlx5_core: remove unneccessary LFENCE instruction. Use fence instead of barrier, which is optimized to take advantage of the x86 TSO memory model. Reviewed by: hselasky Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_eq.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Jul 2 10:42:58 2020 (r362886) +++ head/sys/dev/mlx5/mlx5_core/mlx5_eq.c Thu Jul 2 10:44:45 2020 (r362887) @@ -240,7 +240,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, stru * Make sure we read EQ entry contents after we've * checked the ownership bit. */ - rmb(); + atomic_thread_fence_acq(); mlx5_core_dbg(eq->dev, "eqn %d, eqe type %s\n", eq->eqn, eqe_type_str(eqe->type)); From owner-svn-src-head@freebsd.org Thu Jul 2 12:54: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 48763355E8E; Thu, 2 Jul 2020 12:54:51 +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 49yJ2z1Fj2z3Xj8; Thu, 2 Jul 2020 12:54:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0EBD91AF37; Thu, 2 Jul 2020 12:54:51 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 062Csogp086779; Thu, 2 Jul 2020 12:54:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062Cso12086778; Thu, 2 Jul 2020 12:54:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007021254.062Cso12086778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 2 Jul 2020 12:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362888 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362888 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 12:54:51 -0000 Author: mjg Date: Thu Jul 2 12:54:50 2020 New Revision: 362888 URL: https://svnweb.freebsd.org/changeset/base/362888 Log: cache: fix misplaced fence in cache_ncp_invalidate The intent was to mark the entry as invalid before cache_zap starts messing with it. While here add some comments. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Jul 2 10:44:45 2020 (r362887) +++ head/sys/kern/vfs_cache.c Thu Jul 2 12:54:50 2020 (r362888) @@ -147,22 +147,33 @@ struct namecache_ts { #define NCF_HOTNEGATIVE 0x40 #define NCF_INVALID 0x80 -static bool -cache_ncp_invalid(struct namecache *ncp) -{ - - atomic_thread_fence_acq(); - return ((ncp->nc_flag & NCF_INVALID) != 0); -} - +/* + * Mark an entry as invalid. + * + * This is called before it starts getting deconstructed. + */ static void cache_ncp_invalidate(struct namecache *ncp) { - atomic_thread_fence_rel(); KASSERT((ncp->nc_flag & NCF_INVALID) == 0, ("%s: entry %p already invalid", __func__, ncp)); ncp->nc_flag |= NCF_INVALID; + atomic_thread_fence_rel(); +} + +/* + * Verify validity of an entry. + * + * All places which elide locks are supposed to call this after they are + * done with reading from an entry. + */ +static bool +cache_ncp_invalid(struct namecache *ncp) +{ + + atomic_thread_fence_acq(); + return ((ncp->nc_flag & NCF_INVALID) != 0); } /* From owner-svn-src-head@freebsd.org Thu Jul 2 12:56: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 99071355F0B; Thu, 2 Jul 2020 12:56:21 +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 49yJ4j3X0Jz3Y87; Thu, 2 Jul 2020 12:56:21 +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 5C2C01AF38; Thu, 2 Jul 2020 12:56:21 +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 062CuLPW086933; Thu, 2 Jul 2020 12:56:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062CuLar086932; Thu, 2 Jul 2020 12:56:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007021256.062CuLar086932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 2 Jul 2020 12:56:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362889 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362889 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 12:56:21 -0000 Author: mjg Date: Thu Jul 2 12:56:20 2020 New Revision: 362889 URL: https://svnweb.freebsd.org/changeset/base/362889 Log: cache: add missing call to cache_ncp_invalid for negative hits Note the dtrace probe can fire even the entry is gone, but I don't think that's worth fixing. Modified: head/sys/kern/vfs_cache.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Thu Jul 2 12:54:50 2020 (r362888) +++ head/sys/kern/vfs_cache.c Thu Jul 2 12:56:20 2020 (r362889) @@ -1342,7 +1342,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, st uint32_t hash; enum vgetstate vs; int error, ltype; - bool try_smr, doing_smr; + bool try_smr, doing_smr, whiteout; #ifdef DEBUG_CACHE if (__predict_false(!doingcache)) { @@ -1498,28 +1498,28 @@ negative_success: goto zap_and_exit; } + SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, ncp->nc_name); + cache_out_ts(ncp, tsp, ticksp); + counter_u64_add(numneghits, 1); + whiteout = (ncp->nc_flag & NCF_WHITE); + if (doing_smr) { - if ((ncp->nc_flag & NCF_HOTNEGATIVE) == 0) { - /* - * We need to take locks to promote the entry. - */ + /* + * We need to take locks to promote an entry. + */ + if ((ncp->nc_flag & NCF_HOTNEGATIVE) == 0 || + cache_ncp_invalid(ncp)) { vfs_smr_exit(); doing_smr = false; goto retry_hashed; } + vfs_smr_exit(); } else { cache_negative_hit(ncp); + cache_lookup_unlock(blp, dvlp); } - counter_u64_add(numneghits, 1); - if (ncp->nc_flag & NCF_WHITE) + if (whiteout) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE2(vfs, namecache, lookup, hit__negative, dvp, - ncp->nc_name); - cache_out_ts(ncp, tsp, ticksp); - if (doing_smr) - vfs_smr_exit(); - else - cache_lookup_unlock(blp, dvlp); return (ENOENT); zap_and_exit: From owner-svn-src-head@freebsd.org Thu Jul 2 12:58: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 B262F355D41; Thu, 2 Jul 2020 12:58:07 +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 49yJ6l4Mhwz3YKy; Thu, 2 Jul 2020 12:58:07 +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 7A5FD1B0FA; Thu, 2 Jul 2020 12:58:07 +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 062Cw7rB087051; Thu, 2 Jul 2020 12:58:07 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062Cw7Av087050; Thu, 2 Jul 2020 12:58:07 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007021258.062Cw7Av087050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 2 Jul 2020 12:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362890 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362890 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 12:58:07 -0000 Author: mjg Date: Thu Jul 2 12:58:07 2020 New Revision: 362890 URL: https://svnweb.freebsd.org/changeset/base/362890 Log: cred: add a prediction to crfree for td->td_realucred == cr This matches crhold and eliminates an assembly maze in the common case. Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Thu Jul 2 12:56:20 2020 (r362889) +++ head/sys/kern/kern_prot.c Thu Jul 2 12:58:07 2020 (r362890) @@ -1985,7 +1985,7 @@ crfree(struct ucred *cr) struct thread *td; td = curthread; - if (td->td_realucred == cr) { + 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--; From owner-svn-src-head@freebsd.org Thu Jul 2 13:17: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 743743564C9; Thu, 2 Jul 2020 13:17:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49yJY82Sq7z3ZKC; Thu, 2 Jul 2020 13:17:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 387641B40E; Thu, 2 Jul 2020 13:17:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 062DHW7Y099409; Thu, 2 Jul 2020 13:17:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062DHWKY099408; Thu, 2 Jul 2020 13:17:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202007021317.062DHWKY099408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 2 Jul 2020 13:17:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362891 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 362891 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 13:17:32 -0000 Author: asomers Date: Thu Jul 2 13:17:31 2020 New Revision: 362891 URL: https://svnweb.freebsd.org/changeset/base/362891 Log: Fix page fault in zfsctl_snapdir_getattr Must acquire the z_teardown_lock before accessing the zfsvfs_t object. I can't reproduce this panic on demand, but this looks like the correct solution. PR: 247668 Reviewed by: avg MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D25543 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jul 2 12:58:07 2020 (r362890) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jul 2 13:17:31 2020 (r362891) @@ -1121,12 +1121,13 @@ zfsctl_snapdir_getattr(ap) vnode_t *vp = ap->a_vp; vattr_t *vap = ap->a_vap; zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data; - dsl_dataset_t *ds = dmu_objset_ds(zfsvfs->z_os); + dsl_dataset_t *ds; sfs_node_t *node = vp->v_data; uint64_t snap_count; int err; ZFS_ENTER(zfsvfs); + ds = dmu_objset_ds(zfsvfs->z_os); zfsctl_common_getattr(vp, vap); vap->va_ctime = dmu_objset_snap_cmtime(zfsvfs->z_os); vap->va_mtime = vap->va_ctime; From owner-svn-src-head@freebsd.org Thu Jul 2 19:20: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 A329035E226; Thu, 2 Jul 2020 19:20:57 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (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 49yScS4SzDz4D1g; Thu, 2 Jul 2020 19:20:56 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x442.google.com with SMTP id f18so21714504wrs.0; Thu, 02 Jul 2020 12:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=wXzAftCdCQa3wtM/e92v3o/hRyW5e6yhG3r/pT7PQ6E=; b=MTEEmNV+5sY8tX6MUyYKxsB5oEmpiQuiNW4OEqVsoPEBpQzVBOYiMS3KRQgzf1EvJK /lgx+SzgTmjyOA+VmoJQdjkRPhTNAS9vktG5gQMGLtJyDvR0YvXZqBiMiEV7ltID3p8A TVCJtHh/1a4AzaOdokCIk9Ylm7N1FMx/psY1K4oNzbWQglPQijbyRR+sVwF8oHkvH9oL YDRNGIjbJdfFlYmusz8QMSXWEU30yBwDLlLnKHOVZvVGEV2UUcUdFaB3hgiAaHxYR3he 9Bd9GQePaWB8sEZkJF2aKfKrsdZVjpZ0qRNcMbHZGABr/AKIK/EskFf1bNZKNcbWWf1l 2S3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=wXzAftCdCQa3wtM/e92v3o/hRyW5e6yhG3r/pT7PQ6E=; b=s5sdKl1z+6Shj3qBa4rN3B05q6xpZbAC8miXPm9reNVm7aeILXDBUM5+jOANsPUKaT 4DpHRvi45unrUfO+4D+klFdLymbNkjGkhby8ElvWz/UZaL89Buxw3yhNnFnjaZxgrQus Jt/hP9dKWj5Qo6gJtddG47H8TdCQi8YlvU52rZFANV8iUkPRVvAGmEc/Lucg/4KlbvYz CH/rpeEQTbEq7c68TqObm0esFLgPWl0gagfiLnRLVPxfx9M0GVlwJav6fTrM5NYTyBgX 6lX4iCz968gKQ9j/8CfBO7gnZI1pYFZqRk74E6Oooij1f5E6HCXeCr8ASL3Q1lNs0opz lfZA== X-Gm-Message-State: AOAM530G7bFdeCwDTb/3//qVZrqJfiek/7g8QOjA4Rhu1k5YTqXeWv+J Zt2baOeIaMd9y5yTcBjMaAaZro+c X-Google-Smtp-Source: ABdhPJyE1kEQolItVatHLBQ8dGZlWBBhGzOl5B0ROyuytl0ToXmKAxQXaaoaeaCd50hgHVYC5safuw== X-Received: by 2002:a5d:4903:: with SMTP id x3mr35073859wrq.351.1593717653059; Thu, 02 Jul 2020 12:20:53 -0700 (PDT) Received: from brick (cpc149474-cmbg20-2-0-cust954.5-4.cable.virginm.net. [82.4.199.187]) by smtp.gmail.com with ESMTPSA id z63sm6965995wmb.2.2020.07.02.12.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 12:20:51 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Thu, 2 Jul 2020 20:20:49 +0100 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Kyle Evans Cc: Shawn Webb , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r362769 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux Message-ID: <20200702192049.GA51788@brick> Mail-Followup-To: Kyle Evans , Shawn Webb , src-committers , svn-src-all , svn-src-head References: <202006290309.05T39ETZ044859@repo.freebsd.org> <20200629152717.2ojwnipxkmjaoix2@mutt-hbsd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 49yScS4SzDz4D1g X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=MTEEmNV+; dmarc=none; spf=pass (mx1.freebsd.org: domain of etnapierala@gmail.com designates 2a00:1450:4864:20::442 as permitted sender) smtp.mailfrom=etnapierala@gmail.com X-Spamd-Result: default: False [-2.43 / 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.95)[-0.946]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.78)[-0.782]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::442:from]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[82.4.199.187: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: Thu, 02 Jul 2020 19:20:57 -0000 On 0629T1242, Kyle Evans wrote: > On Mon, Jun 29, 2020 at 10:27 AM Shawn Webb wrote: > > > > Hey Kyle, > > > > On Mon, Jun 29, 2020 at 03:09:14AM +0000, Kyle Evans wrote: > > > Author: kevans > > > Date: Mon Jun 29 03:09:14 2020 > > > New Revision: 362769 > > > URL: https://svnweb.freebsd.org/changeset/base/362769 > > > > > > Log: > > > linuxolator: implement memfd_create syscall > > > > > > This effectively mirrors our libc implementation, but with minor fudging -- > > > name needs to be copied in from userspace, so we just copy it straight into > > > stack-allocated memfd_name into the correct position rather than allocating > > > memory that needs to be cleaned up. > > > > > > The sealing-related fcntl(2) commands, F_GET_SEALS and F_ADD_SEALS, have > > > also been implemented now that we support them. > > > > > > Note that this implementation is still not quite at feature parity w.r.t. > > > the actual Linux version; some caveats, from my foggy memory: > > > > > > - Need to implement SHM_GROW_ON_WRITE, default for memfd (in progress) > > > - LTP wants the memfd name exposed to fdescfs > > > - Linux allows open() of an fdescfs fd with O_TRUNC to truncate after dup. > > > (?) > > > > > > Interested parties can install and run LTP from ports (devel/linux-ltp) to > > > confirm any fixes. > > > > > > PR: 240874 > > > Reviewed by: kib, trasz > > > Differential Revision: https://reviews.freebsd.org/D21845 > > > > RELNOTES? > > > > > > > > Modified: > > > head/sys/amd64/linux/linux_dummy.c > > > head/sys/amd64/linux32/linux32_dummy.c > > > head/sys/arm64/linux/linux_dummy.c > > > head/sys/compat/linux/linux.c > > > head/sys/compat/linux/linux.h > > > head/sys/compat/linux/linux_file.c > > > head/sys/compat/linux/linux_file.h > > > head/sys/i386/linux/linux_dummy.c > > > > Should __FreeBSD_version be bumped? > > > > I'm roping in trasz@, because I'm unsure on either of these points -- > I haven't paid attention and don't know if we typically include linux > syscalls that we implement in relnotes, and given that this commit > only really affects pre-compiled Linux binaries I'm not sure if > there's any utility in bumping __FreeBSD_version; presumably ports > folks can't do anything differently here, and binaries will work just > the same. I don't think we need to bump the version here. As for the relnotes: I hadn't considered that before, but it sounds like a good idea; we probably do want to at least enumerate the major Linuxulator changes there. From owner-svn-src-head@freebsd.org Thu Jul 2 21:04: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 681FF36024D; Thu, 2 Jul 2020 21:04:12 +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 49yVvc2JW7z4Jgg; Thu, 2 Jul 2020 21:04:12 +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 31F1120AAB; Thu, 2 Jul 2020 21:04:12 +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 062L4Cth089316; Thu, 2 Jul 2020 21:04:12 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062L49Oo089298; Thu, 2 Jul 2020 21:04:09 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202007022104.062L49Oo089298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 2 Jul 2020 21:04:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362900 - in head/sys: net netinet netinet6 netpfil/ipfw netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet netinet6 netpfil/ipfw netpfil/ipfw/nat64 X-SVN-Commit-Revision: 362900 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 21:04:12 -0000 Author: melifaro Date: Thu Jul 2 21:04:08 2020 New Revision: 362900 URL: https://svnweb.freebsd.org/changeset/base/362900 Log: Complete conversions from fib<4|6>_lookup_nh_ to fib<4|6>_lookup(). fib[46]_lookup_nh_ represents pre-epoch generation of fib api, providing less guarantees over pointer validness and requiring on-stack data copying. With no callers remaining, remove fib[46]_lookup_nh_ functions. Submitted by: Neel Chauhan Differential Revision: https://reviews.freebsd.org/D25445 Modified: head/sys/net/if_stf.c head/sys/netinet/if_ether.c head/sys/netinet/in_fib.c head/sys/netinet/in_fib.h head/sys/netinet/in_mcast.c head/sys/netinet/ip_options.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_fib.c head/sys/netinet6/in6_fib.h head/sys/netinet6/in6_mcast.c head/sys/netinet6/in6_src.c head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_table_algo.c head/sys/netpfil/ipfw/nat64/nat64_translate.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/net/if_stf.c Thu Jul 2 21:04:08 2020 (r362900) @@ -97,6 +97,7 @@ #include #include #include +#include #include #include #include @@ -568,12 +569,14 @@ stf_checkaddr4(struct stf_softc *sc, struct in_addr *i * perform ingress filter */ if (sc && (STF2IFP(sc)->if_flags & IFF_LINK2) == 0 && inifp) { - struct nhop4_basic nh4; + struct nhop_object *nh; - if (fib4_lookup_nh_basic(sc->sc_fibnum, *in, 0, 0, &nh4) != 0) + NET_EPOCH_ASSERT(); + nh = fib4_lookup(sc->sc_fibnum, *in, 0, 0, 0); + if (nh == NULL) return (-1); - if (nh4.nh_ifp != inifp) + if (nh->nh_ifp != inifp) return (-1); } Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet/if_ether.c Thu Jul 2 21:04:08 2020 (r362900) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -804,7 +805,7 @@ in_arpinput(struct mbuf *m) int carped; struct sockaddr_in sin; struct sockaddr *dst; - struct nhop4_basic nh4; + struct nhop_object *nh; uint8_t linkhdr[LLE_MAX_LINKHDR]; struct route ro; size_t linkhdrsize; @@ -1065,8 +1066,9 @@ reply: if (!V_arp_proxyall) goto drop; - if (fib4_lookup_nh_basic(ifp->if_fib, itaddr, 0, 0, - &nh4) != 0) + NET_EPOCH_ASSERT(); + nh = fib4_lookup(ifp->if_fib, itaddr, 0, 0, 0); + if (nh == NULL) goto drop; /* @@ -1074,7 +1076,7 @@ reply: * as this one came out of, or we'll get into a fight * over who claims what Ether address. */ - if (nh4.nh_ifp == ifp) + if (nh->nh_ifp == ifp) goto drop; (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); @@ -1087,10 +1089,10 @@ reply: * wrong network. */ - if (fib4_lookup_nh_basic(ifp->if_fib, isaddr, 0, 0, - &nh4) != 0) + nh = fib4_lookup(ifp->if_fib, isaddr, 0, 0, 0); + if (nh == NULL) goto drop; - if (nh4.nh_ifp != ifp) { + if (nh->nh_ifp != ifp) { ARP_LOG(LOG_INFO, "proxy: ignoring request" " from %s via %s\n", inet_ntoa_r(isaddr, addrbuf), Modified: head/sys/netinet/in_fib.c ============================================================================== --- head/sys/netinet/in_fib.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet/in_fib.c Thu Jul 2 21:04:08 2020 (r362900) @@ -66,165 +66,6 @@ __FBSDID("$FreeBSD$"); /* Verify struct route compatiblity */ /* Assert 'struct route_in' is compatible with 'struct route' */ CHK_STRUCT_ROUTE_COMPAT(struct route_in, ro_dst4); -static void fib4_rte_to_nh_basic(struct nhop_object *nh, struct in_addr dst, - uint32_t flags, struct nhop4_basic *pnh4); -static void fib4_rte_to_nh_extended(struct nhop_object *nh, struct in_addr dst, - uint32_t flags, struct nhop4_extended *pnh4); - - -static void -fib4_rte_to_nh_basic(struct nhop_object *nh, struct in_addr dst, - uint32_t flags, struct nhop4_basic *pnh4) -{ - - if ((flags & NHR_IFAIF) != 0) - pnh4->nh_ifp = nh->nh_ifa->ifa_ifp; - else - pnh4->nh_ifp = nh->nh_ifp; - pnh4->nh_mtu = nh->nh_mtu; - if (nh->nh_flags & NHF_GATEWAY) - pnh4->nh_addr = nh->gw4_sa.sin_addr; - else - pnh4->nh_addr = dst; - /* Set flags */ - pnh4->nh_flags = nh->nh_flags; - /* TODO: Handle RTF_BROADCAST here */ -} - -static void -fib4_rte_to_nh_extended(struct nhop_object *nh, struct in_addr dst, - uint32_t flags, struct nhop4_extended *pnh4) -{ - - if ((flags & NHR_IFAIF) != 0) - pnh4->nh_ifp = nh->nh_ifa->ifa_ifp; - else - pnh4->nh_ifp = nh->nh_ifp; - pnh4->nh_mtu = nh->nh_mtu; - if (nh->nh_flags & NHF_GATEWAY) - pnh4->nh_addr = nh->gw4_sa.sin_addr; - else - pnh4->nh_addr = dst; - /* Set flags */ - pnh4->nh_flags = nh->nh_flags; - pnh4->nh_ia = ifatoia(nh->nh_ifa); - pnh4->nh_src = IA_SIN(pnh4->nh_ia)->sin_addr; -} - -/* - * Performs IPv4 route table lookup on @dst. Returns 0 on success. - * Stores nexthop info provided @pnh4 structure. - * Note that - * - nh_ifp cannot be safely dereferenced - * - nh_ifp represents logical transmit interface (rt_ifp) (e.g. if - * looking up address on interface "ix0" pointer to "lo0" interface - * will be returned instead of "ix0") - * - nh_ifp represents "address" interface if NHR_IFAIF flag is passed - * - howewer mtu from "transmit" interface will be returned. - */ -int -fib4_lookup_nh_basic(uint32_t fibnum, struct in_addr dst, uint32_t flags, - uint32_t flowid, struct nhop4_basic *pnh4) -{ - RIB_RLOCK_TRACKER; - struct rib_head *rh; - struct radix_node *rn; - struct sockaddr_in sin; - struct nhop_object *nh; - - KASSERT((fibnum < rt_numfibs), ("fib4_lookup_nh_basic: bad fibnum")); - rh = rt_tables_get_rnh(fibnum, AF_INET); - if (rh == NULL) - return (ENOENT); - - /* Prepare lookup key */ - memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_addr = dst; - - RIB_RLOCK(rh); - rn = rh->rnh_matchaddr((void *)&sin, &rh->head); - if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - nh = RNTORT(rn)->rt_nhop; - /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { - fib4_rte_to_nh_basic(nh, dst, flags, pnh4); - RIB_RUNLOCK(rh); - - return (0); - } - } - RIB_RUNLOCK(rh); - - return (ENOENT); -} - -/* - * Performs IPv4 route table lookup on @dst. Returns 0 on success. - * Stores extende nexthop info provided @pnh4 structure. - * Note that - * - nh_ifp cannot be safely dereferenced unless NHR_REF is specified. - * - in that case you need to call fib4_free_nh_ext() - * - nh_ifp represents logical transmit interface (rt_ifp) (e.g. if - * looking up address of interface "ix0" pointer to "lo0" interface - * will be returned instead of "ix0") - * - nh_ifp represents "address" interface if NHR_IFAIF flag is passed - * - howewer mtu from "transmit" interface will be returned. - */ -int -fib4_lookup_nh_ext(uint32_t fibnum, struct in_addr dst, uint32_t flags, - uint32_t flowid, struct nhop4_extended *pnh4) -{ - RIB_RLOCK_TRACKER; - struct rib_head *rh; - struct radix_node *rn; - struct sockaddr_in sin; - struct rtentry *rte; - struct nhop_object *nh; - - KASSERT((fibnum < rt_numfibs), ("fib4_lookup_nh_ext: bad fibnum")); - rh = rt_tables_get_rnh(fibnum, AF_INET); - if (rh == NULL) - return (ENOENT); - - /* Prepare lookup key */ - memset(&sin, 0, sizeof(sin)); - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_addr = dst; - - RIB_RLOCK(rh); - rn = rh->rnh_matchaddr((void *)&sin, &rh->head); - if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - rte = RNTORT(rn); -#ifdef RADIX_MPATH - rte = rt_mpath_select(rte, flowid); - if (rte == NULL) { - RIB_RUNLOCK(rh); - return (ENOENT); - } -#endif - nh = rte->rt_nhop; - /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { - fib4_rte_to_nh_extended(nh, dst, flags, pnh4); - if ((flags & NHR_REF) != 0) { - /* TODO: lwref on egress ifp's ? */ - } - RIB_RUNLOCK(rh); - - return (0); - } - } - RIB_RUNLOCK(rh); - - return (ENOENT); -} - -void -fib4_free_nh_ext(uint32_t fibnum, struct nhop4_extended *pnh4) -{ - -} /* * Looks up path in fib @fibnum specified by @dst. Modified: head/sys/netinet/in_fib.h ============================================================================== --- head/sys/netinet/in_fib.h Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet/in_fib.h Thu Jul 2 21:04:08 2020 (r362900) @@ -45,32 +45,6 @@ struct route_in { struct sockaddr_in ro_dst4; }; -/* Basic nexthop info used for uRPF/mtu checks */ -struct nhop4_basic { - struct ifnet *nh_ifp; /* Logical egress interface */ - uint16_t nh_mtu; /* nexthop mtu */ - uint16_t nh_flags; /* nhop flags */ - struct in_addr nh_addr; /* GW/DST IPv4 address */ -}; - -/* Extended nexthop info used for control protocols */ -struct nhop4_extended { - struct ifnet *nh_ifp; /* Logical egress interface */ - struct in_ifaddr *nh_ia; /* Associated address */ - uint16_t nh_mtu; /* nexthop mtu */ - uint16_t nh_flags; /* nhop flags */ - uint8_t spare[4]; - struct in_addr nh_addr; /* GW/DST IPv4 address */ - struct in_addr nh_src; /* default source IPv4 address */ - uint64_t spare2; -}; - -int fib4_lookup_nh_basic(uint32_t fibnum, struct in_addr dst, uint32_t flags, - uint32_t flowid, struct nhop4_basic *pnh4); -int fib4_lookup_nh_ext(uint32_t fibnum, struct in_addr dst, uint32_t flags, - uint32_t flowid, struct nhop4_extended *pnh4); -void fib4_free_nh_ext(uint32_t fibnum, struct nhop4_extended *pnh4); - struct nhop_object *fib4_lookup(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags, uint32_t flowid); int fib4_check_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet/in_mcast.c Thu Jul 2 21:04:08 2020 (r362900) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1902,7 +1903,7 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, { struct rm_priotracker in_ifa_tracker; struct ifnet *ifp; - struct nhop4_basic nh4; + struct nhop_object *nh; uint32_t fibnum; KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__)); @@ -1916,8 +1917,9 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, IN_IFADDR_RUNLOCK(&in_ifa_tracker); } else { fibnum = inp ? inp->inp_inc.inc_fibnum : 0; - if (fib4_lookup_nh_basic(fibnum, gsin->sin_addr, 0, 0, &nh4)==0) - ifp = nh4.nh_ifp; + nh = fib4_lookup(fibnum, gsin->sin_addr, 0, 0, 0); + if (nh != NULL) + ifp = nh->nh_ifp; else { struct in_ifaddr *ia; struct ifnet *mifp; @@ -2726,6 +2728,7 @@ inp_setmoptions(struct inpcb *inp, struct sockopt *sop { struct ip_moptions *imo; int error; + struct epoch_tracker et; error = 0; @@ -2832,7 +2835,9 @@ inp_setmoptions(struct inpcb *inp, struct sockopt *sop case IP_ADD_SOURCE_MEMBERSHIP: case MCAST_JOIN_GROUP: case MCAST_JOIN_SOURCE_GROUP: + NET_EPOCH_ENTER(et); error = inp_join_group(inp, sopt); + NET_EPOCH_EXIT(et); break; case IP_DROP_MEMBERSHIP: Modified: head/sys/netinet/ip_options.c ============================================================================== --- head/sys/netinet/ip_options.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet/ip_options.c Thu Jul 2 21:04:08 2020 (r362900) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -107,7 +108,7 @@ ip_dooptions(struct mbuf *m, int pass) int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0; struct in_addr *sin, dst; uint32_t ntime; - struct nhop4_extended nh_ext; + struct nhop_object *nh; struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; NET_EPOCH_ASSERT(); @@ -254,11 +255,12 @@ dropit: sizeof(struct in_addr)); } else { /* XXX MRT 0 for routing */ - if (fib4_lookup_nh_ext(M_GETFIB(m), - ipaddr.sin_addr, 0, 0, &nh_ext) != 0) + nh = fib4_lookup(M_GETFIB(m), ipaddr.sin_addr, + 0, NHR_NONE, 0); + if (nh == NULL) goto bad; - memcpy(cp + off, &nh_ext.nh_src, + memcpy(cp + off, &(IA_SIN(nh->nh_ifa)->sin_addr), sizeof(struct in_addr)); } @@ -299,9 +301,9 @@ dropit: if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) != NULL) { memcpy(cp + off, &(IA_SIN(ia)->sin_addr), sizeof(struct in_addr)); - } else if (fib4_lookup_nh_ext(M_GETFIB(m), - ipaddr.sin_addr, 0, 0, &nh_ext) == 0) { - memcpy(cp + off, &nh_ext.nh_src, + } else if ((nh = fib4_lookup(M_GETFIB(m), + ipaddr.sin_addr, 0, NHR_NONE, 0)) != NULL) { + memcpy(cp + off, &(IA_SIN(nh->nh_ifa)->sin_addr), sizeof(struct in_addr)); } else { type = ICMP_UNREACH; Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet6/icmp6.c Thu Jul 2 21:04:08 2020 (r362900) @@ -2270,13 +2270,17 @@ icmp6_redirect_input(struct mbuf *m, int off) } { /* ip6->ip6_src must be equal to gw for icmp6->icmp6_reddst */ - struct nhop6_basic nh6; + struct nhop_object *nh; struct in6_addr kdst; uint32_t scopeid; in6_splitscope(&reddst6, &kdst, &scopeid); - if (fib6_lookup_nh_basic(ifp->if_fib, &kdst, scopeid, 0, 0,&nh6)==0){ - if ((nh6.nh_flags & NHF_GATEWAY) == 0) { + NET_EPOCH_ASSERT(); + nh = fib6_lookup(ifp->if_fib, &kdst, scopeid, 0, 0); + if (nh == NULL) { + struct in6_addr nh_addr; + nh_addr = ifatoia6(nh->nh_ifa)->ia_addr.sin6_addr; + if ((nh->nh_flags & NHF_GATEWAY) == 0) { nd6log((LOG_ERR, "ICMP6 redirect rejected; no route " "with inet6 gateway found for redirect dst: %s\n", @@ -2285,19 +2289,16 @@ icmp6_redirect_input(struct mbuf *m, int off) } /* - * Embed scope zone id into next hop address, since - * fib6_lookup_nh_basic() returns address without embedded - * scope zone id. + * Embed scope zone id into next hop address. */ - if (in6_setscope(&nh6.nh_addr, m->m_pkthdr.rcvif, NULL)) - goto freeit; + nh_addr = nh->gw6_sa.sin6_addr; - if (IN6_ARE_ADDR_EQUAL(&src6, &nh6.nh_addr) == 0) { + if (IN6_ARE_ADDR_EQUAL(&src6, &nh_addr) == 0) { nd6log((LOG_ERR, "ICMP6 redirect rejected; " "not equal to gw-for-src=%s (must be same): " "%s\n", - ip6_sprintf(ip6buf, &nh6.nh_addr), + ip6_sprintf(ip6buf, &nh_addr), icmp6_redirect_diag(&src6, &reddst6, &redtgt6))); goto bad; } Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet6/in6.c Thu Jul 2 21:04:08 2020 (r362900) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -2141,10 +2142,9 @@ in6_lltable_rtcheck(struct ifnet *ifp, const struct sockaddr *l3addr) { const struct sockaddr_in6 *sin6; - struct nhop6_basic nh6; + struct nhop_object *nh; struct in6_addr dst; uint32_t scopeid; - int error; char ip6buf[INET6_ADDRSTRLEN]; int fibnum; @@ -2155,8 +2155,8 @@ in6_lltable_rtcheck(struct ifnet *ifp, sin6 = (const struct sockaddr_in6 *)l3addr; in6_splitscope(&sin6->sin6_addr, &dst, &scopeid); fibnum = V_rt_add_addr_allfibs ? RT_DEFAULT_FIB : ifp->if_fib; - error = fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, 0, &nh6); - if (error != 0 || (nh6.nh_flags & NHF_GATEWAY) || nh6.nh_ifp != ifp) { + nh = fib6_lookup(fibnum, &dst, scopeid, NHR_NONE, 0); + if (nh && ((nh->nh_flags & NHF_GATEWAY) || nh->nh_ifp != ifp)) { struct ifaddr *ifa; /* * Create an ND6 cache for an IPv6 neighbor Modified: head/sys/netinet6/in6_fib.c ============================================================================== --- head/sys/netinet6/in6_fib.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet6/in6_fib.c Thu Jul 2 21:04:08 2020 (r362900) @@ -70,186 +70,8 @@ __FBSDID("$FreeBSD$"); #include #ifdef INET6 -static void fib6_rte_to_nh_extended(const struct nhop_object *nh, - const struct in6_addr *dst, uint32_t flags, struct nhop6_extended *pnh6); -static void fib6_rte_to_nh_basic(const struct nhop_object *nh, const struct in6_addr *dst, - uint32_t flags, struct nhop6_basic *pnh6); -#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa)) - CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst); - - - -static void -fib6_rte_to_nh_basic(const struct nhop_object *nh, const struct in6_addr *dst, - uint32_t flags, struct nhop6_basic *pnh6) -{ - - /* Do explicit nexthop zero unless we're copying it */ - memset(pnh6, 0, sizeof(*pnh6)); - - if ((flags & NHR_IFAIF) != 0) - pnh6->nh_ifp = nh->nh_aifp; - else - pnh6->nh_ifp = nh->nh_ifp; - - pnh6->nh_mtu = nh->nh_mtu; - if (nh->nh_flags & NHF_GATEWAY) { - /* Return address with embedded scope. */ - pnh6->nh_addr = nh->gw6_sa.sin6_addr; - } else - pnh6->nh_addr = *dst; - /* Set flags */ - pnh6->nh_flags = nh->nh_flags; -} - -static void -fib6_rte_to_nh_extended(const struct nhop_object *nh, const struct in6_addr *dst, - uint32_t flags, struct nhop6_extended *pnh6) -{ - - /* Do explicit nexthop zero unless we're copying it */ - memset(pnh6, 0, sizeof(*pnh6)); - - if ((flags & NHR_IFAIF) != 0) - pnh6->nh_ifp = nh->nh_aifp; - else - pnh6->nh_ifp = nh->nh_ifp; - - pnh6->nh_mtu = nh->nh_mtu; - if (nh->nh_flags & NHF_GATEWAY) { - /* Return address with embedded scope. */ - pnh6->nh_addr = nh->gw6_sa.sin6_addr; - } else - pnh6->nh_addr = *dst; - /* Set flags */ - pnh6->nh_flags = nh->nh_flags; - pnh6->nh_ia = ifatoia6(nh->nh_ifa); -} - -/* - * Performs IPv6 route table lookup on @dst. Returns 0 on success. - * Stores basic nexthop info into provided @pnh6 structure. - * Note that - * - nh_ifp represents logical transmit interface (rt_ifp) by default - * - nh_ifp represents "address" interface if NHR_IFAIF flag is passed - * - mtu from logical transmit interface will be returned. - * - nh_ifp cannot be safely dereferenced - * - nh_ifp represents rt_ifp (e.g. if looking up address on - * interface "ix0" pointer to "ix0" interface will be returned instead - * of "lo0") - * - howewer mtu from "transmit" interface will be returned. - * - scope will be embedded in nh_addr - */ -int -fib6_lookup_nh_basic(uint32_t fibnum, const struct in6_addr *dst, uint32_t scopeid, - uint32_t flags, uint32_t flowid, struct nhop6_basic *pnh6) -{ - RIB_RLOCK_TRACKER; - struct rib_head *rh; - struct radix_node *rn; - struct sockaddr_in6 sin6; - struct nhop_object *nh; - - KASSERT((fibnum < rt_numfibs), ("fib6_lookup_nh_basic: bad fibnum")); - rh = rt_tables_get_rnh(fibnum, AF_INET6); - if (rh == NULL) - return (ENOENT); - - /* Prepare lookup key */ - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_addr = *dst; - sin6.sin6_len = sizeof(struct sockaddr_in6); - /* Assume scopeid is valid and embed it directly */ - if (IN6_IS_SCOPE_LINKLOCAL(dst)) - sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff); - - RIB_RLOCK(rh); - rn = rh->rnh_matchaddr((void *)&sin6, &rh->head); - if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - nh = RNTORT(rn)->rt_nhop; - /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { - fib6_rte_to_nh_basic(nh, &sin6.sin6_addr, flags, pnh6); - RIB_RUNLOCK(rh); - return (0); - } - } - RIB_RUNLOCK(rh); - - return (ENOENT); -} - -/* - * Performs IPv6 route table lookup on @dst. Returns 0 on success. - * Stores extended nexthop info into provided @pnh6 structure. - * Note that - * - nh_ifp cannot be safely dereferenced unless NHR_REF is specified. - * - in that case you need to call fib6_free_nh_ext() - * - nh_ifp represents logical transmit interface (rt_ifp) by default - * - nh_ifp represents "address" interface if NHR_IFAIF flag is passed - * - mtu from logical transmit interface will be returned. - * - scope will be embedded in nh_addr - */ -int -fib6_lookup_nh_ext(uint32_t fibnum, const struct in6_addr *dst,uint32_t scopeid, - uint32_t flags, uint32_t flowid, struct nhop6_extended *pnh6) -{ - RIB_RLOCK_TRACKER; - struct rib_head *rh; - struct radix_node *rn; - struct sockaddr_in6 sin6; - struct rtentry *rte; - struct nhop_object *nh; - - KASSERT((fibnum < rt_numfibs), ("fib6_lookup_nh_ext: bad fibnum")); - rh = rt_tables_get_rnh(fibnum, AF_INET6); - if (rh == NULL) - return (ENOENT); - - /* Prepare lookup key */ - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr = *dst; - /* Assume scopeid is valid and embed it directly */ - if (IN6_IS_SCOPE_LINKLOCAL(dst)) - sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff); - - RIB_RLOCK(rh); - rn = rh->rnh_matchaddr((void *)&sin6, &rh->head); - if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - rte = RNTORT(rn); -#ifdef RADIX_MPATH - rte = rt_mpath_select(rte, flowid); - if (rte == NULL) { - RIB_RUNLOCK(rh); - return (ENOENT); - } -#endif - nh = rte->rt_nhop; - /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { - fib6_rte_to_nh_extended(nh, &sin6.sin6_addr, flags, - pnh6); - if ((flags & NHR_REF) != 0) { - /* TODO: Do lwref on egress ifp's */ - } - RIB_RUNLOCK(rh); - - return (0); - } - } - RIB_RUNLOCK(rh); - - return (ENOENT); -} - -void -fib6_free_nh_ext(uint32_t fibnum, struct nhop6_extended *pnh6) -{ - -} /* * Looks up path in fib @fibnum specified by @dst. Modified: head/sys/netinet6/in6_fib.h ============================================================================== --- head/sys/netinet6/in6_fib.h Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet6/in6_fib.h Thu Jul 2 21:04:08 2020 (r362900) @@ -32,33 +32,6 @@ #ifndef _NETINET6_IN6_FIB_H_ #define _NETINET6_IN6_FIB_H_ -/* Basic nexthop info used for uRPF/mtu checks */ -struct nhop6_basic { - struct ifnet *nh_ifp; /* Logical egress interface */ - uint16_t nh_mtu; /* nexthop mtu */ - uint16_t nh_flags; /* nhop flags */ - uint8_t spare[4]; - struct in6_addr nh_addr; /* GW/DST IPv4 address */ -}; - -/* Extended nexthop info used for control protocols. */ -struct nhop6_extended { - struct ifnet *nh_ifp; /* Logical egress interface */ - struct in6_ifaddr *nh_ia; /* Associated address. */ - uint16_t nh_mtu; /* nexthop mtu */ - uint16_t nh_flags; /* nhop flags */ - uint8_t spare[4]; - struct in6_addr nh_addr; /* GW/DST IPv6 address */ - uint64_t spare2[1]; -}; - -int fib6_lookup_nh_basic(uint32_t fibnum, const struct in6_addr *dst, - uint32_t scopeid, uint32_t flags, uint32_t flowid,struct nhop6_basic *pnh6); -int fib6_lookup_nh_ext(uint32_t fibnum, const struct in6_addr *dst, - uint32_t scopeid, uint32_t flags, uint32_t flowid, - struct nhop6_extended *pnh6); -void fib6_free_nh_ext(uint32_t fibnum, struct nhop6_extended *pnh6); - struct nhop_object *fib6_lookup(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags, uint32_t flowid); Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet6/in6_mcast.c Thu Jul 2 21:04:08 2020 (r362900) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1829,7 +1830,7 @@ static struct ifnet * in6p_lookup_mcast_ifp(const struct inpcb *inp, const struct sockaddr_in6 *gsin6) { - struct nhop6_basic nh6; + struct nhop_object *nh; struct in6_addr dst; uint32_t scopeid; uint32_t fibnum; @@ -1841,10 +1842,9 @@ in6p_lookup_mcast_ifp(const struct inpcb *inp, in6_splitscope(&gsin6->sin6_addr, &dst, &scopeid); fibnum = inp ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB; - if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, 0, &nh6) != 0) - return (NULL); + nh = fib6_lookup(fibnum, &dst, scopeid, 0, 0); - return (nh6.nh_ifp); + return (nh ? nh->nh_ifp : NULL); } /* Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netinet6/in6_src.c Thu Jul 2 21:04:08 2020 (r362900) @@ -916,15 +916,16 @@ in6_selecthlim(struct inpcb *inp, struct ifnet *ifp) else if (ifp) return (ND_IFINFO(ifp)->chlim); else if (inp && !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_faddr)) { - struct nhop6_basic nh6; + struct nhop_object *nh; struct in6_addr dst; uint32_t fibnum, scopeid; int hlim; fibnum = inp->inp_inc.inc_fibnum; in6_splitscope(&inp->in6p_faddr, &dst, &scopeid); - if (fib6_lookup_nh_basic(fibnum, &dst, scopeid, 0, 0, &nh6)==0){ - hlim = ND_IFINFO(nh6.nh_ifp)->chlim; + nh = fib6_lookup(fibnum, &dst, scopeid, 0, 0); + if (nh != NULL) { + hlim = ND_IFINFO(nh->nh_ifp)->chlim; return (hlim); } } Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netpfil/ipfw/ip_fw2.c Thu Jul 2 21:04:08 2020 (r362900) @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -466,9 +467,10 @@ verify_path(struct in_addr src, struct ifnet *ifp, u_i #if defined(USERSPACE) || !defined(__FreeBSD__) return 0; #else - struct nhop4_basic nh4; + struct nhop_object *nh; - if (fib4_lookup_nh_basic(fib, src, NHR_IFAIF, 0, &nh4) != 0) + nh = fib4_lookup(fib, src, 0, NHR_NONE, 0); + if (nh == NULL) return (0); /* @@ -478,15 +480,15 @@ verify_path(struct in_addr src, struct ifnet *ifp, u_i * routing entry (via lo0) for our own address * may exist, so we need to handle routing assymetry. */ - if (ifp != NULL && ifp != nh4.nh_ifp) + if (ifp != NULL && ifp != nh->nh_aifp) return (0); /* if no ifp provided, check if rtentry is not default route */ - if (ifp == NULL && (nh4.nh_flags & NHF_DEFAULT) != 0) + if (ifp == NULL && (nh->nh_flags & NHF_DEFAULT) != 0) return (0); /* or if this is a blackhole/reject route */ - if (ifp == NULL && (nh4.nh_flags & (NHF_REJECT|NHF_BLACKHOLE)) != 0) + if (ifp == NULL && (nh->nh_flags & (NHF_REJECT|NHF_BLACKHOLE)) != 0) return (0); /* found valid route */ @@ -805,24 +807,25 @@ ipfw_localip6(struct in6_addr *in6) static int verify_path6(struct in6_addr *src, struct ifnet *ifp, u_int fib) { - struct nhop6_basic nh6; + struct nhop_object *nh; if (IN6_IS_SCOPE_LINKLOCAL(src)) return (1); - if (fib6_lookup_nh_basic(fib, src, 0, NHR_IFAIF, 0, &nh6) != 0) + nh = fib6_lookup(fib, src, 0, NHR_NONE, 0); + if (nh == NULL) return (0); /* If ifp is provided, check for equality with route table. */ - if (ifp != NULL && ifp != nh6.nh_ifp) + if (ifp != NULL && ifp != nh->nh_aifp) return (0); /* if no ifp provided, check if rtentry is not default route */ - if (ifp == NULL && (nh6.nh_flags & NHF_DEFAULT) != 0) + if (ifp == NULL && (nh->nh_flags & NHF_DEFAULT) != 0) return (0); /* or if this is a blackhole/reject route */ - if (ifp == NULL && (nh6.nh_flags & (NHF_REJECT|NHF_BLACKHOLE)) != 0) + if (ifp == NULL && (nh->nh_flags & (NHF_REJECT|NHF_BLACKHOLE)) != 0) return (0); /* found valid route */ Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_algo.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netpfil/ipfw/ip_fw_table_algo.c Thu Jul 2 21:04:08 2020 (r362900) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include /* ip_fw.h requires IFNAMSIZ */ #include #include +#include #include #include @@ -3811,26 +3812,22 @@ ta_lookup_kfib(struct table_info *ti, void *key, uint3 uint32_t *val) { #ifdef INET - struct nhop4_basic nh4; struct in_addr in; #endif -#ifdef INET6 - struct nhop6_basic nh6; -#endif int error; error = ENOENT; #ifdef INET if (keylen == 4) { in.s_addr = *(in_addr_t *)key; - error = fib4_lookup_nh_basic(ti->data, - in, 0, 0, &nh4); + NET_EPOCH_ASSERT(); + error = fib4_lookup(ti->data, in, 0, NHR_NONE, 0) != NULL; } #endif #ifdef INET6 if (keylen == 6) - error = fib6_lookup_nh_basic(ti->data, - (struct in6_addr *)key, 0, 0, 0, &nh6); + error = fib6_lookup(ti->data, (struct in6_addr *)key, + 0, NHR_NONE, 0) != NULL; #endif if (error != 0) Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Jul 2 18:42:43 2020 (r362899) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Jul 2 21:04:08 2020 (r362900) @@ -50,9 +50,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -79,9 +81,9 @@ typedef int (*nat64_output_t)(struct ifnet *, struct m typedef int (*nat64_output_one_t)(struct mbuf *, struct nat64_counters *, void *); -static int nat64_find_route4(struct nhop4_basic *, struct sockaddr_in *, +static struct nhop_object *nat64_find_route4(struct sockaddr_in *, struct mbuf *); -static int nat64_find_route6(struct nhop6_basic *, struct sockaddr_in6 *, +static struct nhop_object *nat64_find_route6(struct sockaddr_in6 *, struct mbuf *); static int nat64_output_one(struct mbuf *, struct nat64_counters *, void *); static int nat64_output(struct ifnet *, struct mbuf *, struct sockaddr *, @@ -172,8 +174,8 @@ static int nat64_direct_output_one(struct mbuf *m, struct nat64_counters *stats, void *logdata) { - struct nhop6_basic nh6; - struct nhop4_basic nh4; + struct nhop_object *nh4 = NULL; + struct nhop_object *nh6 = NULL; struct sockaddr_in6 dst6; struct sockaddr_in dst4; struct sockaddr *dst; @@ -183,25 +185,28 @@ nat64_direct_output_one(struct mbuf *m, struct nat64_c int error; ip4 = mtod(m, struct ip *); + error = 0; switch (ip4->ip_v) { case IPVERSION: dst4.sin_addr = ip4->ip_dst; - error = nat64_find_route4(&nh4, &dst4, m); - if (error != 0) + nh4 = nat64_find_route4(&dst4, m); + if (nh4 == NULL) { NAT64STAT_INC(stats, noroute4); - else { - ifp = nh4.nh_ifp; + error = EHOSTUNREACH; + } else { + ifp = nh4->nh_ifp; dst = (struct sockaddr *)&dst4; } break; case (IPV6_VERSION >> 4): ip6 = mtod(m, struct ip6_hdr *); dst6.sin6_addr = ip6->ip6_dst; - error = nat64_find_route6(&nh6, &dst6, m); - if (error != 0) + nh6 = nat64_find_route6(&dst6, m); + if (nh6 == NULL) { NAT64STAT_INC(stats, noroute6); - else { - ifp = nh6.nh_ifp; + error = EHOSTUNREACH; + } else { + ifp = nh6->nh_ifp; dst = (struct sockaddr *)&dst6; } break; @@ -614,31 +619,31 @@ fail: return (ENOMEM); } -static NAT64NOINLINE int -nat64_find_route6(struct nhop6_basic *pnh, struct sockaddr_in6 *dst, - struct mbuf *m) +static struct nhop_object * +nat64_find_route6(struct sockaddr_in6 *dst, struct mbuf *m) { - - if (fib6_lookup_nh_basic(M_GETFIB(m), &dst->sin6_addr, 0, 0, 0, - pnh) != 0) - return (EHOSTUNREACH); - if (pnh->nh_flags & (NHF_BLACKHOLE | NHF_REJECT)) - return (EHOSTUNREACH); + struct nhop_object *nh; + NET_EPOCH_ASSERT(); + nh = fib6_lookup(M_GETFIB(m), &dst->sin6_addr, 0, 0, 0); + if (nh == NULL) + return NULL; + if (nh->nh_flags & (NHF_BLACKHOLE | NHF_REJECT)) + return NULL; /* * XXX: we need to use destination address with embedded scope * zone id, because LLTABLE uses such form of addresses for lookup. */ dst->sin6_family = AF_INET6; dst->sin6_len = sizeof(*dst); - dst->sin6_addr = pnh->nh_addr; + dst->sin6_addr = ifatoia6(nh->nh_ifa)->ia_addr.sin6_addr; if (IN6_IS_SCOPE_LINKLOCAL(&dst->sin6_addr)) dst->sin6_addr.s6_addr16[1] = - htons(pnh->nh_ifp->if_index & 0xffff); + htons(nh->nh_ifp->if_index & 0xffff); dst->sin6_port = 0; dst->sin6_scope_id = 0; dst->sin6_flowinfo = 0; - return (0); + return nh; } #define NAT64_ICMP6_PLEN 64 @@ -766,21 +771,23 @@ freeit: m_freem(m); } -static NAT64NOINLINE int -nat64_find_route4(struct nhop4_basic *pnh, struct sockaddr_in *dst, - struct mbuf *m) +static struct nhop_object * +nat64_find_route4(struct sockaddr_in *dst, struct mbuf *m) { + struct nhop_object *nh; - if (fib4_lookup_nh_basic(M_GETFIB(m), dst->sin_addr, 0, 0, pnh) != 0) - return (EHOSTUNREACH); - if (pnh->nh_flags & (NHF_BLACKHOLE | NHF_BROADCAST | NHF_REJECT)) - return (EHOSTUNREACH); + NET_EPOCH_ASSERT(); + nh = fib4_lookup(M_GETFIB(m), dst->sin_addr, 0, 0, 0); + if (nh == NULL) + return NULL; + if (nh->nh_flags & (NHF_BLACKHOLE | NHF_BROADCAST | NHF_REJECT)) + return NULL; dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); - dst->sin_addr = pnh->nh_addr; + dst->sin_addr = IA_SIN(nh->nh_ifa)->sin_addr; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Jul 2 22:59: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 EFE52361AF3; Thu, 2 Jul 2020 22:59:05 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49yYS96492z4P8R; Thu, 2 Jul 2020 22:59:05 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B39EB21F9C; Thu, 2 Jul 2020 22:59:05 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 062Mx5dN056535; Thu, 2 Jul 2020 22:59:05 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 062Mx5Up056534; Thu, 2 Jul 2020 22:59:05 GMT (envelope-from grog@FreeBSD.org) Message-Id: <202007022259.062Mx5Up056534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Thu, 2 Jul 2020 22:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362901 - head/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Group: head X-SVN-Commit-Author: grog X-SVN-Commit-Paths: head/usr.bin/calendar/calendars/de_DE.ISO8859-1 X-SVN-Commit-Revision: 362901 X-SVN-Commit-Repository: base MIME-Version: 1.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, 02 Jul 2020 22:59:06 -0000 Author: grog Date: Thu Jul 2 22:59:05 2020 New Revision: 362901 URL: https://svnweb.freebsd.org/changeset/base/362901 Log: Use canonical description for Schlacht bei Königgrätz, add year. Modified: head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Modified: head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte ============================================================================== --- head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Thu Jul 2 21:04:08 2020 (r362900) +++ head/usr.bin/calendar/calendars/de_DE.ISO8859-1/calendar.geschichte Thu Jul 2 22:59:05 2020 (r362901) @@ -36,7 +36,7 @@ LANG=de_DE.ISO8859-1 Paulskirche, Wahl von Friedrich Wilhelm IV von Preußen zum deutschen Kaiser, 1849 04/28 Ablehnung der deutschen Kaiserkrone durch den preußischen König, 1849 -07/03 Schlacht von Königgrätz +07/03 Schlacht bei Königgrätz, 1866 07/13 Emser Depesche, 1870 07/18 Verkündung des Dogmas von der päpstlichen Unfehlbarkeit durch das I. Vatikanische Konzil From owner-svn-src-head@freebsd.org Fri Jul 3 00: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 4C2D4363586; Fri, 3 Jul 2020 00:09:44 +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 49yb1h189Vz4RYl; Fri, 3 Jul 2020 00:09:44 +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 E1CE122C9C; Fri, 3 Jul 2020 00:09:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06309hhb099590; Fri, 3 Jul 2020 00:09:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06309gcC099579; Fri, 3 Jul 2020 00:09:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202007030009.06309gcC099579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 3 Jul 2020 00:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362902 - in head/lib/csu: . aarch64 amd64 arm i386 mips powerpc powerpc64 riscv X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/lib/csu: . aarch64 amd64 arm i386 mips powerpc powerpc64 riscv X-SVN-Commit-Revision: 362902 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 00:09:44 -0000 Author: jhb Date: Fri Jul 3 00:09:41 2020 New Revision: 362902 URL: https://svnweb.freebsd.org/changeset/base/362902 Log: Consolidate duplicated logic in csu Makefiles to lib/csu/Makefile.inc. Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25537 Modified: head/lib/csu/Makefile.inc head/lib/csu/aarch64/Makefile head/lib/csu/amd64/Makefile head/lib/csu/arm/Makefile head/lib/csu/i386/Makefile head/lib/csu/mips/Makefile head/lib/csu/powerpc/Makefile head/lib/csu/powerpc64/Makefile head/lib/csu/riscv/Makefile Modified: head/lib/csu/Makefile.inc ============================================================================== --- head/lib/csu/Makefile.inc Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/Makefile.inc Fri Jul 3 00:09:41 2020 (r362902) @@ -8,15 +8,52 @@ NO_WMISSING_VARIABLE_DECLARATIONS= .if !defined(BUILDING_TESTS) +OBJS+= Scrt1.o crt1.o gcrt1.o OBJS+= crtbegin.o crtbeginS.o crtbeginT.o OBJS+= crtend.o crtendS.o +OBJS+= crti.o crtn.o +CRT1OBJS+= crtbrand.o ignore_init_note.o + ACFLAGS+= -DLOCORE CFLAGS+= -fno-asynchronous-unwind-tables CFLAGS+= -fno-omit-frame-pointer +CFLAGS+= -I${.CURDIR:H}/common \ + -I${SRCTOP}/lib/libc/include CFLAGS_CRTS= -DSHARED ${PICFLAG} + +FILES= ${OBJS} +FILESMODE= ${LIBMODE} +FILESOWN= ${LIBOWN} +FILESGRP= ${LIBGRP} +FILESDIR= ${LIBDIR} +# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. +.undef LIBRARIES_ONLY + +CLEANFILES+= ${OBJS} ${CRT1OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o + +crt1.o: crt1_c.o ${CRT1OBJS} + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} +.if ${MACHINE_ARCH} == "i386" + ${OBJCOPY} --localize-symbol _start1 crt1.o +.endif + +gcrt1_c.o: crt1_c.c + ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c + +gcrt1.o: gcrt1_c.o ${CRT1OBJS} + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} + +Scrt1_c.o: crt1_c.c + ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c + +Scrt1.o: Scrt1_c.o ${CRT1OBJS} + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} +.if ${MACHINE_ARCH} == "i386" + ${OBJCOPY} --localize-symbol _start1 crt1.o +.endif crtbegin.o: crtbegin.c crtbeginS.o: crtbegin.c Modified: head/lib/csu/aarch64/Makefile ============================================================================== --- head/lib/csu/aarch64/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/aarch64/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,37 +2,8 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o gcrt1.o -CFLAGS+= -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include CFLAGS+= -DCRT_IRELOC_SUPPRESS -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} +CRT1OBJS+= crt1_s.o .include Modified: head/lib/csu/amd64/Makefile ============================================================================== --- head/lib/csu/amd64/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/amd64/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,37 +2,7 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o gcrt1.o -CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include +CFLAGS+= -I${.CURDIR} CFLAGS+= -fno-omit-frame-pointer -DCRT_IRELOC_RELA - -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o - -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o .include Modified: head/lib/csu/arm/Makefile ============================================================================== --- head/lib/csu/arm/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/arm/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,40 +2,8 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o gcrt1.o -CFLAGS+= -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include CFLAGS+= -DCRT_IRELOC_SUPPRESS -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o - -crt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} +CRT1OBJS+= crt1_s.o .include Modified: head/lib/csu/i386/Makefile ============================================================================== --- head/lib/csu/i386/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/i386/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,39 +2,9 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o gcrt1.o -CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include +CFLAGS+= -I${.CURDIR} CFLAGS+= -DCRT_IRELOC_REL -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - ${OBJCOPY} --localize-symbol _start1 crt1.o - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - ${OBJCOPY} --localize-symbol _start1 Scrt1.o +CRT1OBJS+= crt1_s.o .include Modified: head/lib/csu/mips/Makefile ============================================================================== --- head/lib/csu/mips/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/mips/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,37 +2,6 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o gcrt1.o -CFLAGS+= -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include CFLAGS+= -DCRT_IRELOC_SUPPRESS - -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o - -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o .include Modified: head/lib/csu/powerpc/Makefile ============================================================================== --- head/lib/csu/powerpc/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/powerpc/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,37 +2,7 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S crtsavres.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o gcrt1.o -CFLAGS+= -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include +OBJS+= crtsavres.o CFLAGS+= -DCRT_IRELOC_SUPPRESS - -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o - -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o .include Modified: head/lib/csu/powerpc64/Makefile ============================================================================== --- head/lib/csu/powerpc64/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/powerpc64/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,42 +2,14 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o crtsavres.o gcrt1.o -CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include \ +OBJS+= crtsavres.o +CFLAGS+= -I${.CURDIR} \ -mlongcall -DCRT_IRELOC_RELA -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o CLEANFILES+= crtsavres.S # On powerpc64 crtsavres is an empty file crtsavres.S: touch ${.TARGET} - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o - -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o .include Modified: head/lib/csu/riscv/Makefile ============================================================================== --- head/lib/csu/riscv/Makefile Thu Jul 2 22:59:05 2020 (r362901) +++ head/lib/csu/riscv/Makefile Fri Jul 3 00:09:41 2020 (r362902) @@ -2,37 +2,8 @@ .PATH: ${.CURDIR:H}/common -SRCS= crti.S crtn.S -OBJS= ${SRCS:N*.h:R:S/$/.o/g} -OBJS+= Scrt1.o crt1.o gcrt1.o -CFLAGS+= -I${.CURDIR:H}/common \ - -I${SRCTOP}/lib/libc/include CFLAGS+= -DCRT_IRELOC_SUPPRESS -FILES= ${OBJS} -FILESMODE= ${LIBMODE} -FILESOWN= ${LIBOWN} -FILESGRP= ${LIBGRP} -FILESDIR= ${LIBDIR} -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. -.undef LIBRARIES_ONLY - -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o -CLEANFILES+= crtbrand.o ignore_init_note.o - -gcrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} - -Scrt1_c.o: crt1_c.c - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c - -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} +CRT1OBJS+= crt1_s.o .include From owner-svn-src-head@freebsd.org Fri Jul 3 00:26: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 711B0363A55; Fri, 3 Jul 2020 00:26:31 +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 49ybP30z2Lz4Sk4; Fri, 3 Jul 2020 00:26:30 +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 1jr9X6-0004v1-2I; Thu, 02 Jul 2020 17:26:24 -0700 Received: (from gonzo@localhost) by id.bluezbox.com (8.15.2/8.15.2/Submit) id 0630QNEe018910; Thu, 2 Jul 2020 17:26:23 -0700 (PDT) (envelope-from gonzo@freebsd.org) X-Authentication-Warning: id.bluezbox.com: gonzo set sender to gonzo@freebsd.org using -f Date: Thu, 2 Jul 2020 17:26:23 -0700 From: Oleksandr Tymoshenko To: Peter Jeremy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362736 - head/sys/arm64/rockchip Message-ID: <20200703002623.GA18584@bluezbox.com> References: <202006282111.05SLBAAq025544@repo.freebsd.org> <20200701085747.GA23928@server.rulingia.com> <20200701124738.GA30133@server.rulingia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200701124738.GA30133@server.rulingia.com> 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: Peter Jeremy (peter@rulingia.com) wrote: > On 2020-Jul-01 18:57:47 +1000, Peter Jeremy wrote: > >On 2020-Jun-28 21:11:10 +0000, Oleksandr Tymoshenko wro [...] 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: 49ybP30z2Lz4Sk4 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:14061, ipnet:45.55.0.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: Fri, 03 Jul 2020 00:26:31 -0000 Peter Jeremy (peter@rulingia.com) wrote: > On 2020-Jul-01 18:57:47 +1000, Peter Jeremy wrote: > >On 2020-Jun-28 21:11:10 +0000, Oleksandr Tymoshenko wrote: > >>Log: > >> Configure rx_delay/tx_delay values for RK3399/RK3328 GMAC > >> > >> For 1000Mb mode to work reliably TX/RX delays need to be configured > >> between the TX/RX clock and the respective signals on the PHY > >> to compensate for differing trace lengths on the PCB. > > > >This breaks (at least) diskless booting on my Rock64. > > I've studied the RK3328 TRM[1] and the RK3328 code following r362736 > matches[2] the GRF_MAC_CON0/1 documentation on p201-203 (though p574 > says the delay line is configured via GRF_SOC_CON3 - which doesn't > match the documentation on GRF_SOC_CON3 on p175-177). That suggests > that the delay values in the FDT are incorrect. Unfortunately, the > TRM doesn't include any details on how to configure the delay values > so it's difficult to adjust the numbers in the FDT. > > One possible explanation I have is that there are (at least) 2 > different Rock64 variants. Later versions have increased the RGMII > bus voltage to improve GigE reliability. I initially had problems > with GigE reliability and mod'd my Rock64[3] to use the higher RGMII > bus voltage - which made it rock solid at GigE. It's possible that > different variants need different delay values, due to different track > skew or different driver behaviour at different bus voltages. > > [1] Rockchip_RK3328TRM_V1.1-Part1-20170321.pdf > [2] There's one typo: RK3328_GRF_MAC_CON0_TX_MASK instead of > RK3328_GRF_MAC_CON0_RX_MASK but the values are the same). > [3] Move 1 resistor to change a pull-up to a pull-down Hi Peter, Could you try kernel with this patch? It's mostly debug output, with one possible clock-related fix. https://people.freebsd.org/~gonzo/patches/rk3328-gmac-debug.patch I have Rock64 v2, which, as you mentioned, has a known issue with GigE, so my tests are not reliable. I'll try to get another RK3328 board for tests, but it may take some time. If the clock fix doesn't help, I'll make delays configuration run-time configurable with off by default until more hardware is tested. -- gonzo From owner-svn-src-head@freebsd.org Fri Jul 3 01:19: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 945143641DE; Fri, 3 Jul 2020 01:19:30 +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 49ycZB3PJPz4VYH; Fri, 3 Jul 2020 01:19:30 +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 5874F239BF; Fri, 3 Jul 2020 01:19:30 +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 0631JUuh042081; Fri, 3 Jul 2020 01:19:30 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0631JTvr042079; Fri, 3 Jul 2020 01:19:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007030119.0631JTvr042079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 3 Jul 2020 01:19:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362903 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 362903 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 01:19:30 -0000 Author: rmacklem Date: Fri Jul 3 01:19:29 2020 New Revision: 362903 URL: https://svnweb.freebsd.org/changeset/base/362903 Log: Add support for ext_pgs mbufs to nfsm_build(). This is the first of a series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Modified: head/sys/fs/nfs/nfsm_subs.h head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfsm_subs.h ============================================================================== --- head/sys/fs/nfs/nfsm_subs.h Fri Jul 3 00:09:41 2020 (r362902) +++ head/sys/fs/nfs/nfsm_subs.h Fri Jul 3 01:19:29 2020 (r362903) @@ -64,14 +64,27 @@ nfsm_build(struct nfsrv_descript *nd, int siz) void *retp; struct mbuf *mb2; - if (siz > M_TRAILINGSPACE(nd->nd_mb)) { + if ((nd->nd_flag & ND_EXTPG) == 0 && + siz > M_TRAILINGSPACE(nd->nd_mb)) { NFSMCLGET(mb2, M_NOWAIT); if (siz > MLEN) panic("build > MLEN"); mb2->m_len = 0; - nd->nd_bpos = mtod(mb2, caddr_t); + nd->nd_bpos = mtod(mb2, char *); nd->nd_mb->m_next = mb2; nd->nd_mb = mb2; + } else if ((nd->nd_flag & ND_EXTPG) != 0) { + if (siz > nd->nd_bextpgsiz) { + mb2 = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); + nd->nd_bpos = (char *)(void *) + PHYS_TO_DMAP(mb2->m_epg_pa[0]); + nd->nd_bextpg = 0; + nd->nd_bextpgsiz = PAGE_SIZE - siz; + nd->nd_mb->m_next = mb2; + nd->nd_mb = mb2; + } else + nd->nd_bextpgsiz -= siz; + nd->nd_mb->m_epg_last_len += siz; } retp = (void *)(nd->nd_bpos); nd->nd_mb->m_len += siz; Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Fri Jul 3 00:09:41 2020 (r362902) +++ head/sys/fs/nfs/nfsport.h Fri Jul 3 01:19:29 2020 (r362903) @@ -109,8 +109,9 @@ #include #include #include -#include #include +#include +#include #include #include "opt_nfs.h" #include "opt_ufs.h" From owner-svn-src-head@freebsd.org Fri Jul 3 01:21: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 57831364B2A; Fri, 3 Jul 2020 01:21:07 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (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 49ycc26vZqz4VlM; Fri, 3 Jul 2020 01:21:06 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yb1-f170.google.com with SMTP id s1so14678642ybo.7; Thu, 02 Jul 2020 18:21:06 -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:from:date :message-id:subject:to:cc; bh=v1R+pE5brkQucsvxSb2fDW8kPLQPqE9/bNGoTxwCwDk=; b=FUqyhrMfRJ92h1t99keNV+F39Cl1F357/azXljZZflnleGqdMQsE1uqC4m0lGkfzQK jlZVSeYyR3wJt5QFNSN77BvXI2b4pIR0AvdsGpSEhN+imyJ3p7n/H/siHmLqbkz65Nzn jeJ+BXAmKvx4LFrf2ArGVp4Z99pXAlqN/068s24rLA0XRxvrnqbIN6I+HakoHsVv0nOq CUgDUUFa01KVVc0cWBdBQt0wBbOpx/OUGt7ckmJeJDxX3d4H55/1GHcMFm2b/iFvFbah y1eZ205ryIAalu3HDUnMrmhMQM1sXm0RZzQK9aPOhH9dtZIVyGBrksw29RJ+kWbRyDyJ gmfg== X-Gm-Message-State: AOAM530SD6sshTd2mlDDPRlQVfii/x81cErDt/x+Hztt9Jiecl06Gg3a eMt89Re0jlv7AcdPIBs+wCEhfJHrrdEtoov51bdKUzV979A= X-Google-Smtp-Source: ABdhPJzF51Ay9gbXLuFxowLNDSGnnHvEuZeDGNzaq6RGe2GRWJ9mowPU7g882wXgn88k5Sc3nO+hHot6pPxYeJUR1Ew= X-Received: by 2002:a25:c646:: with SMTP id k67mr56417759ybf.110.1593739265727; Thu, 02 Jul 2020 18:21:05 -0700 (PDT) MIME-Version: 1.0 References: <202007022104.062L49Oo089298@repo.freebsd.org> In-Reply-To: <202007022104.062L49Oo089298@repo.freebsd.org> From: Li-Wen Hsu Date: Fri, 3 Jul 2020 09:20:54 +0800 Message-ID: Subject: Re: svn commit: r362900 - in head/sys: net netinet netinet6 netpfil/ipfw netpfil/ipfw/nat64 To: "Alexander V. Chernikov" , Neel Chauhan Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 49ycc26vZqz4VlM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; 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, 03 Jul 2020 01:21:07 -0000 On Fri, Jul 3, 2020 at 5:04 AM Alexander V. Chernikov wrote: > > Author: melifaro > Date: Thu Jul 2 21:04:08 2020 > New Revision: 362900 > URL: https://svnweb.freebsd.org/changeset/base/362900 > > Log: > Complete conversions from fib<4|6>_lookup_nh_ to fib<4|6>_lookup(). > > fib[46]_lookup_nh_ represents pre-epoch generation of fib api, providing less guarantees > over pointer validness and requiring on-stack data copying. > > With no callers remaining, remove fib[46]_lookup_nh_ functions. > > Submitted by: Neel Chauhan > Differential Revision: https://reviews.freebsd.org/D25445 > > Modified: > head/sys/net/if_stf.c > head/sys/netinet/if_ether.c > head/sys/netinet/in_fib.c > head/sys/netinet/in_fib.h > head/sys/netinet/in_mcast.c > head/sys/netinet/ip_options.c > head/sys/netinet6/icmp6.c > head/sys/netinet6/in6.c > head/sys/netinet6/in6_fib.c > head/sys/netinet6/in6_fib.h > head/sys/netinet6/in6_mcast.c > head/sys/netinet6/in6_src.c > head/sys/netpfil/ipfw/ip_fw2.c > head/sys/netpfil/ipfw/ip_fw_table_algo.c > head/sys/netpfil/ipfw/nat64/nat64_translate.c Hi, sys.netinet6.redirect.valid_redirect is failing after this change: https://ci.freebsd.org/job/FreeBSD-head-amd64-test/15739/testReport/junit/sys.netinet6/redirect/valid_redirect/ https://ci.freebsd.org/job/FreeBSD-head-i386-test/9849/testReport/junit/sys.netinet6/redirect/valid_redirect/ Can you help check if the code or test needs fixing? Thanks, Li-Wen From owner-svn-src-head@freebsd.org Fri Jul 3 02:02: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 8705C3651E4; Fri, 3 Jul 2020 02:02:35 +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 49ydWv34qvz4XGC; Fri, 3 Jul 2020 02:02:35 +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 4DDFC23DDC; Fri, 3 Jul 2020 02:02:35 +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 06322ZOW072222; Fri, 3 Jul 2020 02:02:35 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06322ZHo072221; Fri, 3 Jul 2020 02:02:35 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <202007030202.06322ZHo072221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 3 Jul 2020 02:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362904 - head/tests/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/tests/sys/netinet6 X-SVN-Commit-Revision: 362904 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 02:02:35 -0000 Author: lwhsu Date: Fri Jul 3 02:02:34 2020 New Revision: 362904 URL: https://svnweb.freebsd.org/changeset/base/362904 Log: Temporarily skip sys.netinet6.redirect.valid_redirect in CI PR: 247729 Sponsored by: The FreeBSD Foundation Modified: head/tests/sys/netinet6/redirect.sh Modified: head/tests/sys/netinet6/redirect.sh ============================================================================== --- head/tests/sys/netinet6/redirect.sh Fri Jul 3 01:19:29 2020 (r362903) +++ head/tests/sys/netinet6/redirect.sh Fri Jul 3 02:02:34 2020 (r362904) @@ -40,6 +40,10 @@ valid_redirect_head() { valid_redirect_body() { + if [ "$(atf_config_get ci false)" = "true" ]; then + atf_skip "https://bugs.freebsd.org/247729" + fi + ids=65533 id=`printf "%x" ${ids}` if [ $$ -gt 65535 ]; then From owner-svn-src-head@freebsd.org Fri Jul 3 04:44: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 53980369825; Fri, 3 Jul 2020 04:44:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49yj6d1p4Wz3Sws; Fri, 3 Jul 2020 04:44:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07E2326226; Fri, 3 Jul 2020 04:44:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0634iOcZ071903; Fri, 3 Jul 2020 04:44:24 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0634iNGo071896; Fri, 3 Jul 2020 04:44:23 GMT (envelope-from np@FreeBSD.org) Message-Id: <202007030444.0634iNGo071896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 3 Jul 2020 04:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362905 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 362905 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 04:44:25 -0000 Author: np Date: Fri Jul 3 04:44:23 2020 New Revision: 362905 URL: https://svnweb.freebsd.org/changeset/base/362905 Log: cxgbe(4): changes in the Tx path to help increase tx coalescing. - Ask the firmware for the number of frames that can be stuffed in one work request. - Modify mp_ring to increase the likelihood of tx coalescing when there are just one or two threads that are doing most of the tx. Add teeth to the abdication mechanism by pushing the consumer lock into mp_ring. This reduces the likelihood that a consumer will get stuck with all the work even though it is above its budget. - Add support for coalesced tx WR to the VF driver. This, with the changes above, results in a 7x improvement in the tx pps of the VF driver for some common cases. The firmware vets the L2 headers submitted by the VF driver and it's a big win if the checks are performed for a batch of packets and not each one individually. Reviewed by: jhb@ MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D25454 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_mp_ring.c head/sys/dev/cxgbe/t4_mp_ring.h head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/t4_vf.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Fri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/adapter.h Fri Jul 3 04:44:23 2020 (r362905) @@ -550,6 +550,23 @@ struct sge_fl { struct mp_ring; +struct txpkts { + uint8_t wr_type; /* type 0 or type 1 */ + uint8_t npkt; /* # of packets in this work request */ + uint8_t len16; /* # of 16B pieces used by this work request */ + uint8_t score; /* 1-10. coalescing attempted if score > 3 */ + uint8_t max_npkt; /* maximum number of packets allowed */ + uint16_t plen; /* total payload (sum of all packets) */ + + /* straight from fw_eth_tx_pkts_vm_wr. */ + __u8 ethmacdst[6]; + __u8 ethmacsrc[6]; + __be16 ethtype; + __be16 vlantci; + + struct mbuf *mb[15]; +}; + /* txq: SGE egress queue + what's needed for Ethernet NIC */ struct sge_txq { struct sge_eq eq; /* MUST be first */ @@ -560,6 +577,7 @@ struct sge_txq { struct sglist *gl; __be32 cpl_ctrl0; /* for convenience */ int tc_idx; /* traffic class */ + struct txpkts txp; struct task tx_reclaim_task; /* stats for common events first */ Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Fri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/common/common.h Fri Jul 3 04:44:23 2020 (r362905) @@ -389,6 +389,7 @@ struct adapter_params { bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */ bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */ bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ + unsigned int max_pkts_per_eth_tx_pkts_wr; }; #define CHELSIO_T4 0x4 Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/t4_main.c Fri Jul 3 04:44:23 2020 (r362905) @@ -2191,7 +2191,7 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) vi->rsrv_noflowq); items[0] = m; - rc = mp_ring_enqueue(txq->r, items, 1, 4096); + rc = mp_ring_enqueue(txq->r, items, 1, 256); if (__predict_false(rc != 0)) m_freem(m); @@ -2212,7 +2212,7 @@ cxgbe_qflush(struct ifnet *ifp) txq->eq.flags |= EQ_QFLUSH; TXQ_UNLOCK(txq); while (!mp_ring_is_idle(txq->r)) { - mp_ring_check_drainage(txq->r, 0); + mp_ring_check_drainage(txq->r, 4096); pause("qflush", 1); } TXQ_LOCK(txq); @@ -2261,7 +2261,7 @@ vi_get_counter(struct ifnet *ifp, ift_counter c) struct sge_txq *txq; for_each_txq(vi, i, txq) - drops += counter_u64_fetch(txq->r->drops); + drops += counter_u64_fetch(txq->r->dropped); } return (drops); @@ -2326,7 +2326,7 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) struct sge_txq *txq; for_each_txq(vi, i, txq) - drops += counter_u64_fetch(txq->r->drops); + drops += counter_u64_fetch(txq->r->dropped); } return (drops); @@ -4457,6 +4457,13 @@ get_params__post_init(struct adapter *sc) else sc->params.fr_nsmr_tpte_wr_support = false; + param[0] = FW_PARAM_PFVF(MAX_PKTS_PER_ETH_TX_PKTS_WR); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) + sc->params.max_pkts_per_eth_tx_pkts_wr = val[0]; + else + sc->params.max_pkts_per_eth_tx_pkts_wr = 15; + /* get capabilites */ bzero(&caps, sizeof(caps)); caps.op_to_write = htobe32(V_FW_CMD_OP(FW_CAPS_CONFIG_CMD) | @@ -5965,7 +5972,7 @@ quiesce_txq(struct adapter *sc, struct sge_txq *txq) /* Wait for the mp_ring to empty. */ while (!mp_ring_is_idle(txq->r)) { - mp_ring_check_drainage(txq->r, 0); + mp_ring_check_drainage(txq->r, 4096); pause("rquiesce", 1); } Modified: head/sys/dev/cxgbe/t4_mp_ring.c ============================================================================== --- head/sys/dev/cxgbe/t4_mp_ring.c Fri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/t4_mp_ring.c Fri Jul 3 04:44:23 2020 (r362905) @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include "t4_mp_ring.h" @@ -43,6 +45,23 @@ __FBSDID("$FreeBSD$"); #define atomic_cmpset_rel_64 atomic_cmpset_64 #endif +/* + * mp_ring handles multiple threads (producers) enqueueing data to a tx queue. + * The thread that is writing the hardware descriptors is the consumer and it + * runs with the consumer lock held. A producer becomes the consumer if there + * isn't one already. The consumer runs with the flags sets to BUSY and + * consumes everything (IDLE or COALESCING) or gets STALLED. If it is running + * over its budget it sets flags to TOO_BUSY. A producer that observes a + * TOO_BUSY consumer will become the new consumer by setting flags to + * TAKING_OVER. The original consumer stops and sets the flags back to BUSY for + * the new consumer. + * + * COALESCING is the same as IDLE except there are items being held in the hope + * that they can be coalesced with items that follow. The driver must arrange + * for a tx update or some other event that transmits all the held items in a + * timely manner if nothing else is enqueued. + */ + union ring_state { struct { uint16_t pidx_head; @@ -54,13 +73,21 @@ union ring_state { }; enum { - IDLE = 0, /* consumer ran to completion, nothing more to do. */ + IDLE = 0, /* tx is all caught up, nothing to do. */ + COALESCING, /* IDLE, but tx frames are being held for coalescing */ BUSY, /* consumer is running already, or will be shortly. */ + TOO_BUSY, /* consumer is running and is beyond its budget */ + TAKING_OVER, /* new consumer taking over from a TOO_BUSY consumer */ STALLED, /* consumer stopped due to lack of resources. */ - ABDICATED, /* consumer stopped even though there was work to be - done because it wants another thread to take over. */ }; +enum { + C_FAST = 0, + C_2, + C_3, + C_TAKEOVER, +}; + static inline uint16_t space_available(struct mp_ring *r, union ring_state s) { @@ -83,93 +110,104 @@ increment_idx(struct mp_ring *r, uint16_t idx, uint16_ return (x > n ? idx + n : n - x); } -/* Consumer is about to update the ring's state to s */ -static inline uint16_t -state_to_flags(union ring_state s, int abdicate) -{ - - if (s.cidx == s.pidx_tail) - return (IDLE); - else if (abdicate && s.pidx_tail != s.pidx_head) - return (ABDICATED); - - return (BUSY); -} - /* - * Caller passes in a state, with a guarantee that there is work to do and that - * all items up to the pidx_tail in the state are visible. + * Consumer. Called with the consumer lock held and a guarantee that there is + * work to do. */ static void -drain_ring(struct mp_ring *r, union ring_state os, uint16_t prev, int budget) +drain_ring(struct mp_ring *r, int budget) { - union ring_state ns; + union ring_state os, ns; int n, pending, total; - uint16_t cidx = os.cidx; - uint16_t pidx = os.pidx_tail; + uint16_t cidx; + uint16_t pidx; + bool coalescing; + mtx_assert(r->cons_lock, MA_OWNED); + + os.state = atomic_load_acq_64(&r->state); MPASS(os.flags == BUSY); + + cidx = os.cidx; + pidx = os.pidx_tail; MPASS(cidx != pidx); - if (prev == IDLE) - counter_u64_add(r->starts, 1); pending = 0; total = 0; while (cidx != pidx) { /* Items from cidx to pidx are available for consumption. */ - n = r->drain(r, cidx, pidx); + n = r->drain(r, cidx, pidx, &coalescing); if (n == 0) { critical_enter(); - os.state = r->state; + os.state = atomic_load_64(&r->state); do { ns.state = os.state; ns.cidx = cidx; - ns.flags = STALLED; + + MPASS(os.flags == BUSY || + os.flags == TOO_BUSY || + os.flags == TAKING_OVER); + + if (os.flags == TAKING_OVER) + ns.flags = BUSY; + else + ns.flags = STALLED; } while (atomic_fcmpset_64(&r->state, &os.state, ns.state) == 0); critical_exit(); - if (prev != STALLED) + if (os.flags == TAKING_OVER) + counter_u64_add(r->abdications, 1); + else if (ns.flags == STALLED) counter_u64_add(r->stalls, 1); - else if (total > 0) { - counter_u64_add(r->restarts, 1); - counter_u64_add(r->stalls, 1); - } break; } cidx = increment_idx(r, cidx, n); pending += n; total += n; + counter_u64_add(r->consumed, n); - /* - * We update the cidx only if we've caught up with the pidx, the - * real cidx is getting too far ahead of the one visible to - * everyone else, or we have exceeded our budget. - */ - if (cidx != pidx && pending < 64 && total < budget) - continue; - critical_enter(); - os.state = r->state; + os.state = atomic_load_64(&r->state); do { + MPASS(os.flags == BUSY || os.flags == TOO_BUSY || + os.flags == TAKING_OVER); + ns.state = os.state; ns.cidx = cidx; - ns.flags = state_to_flags(ns, total >= budget); + if (__predict_false(os.flags == TAKING_OVER)) { + MPASS(total >= budget); + ns.flags = BUSY; + continue; + } + if (cidx == os.pidx_tail) { + ns.flags = coalescing ? COALESCING : IDLE; + continue; + } + if (total >= budget) { + ns.flags = TOO_BUSY; + continue; + } + MPASS(os.flags == BUSY); + if (pending < 32) + break; } while (atomic_fcmpset_acq_64(&r->state, &os.state, ns.state) == 0); - critical_exit(); - if (ns.flags == ABDICATED) + if (__predict_false(os.flags == TAKING_OVER)) { + MPASS(ns.flags == BUSY); counter_u64_add(r->abdications, 1); - if (ns.flags != BUSY) { - /* Wrong loop exit if we're going to stall. */ - MPASS(ns.flags != STALLED); - if (prev == STALLED) { - MPASS(total > 0); - counter_u64_add(r->restarts, 1); - } break; } + if (ns.flags == IDLE || ns.flags == COALESCING) { + MPASS(ns.pidx_tail == cidx); + if (ns.pidx_head != ns.pidx_tail) + counter_u64_add(r->cons_idle2, 1); + else + counter_u64_add(r->cons_idle, 1); + break; + } + /* * The acquire style atomic above guarantees visibility of items * associated with any pidx change that we notice here. @@ -177,13 +215,55 @@ drain_ring(struct mp_ring *r, union ring_state os, uin pidx = ns.pidx_tail; pending = 0; } + +#ifdef INVARIANTS + if (os.flags == TAKING_OVER) + MPASS(ns.flags == BUSY); + else { + MPASS(ns.flags == IDLE || ns.flags == COALESCING || + ns.flags == STALLED); + } +#endif } +static void +drain_txpkts(struct mp_ring *r, union ring_state os, int budget) +{ + union ring_state ns; + uint16_t cidx = os.cidx; + uint16_t pidx = os.pidx_tail; + bool coalescing; + + mtx_assert(r->cons_lock, MA_OWNED); + MPASS(os.flags == BUSY); + MPASS(cidx == pidx); + + r->drain(r, cidx, pidx, &coalescing); + MPASS(coalescing == false); + critical_enter(); + os.state = atomic_load_64(&r->state); + do { + ns.state = os.state; + MPASS(os.flags == BUSY); + MPASS(os.cidx == cidx); + if (ns.cidx == ns.pidx_tail) + ns.flags = IDLE; + else + ns.flags = BUSY; + } while (atomic_fcmpset_acq_64(&r->state, &os.state, ns.state) == 0); + critical_exit(); + + if (ns.flags == BUSY) + drain_ring(r, budget); +} + int mp_ring_alloc(struct mp_ring **pr, int size, void *cookie, ring_drain_t drain, - ring_can_drain_t can_drain, struct malloc_type *mt, int flags) + ring_can_drain_t can_drain, struct malloc_type *mt, struct mtx *lck, + int flags) { struct mp_ring *r; + int i; /* All idx are 16b so size can be 65536 at most */ if (pr == NULL || size < 2 || size > 65536 || drain == NULL || @@ -201,43 +281,59 @@ mp_ring_alloc(struct mp_ring **pr, int size, void *coo r->mt = mt; r->drain = drain; r->can_drain = can_drain; - r->enqueues = counter_u64_alloc(flags); - r->drops = counter_u64_alloc(flags); - r->starts = counter_u64_alloc(flags); - r->stalls = counter_u64_alloc(flags); - r->restarts = counter_u64_alloc(flags); - r->abdications = counter_u64_alloc(flags); - if (r->enqueues == NULL || r->drops == NULL || r->starts == NULL || - r->stalls == NULL || r->restarts == NULL || - r->abdications == NULL) { - mp_ring_free(r); - return (ENOMEM); + r->cons_lock = lck; + if ((r->dropped = counter_u64_alloc(flags)) == NULL) + goto failed; + for (i = 0; i < nitems(r->consumer); i++) { + if ((r->consumer[i] = counter_u64_alloc(flags)) == NULL) + goto failed; } - + if ((r->not_consumer = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->abdications = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->stalls = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->consumed = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->cons_idle = counter_u64_alloc(flags)) == NULL) + goto failed; + if ((r->cons_idle2 = counter_u64_alloc(flags)) == NULL) + goto failed; *pr = r; return (0); +failed: + mp_ring_free(r); + return (ENOMEM); } void mp_ring_free(struct mp_ring *r) { + int i; if (r == NULL) return; - if (r->enqueues != NULL) - counter_u64_free(r->enqueues); - if (r->drops != NULL) - counter_u64_free(r->drops); - if (r->starts != NULL) - counter_u64_free(r->starts); - if (r->stalls != NULL) - counter_u64_free(r->stalls); - if (r->restarts != NULL) - counter_u64_free(r->restarts); + if (r->dropped != NULL) + counter_u64_free(r->dropped); + for (i = 0; i < nitems(r->consumer); i++) { + if (r->consumer[i] != NULL) + counter_u64_free(r->consumer[i]); + } + if (r->not_consumer != NULL) + counter_u64_free(r->not_consumer); if (r->abdications != NULL) counter_u64_free(r->abdications); + if (r->stalls != NULL) + counter_u64_free(r->stalls); + if (r->consumed != NULL) + counter_u64_free(r->consumed); + if (r->cons_idle != NULL) + counter_u64_free(r->cons_idle); + if (r->cons_idle2 != NULL) + counter_u64_free(r->cons_idle2); free(r, r->mt); } @@ -252,7 +348,8 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n { union ring_state os, ns; uint16_t pidx_start, pidx_stop; - int i; + int i, nospc, cons; + bool consumer; MPASS(items != NULL); MPASS(n > 0); @@ -261,26 +358,70 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n * Reserve room for the new items. Our reservation, if successful, is * from 'pidx_start' to 'pidx_stop'. */ - os.state = r->state; + nospc = 0; + os.state = atomic_load_64(&r->state); for (;;) { - if (n >= space_available(r, os)) { - counter_u64_add(r->drops, n); + for (;;) { + if (__predict_true(space_available(r, os) >= n)) + break; + + /* Not enough room in the ring. */ + MPASS(os.flags != IDLE); + MPASS(os.flags != COALESCING); + if (__predict_false(++nospc > 100)) { + counter_u64_add(r->dropped, n); + return (ENOBUFS); + } if (os.flags == STALLED) - mp_ring_check_drainage(r, 0); - return (ENOBUFS); + mp_ring_check_drainage(r, 64); + else + cpu_spinwait(); + os.state = atomic_load_64(&r->state); } + + /* There is room in the ring. */ + + cons = -1; ns.state = os.state; ns.pidx_head = increment_idx(r, os.pidx_head, n); + if (os.flags == IDLE || os.flags == COALESCING) { + MPASS(os.pidx_tail == os.cidx); + if (os.pidx_head == os.pidx_tail) { + cons = C_FAST; + ns.pidx_tail = increment_idx(r, os.pidx_tail, n); + } else + cons = C_2; + ns.flags = BUSY; + } else if (os.flags == TOO_BUSY) { + cons = C_TAKEOVER; + ns.flags = TAKING_OVER; + } critical_enter(); if (atomic_fcmpset_64(&r->state, &os.state, ns.state)) break; critical_exit(); cpu_spinwait(); - } + }; + pidx_start = os.pidx_head; pidx_stop = ns.pidx_head; + if (cons == C_FAST) { + i = pidx_start; + do { + r->items[i] = *items++; + if (__predict_false(++i == r->size)) + i = 0; + } while (i != pidx_stop); + critical_exit(); + counter_u64_add(r->consumer[C_FAST], 1); + mtx_lock(r->cons_lock); + drain_ring(r, budget); + mtx_unlock(r->cons_lock); + return (0); + } + /* * Wait for other producers who got in ahead of us to enqueue their * items, one producer at a time. It is our turn when the ring's @@ -288,7 +429,7 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n */ while (ns.pidx_tail != pidx_start) { cpu_spinwait(); - ns.state = r->state; + ns.state = atomic_load_64(&r->state); } /* Now it is our turn to fill up the area we reserved earlier. */ @@ -303,21 +444,33 @@ mp_ring_enqueue(struct mp_ring *r, void **items, int n * Update the ring's pidx_tail. The release style atomic guarantees * that the items are visible to any thread that sees the updated pidx. */ - os.state = r->state; + os.state = atomic_load_64(&r->state); do { + consumer = false; ns.state = os.state; ns.pidx_tail = pidx_stop; - ns.flags = BUSY; + if (os.flags == IDLE || os.flags == COALESCING || + (os.flags == STALLED && r->can_drain(r))) { + MPASS(cons == -1); + consumer = true; + ns.flags = BUSY; + } } while (atomic_fcmpset_rel_64(&r->state, &os.state, ns.state) == 0); critical_exit(); - counter_u64_add(r->enqueues, n); - /* - * Turn into a consumer if some other thread isn't active as a consumer - * already. - */ - if (os.flags != BUSY) - drain_ring(r, ns, os.flags, budget); + if (cons == -1) { + if (consumer) + cons = C_3; + else { + counter_u64_add(r->not_consumer, 1); + return (0); + } + } + MPASS(cons > C_FAST && cons < nitems(r->consumer)); + counter_u64_add(r->consumer[cons], 1); + mtx_lock(r->cons_lock); + drain_ring(r, budget); + mtx_unlock(r->cons_lock); return (0); } @@ -327,46 +480,96 @@ mp_ring_check_drainage(struct mp_ring *r, int budget) { union ring_state os, ns; - os.state = r->state; - if (os.flags != STALLED || os.pidx_head != os.pidx_tail || - r->can_drain(r) == 0) - return; - - MPASS(os.cidx != os.pidx_tail); /* implied by STALLED */ - ns.state = os.state; - ns.flags = BUSY; - - /* - * The acquire style atomic guarantees visibility of items associated - * with the pidx that we read here. - */ - if (!atomic_cmpset_acq_64(&r->state, os.state, ns.state)) - return; - - drain_ring(r, ns, os.flags, budget); + os.state = atomic_load_64(&r->state); + if (os.flags == STALLED && r->can_drain(r)) { + MPASS(os.cidx != os.pidx_tail); /* implied by STALLED */ + ns.state = os.state; + ns.flags = BUSY; + if (atomic_cmpset_acq_64(&r->state, os.state, ns.state)) { + mtx_lock(r->cons_lock); + drain_ring(r, budget); + mtx_unlock(r->cons_lock); + } + } else if (os.flags == COALESCING) { + MPASS(os.cidx == os.pidx_tail); + ns.state = os.state; + ns.flags = BUSY; + if (atomic_cmpset_acq_64(&r->state, os.state, ns.state)) { + mtx_lock(r->cons_lock); + drain_txpkts(r, ns, budget); + mtx_unlock(r->cons_lock); + } + } } void mp_ring_reset_stats(struct mp_ring *r) { + int i; - counter_u64_zero(r->enqueues); - counter_u64_zero(r->drops); - counter_u64_zero(r->starts); - counter_u64_zero(r->stalls); - counter_u64_zero(r->restarts); + counter_u64_zero(r->dropped); + for (i = 0; i < nitems(r->consumer); i++) + counter_u64_zero(r->consumer[i]); + counter_u64_zero(r->not_consumer); counter_u64_zero(r->abdications); + counter_u64_zero(r->stalls); + counter_u64_zero(r->consumed); + counter_u64_zero(r->cons_idle); + counter_u64_zero(r->cons_idle2); } -int +bool mp_ring_is_idle(struct mp_ring *r) { union ring_state s; - s.state = r->state; + s.state = atomic_load_64(&r->state); if (s.pidx_head == s.pidx_tail && s.pidx_tail == s.cidx && s.flags == IDLE) - return (1); + return (true); - return (0); + return (false); +} + +void +mp_ring_sysctls(struct mp_ring *r, struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *children) +{ + struct sysctl_oid *oid; + + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "mp_ring", CTLFLAG_RD | + CTLFLAG_MPSAFE, NULL, "mp_ring statistics"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "state", CTLFLAG_RD, + __DEVOLATILE(uint64_t *, &r->state), 0, "ring state"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "dropped", CTLFLAG_RD, + &r->dropped, "# of items dropped"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "consumed", + CTLFLAG_RD, &r->consumed, "# of items consumed"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "fast_consumer", + CTLFLAG_RD, &r->consumer[C_FAST], + "# of times producer became consumer (fast)"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "consumer2", + CTLFLAG_RD, &r->consumer[C_2], + "# of times producer became consumer (2)"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "consumer3", + CTLFLAG_RD, &r->consumer[C_3], + "# of times producer became consumer (3)"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "takeovers", + CTLFLAG_RD, &r->consumer[C_TAKEOVER], + "# of times producer took over from another consumer."); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "not_consumer", + CTLFLAG_RD, &r->not_consumer, + "# of times producer did not become consumer"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "abdications", + CTLFLAG_RD, &r->abdications, "# of consumer abdications"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "stalls", + CTLFLAG_RD, &r->stalls, "# of consumer stalls"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "cons_idle", + CTLFLAG_RD, &r->cons_idle, + "# of times consumer ran fully to completion"); + SYSCTL_ADD_COUNTER_U64(ctx, children, OID_AUTO, "cons_idle2", + CTLFLAG_RD, &r->cons_idle2, + "# of times consumer idled when another enqueue was in progress"); } Modified: head/sys/dev/cxgbe/t4_mp_ring.h ============================================================================== --- head/sys/dev/cxgbe/t4_mp_ring.h Fri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/t4_mp_ring.h Fri Jul 3 04:44:23 2020 (r362905) @@ -36,33 +36,38 @@ #endif struct mp_ring; -typedef u_int (*ring_drain_t)(struct mp_ring *, u_int, u_int); +typedef u_int (*ring_drain_t)(struct mp_ring *, u_int, u_int, bool *); typedef u_int (*ring_can_drain_t)(struct mp_ring *); struct mp_ring { volatile uint64_t state __aligned(CACHE_LINE_SIZE); + struct malloc_type * mt; int size __aligned(CACHE_LINE_SIZE); void * cookie; - struct malloc_type * mt; ring_drain_t drain; ring_can_drain_t can_drain; /* cheap, may be unreliable */ - counter_u64_t enqueues; - counter_u64_t drops; - counter_u64_t starts; - counter_u64_t stalls; - counter_u64_t restarts; /* recovered after stalling */ + struct mtx * cons_lock; + counter_u64_t dropped; + counter_u64_t consumer[4]; + counter_u64_t not_consumer; counter_u64_t abdications; + counter_u64_t consumed; + counter_u64_t cons_idle; + counter_u64_t cons_idle2; + counter_u64_t stalls; void * volatile items[] __aligned(CACHE_LINE_SIZE); }; int mp_ring_alloc(struct mp_ring **, int, void *, ring_drain_t, - ring_can_drain_t, struct malloc_type *, int); + ring_can_drain_t, struct malloc_type *, struct mtx *, int); void mp_ring_free(struct mp_ring *); int mp_ring_enqueue(struct mp_ring *, void **, int, int); void mp_ring_check_drainage(struct mp_ring *, int); void mp_ring_reset_stats(struct mp_ring *); -int mp_ring_is_idle(struct mp_ring *); +bool mp_ring_is_idle(struct mp_ring *); +void mp_ring_sysctls(struct mp_ring *, struct sysctl_ctx_list *, + struct sysctl_oid_list *); #endif Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Jul 3 02:02:34 2020 (r362904) +++ head/sys/dev/cxgbe/t4_sge.c Fri Jul 3 04:44:23 2020 (r362905) @@ -203,19 +203,6 @@ static int lro_mbufs = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, lro_mbufs, CTLFLAG_RDTUN, &lro_mbufs, 0, "Enable presorting of LRO frames"); -struct txpkts { - u_int wr_type; /* type 0 or type 1 */ - u_int npkt; /* # of packets in this work request */ - u_int plen; /* total payload (sum of all packets) */ - u_int len16; /* # of 16B pieces used by this work request */ -}; - -/* A packet's SGL. This + m_pkthdr has all info needed for tx */ -struct sgl { - struct sglist sg; - struct sglist_seg seg[TX_SGL_SEGS]; -}; - static int service_iq(struct sge_iq *, int); static int service_iq_fl(struct sge_iq *, int); static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, uint32_t); @@ -284,14 +271,16 @@ static inline u_int txpkt_vm_len16(u_int, u_int); static inline u_int txpkts0_len16(u_int); static inline u_int txpkts1_len16(void); static u_int write_raw_wr(struct sge_txq *, void *, struct mbuf *, u_int); -static u_int write_txpkt_wr(struct adapter *, struct sge_txq *, - struct fw_eth_tx_pkt_wr *, struct mbuf *, u_int); +static u_int write_txpkt_wr(struct adapter *, struct sge_txq *, struct mbuf *, + u_int); static u_int write_txpkt_vm_wr(struct adapter *, struct sge_txq *, - struct fw_eth_tx_pkt_vm_wr *, struct mbuf *, u_int); -static int try_txpkts(struct mbuf *, struct mbuf *, struct txpkts *, u_int); -static int add_to_txpkts(struct mbuf *, struct txpkts *, u_int); -static u_int write_txpkts_wr(struct adapter *, struct sge_txq *, - struct fw_eth_tx_pkts_wr *, struct mbuf *, const struct txpkts *, u_int); + struct mbuf *); +static int add_to_txpkts_vf(struct adapter *, struct sge_txq *, struct mbuf *, + int, bool *); +static int add_to_txpkts_pf(struct adapter *, struct sge_txq *, struct mbuf *, + int, bool *); +static u_int write_txpkts_wr(struct adapter *, struct sge_txq *); +static u_int write_txpkts_vm_wr(struct adapter *, struct sge_txq *); static void write_gl_to_txd(struct sge_txq *, struct mbuf *, caddr_t *, int); static inline void copy_to_txd(struct sge_eq *, caddr_t, caddr_t *, int); static inline void ring_eq_db(struct adapter *, struct sge_eq *, u_int); @@ -2839,7 +2828,7 @@ can_resume_eth_tx(struct mp_ring *r) return (total_available_tx_desc(eq) > eq->sidx / 8); } -static inline int +static inline bool cannot_use_txpkts(struct mbuf *m) { /* maybe put a GL limit too, to avoid silliness? */ @@ -2855,8 +2844,9 @@ discard_tx(struct sge_eq *eq) } static inline int -wr_can_update_eq(struct fw_eth_tx_pkts_wr *wr) +wr_can_update_eq(void *p) { + struct fw_eth_tx_pkts_wr *wr = p; switch (G_FW_WR_OP(be32toh(wr->op_pkd))) { case FW_ULPTX_WR: @@ -2864,159 +2854,232 @@ wr_can_update_eq(struct fw_eth_tx_pkts_wr *wr) case FW_ETH_TX_PKTS_WR: case FW_ETH_TX_PKTS2_WR: case FW_ETH_TX_PKT_VM_WR: + case FW_ETH_TX_PKTS_VM_WR: return (1); default: return (0); } } +static inline void +set_txupdate_flags(struct sge_txq *txq, u_int avail, + struct fw_eth_tx_pkt_wr *wr) +{ + struct sge_eq *eq = &txq->eq; + struct txpkts *txp = &txq->txp; + + if ((txp->npkt > 0 || avail < eq->sidx / 2) && + atomic_cmpset_int(&eq->equiq, 0, 1)) { + wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ | F_FW_WR_EQUIQ); + eq->equeqidx = eq->pidx; + } else if (IDXDIFF(eq->pidx, eq->equeqidx, eq->sidx) >= 32) { + wr->equiq_to_len16 |= htobe32(F_FW_WR_EQUEQ); + eq->equeqidx = eq->pidx; + } +} + /* * r->items[cidx] to r->items[pidx], with a wraparound at r->size, are ready to * be consumed. Return the actual number consumed. 0 indicates a stall. */ static u_int -eth_tx(struct mp_ring *r, u_int cidx, u_int pidx) +eth_tx(struct mp_ring *r, u_int cidx, u_int pidx, bool *coalescing) { struct sge_txq *txq = r->cookie; - struct sge_eq *eq = &txq->eq; struct ifnet *ifp = txq->ifp; + struct sge_eq *eq = &txq->eq; + struct txpkts *txp = &txq->txp; struct vi_info *vi = ifp->if_softc; struct adapter *sc = vi->adapter; u_int total, remaining; /* # of packets */ - u_int available, dbdiff; /* # of hardware descriptors */ - u_int n, next_cidx; - struct mbuf *m0, *tail; - struct txpkts txp; - struct fw_eth_tx_pkts_wr *wr; /* any fw WR struct will do */ + u_int n, avail, dbdiff; /* # of hardware descriptors */ + int i, rc; + struct mbuf *m0; + bool snd; + void *wr; /* start of the last WR written to the ring */ - remaining = IDXDIFF(pidx, cidx, r->size); - MPASS(remaining > 0); /* Must not be called without work to do. */ - total = 0; + TXQ_LOCK_ASSERT_OWNED(txq); - TXQ_LOCK(txq); + remaining = IDXDIFF(pidx, cidx, r->size); if (__predict_false(discard_tx(eq))) { + for (i = 0; i < txp->npkt; i++) + m_freem(txp->mb[i]); + txp->npkt = 0; while (cidx != pidx) { m0 = r->items[cidx]; m_freem(m0); if (++cidx == r->size) cidx = 0; } - reclaim_tx_descs(txq, 2048); - total = remaining; - goto done; + reclaim_tx_descs(txq, eq->sidx); + *coalescing = false; + return (remaining); /* emptied */ } /* How many hardware descriptors do we have readily available. */ - if (eq->pidx == eq->cidx) - available = eq->sidx - 1; - else - available = IDXDIFF(eq->cidx, eq->pidx, eq->sidx) - 1; - dbdiff = IDXDIFF(eq->pidx, eq->dbidx, eq->sidx); + if (eq->pidx == eq->cidx) { + avail = eq->sidx - 1; + if (txp->score++ >= 5) + txp->score = 5; /* tx is completely idle, reset. */ + } else + avail = IDXDIFF(eq->cidx, eq->pidx, eq->sidx) - 1; - while (remaining > 0) { + total = 0; + if (remaining == 0) { + if (txp->score-- == 1) /* egr_update had to drain txpkts */ + txp->score = 1; + goto send_txpkts; + } + dbdiff = 0; + MPASS(remaining > 0); + while (remaining > 0) { m0 = r->items[cidx]; M_ASSERTPKTHDR(m0); MPASS(m0->m_nextpkt == NULL); - if (available < tx_len16_to_desc(mbuf_len16(m0))) { - available += reclaim_tx_descs(txq, 64); - if (available < tx_len16_to_desc(mbuf_len16(m0))) - break; /* out of descriptors */ + if (avail < 2 * SGE_MAX_WR_NDESC) + avail += reclaim_tx_descs(txq, 64); + + if (txp->npkt > 0 || remaining > 1 || txp->score > 3 || + atomic_load_int(&txq->eq.equiq) != 0) { + if (sc->flags & IS_VF) + rc = add_to_txpkts_vf(sc, txq, m0, avail, &snd); + else + rc = add_to_txpkts_pf(sc, txq, m0, avail, &snd); + } else { + snd = false; + rc = EINVAL; } + if (snd) { + MPASS(txp->npkt > 0); + for (i = 0; i < txp->npkt; i++) + ETHER_BPF_MTAP(ifp, txp->mb[i]); + if (txp->npkt > 1) { + if (txp->score++ >= 10) + txp->score = 10; + MPASS(avail >= tx_len16_to_desc(txp->len16)); + if (sc->flags & IS_VF) + n = write_txpkts_vm_wr(sc, txq); + else + n = write_txpkts_wr(sc, txq); + } else { + MPASS(avail >= + tx_len16_to_desc(mbuf_len16(txp->mb[0]))); + if (sc->flags & IS_VF) + n = write_txpkt_vm_wr(sc, txq, + txp->mb[0]); + else + n = write_txpkt_wr(sc, txq, txp->mb[0], + avail); + } + MPASS(n <= SGE_MAX_WR_NDESC); + avail -= n; + dbdiff += n; + wr = &eq->desc[eq->pidx]; + IDXINCR(eq->pidx, n, eq->sidx); + txp->npkt = 0; /* emptied */ + } + if (rc == 0) { + /* m0 was coalesced into txq->txpkts. */ + goto next_mbuf; + } + if (rc == EAGAIN) { + /* + * m0 is suitable for tx coalescing but could not be + * combined with the existing txq->txpkts, which has now + * been transmitted. Start a new txpkts with m0. + */ + MPASS(snd); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Jul 3 05:21: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 74EC2369C5B; Fri, 3 Jul 2020 05:21:06 +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 49yjwy29gwz3TtS; Fri, 3 Jul 2020 05:21:06 +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 2F4A12698A; Fri, 3 Jul 2020 05:21:06 +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 0635L6dx090312; Fri, 3 Jul 2020 05:21:06 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0635L67u090311; Fri, 3 Jul 2020 05:21:06 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007030521.0635L67u090311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 3 Jul 2020 05:21:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362906 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 362906 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 05:21:06 -0000 Author: rmacklem Date: Fri Jul 3 05:21:05 2020 New Revision: 362906 URL: https://svnweb.freebsd.org/changeset/base/362906 Log: Fix build breakage caused by r362903. Only pmap.h is needed now, but vm_page.h and vm_pageout.h is needed later, so put them in now. Pointy hat goes on me. Modified: head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Fri Jul 3 04:44:23 2020 (r362905) +++ head/sys/fs/nfs/nfsport.h Fri Jul 3 05:21:05 2020 (r362906) @@ -109,8 +109,11 @@ #include #include #include +#include #include #include +#include +#include #include #include #include "opt_nfs.h" From owner-svn-src-head@freebsd.org Fri Jul 3 08:06: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 1B71336E068; Fri, 3 Jul 2020 08:06:27 +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 49ynbk728Rz3gYY; Fri, 3 Jul 2020 08:06:26 +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 D11C68ACE; Fri, 3 Jul 2020 08:06:26 +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 06386QKs095692; Fri, 3 Jul 2020 08:06:26 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06386QS8095690; Fri, 3 Jul 2020 08:06:26 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202007030806.06386QS8095690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 3 Jul 2020 08:06:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362909 - in head: sys/netinet6 tests/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head: sys/netinet6 tests/sys/netinet6 X-SVN-Commit-Revision: 362909 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 08:06:27 -0000 Author: melifaro Date: Fri Jul 3 08:06:26 2020 New Revision: 362909 URL: https://svnweb.freebsd.org/changeset/base/362909 Log: Fix IPv6 regression introduced by r362900. PR: kern/247729 Modified: head/sys/netinet6/icmp6.c head/tests/sys/netinet6/redirect.sh Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Fri Jul 3 07:25:26 2020 (r362908) +++ head/sys/netinet6/icmp6.c Fri Jul 3 08:06:26 2020 (r362909) @@ -2277,7 +2277,7 @@ icmp6_redirect_input(struct mbuf *m, int off) in6_splitscope(&reddst6, &kdst, &scopeid); NET_EPOCH_ASSERT(); nh = fib6_lookup(ifp->if_fib, &kdst, scopeid, 0, 0); - if (nh == NULL) { + if (nh != NULL) { struct in6_addr nh_addr; nh_addr = ifatoia6(nh->nh_ifa)->ia_addr.sin6_addr; if ((nh->nh_flags & NHF_GATEWAY) == 0) { Modified: head/tests/sys/netinet6/redirect.sh ============================================================================== --- head/tests/sys/netinet6/redirect.sh Fri Jul 3 07:25:26 2020 (r362908) +++ head/tests/sys/netinet6/redirect.sh Fri Jul 3 08:06:26 2020 (r362909) @@ -87,7 +87,15 @@ valid_redirect_body() { local_ll_mac=`jexec ${jname} ifconfig ${epair}b ether | awk '$1~/ether/{print$2}'` # wait for DAD to complete - sleep 2 + while [ `ifconfig ${epair}a inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + while [ `jexec ${jname}b ifconfig ${epair}b inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + + # enable ND debugging in the target jail to ease catching errors + jexec ${jname} sysctl net.inet6.icmp6.nd6_debug=1 # echo "LOCAL: ${local_ll_ip} ${local_ll_mac}" # echo "REMOTE: ${remote_rtr_ll_ip} ${remote_rtr_mac}" From owner-svn-src-head@freebsd.org Fri Jul 3 09:23: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 4E04734890A; Fri, 3 Jul 2020 09:23:12 +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 49yqJJ1Khcz4340; Fri, 3 Jul 2020 09:23:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1109394EC; Fri, 3 Jul 2020 09:23:12 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0639NBVH044711; Fri, 3 Jul 2020 09:23:11 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0639NBoj044710; Fri, 3 Jul 2020 09:23:11 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007030923.0639NBoj044710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 3 Jul 2020 09:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362910 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 362910 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 09:23:12 -0000 Author: mjg Date: Fri Jul 3 09:23:11 2020 New Revision: 362910 URL: https://svnweb.freebsd.org/changeset/base/362910 Log: ifdef out pg_jobc assertions added in r361967 They trigger for some people, the bug is not obvious, there are no takers for fixing it, the issue already had to be there for years beforehand and is low priority. Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Fri Jul 3 08:06:26 2020 (r362909) +++ head/sys/kern/kern_proc.c Fri Jul 3 09:23:11 2020 (r362910) @@ -731,10 +731,14 @@ pgadjustjobc(struct pgrp *pgrp, int entering) PGRP_LOCK(pgrp); if (entering) { +#ifdef notyet MPASS(pgrp->pg_jobc >= 0); +#endif pgrp->pg_jobc++; } else { +#ifdef notyet MPASS(pgrp->pg_jobc > 0); +#endif --pgrp->pg_jobc; if (pgrp->pg_jobc == 0) orphanpg(pgrp); From owner-svn-src-head@freebsd.org Fri Jul 3 14:54: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 84D86350C90; Fri, 3 Jul 2020 14:54:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.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 49yyfv2sCpz4Mdp; Fri, 3 Jul 2020 14:54:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45C8FD6F0; Fri, 3 Jul 2020 14:54:47 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 063EslYt049007; Fri, 3 Jul 2020 14:54:47 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 063EskxA049004; Fri, 3 Jul 2020 14:54:46 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202007031454.063EskxA049004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 3 Jul 2020 14:54:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362913 - in head/sys: amd64/amd64 amd64/include crypto/aesni crypto/blake2 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include crypto/aesni crypto/blake2 X-SVN-Commit-Revision: 362913 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 14:54:47 -0000 Author: cem Date: Fri Jul 3 14:54:46 2020 New Revision: 362913 URL: https://svnweb.freebsd.org/changeset/base/362913 Log: Add domain policy allocation for amd64 fpu_kern_ctx Like other types of allocation, fpu_kern_ctx are frequently allocated per-cpu. Provide the API and sketch some example consumers. fpu_kern_alloc_ctx_domain() preferentially allocates memory from the provided domain, and falls back to other domains if that one is empty (DOMAINSET_PREF(domain) policy). Maybe it makes more sense to just shove one of these in the DPCPU area sooner or later -- left for future work. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D22053 Modified: head/sys/amd64/amd64/fpu.c head/sys/amd64/include/fpu.h head/sys/crypto/aesni/aesni.c head/sys/crypto/blake2/blake2_cryptodev.c Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Fri Jul 3 11:46:42 2020 (r362912) +++ head/sys/amd64/amd64/fpu.c Fri Jul 3 14:54:46 2020 (r362913) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1030,17 +1031,31 @@ struct fpu_kern_ctx { char hwstate1[]; }; +static inline size_t __pure2 +fpu_kern_alloc_sz(u_int max_est) +{ + return (sizeof(struct fpu_kern_ctx) + XSAVE_AREA_ALIGN + max_est); +} + +static inline int __pure2 +fpu_kern_malloc_flags(u_int fpflags) +{ + return (((fpflags & FPU_KERN_NOWAIT) ? M_NOWAIT : M_WAITOK) | M_ZERO); +} + struct fpu_kern_ctx * -fpu_kern_alloc_ctx(u_int flags) +fpu_kern_alloc_ctx_domain(int domain, u_int flags) { - struct fpu_kern_ctx *res; - size_t sz; + return (malloc_domainset(fpu_kern_alloc_sz(cpu_max_ext_state_size), + M_FPUKERN_CTX, DOMAINSET_PREF(domain), + fpu_kern_malloc_flags(flags))); +} - sz = sizeof(struct fpu_kern_ctx) + XSAVE_AREA_ALIGN + - cpu_max_ext_state_size; - res = malloc(sz, M_FPUKERN_CTX, ((flags & FPU_KERN_NOWAIT) ? - M_NOWAIT : M_WAITOK) | M_ZERO); - return (res); +struct fpu_kern_ctx * +fpu_kern_alloc_ctx(u_int flags) +{ + return (malloc(fpu_kern_alloc_sz(cpu_max_ext_state_size), + M_FPUKERN_CTX, fpu_kern_malloc_flags(flags))); } void Modified: head/sys/amd64/include/fpu.h ============================================================================== --- head/sys/amd64/include/fpu.h Fri Jul 3 11:46:42 2020 (r362912) +++ head/sys/amd64/include/fpu.h Fri Jul 3 14:54:46 2020 (r362913) @@ -71,6 +71,7 @@ int fputrap_sse(void); int fputrap_x87(void); void fpuuserinited(struct thread *td); struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); +struct fpu_kern_ctx *fpu_kern_alloc_ctx_domain(int domain, u_int flags); void fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags); Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Fri Jul 3 11:46:42 2020 (r362912) +++ head/sys/crypto/aesni/aesni.c Fri Jul 3 14:54:46 2020 (r362913) @@ -180,7 +180,12 @@ aesni_attach(device_t dev) M_WAITOK|M_ZERO); CPU_FOREACH(i) { - ctx_fpu[i] = fpu_kern_alloc_ctx(0); +#ifdef __amd64__ + ctx_fpu[i] = fpu_kern_alloc_ctx_domain( + pcpu_find(i)->pc_domain, FPU_KERN_NORMAL); +#else + ctx_fpu[i] = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); +#endif mtx_init(&ctx_mtx[i], "anifpumtx", NULL, MTX_DEF|MTX_NEW); } Modified: head/sys/crypto/blake2/blake2_cryptodev.c ============================================================================== --- head/sys/crypto/blake2/blake2_cryptodev.c Fri Jul 3 11:46:42 2020 (r362912) +++ head/sys/crypto/blake2/blake2_cryptodev.c Fri Jul 3 14:54:46 2020 (r362913) @@ -142,7 +142,12 @@ blake2_attach(device_t dev) M_WAITOK | M_ZERO); CPU_FOREACH(i) { - ctx_fpu[i] = fpu_kern_alloc_ctx(0); +#ifdef __amd64__ + ctx_fpu[i] = fpu_kern_alloc_ctx_domain( + pcpu_find(i)->pc_domain, FPU_KERN_NORMAL); +#else + ctx_fpu[i] = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); +#endif mtx_init(&ctx_mtx[i], "bl2fpumtx", NULL, MTX_DEF | MTX_NEW); } From owner-svn-src-head@freebsd.org Fri Jul 3 20:13: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 84984358049; Fri, 3 Jul 2020 20:13:59 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 49z5lB5PNQz3SCj; Fri, 3 Jul 2020 20:13:58 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr1-x42c.google.com with SMTP id a6so33934398wrm.4; Fri, 03 Jul 2020 13:13:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to; bh=RMH3tKHZ1APMhtqxofNmn1epoFJrzCahIgwDMxNdHTw=; b=dgkxOF5zX/dhVpuIul8r6wrpDj50AAUkFjk6oh4vxAdz7Ai8GWFTWSy0HX4qIW0R/n HW/EjMNL9yyodVKfGHZiRg9RYu6xLt5Qo/keiC6RPSkWt0W5ojdQv+gHMoxOm2KioJXe hfmBMGUhNW+k/wBJOKw8XNcQkR/hWQ8sZrHHZXqbpx3tfBzHQzDfXW7IbVBUwduVUKbF VdAPk6lXZhEpayhz/L/2GgNwxYWX0czUqxgbYfNKOuRChPIARaerLv0QPJVgo/YZpipj GrrDlB89g9qnjlespEoB7/TpZLq834L+v2izim+b96cFpBr/MNGDnvS9hDqDLwlxGOMS 7C3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=RMH3tKHZ1APMhtqxofNmn1epoFJrzCahIgwDMxNdHTw=; b=dMCEg4fHwj8ZQZzslpIuaRMNIO5Q89HtkCoCjAIeGtavQTxU2hgolTKT/JVUXg19Ks A6/7lqyVz1pe4S8XECYjXe8RYu6osKS8bQ+kEqz6tvBSzAfENRvTEGBqDAZ99zEqmfrn pN50bnHDhQyv9NncLKWdIvKRMU3XX4ekrLoIarT4IXOrPlJMMC/bI1pWr/bX6y8MaeaR 41WNH9Ut+of9UX1VQJQjJxRlAFsCP0igOQ42rJRWjPc6HUUQmNqaMCHc8FLL+f4e+fm3 gC7j9oMfII+HrsccZld7y0YYol198mi4/1Jy07fHxoP2dhtMgeAZ4+R29ReYQZA2qVRe pAjQ== X-Gm-Message-State: AOAM531LVRQeW4nzRoE8P0A5epZmDjZ6rZAUkdrnbA8EeRt6YRU227i0 7AAAV2QkB3vq5OHhSP55L/aMPycx X-Google-Smtp-Source: ABdhPJzxoFgVqcdnziAQuRGJitSMpzw3IuSSvIteOrOaa+zhUOqGlgt0sgr5aUWdrHVpgCpkn8KksQ== X-Received: by 2002:a5d:4bd2:: with SMTP id l18mr37276838wrt.119.1593807236525; Fri, 03 Jul 2020 13:13:56 -0700 (PDT) Received: from brick (cpc149474-cmbg20-2-0-cust954.5-4.cable.virginm.net. [82.4.199.187]) by smtp.gmail.com with ESMTPSA id j24sm16772666wrd.43.2020.07.03.13.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 13:13:55 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Fri, 3 Jul 2020 21:13:53 +0100 From: Edward Tomasz Napierala To: Mateusz Piotrowski <0mp@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r362806 - head/sys/compat/linprocfs Message-ID: <20200703201353.GA1574@brick> Mail-Followup-To: Mateusz Piotrowski <0mp@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202006301624.05UGOS9F035293@repo.freebsd.org> <526e3180-bc4a-b609-b601-80dfa6e3d918@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <526e3180-bc4a-b609-b601-80dfa6e3d918@FreeBSD.org> X-Rspamd-Queue-Id: 49z5lB5PNQz3SCj X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=dgkxOF5z; dmarc=none; spf=pass (mx1.freebsd.org: domain of etnapierala@gmail.com designates 2a00:1450:4864:20::42c as permitted sender) smtp.mailfrom=etnapierala@gmail.com X-Spamd-Result: default: False [-1.40 / 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.94)[-0.944]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_NA(0.00)[freebsd.org]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-0.89)[-0.892]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.13)[0.135]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::42c:from]; FORGED_SENDER(0.30)[trasz@freebsd.org,etnapierala@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[82.4.199.187: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: Fri, 03 Jul 2020 20:13:59 -0000 On 0630T1828, Mateusz Piotrowski wrote: > Hi, > > On 6/30/20 6:24 PM, Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Tue Jun 30 16:24:28 2020 > > New Revision: 362806 > > URL: https://svnweb.freebsd.org/changeset/base/362806 > > > > Log: > > Make linprocfs(5) create the /proc//task/ directores. > > This is to silence down some Chromium assertions. > > > > PR: kern/240991 > > Analyzed by: Alex S > > MFC after: 2 weeks > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D25256 > > Hmm, could something similar be done to the following warning which is being printed > when service fahclient is started (from the biology/linux-foldingathome port): > > 16:25:39:WARNING:Exception: Failed to open '/proc/bus/pci/devices': Failed to open > '/proc/bus/pci/devices': No such file or directory: No such file or directory Sure: https://reviews.freebsd.org/D25557 From owner-svn-src-head@freebsd.org Fri Jul 3 20:32:54 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 9B7AF358B5C; Fri, 3 Jul 2020 20:32:54 +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 49z6923V9tz3TN8; Fri, 3 Jul 2020 20:32:54 +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 5B5C7111CF; Fri, 3 Jul 2020 20:32:54 +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 063KWsJf058385; Fri, 3 Jul 2020 20:32:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 063KWsRA058384; Fri, 3 Jul 2020 20:32:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202007032032.063KWsRA058384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 3 Jul 2020 20:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362914 - head/usr.bin/gh-bc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.bin/gh-bc X-SVN-Commit-Revision: 362914 X-SVN-Commit-Repository: base MIME-Version: 1.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, 03 Jul 2020 20:32:54 -0000 Author: emaste Date: Fri Jul 3 20:32:53 2020 New Revision: 362914 URL: https://svnweb.freebsd.org/changeset/base/362914 Log: bc: disable -flto on powerpc64 Previously bc segfaulted at start, on powerpc64. PR: 247738 Submitted by: luporl Reported by: pkubaj MFC after: 1 week Modified: head/usr.bin/gh-bc/Makefile Modified: head/usr.bin/gh-bc/Makefile ============================================================================== --- head/usr.bin/gh-bc/Makefile Fri Jul 3 14:54:46 2020 (r362913) +++ head/usr.bin/gh-bc/Makefile Fri Jul 3 20:32:53 2020 (r362914) @@ -50,7 +50,8 @@ CFLAGS+= -DBC_ENABLE_NLS=0 CFLAGS+= -DBC_ENABLE_NLS=1 # prevent floating point incompatibilities caused by -flto on some architectures -.if ${MACHINE_ARCH} != mips && ${MACHINE_ARCH} != mips64 && ${MACHINE_ARCH} != riscv64 +.if ${MACHINE_ARCH} != mips && ${MACHINE_ARCH} != mips64 && \ + ${MACHINE_ARCH} != powerpc64 && ${MACHINE_ARCH} != riscv64 CFLAGS+= -flto .endif From owner-svn-src-head@freebsd.org Fri Jul 3 21:52: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 2854D35AA4D; Fri, 3 Jul 2020 21:52:59 +0000 (UTC) (envelope-from ktullavik@gmail.com) Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) (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 49z7xQ1Jw3z3YGF; Fri, 3 Jul 2020 21:52:57 +0000 (UTC) (envelope-from ktullavik@gmail.com) Received: by mail-lj1-x241.google.com with SMTP id f5so22695001ljj.10; Fri, 03 Jul 2020 14:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=/zOKhtEVa7xqG6QUdWwxz04dW0Lijj11MZpb4f0NE5o=; b=C0ri/0IJlMt8uRb70+l/KSyVGUlt1MZMAl03VHoYm98llw9IFRg7ClKoPPIWewoo6H leJHhrNbHi2Zg/EE9qa2/ZfVIiSqy2hs5jFXaavn3FdwXLJRleKgJlWWZ3Cwhk7OhTSe 1aWkulxe2oVhTVAIG5OXsW9jIyLhI7v4hLxjjziBOMD0lQtK/BpbU+uBXiPEWkvamNhN UarYoAlw4eQZl+EaUFGtGdW1n5XMv4qGWxOJH+f1Ia/ZkxJH+KSCb6WeureV3fupOUb0 y0AhzG0rZuer+yuwzICDO5ifSvEIyWrSD3pzVTm588UcjIAPZ4jXHOKdeuEb0grS1KQ6 lepw== 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=/zOKhtEVa7xqG6QUdWwxz04dW0Lijj11MZpb4f0NE5o=; b=WMC8Ran7+Vzop4JctOE0hErX8zaiS8Y6F3VPeC2MhWmt0CR8mosU+jBiTdu0jPAXnP OrF2mn0EEAl0C1zS6Vtoffxl8fxmbshGmkNsWWA5Bia9GCPqPFv9L03y56RaXsPfrbwq l+O4dcHMqT5CRlxh4AnawBoHRjITl1dEqhvhxB6Ko9UlGY1VKur0TD9wnzr8uQnzZ96u xp8gcUjcEoyI/CgaYWsynqPHz29mMs1sNG94T5y7Am6IqKm6oSmfA4JKs2gELREf5qYW S8g5ll+lPcoIMZc55KluKNu7UQPgGTzEX0D4TAqbDyVtztTtLdgTTiluWI6uXsW3f2CJ G5VA== X-Gm-Message-State: AOAM533LA0FyFqnwyoU7Z/ykffzgHVZ8dzmNt2brhlDHRPj4IOz35T9c n/PeZ2Kn4iyTCPOHIGWvlHJnMgT1OtWY2g== X-Google-Smtp-Source: ABdhPJzaK0WUABBfNP/fqOhn0KRrM9x+7prhW96H3x7TxzurucbMf7AkBh9ORCh4ekMmhQEov40R5A== X-Received: by 2002:a05:651c:1105:: with SMTP id d5mr9038422ljo.62.1593813174492; Fri, 03 Jul 2020 14:52:54 -0700 (PDT) Received: from [10.0.0.11] (cm-84.208.206.179.getinternet.no. [84.208.206.179]) by smtp.gmail.com with ESMTPSA id l4sm778048ljc.83.2020.07.03.14.52.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Jul 2020 14:52:54 -0700 (PDT) Subject: Re: svn commit: r362902 - in head/lib/csu: . aarch64 amd64 arm i386 mips powerpc powerpc64 riscv To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202007030009.06309gcC099579@repo.freebsd.org> From: Kjell Tore Ullavik Message-ID: <7b140e64-ba4d-d76e-29a4-d0587f7351a0@gmail.com> Date: Fri, 3 Jul 2020 23:46:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <202007030009.06309gcC099579@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 49z7xQ1Jw3z3YGF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=C0ri/0IJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of ktullavik@gmail.com designates 2a00:1450:4864:20::241 as permitted sender) smtp.mailfrom=ktullavik@gmail.com X-Spamd-Result: default: False [-2.14 / 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.96)[-0.956]; 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.00)[-0.995]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.81)[0.814]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::241:from]; 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_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(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, 03 Jul 2020 21:52:59 -0000 Got a buildworld error for CURRENT, amd64 today. I have not rebuilt in while, but maybe r362902 is related? I'm at r362906 sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444 libgcc_eh.a /usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32/ ===> lib/libgcc_s (obj,all,install) ===> lib/csu (obj,all,install) ===> lib/csu/i386 (all) cc -DCOMPAT_32BIT -march=i686 -mmmx -msse -msse2 -target x86_64-unknown-freebsd13.0 -m32 -L/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 --sysroot=/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -B/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 -O2 -pipe -fno-common -I/usr/src/lib/csu/i386 -DCRT_IRELOC_REL -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/src/lib/csu/common  -I/usr/src/lib/libc/include -g -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/10.0.0/include  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments    -fPIC -DPIC -c -o Scrt1_c.o /usr/src/lib/csu/i386/crt1_c.c cc -DCOMPAT_32BIT -march=i686 -mmmx -msse -msse2 -target x86_64-unknown-freebsd13.0 -m32 -L/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 --sysroot=/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -B/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 -O2 -pipe -fno-common -I/usr/src/lib/csu/i386 -DCRT_IRELOC_REL -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/src/lib/csu/common  -I/usr/src/lib/libc/include -g -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/10.0.0/include  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments     -DLOCORE   -c /usr/src/lib/csu/i386/crt1_s.S -o crt1_s.o cc -DCOMPAT_32BIT -march=i686 -mmmx -msse -msse2 -target x86_64-unknown-freebsd13.0 -m32 -L/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 --sysroot=/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -B/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 -O2 -pipe -fno-common -I/usr/src/lib/csu/i386 -DCRT_IRELOC_REL -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/src/lib/csu/common  -I/usr/src/lib/libc/include -g -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/10.0.0/include  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments     -DLOCORE   -c /usr/src/lib/csu/common/crtbrand.S -o crtbrand.o cc -DCOMPAT_32BIT -march=i686 -mmmx -msse -msse2 -target x86_64-unknown-freebsd13.0 -m32 -L/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 --sysroot=/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -B/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32 -O2 -pipe -fno-common -I/usr/src/lib/csu/i386 -DCRT_IRELOC_REL -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -I/usr/src/lib/csu/common  -I/usr/src/lib/libc/include -g -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/10.0.0/include  -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments     -DLOCORE   -c /usr/src/lib/csu/common/ignore_init_note.S -o ignore_init_note.o ld -m elf_i386_fbsd -L/usr/obj/usr/src/amd64.amd64/obj-lib32/tmp/usr/lib32  -o Scrt1.o -r Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o objcopy --localize-symbol _start1 crt1.o objcopy: open crt1.o failed: No such file or directory *** Error code 1 Stop. make[5]: stopped in /usr/src/lib/csu/i386 *** Error code 1 Stop. make[4]: stopped in /usr/src/lib/csu *** Error code 1 Stop. make[3]: stopped in /usr/src *** Error code 1 Stop. make[2]: stopped in /usr/src *** Error code 1 Stop. make[1]: stopped in /usr/src *** Error code 1 Stop. make: stopped in /usr/src -------- src.conf -------- KERNCONF=GALOIS WITHOUT_ATM= WITHOUT_BSDINSTALL= WITHOUT_CROSS_COMPILER= WITHOUT_CTM= WITHOUT_DICT= WITHOUT_EE= WITHOUT_FINGER= WITHOUT_FLOPPY= WITHOUT_FREEBSD_UPDATE= WITHOUT_GAMES= WITHOUT_HAST= WITHOUT_HTML= WITHOUT_HYPERV= WITHOUT_IPFILTER= WITHOUT_MAIL= WITHOUT_NDIS= WITHOUT_PF= WITHOUT_SVNLITE= WITHOUT_TALK= WITHOUT_TESTS= WITHOUT_UNBOUND= ------ make.conf ------ MALLOC_PRODUCTION= On 03.07.2020 02:09, John Baldwin wrote: > Author: jhb > Date: Fri Jul 3 00:09:41 2020 > New Revision: 362902 > URL: https://svnweb.freebsd.org/changeset/base/362902 > > Log: > Consolidate duplicated logic in csu Makefiles to lib/csu/Makefile.inc. > > Reviewed by: kib > Sponsored by: DARPA > Differential Revision: https://reviews.freebsd.org/D25537 > > Modified: > head/lib/csu/Makefile.inc > head/lib/csu/aarch64/Makefile > head/lib/csu/amd64/Makefile > head/lib/csu/arm/Makefile > head/lib/csu/i386/Makefile > head/lib/csu/mips/Makefile > head/lib/csu/powerpc/Makefile > head/lib/csu/powerpc64/Makefile > head/lib/csu/riscv/Makefile > > Modified: head/lib/csu/Makefile.inc > ============================================================================== > --- head/lib/csu/Makefile.inc Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/Makefile.inc Fri Jul 3 00:09:41 2020 (r362902) > @@ -8,15 +8,52 @@ NO_WMISSING_VARIABLE_DECLARATIONS= > > .if !defined(BUILDING_TESTS) > > +OBJS+= Scrt1.o crt1.o gcrt1.o > OBJS+= crtbegin.o crtbeginS.o crtbeginT.o > OBJS+= crtend.o crtendS.o > +OBJS+= crti.o crtn.o > > +CRT1OBJS+= crtbrand.o ignore_init_note.o > + > ACFLAGS+= -DLOCORE > > CFLAGS+= -fno-asynchronous-unwind-tables > CFLAGS+= -fno-omit-frame-pointer > +CFLAGS+= -I${.CURDIR:H}/common \ > + -I${SRCTOP}/lib/libc/include > > CFLAGS_CRTS= -DSHARED ${PICFLAG} > + > +FILES= ${OBJS} > +FILESMODE= ${LIBMODE} > +FILESOWN= ${LIBOWN} > +FILESGRP= ${LIBGRP} > +FILESDIR= ${LIBDIR} > +# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > +.undef LIBRARIES_ONLY > + > +CLEANFILES+= ${OBJS} ${CRT1OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o > + > +crt1.o: crt1_c.o ${CRT1OBJS} > + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > +.if ${MACHINE_ARCH} == "i386" > + ${OBJCOPY} --localize-symbol _start1 crt1.o > +.endif > + > +gcrt1_c.o: crt1_c.c > + ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > + > +gcrt1.o: gcrt1_c.o ${CRT1OBJS} > + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > + > +Scrt1_c.o: crt1_c.c > + ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > + > +Scrt1.o: Scrt1_c.o ${CRT1OBJS} > + ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > +.if ${MACHINE_ARCH} == "i386" > + ${OBJCOPY} --localize-symbol _start1 crt1.o > +.endif > > crtbegin.o: crtbegin.c > crtbeginS.o: crtbegin.c > > Modified: head/lib/csu/aarch64/Makefile > ============================================================================== > --- head/lib/csu/aarch64/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/aarch64/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,37 +2,8 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o gcrt1.o > -CFLAGS+= -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include > CFLAGS+= -DCRT_IRELOC_SUPPRESS > > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - > -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > +CRT1OBJS+= crt1_s.o > > .include > > Modified: head/lib/csu/amd64/Makefile > ============================================================================== > --- head/lib/csu/amd64/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/amd64/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,37 +2,7 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o gcrt1.o > -CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include > +CFLAGS+= -I${.CURDIR} > CFLAGS+= -fno-omit-frame-pointer -DCRT_IRELOC_RELA > - > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o > - > -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o > > .include > > Modified: head/lib/csu/arm/Makefile > ============================================================================== > --- head/lib/csu/arm/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/arm/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,40 +2,8 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o gcrt1.o > -CFLAGS+= -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include > CFLAGS+= -DCRT_IRELOC_SUPPRESS > > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > - > -crt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > +CRT1OBJS+= crt1_s.o > > .include > > Modified: head/lib/csu/i386/Makefile > ============================================================================== > --- head/lib/csu/i386/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/i386/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,39 +2,9 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o gcrt1.o > -CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include > +CFLAGS+= -I${.CURDIR} > CFLAGS+= -DCRT_IRELOC_REL > > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - > -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - ${OBJCOPY} --localize-symbol _start1 crt1.o > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - ${OBJCOPY} --localize-symbol _start1 Scrt1.o > +CRT1OBJS+= crt1_s.o > > .include > > Modified: head/lib/csu/mips/Makefile > ============================================================================== > --- head/lib/csu/mips/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/mips/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,37 +2,6 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o gcrt1.o > -CFLAGS+= -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include > CFLAGS+= -DCRT_IRELOC_SUPPRESS > - > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o > - > -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o > > .include > > Modified: head/lib/csu/powerpc/Makefile > ============================================================================== > --- head/lib/csu/powerpc/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/powerpc/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,37 +2,7 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S crtsavres.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o gcrt1.o > -CFLAGS+= -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include > +OBJS+= crtsavres.o > CFLAGS+= -DCRT_IRELOC_SUPPRESS > - > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o > - > -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o > > .include > > Modified: head/lib/csu/powerpc64/Makefile > ============================================================================== > --- head/lib/csu/powerpc64/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/powerpc64/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,42 +2,14 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o crtsavres.o gcrt1.o > -CFLAGS+= -I${.CURDIR} -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include \ > +OBJS+= crtsavres.o > +CFLAGS+= -I${.CURDIR} \ > -mlongcall -DCRT_IRELOC_RELA > > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > CLEANFILES+= crtsavres.S > > # On powerpc64 crtsavres is an empty file > crtsavres.S: > touch ${.TARGET} > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o gcrt1.o -r crtbrand.o ignore_init_note.o gcrt1_c.o > - > -crt1.o: crt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o crt1.o -r crtbrand.o ignore_init_note.o crt1_c.o > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o Scrt1.o -r crtbrand.o ignore_init_note.o Scrt1_c.o > > .include > > Modified: head/lib/csu/riscv/Makefile > ============================================================================== > --- head/lib/csu/riscv/Makefile Thu Jul 2 22:59:05 2020 (r362901) > +++ head/lib/csu/riscv/Makefile Fri Jul 3 00:09:41 2020 (r362902) > @@ -2,37 +2,8 @@ > > .PATH: ${.CURDIR:H}/common > > -SRCS= crti.S crtn.S > -OBJS= ${SRCS:N*.h:R:S/$/.o/g} > -OBJS+= Scrt1.o crt1.o gcrt1.o > -CFLAGS+= -I${.CURDIR:H}/common \ > - -I${SRCTOP}/lib/libc/include > CFLAGS+= -DCRT_IRELOC_SUPPRESS > > -FILES= ${OBJS} > -FILESMODE= ${LIBMODE} > -FILESOWN= ${LIBOWN} > -FILESGRP= ${LIBGRP} > -FILESDIR= ${LIBDIR} > -# These FILES qualify as libraries for the purpose of LIBRARIES_ONLY. > -.undef LIBRARIES_ONLY > - > -CLEANFILES= ${OBJS} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o > -CLEANFILES+= crtbrand.o ignore_init_note.o > - > -gcrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -DGCRT -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -gcrt1.o: gcrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - > -crt1.o: crt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > - > -Scrt1_c.o: crt1_c.c > - ${CC} ${CFLAGS} -fPIC -DPIC -c -o ${.TARGET} ${.CURDIR}/crt1_c.c > - > -Scrt1.o: Scrt1_c.o crt1_s.o crtbrand.o ignore_init_note.o > - ${LD} ${_LDFLAGS} -o ${.TARGET} -r ${.ALLSRC:M*.o} > +CRT1OBJS+= crt1_s.o > > .include > _______________________________________________ > 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 Sat Jul 4 03:28: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 00E09360614; Sat, 4 Jul 2020 03:28:14 +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 49zHNF6DfJz45r0; Sat, 4 Jul 2020 03:28:13 +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 B929A1638B; Sat, 4 Jul 2020 03:28:13 +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 0643SDlO015991; Sat, 4 Jul 2020 03:28:13 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0643SD5O015990; Sat, 4 Jul 2020 03:28:13 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202007040328.0643SD5O015990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 4 Jul 2020 03:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362917 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 362917 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 03:28:14 -0000 Author: rmacklem Date: Sat Jul 4 03:28:13 2020 New Revision: 362917 URL: https://svnweb.freebsd.org/changeset/base/362917 Log: Add support for ext_pgs mbufs to nfscl_reqstart() and nfsm_set(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Modified: head/sys/fs/nfs/nfs_commonsubs.c Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Sat Jul 4 03:27:51 2020 (r362916) +++ head/sys/fs/nfs/nfs_commonsubs.c Sat Jul 4 03:28:13 2020 (r362917) @@ -359,13 +359,19 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum, /* * Get the first mbuf for the request. */ - if (nfs_bigrequest[procnum]) - NFSMCLGET(mb, M_WAITOK); - else - NFSMGET(mb); - mb->m_len = 0; - nd->nd_mreq = nd->nd_mb = mb; - nd->nd_bpos = mtod(mb, char *); + if ((nd->nd_flag & ND_EXTPG) != 0) { + mb = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK); + nd->nd_mreq = nd->nd_mb = mb; + nfsm_set(nd, 0); + } else { + if (nfs_bigrequest[procnum]) + NFSMCLGET(mb, M_WAITOK); + else + NFSMGET(mb); + mb->m_len = 0; + nd->nd_mreq = nd->nd_mb = mb; + nd->nd_bpos = mtod(mb, char *); + } /* * And fill the first file handle into the request. @@ -4804,7 +4810,38 @@ void nfsm_set(struct nfsrv_descript *nd, u_int offs) { struct mbuf *m; + int rlen; m = nd->nd_mb; - nd->nd_bpos = mtod(m, char *) + offs; + if ((m->m_flags & M_EXTPG) != 0) { + nd->nd_bextpg = 0; + while (offs > 0) { + if (nd->nd_bextpg == 0) + rlen = m_epg_pagelen(m, 0, m->m_epg_1st_off); + else + rlen = m_epg_pagelen(m, nd->nd_bextpg, 0); + if (offs <= rlen) + break; + offs -= rlen; + nd->nd_bextpg++; + if (nd->nd_bextpg == m->m_epg_npgs) { + printf("nfsm_set: build offs " + "out of range\n"); + nd->nd_bextpg--; + break; + } + } + nd->nd_bpos = (char *)(void *) + PHYS_TO_DMAP(m->m_epg_pa[nd->nd_bextpg]); + if (nd->nd_bextpg == 0) + nd->nd_bpos += m->m_epg_1st_off; + if (offs > 0) { + nd->nd_bpos += offs; + nd->nd_bextpgsiz = rlen - offs; + } else if (nd->nd_bextpg == 0) + nd->nd_bextpgsiz = PAGE_SIZE - m->m_epg_1st_off; + else + nd->nd_bextpgsiz = PAGE_SIZE; + } else + nd->nd_bpos = mtod(m, char *) + offs; } From owner-svn-src-head@freebsd.org Sat Jul 4 06: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 D9E3D362773; Sat, 4 Jul 2020 06:21:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49zMD05JBYz4DMV; Sat, 4 Jul 2020 06:21:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A83D17EEF; Sat, 4 Jul 2020 06:21:20 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0646LKxg023829; Sat, 4 Jul 2020 06:21:20 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0646LKZj023828; Sat, 4 Jul 2020 06:21:20 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007040621.0646LKZj023828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 4 Jul 2020 06:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362920 - head/sys/security/audit X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/security/audit X-SVN-Commit-Revision: 362920 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 06:21:20 -0000 Author: mjg Date: Sat Jul 4 06:21:20 2020 New Revision: 362920 URL: https://svnweb.freebsd.org/changeset/base/362920 Log: audit: provide AUDITING_TD for !AUDIT case Modified: head/sys/security/audit/audit.h Modified: head/sys/security/audit/audit.h ============================================================================== --- head/sys/security/audit/audit.h Sat Jul 4 03:30:19 2020 (r362919) +++ head/sys/security/audit/audit.h Sat Jul 4 06:21:20 2020 (r362920) @@ -468,6 +468,8 @@ void audit_thread_free(struct thread *td); #define AUDIT_ARG_VNODE1(vp) #define AUDIT_ARG_VNODE2(vp) +#define AUDITING_TD(td) 0 + #define AUDIT_SYSCALL_ENTER(code, td) 0 #define AUDIT_SYSCALL_EXIT(error, td) From owner-svn-src-head@freebsd.org Sat Jul 4 06:22: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 0E27C363081; Sat, 4 Jul 2020 06:22:06 +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 49zMDs6VRxz4DfF; Sat, 4 Jul 2020 06:22:05 +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 C25C51813F; Sat, 4 Jul 2020 06:22:05 +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 0646M5OC025754; Sat, 4 Jul 2020 06:22:05 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0646M5OD025751; Sat, 4 Jul 2020 06:22:05 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007040622.0646M5OD025751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 4 Jul 2020 06:22:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362921 - 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: 362921 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 06:22:06 -0000 Author: mjg Date: Sat Jul 4 06:22:05 2020 New Revision: 362921 URL: https://svnweb.freebsd.org/changeset/base/362921 Log: Add char and short types to kcsan Modified: head/sys/kern/subr_csan.c head/sys/sys/_cscan_atomic.h Modified: head/sys/kern/subr_csan.c ============================================================================== --- head/sys/kern/subr_csan.c Sat Jul 4 06:21:20 2020 (r362920) +++ head/sys/kern/subr_csan.c Sat Jul 4 06:22:05 2020 (r362921) @@ -590,6 +590,38 @@ CSAN_ATOMIC_FUNC_TESTANDCLEAR(64, uint64_t) CSAN_ATOMIC_FUNC_TESTANDSET(64, uint64_t) #endif +CSAN_ATOMIC_FUNC_ADD(char, uint8_t) +CSAN_ATOMIC_FUNC_CLEAR(char, uint8_t) +CSAN_ATOMIC_FUNC_CMPSET(char, uint8_t) +CSAN_ATOMIC_FUNC_FCMPSET(char, uint8_t) +CSAN_ATOMIC_FUNC_LOAD(char, uint8_t) +CSAN_ATOMIC_FUNC_SET(char, uint8_t) +CSAN_ATOMIC_FUNC_SUBTRACT(char, uint8_t) +_CSAN_ATOMIC_FUNC_STORE(char, uint8_t) +#if 0 +CSAN_ATOMIC_FUNC_FETCHADD(char, uint8_t) +CSAN_ATOMIC_FUNC_READANDCLEAR(char, uint8_t) +CSAN_ATOMIC_FUNC_SWAP(char, uint8_t) +CSAN_ATOMIC_FUNC_TESTANDCLEAR(char, uint8_t) +CSAN_ATOMIC_FUNC_TESTANDSET(char, uint8_t) +#endif + +CSAN_ATOMIC_FUNC_ADD(short, uint16_t) +CSAN_ATOMIC_FUNC_CLEAR(short, uint16_t) +CSAN_ATOMIC_FUNC_CMPSET(short, uint16_t) +CSAN_ATOMIC_FUNC_FCMPSET(short, uint16_t) +CSAN_ATOMIC_FUNC_LOAD(short, uint16_t) +CSAN_ATOMIC_FUNC_SET(short, uint16_t) +CSAN_ATOMIC_FUNC_SUBTRACT(short, uint16_t) +_CSAN_ATOMIC_FUNC_STORE(short, uint16_t) +#if 0 +CSAN_ATOMIC_FUNC_FETCHADD(short, uint16_t) +CSAN_ATOMIC_FUNC_READANDCLEAR(short, uint16_t) +CSAN_ATOMIC_FUNC_SWAP(short, uint16_t) +CSAN_ATOMIC_FUNC_TESTANDCLEAR(short, uint16_t) +CSAN_ATOMIC_FUNC_TESTANDSET(short, uint16_t) +#endif + CSAN_ATOMIC_FUNC_ADD(int, u_int) CSAN_ATOMIC_FUNC_CLEAR(int, u_int) CSAN_ATOMIC_FUNC_CMPSET(int, u_int) Modified: head/sys/sys/_cscan_atomic.h ============================================================================== --- head/sys/sys/_cscan_atomic.h Sat Jul 4 06:21:20 2020 (r362920) +++ head/sys/sys/_cscan_atomic.h Sat Jul 4 06:22:05 2020 (r362921) @@ -87,6 +87,8 @@ KCSAN_ATOMIC_TEST(testandclear, name, type); \ KCSAN_ATOMIC_TEST(testandset, name, type) +KCSAN_ATOMIC_FUNCS(char, uint8_t); +KCSAN_ATOMIC_FUNCS(short, uint16_t); KCSAN_ATOMIC_FUNCS(int, u_int); KCSAN_ATOMIC_FUNCS(long, u_long); KCSAN_ATOMIC_FUNCS(ptr, uintptr_t); @@ -101,6 +103,62 @@ void kcsan_atomic_thread_fence_rel(void); void kcsan_atomic_thread_fence_seq_cst(void); #ifndef KCSAN_RUNTIME + +#define atomic_add_char kcsan_atomic_add_char +#define atomic_add_acq_char kcsan_atomic_add_acq_char +#define atomic_add_rel_char kcsan_atomic_add_rel_char +#define atomic_clear_char kcsan_atomic_clear_char +#define atomic_clear_acq_char kcsan_atomic_clear_acq_char +#define atomic_clear_rel_char kcsan_atomic_clear_rel_char +#define atomic_cmpset_char kcsan_atomic_cmpset_char +#define atomic_cmpset_acq_char kcsan_atomic_cmpset_acq_char +#define atomic_cmpset_rel_char kcsan_atomic_cmpset_rel_char +#define atomic_fcmpset_char kcsan_atomic_fcmpset_char +#define atomic_fcmpset_acq_char kcsan_atomic_fcmpset_acq_char +#define atomic_fcmpset_rel_char kcsan_atomic_fcmpset_rel_char +#define atomic_fetchadd_char kcsan_atomic_fetchadd_char +#define atomic_load_char kcsan_atomic_load_char +#define atomic_load_acq_char kcsan_atomic_load_acq_char +#define atomic_readandclear_char kcsan_atomic_readandclear_char +#define atomic_set_char kcsan_atomic_set_char +#define atomic_set_acq_char kcsan_atomic_set_acq_char +#define atomic_set_rel_char kcsan_atomic_set_rel_char +#define atomic_subtract_char kcsan_atomic_subtract_char +#define atomic_subtract_acq_char kcsan_atomic_subtract_acq_char +#define atomic_subtract_rel_char kcsan_atomic_subtract_rel_char +#define atomic_store_char kcsan_atomic_store_char +#define atomic_store_rel_char kcsan_atomic_store_rel_char +#define atomic_swap_char kcsan_atomic_swap_char +#define atomic_testandclear_char kcsan_atomic_testandclear_char +#define atomic_testandset_char kcsan_atomic_testandset_char + +#define atomic_add_short kcsan_atomic_add_short +#define atomic_add_acq_short kcsan_atomic_add_acq_short +#define atomic_add_rel_short kcsan_atomic_add_rel_short +#define atomic_clear_short kcsan_atomic_clear_short +#define atomic_clear_acq_short kcsan_atomic_clear_acq_short +#define atomic_clear_rel_short kcsan_atomic_clear_rel_short +#define atomic_cmpset_short kcsan_atomic_cmpset_short +#define atomic_cmpset_acq_short kcsan_atomic_cmpset_acq_short +#define atomic_cmpset_rel_short kcsan_atomic_cmpset_rel_short +#define atomic_fcmpset_short kcsan_atomic_fcmpset_short +#define atomic_fcmpset_acq_short kcsan_atomic_fcmpset_acq_short +#define atomic_fcmpset_rel_short kcsan_atomic_fcmpset_rel_short +#define atomic_fetchadd_short kcsan_atomic_fetchadd_short +#define atomic_load_short kcsan_atomic_load_short +#define atomic_load_acq_short kcsan_atomic_load_acq_short +#define atomic_readandclear_short kcsan_atomic_readandclear_short +#define atomic_set_short kcsan_atomic_set_short +#define atomic_set_acq_short kcsan_atomic_set_acq_short +#define atomic_set_rel_short kcsan_atomic_set_rel_short +#define atomic_subtract_short kcsan_atomic_subtract_short +#define atomic_subtract_acq_short kcsan_atomic_subtract_acq_short +#define atomic_subtract_rel_short kcsan_atomic_subtract_rel_short +#define atomic_store_short kcsan_atomic_store_short +#define atomic_store_rel_short kcsan_atomic_store_rel_short +#define atomic_swap_short kcsan_atomic_swap_short +#define atomic_testandclear_short kcsan_atomic_testandclear_short +#define atomic_testandset_short kcsan_atomic_testandset_short #define atomic_add_int kcsan_atomic_add_int #define atomic_add_acq_int kcsan_atomic_add_acq_int From owner-svn-src-head@freebsd.org Sat Jul 4 06:25: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 60E71363100; Sat, 4 Jul 2020 06:25:42 +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 49zMK21Hhvz4FG0; Sat, 4 Jul 2020 06:25:42 +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 1030418448; Sat, 4 Jul 2020 06:25:42 +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 0646Pflf026708; Sat, 4 Jul 2020 06:25:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0646Pf7H026707; Sat, 4 Jul 2020 06:25:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007040625.0646Pf7H026707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 4 Jul 2020 06:25:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362922 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 362922 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 06:25:42 -0000 Author: mjg Date: Sat Jul 4 06:25:41 2020 New Revision: 362922 URL: https://svnweb.freebsd.org/changeset/base/362922 Log: linux: fix ioctl performance for termios TCGETS et al are frequently issued by Linux binaries while the previous code avoidably ping-pongs a global sx lock and serializes on Giant. Note that even with the fix the common case will serialize on a per-tty lock. Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Sat Jul 4 06:22:05 2020 (r362921) +++ head/sys/compat/linux/linux_ioctl.c Sat Jul 4 06:25:41 2020 (r362922) @@ -132,8 +132,6 @@ static struct linux_ioctl_handler socket_handler = { linux_ioctl_socket, LINUX_IOCTL_SOCKET_MIN, LINUX_IOCTL_SOCKET_MAX }; static struct linux_ioctl_handler sound_handler = { linux_ioctl_sound, LINUX_IOCTL_SOUND_MIN, LINUX_IOCTL_SOUND_MAX }; -static struct linux_ioctl_handler termio_handler = -{ linux_ioctl_termio, LINUX_IOCTL_TERMIO_MIN, LINUX_IOCTL_TERMIO_MAX }; static struct linux_ioctl_handler private_handler = { linux_ioctl_private, LINUX_IOCTL_PRIVATE_MIN, LINUX_IOCTL_PRIVATE_MAX }; static struct linux_ioctl_handler drm_handler = @@ -156,7 +154,6 @@ DATA_SET(linux_ioctl_handler_set, hdio_handler); DATA_SET(linux_ioctl_handler_set, disk_handler); DATA_SET(linux_ioctl_handler_set, socket_handler); DATA_SET(linux_ioctl_handler_set, sound_handler); -DATA_SET(linux_ioctl_handler_set, termio_handler); DATA_SET(linux_ioctl_handler_set, private_handler); DATA_SET(linux_ioctl_handler_set, drm_handler); DATA_SET(linux_ioctl_handler_set, sg_handler); @@ -165,6 +162,14 @@ DATA_SET(linux_ioctl_handler_set, video2_handler); DATA_SET(linux_ioctl_handler_set, fbsd_usb); DATA_SET(linux_ioctl_handler_set, evdev_handler); +/* + * Keep sorted by low. + */ +static struct linux_ioctl_handler linux_ioctls[] = { + { .func = linux_ioctl_termio, .low = LINUX_IOCTL_TERMIO_MIN, + .high = LINUX_IOCTL_TERMIO_MAX }, +}; + #ifdef __i386__ static TAILQ_HEAD(, linux_ioctl_handler_element) linux_ioctl_handlers = TAILQ_HEAD_INITIALIZER(linux_ioctl_handlers); @@ -3558,8 +3563,8 @@ linux_ioctl_evdev(struct thread *td, struct linux_ioct * main ioctl syscall function */ -int -linux_ioctl(struct thread *td, struct linux_ioctl_args *args) +static int +linux_ioctl_fallback(struct thread *td, struct linux_ioctl_args *args) { struct file *fp; struct linux_ioctl_handler_element *he; @@ -3618,6 +3623,35 @@ linux_ioctl(struct thread *td, struct linux_ioctl_args } return (EINVAL); +} + +int +linux_ioctl(struct thread *td, struct linux_ioctl_args *args) +{ + struct linux_ioctl_handler *handler; + int error, cmd, i; + + cmd = args->cmd & 0xffff; + + /* + * array of ioctls known at compilation time. Elides a lot of work on + * each call compared to the list variant. Everything frequently used + * should be moved here. + * + * Arguably the magic creating the list should create an array instead. + * + * For now just a linear scan. + */ + for (i = 0; i < nitems(linux_ioctls); i++) { + handler = &linux_ioctls[i]; + if (cmd >= handler->low && cmd <= handler->high) { + error = (*handler->func)(td, args); + if (error != ENOIOCTL) { + return (error); + } + } + } + return (linux_ioctl_fallback(td, args)); } int From owner-svn-src-head@freebsd.org Sat Jul 4 06:27: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 38354363123; Sat, 4 Jul 2020 06:27:29 +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 49zMM46bhdz4F7r; Sat, 4 Jul 2020 06:27:28 +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 C1A4518320; Sat, 4 Jul 2020 06:27:28 +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 0646RSgL026834; Sat, 4 Jul 2020 06:27:28 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0646RSEi026833; Sat, 4 Jul 2020 06:27:28 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202007040627.0646RSEi026833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 4 Jul 2020 06:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362923 - head/sys/fs/devfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/devfs X-SVN-Commit-Revision: 362923 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 06:27:29 -0000 Author: mjg Date: Sat Jul 4 06:27:28 2020 New Revision: 362923 URL: https://svnweb.freebsd.org/changeset/base/362923 Log: devfs: fix a vnode use-after-free in devfs_ioctl The vnode to be replaced was read with a shared lock, meaning 2 racing threads can find the same one. While here clean it up a little bit. Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Sat Jul 4 06:25:41 2020 (r362922) +++ head/sys/fs/devfs/devfs_vnops.c Sat Jul 4 06:27:28 2020 (r362923) @@ -787,6 +787,7 @@ devfs_ioctl(struct vop_ioctl_args *ap) struct vnode *vpold, *vp; struct cdevsw *dsw; struct thread *td; + struct session *sess; struct cdev *dev; int error, ref, i; const char *p; @@ -836,18 +837,18 @@ devfs_ioctl(struct vop_ioctl_args *ap) * nothing left to do. */ sx_slock(&proctree_lock); - if (td->td_proc->p_session->s_ttyvp == vp || - td->td_proc->p_session->s_ttyp == NULL) { + sess = td->td_proc->p_session; + if (sess->s_ttyvp == vp || sess->s_ttyp == NULL) { sx_sunlock(&proctree_lock); return (0); } - vpold = td->td_proc->p_session->s_ttyvp; - VREF(vp); - SESS_LOCK(td->td_proc->p_session); - td->td_proc->p_session->s_ttyvp = vp; - td->td_proc->p_session->s_ttydp = cdev2priv(dev); - SESS_UNLOCK(td->td_proc->p_session); + vrefact(vp); + SESS_LOCK(sess); + vpold = sess->s_ttyvp; + sess->s_ttyvp = vp; + sess->s_ttydp = cdev2priv(dev); + SESS_UNLOCK(sess); sx_sunlock(&proctree_lock); From owner-svn-src-head@freebsd.org Sat Jul 4 11:22: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 62EF1349E81; Sat, 4 Jul 2020 11:22:36 +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 49zTvc23wpz4Ws0; Sat, 4 Jul 2020 11:22:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B7F41BAD2; Sat, 4 Jul 2020 11:22:36 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 064BMaKU013687; Sat, 4 Jul 2020 11:22:36 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 064BMZR9013685; Sat, 4 Jul 2020 11:22:35 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202007041122.064BMZR9013685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 4 Jul 2020 11:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362929 - in head/sys/compat: linprocfs linsysfs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys/compat: linprocfs linsysfs X-SVN-Commit-Revision: 362929 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 11:22:36 -0000 Author: trasz Date: Sat Jul 4 11:22:35 2020 New Revision: 362929 URL: https://svnweb.freebsd.org/changeset/base/362929 Log: Make linprocfs(5) create /proc/bus/pci/devices/, and linsysfs(5) create /sys/class/power_supply/. This silences some warnings from biology/linux-foldingathome. Reported by: 0mp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25557 Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linsysfs/linsysfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 09:18:19 2020 (r362928) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 11:22:35 2020 (r362929) @@ -1746,6 +1746,11 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(root, "version", &linprocfs_doversion, NULL, NULL, NULL, PFS_RD); + /* /proc/bus/... */ + dir = pfs_create_dir(root, "bus", NULL, NULL, NULL, 0); + dir = pfs_create_dir(dir, "pci", NULL, NULL, NULL, 0); + dir = pfs_create_dir(dir, "devices", NULL, NULL, NULL, 0); + /* /proc/net/... */ dir = pfs_create_dir(root, "net", NULL, NULL, NULL, 0); pfs_create_file(dir, "dev", &linprocfs_donetdev, Modified: head/sys/compat/linsysfs/linsysfs.c ============================================================================== --- head/sys/compat/linsysfs/linsysfs.c Sat Jul 4 09:18:19 2020 (r362928) +++ head/sys/compat/linsysfs/linsysfs.c Sat Jul 4 11:22:35 2020 (r362929) @@ -622,6 +622,7 @@ linsysfs_init(PFS_INIT_ARGS) struct pfs_node *pci; struct pfs_node *scsi; struct pfs_node *net; + struct pfs_node *power_supply; struct pfs_node *devdir, *chardev; devclass_t devclass; device_t dev; @@ -634,6 +635,7 @@ linsysfs_init(PFS_INIT_ARGS) class = pfs_create_dir(root, "class", NULL, NULL, NULL, 0); scsi = pfs_create_dir(class, "scsi_host", NULL, NULL, NULL, 0); drm = pfs_create_dir(class, "drm", NULL, NULL, NULL, 0); + power_supply = pfs_create_dir(class, "power_supply", NULL, NULL, NULL, 0); /* /sys/class/net/.. */ net = pfs_create_dir(class, "net", NULL, NULL, NULL, 0); From owner-svn-src-head@freebsd.org Sat Jul 4 11:26: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 538B7349BD4; Sat, 4 Jul 2020 11:26:04 +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 49zTzc0lDhz4XCP; Sat, 4 Jul 2020 11:26:04 +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 D9E5F1BC9D; Sat, 4 Jul 2020 11:26:03 +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 064BQ3mL014010; Sat, 4 Jul 2020 11:26:03 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 064BQ38W014009; Sat, 4 Jul 2020 11:26:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202007041126.064BQ38W014009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 4 Jul 2020 11:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362930 - head/sys/compat/linprocfs X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/compat/linprocfs X-SVN-Commit-Revision: 362930 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 11:26:04 -0000 Author: trasz Date: Sat Jul 4 11:26:03 2020 New Revision: 362930 URL: https://svnweb.freebsd.org/changeset/base/362930 Log: Add /proc/sys/kernel/tainted to linprocfs(5). Helps LTP. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25556 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 11:22:35 2020 (r362929) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 11:26:03 2020 (r362930) @@ -1414,6 +1414,17 @@ linprocfs_dosem(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/tainted + */ +static int +linprocfs_dotainted(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "0\n"); + return (0); +} + +/* * Filler function for proc/sys/vm/min_free_kbytes * * This mirrors the approach in illumos to return zero for reads. Effectively, @@ -1814,6 +1825,8 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "pid_max", &linprocfs_dopid_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "sem", &linprocfs_dosem, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "tainted", &linprocfs_dotainted, NULL, NULL, NULL, PFS_RD); /* /proc/sys/kernel/random/... */ From owner-svn-src-head@freebsd.org Sat Jul 4 14:20: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 7D7C734F9FF; Sat, 4 Jul 2020 14:20:04 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (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 49zYrN2mVGz3W4h; Sat, 4 Jul 2020 14:20:04 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4333F1DD81; Sat, 4 Jul 2020 14:20:04 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 064EK46e020144; Sat, 4 Jul 2020 14:20:04 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 064EK4Lk020143; Sat, 4 Jul 2020 14:20:04 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202007041420.064EK4Lk020143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Sat, 4 Jul 2020 14:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362932 - head/sys/dev/ixl X-SVN-Group: head X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: head/sys/dev/ixl X-SVN-Commit-Revision: 362932 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 14:20:04 -0000 Author: kaktus Date: Sat Jul 4 14:20:03 2020 New Revision: 362932 URL: https://svnweb.freebsd.org/changeset/base/362932 Log: dev.ixl..debug: mark as MPSAFE This node provides no handler, it's implicitly MPSAFE. Reviewed by: erj Sponsored by: Mysterious Code Ltd. Differential Revision: https://reviews.freebsd.org/D25408 Modified: head/sys/dev/ixl/if_iavf.c Modified: head/sys/dev/ixl/if_iavf.c ============================================================================== --- head/sys/dev/ixl/if_iavf.c Sat Jul 4 13:32:57 2020 (r362931) +++ head/sys/dev/ixl/if_iavf.c Sat Jul 4 14:20:03 2020 (r362932) @@ -2090,7 +2090,7 @@ iavf_add_device_sysctls(struct iavf_sc *sc) /* Add sysctls meant to print debug information, but don't list them * in "sysctl -a" output. */ debug_node = SYSCTL_ADD_NODE(ctx, ctx_list, - OID_AUTO, "debug", CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_NEEDGIANT, + OID_AUTO, "debug", CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_MPSAFE, NULL, "Debug Sysctls"); debug_list = SYSCTL_CHILDREN(debug_node); From owner-svn-src-head@freebsd.org Sat Jul 4 18:01: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 DBEB43545BD; Sat, 4 Jul 2020 18:01:29 +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 49zfls5SXPz405g; Sat, 4 Jul 2020 18:01:29 +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 9EACC2042F; Sat, 4 Jul 2020 18:01:29 +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 064I1TCE059041; Sat, 4 Jul 2020 18:01:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 064I1TAc059039; Sat, 4 Jul 2020 18:01:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202007041801.064I1TAc059039@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 4 Jul 2020 18:01:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362935 - in head: libexec/rc/rc.d share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: libexec/rc/rc.d share/man/man4 X-SVN-Commit-Revision: 362935 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 18:01:29 -0000 Author: trasz Date: Sat Jul 4 18:01:29 2020 New Revision: 362935 URL: https://svnweb.freebsd.org/changeset/base/362935 Log: Make the linux rc script use linrdlnk by default. This fixes Linux gettyname(3), with caveats (see PR). PR: kern/240767 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25558 Modified: head/libexec/rc/rc.d/linux head/share/man/man4/linux.4 Modified: head/libexec/rc/rc.d/linux ============================================================================== --- head/libexec/rc/rc.d/linux Sat Jul 4 15:20:23 2020 (r362934) +++ head/libexec/rc/rc.d/linux Sat Jul 4 18:01:29 2020 (r362935) @@ -51,7 +51,7 @@ linux_start() mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" mount -o nocover -t devfs devfs "${_emul_path}/dev" - mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" fi } Modified: head/share/man/man4/linux.4 ============================================================================== --- head/share/man/man4/linux.4 Sat Jul 4 15:20:23 2020 (r362934) +++ head/share/man/man4/linux.4 Sat Jul 4 18:01:29 2020 (r362935) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2020 +.Dd July 4, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -130,7 +130,9 @@ Defaults to 0. .It Pa /compat/linux minimal Linux run-time environment .It Pa /compat/linux/dev/fd -file-descriptor file system, see +file descriptor file system mounted with the +.Cm linrdlnk +option, see .Xr fdescfs 5 .It Pa /compat/linux/dev/shm in-memory file system, see From owner-svn-src-head@freebsd.org Sat Jul 4 18:37: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 6590B35554C; Sat, 4 Jul 2020 18:37:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 49zgXx1xKVz41s1; Sat, 4 Jul 2020 18:37:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25D19206E3; Sat, 4 Jul 2020 18:37:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 064Ib47f082462; Sat, 4 Jul 2020 18:37:04 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 064Ib4PL082461; Sat, 4 Jul 2020 18:37:04 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202007041837.064Ib4PL082461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 4 Jul 2020 18:37:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362936 - head/sbin/newfs_msdos X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/newfs_msdos X-SVN-Commit-Revision: 362936 X-SVN-Commit-Repository: base MIME-Version: 1.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, 04 Jul 2020 18:37:05 -0000 Author: delphij Date: Sat Jul 4 18:37:04 2020 New Revision: 362936 URL: https://svnweb.freebsd.org/changeset/base/362936 Log: Gather writes to larger chunks (MAXPHYS) instead of issuing them in sectors. On my SanDisk Cruzer Blade 16GB USB stick this made formatting much faster: x before + after +--------------------------------------------------------------------------+ |+ | |+ x | |+ x x| |A MA|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 15.89 16.38 16 16.09 0.2570992 + 3 0.32 0.37 0.35 0.34666667 0.025166115 Difference at 95.0% confidence -15.7433 +/- 0.414029 -97.8455% +/- 0.25668% (Student's t, pooled s = 0.182665) Reviewed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24508 Modified: head/sbin/newfs_msdos/mkfs_msdos.c Modified: head/sbin/newfs_msdos/mkfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/mkfs_msdos.c Sat Jul 4 18:01:29 2020 (r362935) +++ head/sbin/newfs_msdos/mkfs_msdos.c Sat Jul 4 18:37:04 2020 (r362936) @@ -64,6 +64,7 @@ static const char rcsid[] = #define DOSMAGIC 0xaa55 /* DOS magic number */ #define MINBPS 512 /* minimum bytes per sector */ +#define MAXBPS 4096 /* maximum bytes per sector */ #define MAXSPC 128 /* maximum sectors per cluster */ #define MAXNFT 16 /* maximum number of FATs */ #define DEFBLK 4096 /* default block size */ @@ -77,6 +78,25 @@ static const char rcsid[] = #define MAXCLS16 0xfff4U /* maximum FAT16 clusters */ #define MAXCLS32 0xffffff4U /* maximum FAT32 clusters */ +#ifndef CTASSERT +#define CTASSERT(x) _CTASSERT(x, __LINE__) +#define _CTASSERT(x, y) __CTASSERT(x, y) +#define __CTASSERT(x, y) typedef char __assert_ ## y [(x) ? 1 : -1] +#endif + +/* + * For better performance, we want to write larger chunks instead of + * individual sectors (the size can only be 512, 1024, 2048 or 4096 + * bytes). Assert that MAXPHYS can always hold an integer number of + * sectors by asserting that both are power of two numbers and the + * MAXPHYS is greater than MAXBPS. + */ +CTASSERT(powerof2(MAXPHYS)); +CTASSERT(powerof2(MAXBPS)); +CTASSERT(MAXPHYS > MAXBPS); + +const static ssize_t chunksize = MAXPHYS; + #define mincls(fat) ((fat) == 12 ? MINCLS12 : \ (fat) == 16 ? MINCLS16 : \ MINCLS32) @@ -243,6 +263,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct bsx *bsx; struct de *de; u_int8_t *img; + u_int8_t *physbuf, *physbuf_end; const char *bname; ssize_t n; time_t now; @@ -252,7 +273,7 @@ mkfs_msdos(const char *fname, const char *dtype, const int fd, fd1, rv; struct msdos_options o = *op; - img = NULL; + physbuf = NULL; rv = -1; fd = fd1 = -1; @@ -343,15 +364,13 @@ mkfs_msdos(const char *fname, const char *dtype, const bpb.bpbSecPerClust = 64; /* otherwise 32k */ } } - if (!powerof2(bpb.bpbBytesPerSec)) { - warnx("bytes/sector (%u) is not a power of 2", bpb.bpbBytesPerSec); + if (bpb.bpbBytesPerSec < MINBPS || + bpb.bpbBytesPerSec > MAXBPS || + !powerof2(bpb.bpbBytesPerSec)) { + warnx("Invalid bytes/sector (%u): must be 512, 1024, 2048 or 4096", + bpb.bpbBytesPerSec); goto done; } - if (bpb.bpbBytesPerSec < MINBPS) { - warnx("bytes/sector (%u) is too small; minimum is %u", - bpb.bpbBytesPerSec, MINBPS); - goto done; - } if (o.volume_label && !oklabel(o.volume_label)) { warnx("%s: bad volume label", o.volume_label); @@ -621,11 +640,14 @@ mkfs_msdos(const char *fname, const char *dtype, const tm = localtime(&now); } - - if (!(img = malloc(bpb.bpbBytesPerSec))) { + physbuf = malloc(chunksize); + if (physbuf == NULL) { warn(NULL); goto done; } + physbuf_end = physbuf + chunksize; + img = physbuf; + dir = bpb.bpbResSectors + (bpb.bpbFATsecs ? bpb.bpbFATsecs : bpb.bpbBigFATsecs) * bpb.bpbFATs; memset(&si_sa, 0, sizeof(si_sa)); @@ -750,19 +772,37 @@ mkfs_msdos(const char *fname, const char *dtype, const (u_int)tm->tm_mday; mk2(de->deMDate, x); } - if ((n = write(fd, img, bpb.bpbBytesPerSec)) == -1) { - warn("%s", fname); - goto done; + /* + * Issue a write of chunksize once we have collected + * enough sectors. + */ + img += bpb.bpbBytesPerSec; + if (img >= physbuf_end) { + n = write(fd, physbuf, chunksize); + if (n != chunksize) { + warnx("%s: can't write sector %u", fname, lsn); + goto done; + } + img = physbuf; } - if ((unsigned)n != bpb.bpbBytesPerSec) { - warnx("%s: can't write sector %u", fname, lsn); - goto done; - } } + /* + * Write remaining sectors, if the last write didn't end + * up filling a whole chunk. + */ + if (img != physbuf) { + ssize_t tailsize = img - physbuf; + + n = write(fd, physbuf, tailsize); + if (n != tailsize) { + warnx("%s: can't write sector %u", fname, lsn); + goto done; + } + } } rv = 0; done: - free(img); + free(physbuf); if (fd != -1) close(fd); if (fd1 != -1) From owner-svn-src-head@freebsd.org Sat Jul 4 19: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 D3945355E18; Sat, 4 Jul 2020 19:02:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (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 49zh5t22rXz438R; Sat, 4 Jul 2020 19:02:10 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f44.google.com with SMTP id 5so26835780oty.11; Sat, 04 Jul 2020 12:02:10 -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=kAIPcqos0P65//5USrP/xzS1t1p4zztCxSsCDZOS9M4=; b=TdC1uOKq1nxzuaHkAkNSCzz96RzmYT58c4TyRmcWxzzbWm3DvA8Es1mzlYHU0pMcST Gc5z2qa16IfnltCo93UPtrN5eQLjDpM0Gy9ShrVLYLCaIvI7Vv9nrscv+bLB+0xEKBFN a9gEksfQIWEFEe6uArPLc7KtAmQQpcXE4xhHPOZoVXq9p8DWZfgzwwDEp/47eeLRRPwP l3XYuLRiKYXavurVi1QiW9Q9noX6PYYDg+Rwk5u++ZnjCyicddccqV67kN8qXkMTfFko 26qd6DSLVKLPok6byZedql6p8MrXBIDKN2+znRSWaw9lbipkX5OzeAL4NFKpCaCfFw7t E+7w== X-Gm-Message-State: AOAM530p9mSF+7exVUniiT3p5DIySUw+K2qzMXGsvuMaoQw3ort7i77J HkG9cbB2QwBFPYvZgY3HL31Yr+yg X-Google-Smtp-Source: ABdhPJy9wNNj8Ur8AGjgB9XTZMTKYa6JbvkXAmhH9E6d8j8esHqNqsox+BdKASusKS1jJMsUJsEvyg== X-Received: by 2002:a05:6830:138d:: with SMTP id d13mr9693538otq.298.1593889328319; Sat, 04 Jul 2020 12:02:08 -0700 (PDT) Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com. [209.85.210.47]) by smtp.gmail.com with ESMTPSA id l23sm4404114oot.41.2020.07.04.12.02.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 04 Jul 2020 12:02:08 -0700 (PDT) Received: by mail-ot1-f47.google.com with SMTP id w17so20989712otl.4; Sat, 04 Jul 2020 12:02:07 -0700 (PDT) X-Received: by 2002:a9d:2224:: with SMTP id o33mr36663051ota.216.1593889327326; Sat, 04 Jul 2020 12:02:07 -0700 (PDT) MIME-Version: 1.0 References: <202007041837.064Ib4PL082461@repo.freebsd.org> In-Reply-To: <202007041837.064Ib4PL082461@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Sat, 4 Jul 2020 12:01:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r362936 - head/sbin/newfs_msdos To: Xin LI Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 49zh5t22rXz438R X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, 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: Sat, 04 Jul 2020 19:02:10 -0000 Hi Xin Li, Maybe we can use C11 static_assert instead of the CTASSERT array mechanism? Best, Conrad On Sat, Jul 4, 2020 at 11:37 Xin LI wrote: > Author: delphij > Date: Sat Jul 4 18:37:04 2020 > New Revision: 362936 > URL: https://svnweb.freebsd.org/changeset/base/362936 > > Log: > Gather writes to larger chunks (MAXPHYS) instead of issuing them in > sectors. > > On my SanDisk Cruzer Blade 16GB USB stick this made formatting much > faster: > > x before > + after > > +--------------------------------------------------------------------------+ > |+ > | > |+ > x | > |+ > x x| > |A > MA|| > > +--------------------------------------------------------------------------+ > N Min Max Median Avg > Stddev > x 3 15.89 16.38 16 16.09 > 0.2570992 > + 3 0.32 0.37 0.35 0.34666667 > 0.025166115 > Difference at 95.0% confidence > -15.7433 +/- 0.414029 > -97.8455% +/- 0.25668% > (Student's t, pooled s = 0.182665) > > Reviewed by: emaste > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D24508 > > Modified: > head/sbin/newfs_msdos/mkfs_msdos.c > > Modified: head/sbin/newfs_msdos/mkfs_msdos.c > > ============================================================================== > --- head/sbin/newfs_msdos/mkfs_msdos.c Sat Jul 4 18:01:29 2020 > (r362935) > +++ head/sbin/newfs_msdos/mkfs_msdos.c Sat Jul 4 18:37:04 2020 > (r362936) > @@ -64,6 +64,7 @@ static const char rcsid[] = > > #define DOSMAGIC 0xaa55 /* DOS magic number */ > #define MINBPS 512 /* minimum bytes per sector */ > +#define MAXBPS 4096 /* maximum bytes per sector */ > #define MAXSPC 128 /* maximum sectors per cluster */ > #define MAXNFT 16 /* maximum number of FATs */ > #define DEFBLK 4096 /* default block size */ > @@ -77,6 +78,25 @@ static const char rcsid[] = > #define MAXCLS16 0xfff4U /* maximum FAT16 clusters */ > #define MAXCLS32 0xffffff4U /* maximum FAT32 clusters */ > > +#ifndef CTASSERT > +#define CTASSERT(x) _CTASSERT(x, __LINE__) > +#define _CTASSERT(x, y) __CTASSERT(x, y) > +#define __CTASSERT(x, y) typedef char __assert_ ## y [(x) ? > 1 : -1] > +#endif > + > +/* > + * For better performance, we want to write larger chunks instead of > + * individual sectors (the size can only be 512, 1024, 2048 or 4096 > + * bytes). Assert that MAXPHYS can always hold an integer number of > + * sectors by asserting that both are power of two numbers and the > + * MAXPHYS is greater than MAXBPS. > + */ > +CTASSERT(powerof2(MAXPHYS)); > +CTASSERT(powerof2(MAXBPS)); > +CTASSERT(MAXPHYS > MAXBPS); > + > +const static ssize_t chunksize = MAXPHYS; > + > #define mincls(fat) ((fat) == 12 ? MINCLS12 : \ > (fat) == 16 ? MINCLS16 : \ > MINCLS32) > @@ -243,6 +263,7 @@ mkfs_msdos(const char *fname, const char *dtype, const > struct bsx *bsx; > struct de *de; > u_int8_t *img; > + u_int8_t *physbuf, *physbuf_end; > const char *bname; > ssize_t n; > time_t now; > @@ -252,7 +273,7 @@ mkfs_msdos(const char *fname, const char *dtype, const > int fd, fd1, rv; > struct msdos_options o = *op; > > - img = NULL; > + physbuf = NULL; > rv = -1; > fd = fd1 = -1; > > @@ -343,15 +364,13 @@ mkfs_msdos(const char *fname, const char *dtype, > const > bpb.bpbSecPerClust = 64; /* otherwise 32k */ > } > } > - if (!powerof2(bpb.bpbBytesPerSec)) { > - warnx("bytes/sector (%u) is not a power of 2", bpb.bpbBytesPerSec); > + if (bpb.bpbBytesPerSec < MINBPS || > + bpb.bpbBytesPerSec > MAXBPS || > + !powerof2(bpb.bpbBytesPerSec)) { > + warnx("Invalid bytes/sector (%u): must be 512, 1024, 2048 or 4096", > + bpb.bpbBytesPerSec); > goto done; > } > - if (bpb.bpbBytesPerSec < MINBPS) { > - warnx("bytes/sector (%u) is too small; minimum is %u", > - bpb.bpbBytesPerSec, MINBPS); > - goto done; > - } > > if (o.volume_label && !oklabel(o.volume_label)) { > warnx("%s: bad volume label", o.volume_label); > @@ -621,11 +640,14 @@ mkfs_msdos(const char *fname, const char *dtype, > const > tm = localtime(&now); > } > > - > - if (!(img = malloc(bpb.bpbBytesPerSec))) { > + physbuf = malloc(chunksize); > + if (physbuf == NULL) { > warn(NULL); > goto done; > } > + physbuf_end = physbuf + chunksize; > + img = physbuf; > + > dir = bpb.bpbResSectors + (bpb.bpbFATsecs ? bpb.bpbFATsecs : > bpb.bpbBigFATsecs) * bpb.bpbFATs; > memset(&si_sa, 0, sizeof(si_sa)); > @@ -750,19 +772,37 @@ mkfs_msdos(const char *fname, const char *dtype, > const > (u_int)tm->tm_mday; > mk2(de->deMDate, x); > } > - if ((n = write(fd, img, bpb.bpbBytesPerSec)) == -1) { > - warn("%s", fname); > - goto done; > + /* > + * Issue a write of chunksize once we have collected > + * enough sectors. > + */ > + img += bpb.bpbBytesPerSec; > + if (img >= physbuf_end) { > + n = write(fd, physbuf, chunksize); > + if (n != chunksize) { > + warnx("%s: can't write sector %u", fname, lsn); > + goto done; > + } > + img = physbuf; > } > - if ((unsigned)n != bpb.bpbBytesPerSec) { > - warnx("%s: can't write sector %u", fname, lsn); > - goto done; > - } > } > + /* > + * Write remaining sectors, if the last write didn't end > + * up filling a whole chunk. > + */ > + if (img != physbuf) { > + ssize_t tailsize = img - physbuf; > + > + n = write(fd, physbuf, tailsize); > + if (n != tailsize) { > + warnx("%s: can't write sector %u", fname, lsn); > + goto done; > + } > + } > } > rv = 0; > done: > - free(img); > + free(physbuf); > if (fd != -1) > close(fd); > if (fd1 != -1) > From owner-svn-src-head@freebsd.org Sat Jul 4 19:21: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 E3DCA3564C8; Sat, 4 Jul 2020 19:21:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (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 "anubis.delphij.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49zhXL3QwVz44Ft; Sat, 4 Jul 2020 19:21:38 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from p51.home.us.delphij.net (unknown [IPv6:2601:646:8600:58ba:e670:b8ff:fe5c:4e69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 8883A3A119; Sat, 4 Jul 2020 12:21:30 -0700 (PDT) Reply-To: d@delphij.net Subject: Re: svn commit: r362936 - head/sbin/newfs_msdos To: cem@freebsd.org, Xin LI Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202007041837.064Ib4PL082461@repo.freebsd.org> From: Xin Li Autocrypt: addr=delphij@delphij.net; keydata= mQINBFuSR4oBEACvvEgwRIHs6IcSP/yaDtySF78Ji3rP29qdiQsxhMsOtvtffdbS56VApIWO UFb3/iN2gA8HwLvrmjijN0HEoLVX7na1WARmxRYzQMtApsZIUTtx7hnUYlsi2F5odZa6CDW9 a954DLRzYxiUwYDcu5Zjl9bglK1H8e/N9uC0Vuigr4teWfh86brzOyf819QzwFVYfMIK4ihw QGwMvTzbyVuCFy+LENkmcVYni70oQy6rZ5ktSuYbuOFvu7inRRfhSWPHziV7k+bW88sJ7xhv lBlegcnhkSudWX2M8tZ3MO1PJOcyys0CJlsBY5Weiog2lIPi05h/E9pZ9mc1Vud17iqDaL6w RaggOUhuPfDGCdO5ro82W4BZGeQMRnRF5Ntk+t2ShIH4nn3xRLV0E5nziCiKlgiMqOrz/ZTL QTVbHrCuiwD+fSK14y0oHbkOLYTYLlgh1JbwfY2Ty7elOYiWzyeJ7sJh2dF91NSEneWIOys3 mBpuvtU3nSzzTvAB48VV+Nbg1CpIOgNlPjj7uhIum/Z/VjUaJEyaLpTIRh0MVJVcbP7hXSqZ NA35EEZZVnWEOYdycm4CmEdeNPWkrAf2Ya77iR5VLGypwMlsUMQPh+sKVWDD38M8stFGBBNm d01Hi74Bsq5hKan654dOqMt5eYklrVj0ucMzFQtus7oE502UswARAQABtBxYaW4gTEkgPGRl bHBoaWpAZGVscGhpai5uZXQ+iQJUBBMBCgA+FiEEceNg5NEMZIki80nQQHl/fJX0g08FAluS R/YCGwMFCQmuhAAFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQQHl/fJX0g0+2Og//bWpE F2V5/M5l6YW1T8oLcT9rIOH6oq9M0LMNRgFeiNNnilGIeeIgtOGBRueG4CZiZAvsRPJkrO70 1R2SrdkCIvwGUzUAxx1NfBWb+vgm4fgkW/MotGonceM5v0qfSKKXasWvDctkK28aG+IoQzmi FjXNW4+ju4zeQFYwD4ZDWqw9MqO0hVb24uW3dxtQhbfmOLgJ/PEDMQaFuANbW1c+iR0BQA3D Go/EeMY4kpN8on6Aqt/S/4JVltudfQ9OXdjQsC7netSaB9K3mHGt9aKAAB7RzlRY00DKkYS/ /eQwLzGPmK7yX13M68mMDjBs6mIR8t/E1S5OdBNhHRPNPlEbwugR4KaiCsN5yqzJoSV99fKY z2VyxjWPaG8yhHE+jmKUgIBKTfFUQEfkriQR4EASoeJ+soaMTiFDBij1Zw5n3ndLRFMB1ZCl fZLER36mAgW4m4kP83TWnDiJLxOxSOxifV8HpTFjff902H85cybg9KMwrfPDr6W19GGk5Vo1 fkza5krRMGbKWb7+74Evusi0ZxJLIOFwp5Y8eVqUMZaAD3f1ZX1M3pgXOp20QgAy+2KvMHij rLa4q+tMGRzYYD1BnFVSVdXAX5VOoTmHBcDz67DkuRwk2Byp1sgd407oEOmSwrNJlKS0TPCm xUJ2fdSQF+1/MMSRfee49vtMvz7cOrC5Ag0EW5JHigEQANiBmIFAfRNH3nzYNWC0yC+tfx3z sUwAsH1VaBM/cTib+yKtbBOSIlXWjJZWX3MHwoI/1LeGghB2mxkkX1L0pJ/vj1eXNR+sFZ32 0pYcl61Fxg/5fioG4QDTM4i3i7NR5PxDnc6UVaynSlII93DedRhZ1ROtdn4vyMgzsDiqhbL7 BthDOt5KxjqdRk4qRPSw7BovEqZLOcG5IJtf/zZUzRbM7SBljEbOAfekDGx1Br+RrYSD7/Ef Pwwzou9T8315IpBpIHyQF/dZNk3iFiB9Ed5CA71ZRYV5YoLWE9lL0j9kxOLQ5vHnX3mVq7QZ Bc7nzwZ6UhQgYmrG5+RWvuiPpGwvDRIsugJUGXucYkAQh5kuNblmkwpv6u9rNMjCNbzAylOa qdogra5EW+RUSbRz0b4iIr8nnZeAlh7BihCe7JjOwbDjoBEEEtSfVc4hD/LENqpcYVrChphf aOLB9YIXhnVDTVvMc9OklWT/81HzAaDQqOQCzEfY92199Ct9/CwRoQ2OpO8TO5+8A7b9Nb33 nmxMn09mb48ruRacMrfHxCWbgU4w9SEfbip4GcS5wGG6yTC+hw55Iwnnwus40NrJ0GEr8a4r cdsLbkvlyoNHB8ZGgyJ4aFCQ1V4qE1BnlTk7Z8BYBUkJM1odPSkVvHpCnMUjVpJ3hEOC+73Z YH1dh7lZABEBAAGJAjwEGAEKACYWIQRx42Dk0QxkiSLzSdBAeX98lfSDTwUCW5JHigIbDAUJ Ca6EAAAKCRBAeX98lfSDTz8DEACMh3poeUb+gWNF4RWFZuLteZVo0+E1JLYXQkmtrRBLXviP +Qy0pXyFAVxLM4hNIBoIDYfK9BcwrBYf7AwSKrH0GiNwFpgHCkbZd6qoZy2gB+adTnCpVCTJ KJetsH/8awkrChJWMK0ckGf3EeWMPvawG7kW7FBz70NYEZ0pOMiaEZNVtzD3wwbYWUiDFYth 83XGglOExg+1ShTW5XjQPRrdyJAO+aUW4o3lVjfyUJXMgI4rmhMiLVm06GuNrbpKIF0s+4Vd jQAjhrDQjfoXi9CkfsA/cONseuHNv1JGj3RqHiqHJq1dbrpodXp925zGDAnUGxCOBPoFopAH gVzR89GTut059GpwqsddZmU6y7rqifuam/ekJ+QRwc16vgt7pHqCrTY8WPxRZr2UpFU1wlTo COdeiFep1gq1F9jzFjJnoMaAdmC6k7bgAA+RQusOgIhJL0jIej7DoAHxmxFFCfRy+lDtpXwF gQ8HMvzHI65QWmQnMo7s6SQH/ZH5s1yR6SJq8+3lDz+dCuT42qJVqIPVvxd10LW0FNN+t7HF eLadU6ekSgD13/EYMYXlvNHkw7dAItSDxIzgRyykLz0bCU9xwNWoS4Z43+ifF9anJ+uR0ltW El1j++h6ZrD3LLuCgJIt1so0m49GzdcSpOI7LCwMlacyvafiEyjUn+tSNDsnfw== Organization: The FreeBSD Project Message-ID: <2697ce4c-521f-8400-f05d-3d8c41efd865@delphij.net> Date: Sat, 4 Jul 2020 12:21:24 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6eR4VNvaWS4dUGv3aJmeh6ZPWQpA9vuzZ" X-Rspamd-Queue-Id: 49zhXL3QwVz44Ft X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:64.62.128.0/18, 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: Sat, 04 Jul 2020 19:21:39 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --6eR4VNvaWS4dUGv3aJmeh6ZPWQpA9vuzZ Content-Type: multipart/mixed; boundary="6KItCRYqdIR2cJNlTlk7S90DlWJpueKIl"; protected-headers="v1" From: Xin Li Reply-To: d@delphij.net To: cem@freebsd.org, Xin LI Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <2697ce4c-521f-8400-f05d-3d8c41efd865@delphij.net> Subject: Re: svn commit: r362936 - head/sbin/newfs_msdos References: <202007041837.064Ib4PL082461@repo.freebsd.org> In-Reply-To: --6KItCRYqdIR2cJNlTlk7S90DlWJpueKIl Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 7/4/20 12:01 PM, Conrad Meyer wrote: > Hi Xin Li, >=20 > Maybe we can use C11 static_assert instead of the CTASSERT array mechan= ism? Good point, maybe https://reviews.freebsd.org/D25562 ? --6KItCRYqdIR2cJNlTlk7S90DlWJpueKIl-- --6eR4VNvaWS4dUGv3aJmeh6ZPWQpA9vuzZ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.2.20 (FreeBSD) iQIzBAEBCgAdFiEEceNg5NEMZIki80nQQHl/fJX0g08FAl8A1rkACgkQQHl/fJX0 g0+bZQ/9GDgBoVtMUMyZvzIQaHEDiEm3ih53xbt2qkjn5ISy+4IVGzgcXjZvFNfH 8/maJl/YAxt06Y9eW0B6KSV7q2hbxkBtyfLbpqMnXSKO7hz4Pwk/xp/oXFBabWwR M3J9XAJFgMZr2GDrS7nyd9e2Tj7hJsUt2oEP2quUc8z190ZJCJqpoacv/Wx4tDqw dLph6elfENqGM6rxOpw1htM2xz1U6/RV1zLm0sAqOOHXX0PCrOZ0jpcGKVyF4pLp XrcvoF3aVlhGg/BgR7GTdEY1o4U+w81AJSofuIHmFcqVXMSsu1HnFLt4oPZGlZ3N 3HbQNhv1CfpLaZjC0GXlVUMI2x7OIYIHrSyWMP2nDbj6OZ99628HugTEKWqL4GQf Gdn2C9Vh/huE18JQJ0g1XIPSYPD9ZuUU7nspbaGdAIxAfzTzSN3iZZaq4J4+MoAH JPz79ILMzDoLJzLfqmtm/tfPTtBnmBGlo1rQFu9MHw7aQQtGmYA6VSbieGaQPNCZ QTzI+Otts2eyuZaTyoB5C4fqpga3RUHoRQ0AgivQUjh/Z9/fxb74d5nitvNN80Hk r/AkqSgy/f/54otcjBq4PQjFNpmmPSljna2uiIGnZDyzg2IqOjedJ8Ps77gnUi4M 6O+xVHgJh82O/Hw6tGz4z5/q1ZG/qrFmbN2wnnzsWS9qA8vEmT0= =JEpm -----END PGP SIGNATURE----- --6eR4VNvaWS4dUGv3aJmeh6ZPWQpA9vuzZ--