From owner-svn-src-head@freebsd.org Sun Apr 26 00:41: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 D20142C6554; Sun, 26 Apr 2020 00:41:30 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 498pxk5Fymz3Hyj; Sun, 26 Apr 2020 00:41:30 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFBBB187CE; Sun, 26 Apr 2020 00:41:30 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03Q0fUOg007533; Sun, 26 Apr 2020 00:41:30 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03Q0fUoK007530; Sun, 26 Apr 2020 00:41:30 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <202004260041.03Q0fUoK007530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Sun, 26 Apr 2020 00:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360328 - in head/sys: kern sys x86/x86 X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: in head/sys: kern sys x86/x86 X-SVN-Commit-Revision: 360328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 00:41:30 -0000 Author: vangyzen Date: Sun Apr 26 00:41:29 2020 New Revision: 360328 URL: https://svnweb.freebsd.org/changeset/base/360328 Log: Fix handling of NMIs from unknown sources (BMC, hypervisor) Release kernels have no KDB backends enabled, so they discard an NMI if it is not due to a hardware failure. This includes NMIs from IPMI BMCs and hypervisors. Furthermore, the interaction of panic_on_nmi, kdb_on_nmi, and debugger_on_panic is confusing. Respond to all NMIs according to panic_on_nmi and debugger_on_panic. Remove kdb_on_nmi. Expand the meaning of panic_on_nmi by making it a bitfield. There are currently two bits: one for NMIs due to hardware failure, and one for all others. Leave room for more. If panic_on_nmi and debugger_on_panic are both true, don't actually panic, but directly enter the debugger, to allow someone to leave the debugger and [hopefully] resume normal execution. Reviewed by: kib MFC after: 2 weeks Relnotes: yes: machdep.kdb_on_nmi is gone; machdep.panic_on_nmi changed Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24558 Modified: head/sys/kern/kern_shutdown.c head/sys/sys/kdb.h head/sys/x86/x86/cpu_machdep.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Sat Apr 25 23:35:49 2020 (r360327) +++ head/sys/kern/kern_shutdown.c Sun Apr 26 00:41:29 2020 (r360328) @@ -119,9 +119,9 @@ SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CT #ifdef KDB #ifdef KDB_UNATTENDED -static int debugger_on_panic = 0; +int debugger_on_panic = 0; #else -static int debugger_on_panic = 1; +int debugger_on_panic = 1; #endif SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RWTUN | CTLFLAG_SECURE, Modified: head/sys/sys/kdb.h ============================================================================== --- head/sys/sys/kdb.h Sat Apr 25 23:35:49 2020 (r360327) +++ head/sys/sys/kdb.h Sun Apr 26 00:41:29 2020 (r360328) @@ -65,6 +65,7 @@ struct kdb_dbbe { SET_DECLARE(kdb_dbbe_set, struct kdb_dbbe); extern u_char kdb_active; /* Non-zero while in debugger. */ +extern int debugger_on_panic; /* enter the debugger on panic. */ extern int debugger_on_trap; /* enter the debugger on trap. */ extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Sat Apr 25 23:35:49 2020 (r360327) +++ head/sys/x86/x86/cpu_machdep.c Sun Apr 26 00:41:29 2020 (r360328) @@ -823,20 +823,14 @@ cpu_idle_tun(void *unused __unused) } SYSINIT(cpu_idle_tun, SI_SUB_CPU, SI_ORDER_MIDDLE, cpu_idle_tun, NULL); -static int panic_on_nmi = 1; +static int panic_on_nmi = 0xff; SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, &panic_on_nmi, 0, - "Panic on NMI raised by hardware failure"); + "Panic on NMI: 1 = H/W failure; 2 = unknown; 0xff = all"); int nmi_is_broadcast = 1; SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, &nmi_is_broadcast, 0, "Chipset NMI is broadcast"); -#ifdef KDB -int kdb_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, - &kdb_on_nmi, 0, - "Go to KDB on NMI with unknown source"); -#endif void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) @@ -847,19 +841,31 @@ nmi_call_kdb(u_int cpu, u_int type, struct trapframe * /* machine/parity/power fail/"kitchen sink" faults */ if (isa_nmi(frame->tf_err)) { claimed = true; - if (panic_on_nmi) + if ((panic_on_nmi & 1) != 0) panic("NMI indicates hardware failure"); } #endif /* DEV_ISA */ + + /* + * NMIs can be useful for debugging. They can be hooked up to a + * pushbutton, usually on an ISA, PCI, or PCIe card. They can also be + * generated by an IPMI BMC, either manually or in response to a + * watchdog timeout. For example, see the "power diag" command in + * ports/sysutils/ipmitool. They can also be generated by a + * hypervisor; see "bhyvectl --inject-nmi". + */ + #ifdef KDB - if (!claimed && kdb_on_nmi) { - /* - * NMI can be hooked up to a pushbutton for debugging. - */ - printf("NMI/cpu%d ... going to debugger\n", cpu); - kdb_trap(type, 0, frame); + if (!claimed && (panic_on_nmi & 2) != 0) { + if (debugger_on_panic) { + printf("NMI/cpu%d ... going to debugger\n", cpu); + claimed = kdb_trap(type, 0, frame); + } } #endif /* KDB */ + + if (!claimed && panic_on_nmi != 0) + panic("NMI"); } void From owner-svn-src-head@freebsd.org Sun Apr 26 08:31: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 D6AE22CF5FD; Sun, 26 Apr 2020 08:31:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4991Mc5Q7vz47p0; Sun, 26 Apr 2020 08:31:08 +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 B1E6C1DFBE; Sun, 26 Apr 2020 08:31:08 +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 03Q8V8Nq098436; Sun, 26 Apr 2020 08:31:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03Q8V8HG098435; Sun, 26 Apr 2020 08:31:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004260831.03Q8V8HG098435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sun, 26 Apr 2020 08:31:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360329 - head/usr.sbin/bluetooth/hccontrol X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/usr.sbin/bluetooth/hccontrol X-SVN-Commit-Revision: 360329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 08:31:08 -0000 Author: hselasky Date: Sun Apr 26 08:31:08 2020 New Revision: 360329 URL: https://svnweb.freebsd.org/changeset/base/360329 Log: Properly update AD field length in hccontrol(8). While at it use strtol() instead of atoi() to support hexadecimal numbers aswell as 10-base numbers. Submitted by: Marc Veldman PR: 245899 MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/le.c Sun Apr 26 00:41:29 2020 (r360328) +++ head/usr.sbin/bluetooth/hccontrol/le.c Sun Apr 26 08:31:08 2020 (r360329) @@ -172,13 +172,13 @@ parse_param(int argc, char *argv[], char *buf, int *le goto done; curbuf[0] = 2; curbuf[1] = 1; - curbuf[2] = atoi(optarg); + curbuf[2] = (uint8_t)strtol(optarg, NULL, 16); curbuf += 3; break; case 'u': - lenpos = buf; if ((buf+2) >= buflast) goto done; + lenpos = curbuf; curbuf[1] = 2; *lenpos = 1; curbuf += 2; @@ -189,6 +189,7 @@ parse_param(int argc, char *argv[], char *buf, int *le curbuf[0] = value &0xff; curbuf[1] = (value>>8)&0xff; curbuf += 2; + *lenpos += 2; } } From owner-svn-src-head@freebsd.org Sun Apr 26 13:02: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 414882AF205; Sun, 26 Apr 2020 13:02:43 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4997Nz0fJ9z4SMn; Sun, 26 Apr 2020 13:02:43 +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 117F9214D9; Sun, 26 Apr 2020 13:02:43 +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 03QD2gRp076187; Sun, 26 Apr 2020 13:02:42 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QD2gDE076186; Sun, 26 Apr 2020 13:02:42 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004261302.03QD2gDE076186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 26 Apr 2020 13:02:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360337 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 360337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 13:02:43 -0000 Author: melifaro Date: Sun Apr 26 13:02:42 2020 New Revision: 360337 URL: https://svnweb.freebsd.org/changeset/base/360337 Log: Fix order of arguments in fib[46]_lookup calls in SCTP. r360292 introduced the wrong order, resulting in returned nhops not being referenced, despite the fact that references were requested. That lead to random GPF after using SCTP sockets. Special defined macro like IPV[46]_SCOPE_GLOBAL will be introduced soon to reduce the chance of putting arguments in wrong order. Reported-by: syzbot+5c813c01096363174684@syzkaller.appspotmail.com Modified: head/sys/netinet/sctp_os_bsd.h Modified: head/sys/netinet/sctp_os_bsd.h ============================================================================== --- head/sys/netinet/sctp_os_bsd.h Sun Apr 26 08:38:53 2020 (r360336) +++ head/sys/netinet/sctp_os_bsd.h Sun Apr 26 13:02:42 2020 (r360337) @@ -403,9 +403,9 @@ typedef struct route sctp_route_t; { \ if ((ro)->ro_nh == NULL) { \ if ((ro)->ro_dst.sa_family == AF_INET) \ - (ro)->ro_nh = fib4_lookup(fibnum, ((struct sockaddr_in *)&(ro)->ro_dst)->sin_addr, NHR_REF, 0, 0); \ + (ro)->ro_nh = fib4_lookup(fibnum, ((struct sockaddr_in *)&(ro)->ro_dst)->sin_addr, 0, NHR_REF, 0); \ if ((ro)->ro_dst.sa_family == AF_INET6) \ - (ro)->ro_nh = fib6_lookup(fibnum, &((struct sockaddr_in6 *)&(ro)->ro_dst)->sin6_addr, NHR_REF, 0, 0); \ + (ro)->ro_nh = fib6_lookup(fibnum, &((struct sockaddr_in6 *)&(ro)->ro_dst)->sin6_addr, 0, NHR_REF, 0); \ } \ } From owner-svn-src-head@freebsd.org Sun Apr 26 15:51: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 CE1972B3D11; Sun, 26 Apr 2020 15:51:46 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499C825HDkz4d1M; Sun, 26 Apr 2020 15:51:46 +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 B049B234B6; Sun, 26 Apr 2020 15:51:46 +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 03QFpkx7081616; Sun, 26 Apr 2020 15:51:46 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QFpkPq081258; Sun, 26 Apr 2020 15:51:46 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202004261551.03QFpkPq081258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 26 Apr 2020 15:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360339 - head/tests/sys/mac/bsdextended X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/mac/bsdextended X-SVN-Commit-Revision: 360339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 15:51:46 -0000 Author: asomers Date: Sun Apr 26 15:51:46 2020 New Revision: 360339 URL: https://svnweb.freebsd.org/changeset/base/360339 Log: mac_bsdextended: ATFify the tests The new tests have more complete setup and cleanup, are more granular, and correctly annotate expected failures and skipped tests. A follow-up commit will resolve a conflict with the fusefs tests (bug 244229). MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24257 Modified: head/tests/sys/mac/bsdextended/Makefile head/tests/sys/mac/bsdextended/matches_test.sh Modified: head/tests/sys/mac/bsdextended/Makefile ============================================================================== --- head/tests/sys/mac/bsdextended/Makefile Sun Apr 26 15:50:32 2020 (r360338) +++ head/tests/sys/mac/bsdextended/Makefile Sun Apr 26 15:51:46 2020 (r360339) @@ -2,12 +2,14 @@ TESTSDIR= ${TESTSBASE}/sys/mac/bsdextended +ATF_TESTS_SH+= matches_test TAP_TESTS_C+= ugidfw_test -TAP_TESTS_SH+= matches_test LIBADD.ugidfw_test+= ugidfw -TEST_METADATA.matches_test+= required_user="root" TEST_METADATA.ugidfw_test+= required_user="root" +# Each test case of matches_test reuses the same ruleset number, so they cannot +# be run simultaneously +TEST_METADATA.matches_test+= is_exclusive=true .include Modified: head/tests/sys/mac/bsdextended/matches_test.sh ============================================================================== --- head/tests/sys/mac/bsdextended/matches_test.sh Sun Apr 26 15:50:32 2020 (r360338) +++ head/tests/sys/mac/bsdextended/matches_test.sh Sun Apr 26 15:51:46 2020 (r360339) @@ -10,356 +10,381 @@ uidoutrange="daemon" gidinrange="nobody" # We expect $uidinrange in this group gidoutrange="daemon" # We expect $uidinrange in this group -test_num=1 -pass() -{ - echo "ok $test_num # $@" - : $(( test_num += 1 )) -} -fail() +check_ko() { - echo "not ok $test_num # $@" - : $(( test_num += 1 )) + if ! sysctl -N security.mac.bsdextended >/dev/null 2>&1; then + atf_skip "mac_bsdextended(4) support isn't available" + fi } -# -# Setup -# - -: ${TMPDIR=/tmp} -if [ $(id -u) -ne 0 ]; then - echo "1..0 # SKIP test must be run as root" - exit 0 -fi -if ! sysctl -N security.mac.bsdextended >/dev/null 2>&1; then - echo "1..0 # SKIP mac_bsdextended(4) support isn't available" - exit 0 -fi -if [ "$TMPDIR" != "/tmp" ]; then - if ! chmod -Rf 0755 $TMPDIR; then - echo "1..0 # SKIP failed to chmod $TMPDIR" - exit 0 +setup() +{ + check_ko + mkdir mnt + mdmfs -s 25m md mnt \ + || atf_fail "failed to mount md device" + chmod a+rwx mnt + md_device=$(mount -p | grep "$PWD/mnt" | awk '{ gsub(/^\/dev\//, "", $1); print $1 }') + if [ -z "$md_device" ]; then + atf_fail "md device not properly attached to the system" fi -fi -if ! playground=$(mktemp -d $TMPDIR/tmp.XXXXXXX); then - echo "1..0 # SKIP failed to create temporary directory" - exit 0 -fi -trap "rmdir $playground" EXIT INT TERM -if ! mdmfs -s 25m md $playground; then - echo "1..0 # SKIP failed to mount md device" - exit 0 -fi -chmod a+rwx $playground -md_device=$(mount -p | grep "$playground" | awk '{ gsub(/^\/dev\//, "", $1); print $1 }') -trap "umount -f $playground; mdconfig -d -u $md_device; rmdir $playground" EXIT INT TERM -if [ -z "$md_device" ]; then - mount -p | grep $playground - echo "1..0 # SKIP md device not properly attached to the system" -fi + echo $md_device > md_device -ugidfw remove 1 + ugidfw remove 1 -file1=$playground/test-$uidinrange -file2=$playground/test-$uidoutrange -cat > $playground/test-script.sh <<'EOF' + cat > mnt/test-script.sh <<'EOF' #!/bin/sh : > $1 EOF -if [ $? -ne 0 ]; then - echo "1..0 # SKIP failed to create test script" - exit 0 -fi -echo "1..30" + if [ $? -ne 0 ]; then + atf_fail "failed to create test script" + fi -command1="sh $playground/test-script.sh $file1" -command2="sh $playground/test-script.sh $file2" + file1=mnt/test-$uidinrange + file2=mnt/test-$uidoutrange + command1="sh mnt/test-script.sh $file1" + command2="sh mnt/test-script.sh $file2" -desc="$uidinrange file" -if su -m $uidinrange -c "$command1"; then - pass $desc -else - fail $desc -fi + # $uidinrange file + atf_check -s exit:0 su -m $uidinrange -c "$command1" -chown "$uidinrange":"$gidinrange" $file1 -chmod a+w $file1 + chown "$uidinrange":"$gidinrange" $file1 + chmod a+w $file1 -desc="$uidoutrange file" -if $command2; then - pass $desc -else - fail $desc -fi + # $uidoutrange file + if ! $command2; then + atf_fail $desc + fi -chown "$uidoutrange":"$gidoutrange" $file2 -chmod a+w $file2 + chown "$uidoutrange":"$gidoutrange" $file2 + chmod a+w $file2 +} -# -# No rules -# -desc="no rules $uidinrange" -if su -fm $uidinrange -c "$command1"; then - pass $desc -else - fail $desc -fi +cleanup() +{ + ugidfw remove 1 -desc="no rules $uidoutrange" -if su -fm $uidoutrange -c "$command1"; then - pass $desc -else - fail $desc -fi + umount -f mnt + if [ -f md_device ]; then + mdconfig -d -u $( cat md_device ) + fi +} -# -# Subject Match on uid -# -ugidfw set 1 subject uid $uidrange object mode rasx -desc="subject uid in range" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi +atf_test_case no_rules cleanup +no_rules_head() +{ + atf_set "require.user" "root" +} +no_rules_body() +{ + setup -desc="subject uid out range" -if su -fm $uidoutrange -c "$command1"; then - pass $desc -else - fail $desc -fi + # no rules $uidinrange + atf_check -s exit:0 su -fm $uidinrange -c "$command1" -# -# Subject Match on gid -# -ugidfw set 1 subject gid $gidrange object mode rasx + # no rules $uidoutrange + atf_check -s exit:0 su -fm $uidoutrange -c "$command1" +} +no_rules_cleanup() +{ + cleanup +} -desc="subject gid in range" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi +atf_test_case subject_match_on_uid cleanup +subject_match_on_uid_head() +{ + atf_set "require.user" "root" +} +subject_match_on_uid_body() +{ + setup -desc="subject gid out range" -if su -fm $uidoutrange -c "$command1"; then - pass $desc -else - fail $desc -fi + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object mode rasx + # subject uid in range + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" -if which jail >/dev/null; then - # - # Subject Match on jail - # - rm -f $playground/test-jail + # subject uid out range + atf_check -s exit:0 su -fm $uidoutrange -c "$command1" - desc="subject matching jailid" - jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c "(sleep 5; touch $playground/test-jail) &"` - ugidfw set 1 subject jailid $jailid object mode rasx +} +subject_match_on_uid_cleanup() +{ + cleanup +} + +atf_test_case subject_match_on_gid cleanup +subject_match_on_gid_head() +{ + atf_set "require.user" "root" +} +subject_match_on_gid_body() +{ + setup + + atf_check -s exit:0 ugidfw set 1 subject gid $gidrange object mode rasx + + # subject gid in range + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" + + # subject gid out range + atf_check -s exit:0 su -fm $uidoutrange -c "$command1" +} +subject_match_on_gid_cleanup() +{ + cleanup +} + +atf_test_case subject_match_on_jail cleanup +subject_match_on_jail_head() +{ + atf_set "require.progs" "jail" + atf_set "require.user" "root" +} +subject_match_on_jail_body() +{ + setup + + atf_expect_fail "this testcase fails (see bug # 205481)" + # subject matching jailid + jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c "(sleep 5; touch mnt/test-jail) &"` + atf_check -s exit:0 ugidfw set 1 subject jailid $jailid object mode rasx sleep 10 - if [ -f $playground/test-jail ]; then - fail "TODO $desc: this testcase fails (see bug # 205481)" - else - pass $desc + if [ -f mnt/test-jail ]; then + atf_fail "$desc" fi - rm -f $playground/test-jail - desc="subject nonmatching jailid" - jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c "(sleep 5; touch $playground/test-jail) &"` + rm -f mnt/test-jail + # subject nonmatching jailid + jailid=`jail -i / localhost 127.0.0.1 /usr/sbin/daemon -f /bin/sh -c "(sleep 5; touch mnt/test-jail) &"` sleep 10 - if [ -f $playground/test-jail ]; then - pass $desc - else - fail $desc + if ! [ -f mnt/test-jail ]; then + atf_fail $desc fi -else - # XXX: kyua is too dumb to parse skip ranges, still.. - pass "skip jail(8) not installed" - pass "skip jail(8) not installed" -fi +} +subject_match_on_jail_cleanup() +{ + cleanup +} -# -# Object uid -# -ugidfw set 1 subject object uid $uidrange mode rasx +atf_test_case object_uid cleanup +object_uid_head() +{ + atf_set "require.user" "root" +} +object_uid_body() +{ + setup -desc="object uid in range" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi + atf_check -s exit:0 ugidfw set 1 subject object uid $uidrange mode rasx -desc="object uid out range" -if su -fm $uidinrange -c "$command2"; then - pass $desc -else - fail $desc -fi -ugidfw set 1 subject object uid $uidrange mode rasx + # object uid in range + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" -desc="object uid in range (different subject)" -if su -fm $uidoutrange -c "$command1"; then - fail $desc -else - pass $desc -fi + # object uid out range + atf_check -s exit:0 su -fm $uidinrange -c "$command2" + atf_check -s exit:0 ugidfw set 1 subject object uid $uidrange mode rasx -desc="object uid out range (different subject)" -if su -fm $uidoutrange -c "$command2"; then - pass $desc -else - fail $desc -fi + # object uid in range (different subject) + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidoutrange -c "$command1" -# -# Object gid -# -ugidfw set 1 subject object gid $uidrange mode rasx + # object uid out range (different subject) + atf_check -s exit:0 su -fm $uidoutrange -c "$command2" -desc="object gid in range" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi +} +object_uid_cleanup() +{ + cleanup +} -desc="object gid out range" -if su -fm $uidinrange -c "$command2"; then - pass $desc -else - fail $desc -fi -desc="object gid in range (different subject)" -if su -fm $uidoutrange -c "$command1"; then - fail $desc -else - pass $desc -fi +atf_test_case object_gid cleanup +object_gid_head() +{ + atf_set "require.user" "root" +} +object_gid_body() +{ + setup -desc="object gid out range (different subject)" -if su -fm $uidoutrange -c "$command2"; then - pass $desc -else - fail $desc -fi + atf_check -s exit:0 ugidfw set 1 subject object gid $uidrange mode rasx -# -# Object filesys -# -ugidfw set 1 subject uid $uidrange object filesys / mode rasx -desc="object out of filesys" -if su -fm $uidinrange -c "$command1"; then - pass $desc -else - fail $desc -fi + # object gid in range + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" -ugidfw set 1 subject uid $uidrange object filesys $playground mode rasx -desc="object in filesys" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi + # object gid out range + atf_check -s exit:0 su -fm $uidinrange -c "$command2" + # object gid in range (different subject) + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidoutrange -c "$command1" -# -# Object suid -# -ugidfw set 1 subject uid $uidrange object suid mode rasx -desc="object notsuid" -if su -fm $uidinrange -c "$command1"; then - pass $desc -else - fail $desc -fi + # object gid out range (different subject) + atf_check -s exit:0 su -fm $uidoutrange -c "$command2" +} +object_gid_cleanup() +{ + cleanup +} -chmod u+s $file1 -desc="object suid" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi -chmod u-s $file1 +atf_test_case object_filesys cleanup +object_filesys_head() +{ + atf_set "require.user" "root" +} +object_filesys_body() +{ + setup -# -# Object sgid -# -ugidfw set 1 subject uid $uidrange object sgid mode rasx -desc="object notsgid" -if su -fm $uidinrange -c "$command1"; then - pass $desc -else - fail $desc -fi + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object filesys / mode rasx + # object out of filesys + atf_check -s exit:0 su -fm $uidinrange -c "$command1" -chmod g+s $file1 -desc="object sgid" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi -chmod g-s $file1 + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object filesys mnt mode rasx + # object in filesys + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" +} +object_filesys_cleanup() +{ + cleanup +} -# -# Object uid matches subject -# -ugidfw set 1 subject uid $uidrange object uid_of_subject mode rasx +atf_test_case object_suid cleanup +object_suid_head() +{ + atf_set "require.user" "root" +} +object_suid_body() +{ + setup -desc="object uid notmatches subject" -if su -fm $uidinrange -c "$command2"; then - pass $desc -else - fail $desc -fi + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object suid mode rasx + # object notsuid + atf_check -s exit:0 su -fm $uidinrange -c "$command1" -desc="object uid matches subject" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi + chmod u+s $file1 + # object suid + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" + chmod u-s $file1 -# -# Object gid matches subject -# -ugidfw set 1 subject uid $uidrange object gid_of_subject mode rasx +} +object_suid_cleanup() +{ + cleanup +} -desc="object gid notmatches subject" -if su -fm $uidinrange -c "$command2"; then - pass $desc -else - fail $desc -fi +atf_test_case object_sgid cleanup +object_sgid_head() +{ + atf_set "require.user" "root" +} +object_sgid_body() +{ + setup -desc="object gid matches subject" -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object sgid mode rasx + # object notsgid + atf_check -s exit:0 su -fm $uidinrange -c "$command1" -# -# Object type -# -desc="object not type" -ugidfw set 1 subject uid $uidrange object type dbclsp mode rasx -if su -fm $uidinrange -c "$command1"; then - pass $desc -else - fail $desc -fi + chmod g+s $file1 + # object sgid + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" + chmod g-s $file1 +} +object_sgid_cleanup() +{ + cleanup +} -desc="object type" -ugidfw set 1 subject uid $uidrange object type r mode rasx -if su -fm $uidinrange -c "$command1"; then - fail $desc -else - pass $desc -fi +atf_test_case object_uid_matches_subject cleanup +object_uid_matches_subject_head() +{ + atf_set "require.user" "root" +} +object_uid_matches_subject_body() +{ + setup + + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object uid_of_subject mode rasx + + # object uid notmatches subject + atf_check -s exit:0 su -fm $uidinrange -c "$command2" + + # object uid matches subject + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" +} +object_uid_matches_subject_cleanup() +{ + cleanup +} + +atf_test_case object_gid_matches_subject cleanup +object_gid_matches_subject_head() +{ + atf_set "require.user" "root" +} +object_gid_matches_subject_body() +{ + setup + + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object gid_of_subject mode rasx + + # object gid notmatches subject + atf_check -s exit:0 su -fm $uidinrange -c "$command2" + + # object gid matches subject + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" + +} +object_gid_matches_subject_cleanup() +{ + cleanup +} + +atf_test_case object_type cleanup +object_type_head() +{ + atf_set "require.user" "root" +} +object_type_body() +{ + setup + + # object not type + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object type dbclsp mode rasx + atf_check -s exit:0 su -fm $uidinrange -c "$command1" + + # object type + atf_check -s exit:0 ugidfw set 1 subject uid $uidrange object type r mode rasx + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -fm $uidinrange -c "$command1" +} +object_type_cleanup() +{ + cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case no_rules + atf_add_test_case subject_match_on_uid + atf_add_test_case subject_match_on_gid + atf_add_test_case subject_match_on_jail + atf_add_test_case object_uid + atf_add_test_case object_gid + atf_add_test_case object_filesys + atf_add_test_case object_suid + atf_add_test_case object_sgid + atf_add_test_case object_uid_matches_subject + atf_add_test_case object_gid_matches_subject + atf_add_test_case object_type +} From owner-svn-src-head@freebsd.org Sun Apr 26 16:16:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BFFA2B47B2; Sun, 26 Apr 2020 16:16:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499Chm2jtwz4fn2; Sun, 26 Apr 2020 16:16:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FE36238FC; Sun, 26 Apr 2020 16:16:40 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03QGGeGc095625; Sun, 26 Apr 2020 16:16:40 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QGGeBf095624; Sun, 26 Apr 2020 16:16:40 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202004261616.03QGGeBf095624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 26 Apr 2020 16:16:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360344 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 360344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 16:16:40 -0000 Author: kp Date: Sun Apr 26 16:16:39 2020 New Revision: 360344 URL: https://svnweb.freebsd.org/changeset/base/360344 Log: pf: Improve input validation If we pass an anchor name which doesn't exist pfr_table_count() returns -1, which leads to an overflow in mallocarray() and thus a panic. Explicitly check that pfr_table_count() does not return an error. Reported-by: syzbot+bd09d55d897d63d5f4f4@syzkaller.appspotmail.com Reviewed by: melifaro MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D24539 Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Sun Apr 26 16:13:51 2020 (r360343) +++ head/sys/netpfil/pf/pf_ioctl.c Sun Apr 26 16:16:39 2020 (r360344) @@ -3008,7 +3008,8 @@ DIOCCHANGEADDR_error: case DIOCRGETTABLES: { struct pfioc_table *io = (struct pfioc_table *)addr; struct pfr_table *pfrts; - size_t totlen, n; + size_t totlen; + int n; if (io->pfrio_esize != sizeof(struct pfr_table)) { error = ENODEV; @@ -3016,6 +3017,11 @@ DIOCCHANGEADDR_error: } PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); + if (n < 0) { + PF_RULES_RUNLOCK(); + error = EINVAL; + break; + } io->pfrio_size = min(io->pfrio_size, n); totlen = io->pfrio_size * sizeof(struct pfr_table); @@ -3039,7 +3045,8 @@ DIOCCHANGEADDR_error: case DIOCRGETTSTATS: { struct pfioc_table *io = (struct pfioc_table *)addr; struct pfr_tstats *pfrtstats; - size_t totlen, n; + size_t totlen; + int n; if (io->pfrio_esize != sizeof(struct pfr_tstats)) { error = ENODEV; @@ -3047,6 +3054,11 @@ DIOCCHANGEADDR_error: } PF_RULES_WLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); + if (n < 0) { + PF_RULES_WUNLOCK(); + error = EINVAL; + break; + } io->pfrio_size = min(io->pfrio_size, n); totlen = io->pfrio_size * sizeof(struct pfr_tstats); @@ -3069,7 +3081,8 @@ DIOCCHANGEADDR_error: case DIOCRCLRTSTATS: { struct pfioc_table *io = (struct pfioc_table *)addr; struct pfr_table *pfrts; - size_t totlen, n; + size_t totlen; + int n; if (io->pfrio_esize != sizeof(struct pfr_table)) { error = ENODEV; @@ -3078,6 +3091,11 @@ DIOCCHANGEADDR_error: PF_RULES_WLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); + if (n < 0) { + PF_RULES_WUNLOCK(); + error = EINVAL; + break; + } io->pfrio_size = min(io->pfrio_size, n); totlen = io->pfrio_size * sizeof(struct pfr_table); @@ -3104,7 +3122,8 @@ DIOCCHANGEADDR_error: case DIOCRSETTFLAGS: { struct pfioc_table *io = (struct pfioc_table *)addr; struct pfr_table *pfrts; - size_t totlen, n; + size_t totlen; + int n; if (io->pfrio_esize != sizeof(struct pfr_table)) { error = ENODEV; @@ -3113,6 +3132,12 @@ DIOCCHANGEADDR_error: PF_RULES_RLOCK(); n = pfr_table_count(&io->pfrio_table, io->pfrio_flags); + if (n < 0) { + PF_RULES_RUNLOCK(); + error = EINVAL; + break; + } + io->pfrio_size = min(io->pfrio_size, n); PF_RULES_RUNLOCK(); From owner-svn-src-head@freebsd.org Sun Apr 26 16: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 39EBA2B4A41; Sun, 26 Apr 2020 16:22:36 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499Cqc0T0tz4gCl; Sun, 26 Apr 2020 16:22:36 +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 0B36723AF6; Sun, 26 Apr 2020 16:22:36 +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 03QGMZwu001812; Sun, 26 Apr 2020 16:22:35 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QGMZWt001811; Sun, 26 Apr 2020 16:22:35 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202004261622.03QGMZWt001811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 26 Apr 2020 16:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360345 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 360345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 16:22:36 -0000 Author: kp Date: Sun Apr 26 16:22:35 2020 New Revision: 360345 URL: https://svnweb.freebsd.org/changeset/base/360345 Log: bridge: epoch-ification Run the bridge datapath under epoch, rather than under the BRIDGE_LOCK(). We still take the BRIDGE_LOCK() whenever we insert or delete items in the relevant lists, but we use epoch callbacks to free items so that it's safe to iterate the lists without the BRIDGE_LOCK. Tests on mercat5/6 shows this increases bridge throughput significantly, from 3.7Mpps to 18.6Mpps. Reviewed by: emaste, philip, melifaro MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24250 Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sun Apr 26 16:16:39 2020 (r360344) +++ head/sys/net/if_bridge.c Sun Apr 26 16:22:35 2020 (r360345) @@ -189,41 +189,14 @@ extern void nd6_setmtu(struct ifnet *); */ #define BRIDGE_LOCK_INIT(_sc) do { \ mtx_init(&(_sc)->sc_mtx, "if_bridge", NULL, MTX_DEF); \ - cv_init(&(_sc)->sc_cv, "if_bridge_cv"); \ } while (0) #define BRIDGE_LOCK_DESTROY(_sc) do { \ mtx_destroy(&(_sc)->sc_mtx); \ - cv_destroy(&(_sc)->sc_cv); \ } while (0) #define BRIDGE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define BRIDGE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define BRIDGE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) #define BRIDGE_UNLOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) -#define BRIDGE_LOCK2REF(_sc, _err) do { \ - mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ - if ((_sc)->sc_iflist_xcnt > 0) \ - (_err) = EBUSY; \ - else \ - (_sc)->sc_iflist_ref++; \ - mtx_unlock(&(_sc)->sc_mtx); \ -} while (0) -#define BRIDGE_UNREF(_sc) do { \ - mtx_lock(&(_sc)->sc_mtx); \ - (_sc)->sc_iflist_ref--; \ - if (((_sc)->sc_iflist_xcnt > 0) && ((_sc)->sc_iflist_ref == 0)) \ - cv_broadcast(&(_sc)->sc_cv); \ - mtx_unlock(&(_sc)->sc_mtx); \ -} while (0) -#define BRIDGE_XLOCK(_sc) do { \ - mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ - (_sc)->sc_iflist_xcnt++; \ - while ((_sc)->sc_iflist_ref > 0) \ - cv_wait(&(_sc)->sc_cv, &(_sc)->sc_mtx); \ -} while (0) -#define BRIDGE_XDROP(_sc) do { \ - mtx_assert(&(_sc)->sc_mtx, MA_OWNED); \ - (_sc)->sc_iflist_xcnt--; \ -} while (0) /* * Bridge interface list entry. @@ -237,6 +210,7 @@ struct bridge_iflist { uint32_t bif_addrmax; /* max # of addresses */ uint32_t bif_addrcnt; /* cur. # of addresses */ uint32_t bif_addrexceeded;/* # of address violations */ + struct epoch_context bif_epoch_ctx; }; /* @@ -250,6 +224,8 @@ struct bridge_rtnode { uint8_t brt_flags; /* address flags */ uint8_t brt_addr[ETHER_ADDR_LEN]; uint16_t brt_vlan; /* vlan id */ + struct vnet *brt_vnet; + struct epoch_context brt_epoch_ctx; }; #define brt_ifp brt_dst->bif_ifp @@ -260,13 +236,10 @@ struct bridge_softc { struct ifnet *sc_ifp; /* make this an interface */ LIST_ENTRY(bridge_softc) sc_list; struct mtx sc_mtx; - struct cv sc_cv; uint32_t sc_brtmax; /* max # of addresses */ uint32_t sc_brtcnt; /* cur. # of addresses */ uint32_t sc_brttimeout; /* rt timeout in seconds */ struct callout sc_brcallout; /* bridge callout */ - uint32_t sc_iflist_ref; /* refcount for sc_iflist */ - uint32_t sc_iflist_xcnt; /* refcount for sc_iflist */ CK_LIST_HEAD(, bridge_iflist) sc_iflist; /* member interface list */ CK_LIST_HEAD(, bridge_rtnode) *sc_rthash; /* our forwarding table */ CK_LIST_HEAD(, bridge_rtnode) sc_rtlist; /* list version of above */ @@ -276,6 +249,7 @@ struct bridge_softc { uint32_t sc_brtexceeded; /* # of cache drops */ struct ifnet *sc_ifaddr; /* member mac copied from */ struct ether_addr sc_defaddr; /* Default MAC address */ + struct epoch_context sc_epoch_ctx; }; VNET_DEFINE_STATIC(struct mtx, bridge_list_mtx); @@ -596,6 +570,10 @@ vnet_bridge_uninit(const void *unused __unused) if_clone_detach(V_bridge_cloner); V_bridge_cloner = NULL; BRIDGE_LIST_LOCK_DESTROY(); + + /* Callbacks may use the UMA zone. */ + epoch_drain_callbacks(net_epoch_preempt); + uma_zdestroy(V_bridge_rtnode_zone); } VNET_SYSUNINIT(vnet_bridge_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, @@ -722,6 +700,17 @@ bridge_clone_create(struct if_clone *ifc, int unit, ca return (0); } +static void +bridge_clone_destroy_cb(struct epoch_context *ctx) +{ + struct bridge_softc *sc; + + sc = __containerof(ctx, struct bridge_softc, sc_epoch_ctx); + + BRIDGE_LOCK_DESTROY(sc); + free(sc, M_DEVBUF); +} + /* * bridge_clone_destroy: * @@ -732,7 +721,9 @@ bridge_clone_destroy(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_softc; struct bridge_iflist *bif; + struct epoch_tracker et; + NET_EPOCH_ENTER(et); BRIDGE_LOCK(sc); bridge_stop(ifp, 1); @@ -757,11 +748,12 @@ bridge_clone_destroy(struct ifnet *ifp) BRIDGE_LIST_UNLOCK(); bstp_detach(&sc->sc_stp); + NET_EPOCH_EXIT(et); + ether_ifdetach(ifp); if_free(ifp); - BRIDGE_LOCK_DESTROY(sc); - free(sc, M_DEVBUF); + NET_EPOCH_CALL(bridge_clone_destroy_cb, &sc->sc_epoch_ctx); } /* @@ -787,7 +779,10 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t da struct ifdrv *ifd = (struct ifdrv *) data; const struct bridge_control *bc; int error = 0, oldmtu; + struct epoch_tracker et; + NET_EPOCH_ENTER(et); + switch (cmd) { case SIOCADDMULTI: @@ -908,6 +903,8 @@ bridge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t da break; } + NET_EPOCH_EXIT(et); + return (error); } @@ -922,6 +919,8 @@ bridge_mutecaps(struct bridge_softc *sc) struct bridge_iflist *bif; int enabled, mask; + BRIDGE_LOCK_ASSERT(sc); + /* Initial bitmask of capabilities to test */ mask = BRIDGE_IFCAPS_MASK; @@ -930,7 +929,6 @@ bridge_mutecaps(struct bridge_softc *sc) mask &= bif->bif_savedcaps; } - BRIDGE_XLOCK(sc); CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { enabled = bif->bif_ifp->if_capenable; enabled &= ~BRIDGE_IFCAPS_STRIP; @@ -941,8 +939,6 @@ bridge_mutecaps(struct bridge_softc *sc) bridge_set_ifcap(sc, bif, enabled); BRIDGE_LOCK(sc); } - BRIDGE_XDROP(sc); - } static void @@ -983,7 +979,7 @@ bridge_lookup_member(struct bridge_softc *sc, const ch struct bridge_iflist *bif; struct ifnet *ifp; - BRIDGE_LOCK_ASSERT(sc); + NET_EPOCH_ASSERT(); CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { ifp = bif->bif_ifp; @@ -1004,7 +1000,7 @@ bridge_lookup_member_if(struct bridge_softc *sc, struc { struct bridge_iflist *bif; - BRIDGE_LOCK_ASSERT(sc); + NET_EPOCH_ASSERT(); CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { if (bif->bif_ifp == member_ifp) @@ -1014,6 +1010,16 @@ bridge_lookup_member_if(struct bridge_softc *sc, struc return (NULL); } +static void +bridge_delete_member_cb(struct epoch_context *ctx) +{ + struct bridge_iflist *bif; + + bif = __containerof(ctx, struct bridge_iflist, bif_epoch_ctx); + + free(bif, M_DEVBUF); +} + /* * bridge_delete_member: * @@ -1033,9 +1039,7 @@ bridge_delete_member(struct bridge_softc *sc, struct b bstp_disable(&bif->bif_stp); ifs->if_bridge = NULL; - BRIDGE_XLOCK(sc); CK_LIST_REMOVE(bif, bif_next); - BRIDGE_XDROP(sc); /* * If removing the interface that gave the bridge its mac address, set @@ -1094,7 +1098,8 @@ bridge_delete_member(struct bridge_softc *sc, struct b } bstp_destroy(&bif->bif_stp); /* prepare to free */ BRIDGE_LOCK(sc); - free(bif, M_DEVBUF); + + NET_EPOCH_CALL(bridge_delete_member_cb, &bif->bif_epoch_ctx); } /* @@ -1111,7 +1116,8 @@ bridge_delete_span(struct bridge_softc *sc, struct bri ("%s: not a span interface", __func__)); CK_LIST_REMOVE(bif, bif_next); - free(bif, M_DEVBUF); + + NET_EPOCH_CALL(bridge_delete_member_cb, &bif->bif_epoch_ctx); } static int @@ -1167,7 +1173,6 @@ bridge_ioctl_add(struct bridge_softc *sc, void *arg) * If any, remove all inet6 addresses from the member * interfaces. */ - BRIDGE_XLOCK(sc); CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { if (in6ifa_llaonifp(bif->bif_ifp)) { BRIDGE_UNLOCK(sc); @@ -1180,7 +1185,6 @@ bridge_ioctl_add(struct bridge_softc *sc, void *arg) bif->bif_ifp->if_xname); } } - BRIDGE_XDROP(sc); if (in6ifa_llaonifp(ifs)) { BRIDGE_UNLOCK(sc); in6_ifdetach(ifs); @@ -1494,12 +1498,17 @@ bridge_ioctl_saddr(struct bridge_softc *sc, void *arg) struct bridge_iflist *bif; int error; + NET_EPOCH_ASSERT(); + bif = bridge_lookup_member(sc, req->ifba_ifsname); if (bif == NULL) return (ENOENT); + /* bridge_rtupdate() may acquire the lock. */ + BRIDGE_UNLOCK(sc); error = bridge_rtupdate(sc, req->ifba_dst, req->ifba_vlan, bif, 1, req->ifba_flags); + BRIDGE_LOCK(sc); return (error); } @@ -1838,6 +1847,7 @@ bridge_ifdetach(void *arg __unused, struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_bridge; struct bridge_iflist *bif; + struct epoch_tracker et; if (ifp->if_flags & IFF_RENAMING) return; @@ -1848,6 +1858,7 @@ bridge_ifdetach(void *arg __unused, struct ifnet *ifp) */ return; } + NET_EPOCH_ENTER(et); /* Check if the interface is a bridge member */ if (sc != NULL) { BRIDGE_LOCK(sc); @@ -1857,6 +1868,7 @@ bridge_ifdetach(void *arg __unused, struct ifnet *ifp) bridge_delete_member(sc, bif, 1); BRIDGE_UNLOCK(sc); + NET_EPOCH_EXIT(et); return; } @@ -1873,6 +1885,7 @@ bridge_ifdetach(void *arg __unused, struct ifnet *ifp) BRIDGE_UNLOCK(sc); } BRIDGE_LIST_UNLOCK(); + NET_EPOCH_EXIT(et); } /* @@ -1909,6 +1922,7 @@ bridge_stop(struct ifnet *ifp, int disable) { struct bridge_softc *sc = ifp->if_softc; + NET_EPOCH_ASSERT(); BRIDGE_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) @@ -2032,6 +2046,8 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struc struct bridge_softc *sc; uint16_t vlan; + NET_EPOCH_ASSERT(); + if (m->m_len < ETHER_HDR_LEN) { m = m_pullup(m, ETHER_HDR_LEN); if (m == NULL) @@ -2042,7 +2058,6 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struc sc = ifp->if_bridge; vlan = VLANTAGOF(m); - BRIDGE_LOCK(sc); bifp = sc->sc_ifp; /* @@ -2069,16 +2084,10 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struc if (dst_if == NULL) { struct bridge_iflist *bif; struct mbuf *mc; - int error = 0, used = 0; + int used = 0; bridge_span(sc, m); - BRIDGE_LOCK2REF(sc, error); - if (error) { - m_freem(m); - return (0); - } - CK_LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { dst_if = bif->bif_ifp; @@ -2112,7 +2121,6 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struc } if (used == 0) m_freem(m); - BRIDGE_UNREF(sc); return (0); } @@ -2124,11 +2132,9 @@ sendunicast: bridge_span(sc, m); if ((dst_if->if_drv_flags & IFF_DRV_RUNNING) == 0) { m_freem(m); - BRIDGE_UNLOCK(sc); return (0); } - BRIDGE_UNLOCK(sc); bridge_enqueue(sc, dst_if, m); return (0); } @@ -2153,10 +2159,8 @@ bridge_transmit(struct ifnet *ifp, struct mbuf *m) eh = mtod(m, struct ether_header *); - BRIDGE_LOCK(sc); if (((m->m_flags & (M_BCAST|M_MCAST)) == 0) && (dst_if = bridge_rtlookup(sc, eh->ether_dhost, 1)) != NULL) { - BRIDGE_UNLOCK(sc); error = bridge_enqueue(sc, dst_if, m); } else bridge_broadcast(sc, ifp, m, 0); @@ -2190,6 +2194,8 @@ bridge_forward(struct bridge_softc *sc, struct bridge_ uint8_t *dst; int error; + NET_EPOCH_ASSERT(); + src_if = m->m_pkthdr.rcvif; ifp = sc->sc_ifp; @@ -2268,12 +2274,10 @@ bridge_forward(struct bridge_softc *sc, struct bridge_ || PFIL_HOOKED_IN(V_inet6_pfil_head) #endif ) { - BRIDGE_UNLOCK(sc); if (bridge_pfil(&m, ifp, src_if, PFIL_IN) != 0) return; if (m == NULL) return; - BRIDGE_LOCK(sc); } if (dst_if == NULL) { @@ -2301,8 +2305,6 @@ bridge_forward(struct bridge_softc *sc, struct bridge_ dbif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) goto drop; - BRIDGE_UNLOCK(sc); - if (PFIL_HOOKED_OUT(V_inet_pfil_head) #ifdef INET6 || PFIL_HOOKED_OUT(V_inet6_pfil_head) @@ -2318,7 +2320,6 @@ bridge_forward(struct bridge_softc *sc, struct bridge_ return; drop: - BRIDGE_UNLOCK(sc); m_freem(m); } @@ -2339,6 +2340,8 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) uint16_t vlan; int error; + NET_EPOCH_ASSERT(); + if ((sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return (m); @@ -2359,10 +2362,8 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) m_freem(m); return (NULL); } - BRIDGE_LOCK(sc); bif = bridge_lookup_member_if(sc, ifp); if (bif == NULL) { - BRIDGE_UNLOCK(sc); return (m); } @@ -2375,13 +2376,11 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) if (memcmp(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN) == 0) { bstp_input(&bif->bif_stp, ifp, m); /* consumes mbuf */ - BRIDGE_UNLOCK(sc); return (NULL); } if ((bif->bif_flags & IFBIF_STP) && bif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) { - BRIDGE_UNLOCK(sc); return (m); } @@ -2392,7 +2391,6 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) */ mc = m_dup(m, M_NOWAIT); if (mc == NULL) { - BRIDGE_UNLOCK(sc); return (m); } @@ -2424,7 +2422,6 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) if ((bif->bif_flags & IFBIF_STP) && bif->bif_stp.bp_state == BSTP_IFSTATE_DISCARDING) { - BRIDGE_UNLOCK(sc); return (m); } @@ -2458,7 +2455,6 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) error = bridge_rtupdate(sc, eh->ether_shost, \ vlan, bif, 0, IFBAF_DYNAMIC); \ if (error && bif->bif_addrmax) { \ - BRIDGE_UNLOCK(sc); \ m_freem(m); \ return (NULL); \ } \ @@ -2466,7 +2462,6 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) m->m_pkthdr.rcvif = iface; \ if ((iface) == ifp) { \ /* Skip bridge processing... src == dest */ \ - BRIDGE_UNLOCK(sc); \ return (m); \ } \ /* It's passing over or to the bridge, locally. */ \ @@ -2478,13 +2473,11 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) OR_PFIL_HOOKED_INET6)) { \ if (bridge_pfil(&m, NULL, ifp, \ PFIL_IN) != 0 || m == NULL) { \ - BRIDGE_UNLOCK(sc); \ return (NULL); \ } \ } \ if ((iface) != bifp) \ ETHER_BPF_MTAP(iface, m); \ - BRIDGE_UNLOCK(sc); \ return (m); \ } \ \ @@ -2492,7 +2485,6 @@ bridge_input(struct ifnet *ifp, struct mbuf *m) if (memcmp(IF_LLADDR((iface)), eh->ether_shost, ETHER_ADDR_LEN) == 0 \ OR_CARP_CHECK_WE_ARE_SRC((iface)) \ ) { \ - BRIDGE_UNLOCK(sc); \ m_freem(m); \ return (NULL); \ } @@ -2543,16 +2535,12 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet struct bridge_iflist *dbif, *sbif; struct mbuf *mc; struct ifnet *dst_if; - int error = 0, used = 0, i; + int used = 0, i; + NET_EPOCH_ASSERT(); + sbif = bridge_lookup_member_if(sc, src_if); - BRIDGE_LOCK2REF(sc, error); - if (error) { - m_freem(m); - return; - } - /* Filter on the bridge interface before broadcasting */ if (runfilt && (PFIL_HOOKED_OUT(V_inet_pfil_head) #ifdef INET6 @@ -2560,9 +2548,9 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet #endif )) { if (bridge_pfil(&m, sc->sc_ifp, NULL, PFIL_OUT) != 0) - goto out; + return; if (m == NULL) - goto out; + return; } CK_LIST_FOREACH(dbif, &sc->sc_iflist, bif_next) { @@ -2625,9 +2613,6 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet } if (used == 0) m_freem(m); - -out: - BRIDGE_UNREF(sc); } /* @@ -2643,6 +2628,8 @@ bridge_span(struct bridge_softc *sc, struct mbuf *m) struct ifnet *dst_if; struct mbuf *mc; + NET_EPOCH_ASSERT(); + if (CK_LIST_EMPTY(&sc->sc_spanlist)) return; @@ -2674,7 +2661,8 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t struct bridge_rtnode *brt; int error; - BRIDGE_LOCK_ASSERT(sc); + NET_EPOCH_ASSERT(); + BRIDGE_UNLOCK_ASSERT(sc); /* Check the source address is valid and not multicast. */ if (ETHER_IS_MULTICAST(dst) || @@ -2691,13 +2679,24 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t * update it, otherwise create a new one. */ if ((brt = bridge_rtnode_lookup(sc, dst, vlan)) == NULL) { + BRIDGE_LOCK(sc); + + /* Check again, now that we have the lock. There could have + * been a race and we only want to insert this once. */ + if ((brt = bridge_rtnode_lookup(sc, dst, vlan)) != NULL) { + BRIDGE_UNLOCK(sc); + return (0); + } + if (sc->sc_brtcnt >= sc->sc_brtmax) { sc->sc_brtexceeded++; + BRIDGE_UNLOCK(sc); return (ENOSPC); } /* Check per interface address limits (if enabled) */ if (bif->bif_addrmax && bif->bif_addrcnt >= bif->bif_addrmax) { bif->bif_addrexceeded++; + BRIDGE_UNLOCK(sc); return (ENOSPC); } @@ -2707,8 +2706,11 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t * address. */ brt = uma_zalloc(V_bridge_rtnode_zone, M_NOWAIT | M_ZERO); - if (brt == NULL) + if (brt == NULL) { + BRIDGE_UNLOCK(sc); return (ENOMEM); + } + brt->brt_vnet = curvnet; if (bif->bif_flags & IFBIF_STICKY) brt->brt_flags = IFBAF_STICKY; @@ -2720,17 +2722,22 @@ bridge_rtupdate(struct bridge_softc *sc, const uint8_t if ((error = bridge_rtnode_insert(sc, brt)) != 0) { uma_zfree(V_bridge_rtnode_zone, brt); + BRIDGE_UNLOCK(sc); return (error); } brt->brt_dst = bif; bif->bif_addrcnt++; + + BRIDGE_UNLOCK(sc); } if ((brt->brt_flags & IFBAF_TYPEMASK) == IFBAF_DYNAMIC && brt->brt_dst != bif) { + BRIDGE_LOCK(sc); brt->brt_dst->bif_addrcnt--; brt->brt_dst = bif; brt->brt_dst->bif_addrcnt++; + BRIDGE_UNLOCK(sc); } if ((flags & IFBAF_TYPEMASK) == IFBAF_DYNAMIC) @@ -2751,7 +2758,7 @@ bridge_rtlookup(struct bridge_softc *sc, const uint8_t { struct bridge_rtnode *brt; - BRIDGE_LOCK_ASSERT(sc); + NET_EPOCH_ASSERT(); if ((brt = bridge_rtnode_lookup(sc, addr, vlan)) == NULL) return (NULL); @@ -2771,6 +2778,7 @@ bridge_rttrim(struct bridge_softc *sc) { struct bridge_rtnode *brt, *nbrt; + NET_EPOCH_ASSERT(); BRIDGE_LOCK_ASSERT(sc); /* Make sure we actually need to do this. */ @@ -2800,7 +2808,9 @@ static void bridge_timer(void *arg) { struct bridge_softc *sc = arg; + struct epoch_tracker et; + NET_EPOCH_ENTER(et); BRIDGE_LOCK_ASSERT(sc); /* Destruction of rtnodes requires a proper vnet context */ @@ -2811,6 +2821,7 @@ bridge_timer(void *arg) callout_reset(&sc->sc_brcallout, bridge_rtable_prune_period * hz, bridge_timer, sc); CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); } /* @@ -2823,6 +2834,7 @@ bridge_rtage(struct bridge_softc *sc) { struct bridge_rtnode *brt, *nbrt; + NET_EPOCH_ASSERT(); BRIDGE_LOCK_ASSERT(sc); CK_LIST_FOREACH_SAFE(brt, &sc->sc_rtlist, brt_list, nbrt) { @@ -2843,6 +2855,7 @@ bridge_rtflush(struct bridge_softc *sc, int full) { struct bridge_rtnode *brt, *nbrt; + NET_EPOCH_ASSERT(); BRIDGE_LOCK_ASSERT(sc); CK_LIST_FOREACH_SAFE(brt, &sc->sc_rtlist, brt_list, nbrt) { @@ -2862,6 +2875,7 @@ bridge_rtdaddr(struct bridge_softc *sc, const uint8_t struct bridge_rtnode *brt; int found = 0; + NET_EPOCH_ASSERT(); BRIDGE_LOCK_ASSERT(sc); /* @@ -2886,6 +2900,7 @@ bridge_rtdelete(struct bridge_softc *sc, struct ifnet { struct bridge_rtnode *brt, *nbrt; + NET_EPOCH_ASSERT(); BRIDGE_LOCK_ASSERT(sc); CK_LIST_FOREACH_SAFE(brt, &sc->sc_rtlist, brt_list, nbrt) { @@ -2990,7 +3005,7 @@ bridge_rtnode_lookup(struct bridge_softc *sc, const ui uint32_t hash; int dir; - BRIDGE_LOCK_ASSERT(sc); + NET_EPOCH_ASSERT(); hash = bridge_rthash(sc, addr); CK_LIST_FOREACH(brt, &sc->sc_rthash[hash], brt_hash) { @@ -3053,6 +3068,18 @@ out: return (0); } +static void +bridge_rtnode_destroy_cb(struct epoch_context *ctx) +{ + struct bridge_rtnode *brt; + + brt = __containerof(ctx, struct bridge_rtnode, brt_epoch_ctx); + + CURVNET_SET(brt->brt_vnet); + uma_zfree(V_bridge_rtnode_zone, brt); + CURVNET_RESTORE(); +} + /* * bridge_rtnode_destroy: * @@ -3061,6 +3088,7 @@ out: static void bridge_rtnode_destroy(struct bridge_softc *sc, struct bridge_rtnode *brt) { + NET_EPOCH_ASSERT(); BRIDGE_LOCK_ASSERT(sc); CK_LIST_REMOVE(brt, brt_hash); @@ -3068,7 +3096,8 @@ bridge_rtnode_destroy(struct bridge_softc *sc, struct CK_LIST_REMOVE(brt, brt_list); sc->sc_brtcnt--; brt->brt_dst->bif_addrcnt--; - uma_zfree(V_bridge_rtnode_zone, brt); + + NET_EPOCH_CALL(bridge_rtnode_destroy_cb, &brt->brt_epoch_ctx); } /* @@ -3081,7 +3110,9 @@ bridge_rtable_expire(struct ifnet *ifp, int age) { struct bridge_softc *sc = ifp->if_bridge; struct bridge_rtnode *brt; + struct epoch_tracker et; + NET_EPOCH_ENTER(et); CURVNET_SET(ifp->if_vnet); BRIDGE_LOCK(sc); @@ -3102,6 +3133,7 @@ bridge_rtable_expire(struct ifnet *ifp, int age) } BRIDGE_UNLOCK(sc); CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); } /* @@ -3607,17 +3639,20 @@ bridge_linkstate(struct ifnet *ifp) { struct bridge_softc *sc = ifp->if_bridge; struct bridge_iflist *bif; + struct epoch_tracker et; - BRIDGE_LOCK(sc); + NET_EPOCH_ENTER(et); + bif = bridge_lookup_member_if(sc, ifp); if (bif == NULL) { - BRIDGE_UNLOCK(sc); + NET_EPOCH_EXIT(et); return; } bridge_linkcheck(sc); - BRIDGE_UNLOCK(sc); bstp_linkstate(&bif->bif_stp); + + NET_EPOCH_EXIT(et); } static void @@ -3626,7 +3661,8 @@ bridge_linkcheck(struct bridge_softc *sc) struct bridge_iflist *bif; int new_link, hasls; - BRIDGE_LOCK_ASSERT(sc); + NET_EPOCH_ASSERT(); + new_link = LINK_STATE_DOWN; hasls = 0; /* Our link is considered up if at least one of our ports is active */ From owner-svn-src-head@freebsd.org Sun Apr 26 16:27: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 DC7802B4B70; Sun, 26 Apr 2020 16:27: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499Cwl5ZG4z3BqP; Sun, 26 Apr 2020 16:27:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B55DD23B27; Sun, 26 Apr 2020 16:27:03 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03QGR3ME002109; Sun, 26 Apr 2020 16:27:03 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QGR3sO002108; Sun, 26 Apr 2020 16:27:03 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202004261627.03QGR3sO002108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 26 Apr 2020 16:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360346 - head/tests/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/net X-SVN-Commit-Revision: 360346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 16:27:03 -0000 Author: kp Date: Sun Apr 26 16:27:03 2020 New Revision: 360346 URL: https://svnweb.freebsd.org/changeset/base/360346 Log: bridge tests: Test for #216510 We used to have an issue with recursive locking with net.link.bridge.inherit_mac. This causes us to send an ARP request while we hold the BRIDGE_LOCK, which used to cause us to acquire the BRIDGE_LOCK again. We can't re-acquire it, so this caused a panic. Now that we no longer need to acquire the BRIDGE_LOCK for bridge_transmit() this should no longer panic. Test this. PR: 216510 Reviewed by: emaste, philip MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24251 Modified: head/tests/sys/net/if_bridge_test.sh Modified: head/tests/sys/net/if_bridge_test.sh ============================================================================== --- head/tests/sys/net/if_bridge_test.sh Sun Apr 26 16:22:35 2020 (r360345) +++ head/tests/sys/net/if_bridge_test.sh Sun Apr 26 16:27:03 2020 (r360346) @@ -309,12 +309,40 @@ mac_conflict_cleanup() vnet_cleanup } +atf_test_case "inherit_mac" "cleanup" +inherit_mac_head() +{ + atf_set descr 'Bridge inherit_mac test, #216510' + atf_set require.user root +} + +inherit_mac_body() +{ + vnet_init + + bridge=$(vnet_mkbridge) + epair=$(vnet_mkepair) + vnet_mkjail one ${bridge} ${epair}a + + jexec one sysctl net.link.bridge.inherit_mac=1 + + # Attempt to provoke the panic described in #216510 + jexec one ifconfig ${bridge} 192.0.0.1/24 up + jexec one ifconfig ${bridge} addm ${epair}a +} + +inherit_mac_cleanup() +{ + vnet_cleanup +} + atf_init_test_cases() { atf_add_test_case "bridge_transmit_ipv4_unicast" atf_add_test_case "stp" atf_add_test_case "static" atf_add_test_case "span" + atf_add_test_case "inherit_mac" atf_add_test_case "delete_with_members" atf_add_test_case "mac_conflict" } From owner-svn-src-head@freebsd.org Sun Apr 26 16:30: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 148ED2B4C36; Sun, 26 Apr 2020 16:30:01 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499D086lrWz3C26; Sun, 26 Apr 2020 16:30:00 +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 C4C1923B53; Sun, 26 Apr 2020 16:30:00 +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 03QGU04b002367; Sun, 26 Apr 2020 16:30:00 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QGU0Up002366; Sun, 26 Apr 2020 16:30:00 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202004261630.03QGU0Up002366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 26 Apr 2020 16:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360347 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 360347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 16:30:01 -0000 Author: kp Date: Sun Apr 26 16:30:00 2020 New Revision: 360347 URL: https://svnweb.freebsd.org/changeset/base/360347 Log: pf: Virtualise pf_frag_mtx The pf_frag_mtx mutex protects the fragments queue. The fragments queue is virtualised already (i.e. per-vnet) so it makes no sense to block jail A from accessing its fragments queue while jail B is accessing its own fragments queue. Virtualise the lock for improved concurrency. Differential Revision: https://reviews.freebsd.org/D24504 Modified: head/sys/netpfil/pf/pf_norm.c Modified: head/sys/netpfil/pf/pf_norm.c ============================================================================== --- head/sys/netpfil/pf/pf_norm.c Sun Apr 26 16:27:03 2020 (r360346) +++ head/sys/netpfil/pf/pf_norm.c Sun Apr 26 16:30:00 2020 (r360347) @@ -106,11 +106,11 @@ struct pf_fragment_tag { uint32_t ft_id; /* fragment id */ }; -static struct mtx pf_frag_mtx; -MTX_SYSINIT(pf_frag_mtx, &pf_frag_mtx, "pf fragments", MTX_DEF); -#define PF_FRAG_LOCK() mtx_lock(&pf_frag_mtx) -#define PF_FRAG_UNLOCK() mtx_unlock(&pf_frag_mtx) -#define PF_FRAG_ASSERT() mtx_assert(&pf_frag_mtx, MA_OWNED) +VNET_DEFINE_STATIC(struct mtx, pf_frag_mtx); +#define V_pf_frag_mtx VNET(pf_frag_mtx) +#define PF_FRAG_LOCK() mtx_lock(&V_pf_frag_mtx) +#define PF_FRAG_UNLOCK() mtx_unlock(&V_pf_frag_mtx) +#define PF_FRAG_ASSERT() mtx_assert(&V_pf_frag_mtx, MA_OWNED) VNET_DEFINE(uma_zone_t, pf_state_scrub_z); /* XXX: shared with pfsync */ @@ -192,6 +192,8 @@ pf_normalize_init(void) sizeof(struct pf_state_scrub), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + mtx_init(&V_pf_frag_mtx, "pf fragments", NULL, MTX_DEF); + V_pf_limits[PF_LIMIT_FRAGS].zone = V_pf_frent_z; V_pf_limits[PF_LIMIT_FRAGS].limit = PFFRAG_FRENT_HIWAT; uma_zone_set_max(V_pf_frent_z, PFFRAG_FRENT_HIWAT); @@ -207,6 +209,8 @@ pf_normalize_cleanup(void) uma_zdestroy(V_pf_state_scrub_z); uma_zdestroy(V_pf_frent_z); uma_zdestroy(V_pf_frag_z); + + mtx_destroy(&V_pf_frag_mtx); } static int From owner-svn-src-head@freebsd.org Sun Apr 26 18:07: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 7C9CA2B8833; Sun, 26 Apr 2020 18:07:36 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499G8m2lqCz3JVT; Sun, 26 Apr 2020 18:07:36 +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 5548624E8A; Sun, 26 Apr 2020 18:07:36 +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 03QI7aWR064373; Sun, 26 Apr 2020 18:07:36 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QI7aab064372; Sun, 26 Apr 2020 18:07:36 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004261807.03QI7aab064372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 26 Apr 2020 18:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360348 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 360348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 18:07:36 -0000 Author: melifaro Date: Sun Apr 26 18:07:35 2020 New Revision: 360348 URL: https://svnweb.freebsd.org/changeset/base/360348 Log: Fix IPv6 link-local operations with RADIX_MPATH. It was broken by r360292 as fib6_lookup() assumes de-embedded addresses while rtalloc_mpath_fib() requires sockaddr with embedded ones. New fib6_lookup() transparently supports multipath, hence remove old RADIX_MPATH condition. Modified: head/sys/netinet6/in6_src.c Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Sun Apr 26 16:30:00 2020 (r360347) +++ head/sys/netinet6/in6_src.c Sun Apr 26 18:07:35 2020 (r360348) @@ -93,9 +93,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef RADIX_MPATH -#include -#endif #include #include @@ -773,13 +770,9 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_p } -#ifdef RADIX_MPATH - rtalloc_mpath_fib((struct route *)ro, - ntohl(sa6->sin6_addr.s6_addr32[3]), fibnum); -#else ro->ro_nh = fib6_lookup(fibnum, &sa6->sin6_addr, scopeid, NHR_REF, flowid); -#endif + if (IN6_IS_SCOPE_LINKLOCAL(&sa6->sin6_addr)) sa6->sin6_addr.s6_addr16[1] = htons(scopeid); } From owner-svn-src-head@freebsd.org Sun Apr 26 18:42:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFD272B9221; Sun, 26 Apr 2020 18:42:39 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499GxC588gz3KtS; Sun, 26 Apr 2020 18:42:39 +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 ABE0325631; Sun, 26 Apr 2020 18:42:39 +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 03QIgd72088479; Sun, 26 Apr 2020 18:42:39 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QIgcfR088475; Sun, 26 Apr 2020 18:42:38 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004261842.03QIgcfR088475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 26 Apr 2020 18:42:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360349 - in head/sys: net netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet netinet6 X-SVN-Commit-Revision: 360349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 18:42:39 -0000 Author: melifaro Date: Sun Apr 26 18:42:38 2020 New Revision: 360349 URL: https://svnweb.freebsd.org/changeset/base/360349 Log: Convert debugnet to the new routing KPI. Introduce new fib[46]_lookup_debugnet() functions serving as a special interface for the crash-time operations. Underlying implementation will try to return lookup result if datastructures are not corrupted, avoding locking. Convert debugnet to use fib4_lookup_debugnet() and switch it to use nexthops instead of rtentries. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D24555 Modified: head/sys/net/debugnet.c head/sys/netinet/in_fib.c head/sys/netinet/in_fib.h head/sys/netinet6/in6_fib.c head/sys/netinet6/in6_fib.h Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Sun Apr 26 18:07:35 2020 (r360348) +++ head/sys/net/debugnet.c Sun Apr 26 18:42:38 2020 (r360349) @@ -53,8 +53,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include +#include #include #include #include @@ -644,8 +647,8 @@ debugnet_connect(const struct debugnet_conn_params *dc if (pcb->dp_client == INADDR_ANY || pcb->dp_gateway == INADDR_ANY || pcb->dp_ifp == NULL) { struct sockaddr_in dest_sin, *gw_sin, *local_sin; - struct rtentry *dest_rt; struct ifnet *rt_ifp; + struct nhop_object *nh; memset(&dest_sin, 0, sizeof(dest_sin)); dest_sin = (struct sockaddr_in) { @@ -655,29 +658,29 @@ debugnet_connect(const struct debugnet_conn_params *dc }; CURVNET_SET(vnet0); - dest_rt = rtalloc1((struct sockaddr *)&dest_sin, 0, - RTF_RNH_LOCKED); + nh = fib4_lookup_debugnet(RT_DEFAULT_FIB, dest_sin.sin_addr, 0, + NHR_NONE); CURVNET_RESTORE(); - if (dest_rt == NULL) { + if (nh == NULL) { printf("%s: Could not get route for that server.\n", __func__); error = ENOENT; goto cleanup; } - if (dest_rt->rt_gateway->sa_family == AF_INET) - gw_sin = (struct sockaddr_in *)dest_rt->rt_gateway; + if (nh->gw_sa.sa_family == AF_INET) + gw_sin = &nh->gw4_sa; else { - if (dest_rt->rt_gateway->sa_family == AF_LINK) + if (nh->gw_sa.sa_family == AF_LINK) DNETDEBUG("Destination address is on link.\n"); gw_sin = NULL; } - MPASS(dest_rt->rt_ifa->ifa_addr->sa_family == AF_INET); - local_sin = (struct sockaddr_in *)dest_rt->rt_ifa->ifa_addr; + MPASS(nh->nh_ifa->ifa_addr->sa_family == AF_INET); + local_sin = (struct sockaddr_in *)nh->nh_ifa->ifa_addr; - rt_ifp = dest_rt->rt_ifp; + rt_ifp = nh->nh_ifp; if (pcb->dp_client == INADDR_ANY) pcb->dp_client = local_sin->sin_addr.s_addr; @@ -685,8 +688,6 @@ debugnet_connect(const struct debugnet_conn_params *dc pcb->dp_gateway = gw_sin->sin_addr.s_addr; if (pcb->dp_ifp == NULL) pcb->dp_ifp = rt_ifp; - - RTFREE_LOCKED(dest_rt); } ifp = pcb->dp_ifp; Modified: head/sys/netinet/in_fib.c ============================================================================== --- head/sys/netinet/in_fib.c Sun Apr 26 18:07:35 2020 (r360348) +++ head/sys/netinet/in_fib.c Sun Apr 26 18:42:38 2020 (r360349) @@ -361,4 +361,46 @@ fib4_check_urpf(uint32_t fibnum, struct in_addr dst, u return (0); } +struct nhop_object * +fib4_lookup_debugnet(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, + uint32_t flags) +{ + struct rib_head *rh; + struct radix_node *rn; + struct rtentry *rt; + struct nhop_object *nh; + + KASSERT((fibnum < rt_numfibs), ("fib4_lookup_debugnet: bad fibnum")); + rh = rt_tables_get_rnh(fibnum, AF_INET); + if (rh == NULL) + return (NULL); + + /* Prepare lookup key */ + struct sockaddr_in sin4; + memset(&sin4, 0, sizeof(sin4)); + sin4.sin_family = AF_INET; + sin4.sin_len = sizeof(struct sockaddr_in); + sin4.sin_addr = dst; + + nh = NULL; + /* unlocked lookup */ + rn = rh->rnh_matchaddr((void *)&sin4, &rh->head); + if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { + rt = RNTORT(rn); +#ifdef RADIX_MPATH + if (rt_mpath_next(rt) != NULL) + rt = rt_mpath_selectrte(rt, 0); +#endif + nh = rt->rt_nhop; + /* Ensure route & ifp is UP */ + if (RT_LINK_IS_UP(nh->nh_ifp)) { + if (flags & NHR_REF) + nhop_ref_object(nh); + return (nh); + } + } + + return (NULL); +} + #endif Modified: head/sys/netinet/in_fib.h ============================================================================== --- head/sys/netinet/in_fib.h Sun Apr 26 18:07:35 2020 (r360348) +++ head/sys/netinet/in_fib.h Sun Apr 26 18:42:38 2020 (r360349) @@ -75,5 +75,7 @@ struct nhop_object *fib4_lookup(uint32_t fibnum, struc uint32_t scopeid, uint32_t flags, uint32_t flowid); int fib4_check_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags, const struct ifnet *src_if); +struct nhop_object *fib4_lookup_debugnet(uint32_t fibnum, struct in_addr dst, + uint32_t scopeid, uint32_t flags); #endif Modified: head/sys/netinet6/in6_fib.c ============================================================================== --- head/sys/netinet6/in6_fib.c Sun Apr 26 18:07:35 2020 (r360348) +++ head/sys/netinet6/in6_fib.c Sun Apr 26 18:42:38 2020 (r360349) @@ -397,5 +397,46 @@ fib6_check_urpf(uint32_t fibnum, const struct in6_addr return (0); } +struct nhop_object * +fib6_lookup_debugnet(uint32_t fibnum, const struct in6_addr *dst6, + uint32_t scopeid, uint32_t flags) +{ + struct rib_head *rh; + struct radix_node *rn; + struct rtentry *rt; + struct nhop_object *nh; + struct sockaddr_in6 sin6; + + KASSERT((fibnum < rt_numfibs), ("fib6_lookup: bad fibnum")); + rh = rt_tables_get_rnh(fibnum, AF_INET6); + if (rh == NULL) + return (NULL); + + /* TODO: radix changes */ + //addr = *dst6; + /* Prepare lookup key */ + memset(&sin6, 0, sizeof(sin6)); + sin6.sin6_len = sizeof(struct sockaddr_in6); + sin6.sin6_addr = *dst6; + + /* Assume scopeid is valid and embed it directly */ + if (IN6_IS_SCOPE_LINKLOCAL(dst6)) + sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff); + + rn = rh->rnh_matchaddr((void *)&sin6, &rh->head); + if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { + rt = RNTORT(rn); + nh = rt->rt_nhop; + /* Ensure route & ifp is UP */ + if (RT_LINK_IS_UP(nh->nh_ifp)) { + if (flags & NHR_REF) + nhop_ref_object(nh); + return (nh); + } + } + + return (NULL); +} + #endif Modified: head/sys/netinet6/in6_fib.h ============================================================================== --- head/sys/netinet6/in6_fib.h Sun Apr 26 18:07:35 2020 (r360348) +++ head/sys/netinet6/in6_fib.h Sun Apr 26 18:42:38 2020 (r360349) @@ -64,5 +64,7 @@ struct nhop_object *fib6_lookup(uint32_t fibnum, uint32_t flowid); int fib6_check_urpf(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags, const struct ifnet *src_if); +struct nhop_object *fib6_lookup_debugnet(uint32_t fibnum, + const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags); #endif From owner-svn-src-head@freebsd.org Sun Apr 26 19:17:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA0142BA09B; Sun, 26 Apr 2020 19:17:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499Hjj5tdJz3MSL; Sun, 26 Apr 2020 19:17:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C53A425CA5; Sun, 26 Apr 2020 19:17:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03QJHjYU007408; Sun, 26 Apr 2020 19:17:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QJHja8007407; Sun, 26 Apr 2020 19:17:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202004261917.03QJHja8007407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 26 Apr 2020 19:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360350 - head/contrib/llvm-project/llvm/lib/Target/ARM X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Target/ARM X-SVN-Commit-Revision: 360350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 19:17:46 -0000 Author: dim Date: Sun Apr 26 19:17:45 2020 New Revision: 360350 URL: https://svnweb.freebsd.org/changeset/base/360350 Log: Tentatively apply https://reviews.llvm.org/D78877 (by Dave Green): [ARM] Only produce qadd8b under hasV6Ops When compiling for a arm5te cpu from clang, the +dsp attribute is set. This meant we could try and generate qadd8 instructions where we would end up having no pattern. I've changed the condition here to be hasV6Ops && hasDSP, which is what other parts of ARMISelLowering seem to use for similar instructions. Fixed PR45677. This fixes "fatal error: error in backend: Cannot select: t37: i32 = ARMISD::QADD8b t43, t44" when compiling sys/dev/sound/pcm/feeder_mixer.c for armv5. For some reason we do not encounter this on head, but this error popped up while building universes for stable/12. MFC after: 3 days Modified: head/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp Modified: head/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- head/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp Sun Apr 26 18:42:38 2020 (r360349) +++ head/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelLowering.cpp Sun Apr 26 19:17:45 2020 (r360350) @@ -4549,7 +4549,7 @@ SDValue ARMTargetLowering::LowerUnsignedALUO(SDValue O static SDValue LowerSADDSUBSAT(SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget) { EVT VT = Op.getValueType(); - if (!Subtarget->hasDSP()) + if (!Subtarget->hasV6Ops() || !Subtarget->hasDSP()) return SDValue(); if (!VT.isSimple()) return SDValue(); From owner-svn-src-head@freebsd.org Sun Apr 26 20:06: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 D076F2BAF9C; Sun, 26 Apr 2020 20:06:08 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499JnX5CDwz3QYk; Sun, 26 Apr 2020 20:06:08 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A97A3266AA; Sun, 26 Apr 2020 20:06:08 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03QK68Nx038475; Sun, 26 Apr 2020 20:06:08 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QK68Kl038474; Sun, 26 Apr 2020 20:06:08 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202004262006.03QK68Kl038474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 26 Apr 2020 20:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360353 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 360353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 20:06:08 -0000 Author: wulf Date: Sun Apr 26 20:06:08 2020 New Revision: 360353 URL: https://svnweb.freebsd.org/changeset/base/360353 Log: psm(4): Fix wrong key-release event occuring after trackpoint use. Some models of laptops e.g. "X1 Carbon 3rd Gen Thinkpad" have LRM buttons wired as so called "Synaptic touchpads extended buttons" rather thah real trackpoint buttons. Handle this case with merging of events from both sources. PR: 245877 Reported by: Raichoo MFC after: 1 week Modified: head/sys/dev/atkbdc/psm.c Modified: head/sys/dev/atkbdc/psm.c ============================================================================== --- head/sys/dev/atkbdc/psm.c Sun Apr 26 19:43:27 2020 (r360352) +++ head/sys/dev/atkbdc/psm.c Sun Apr 26 20:06:08 2020 (r360353) @@ -3371,7 +3371,7 @@ proc_synaptics(struct psm_softc *sc, packetbuf_t *pb, evdev_push_rel(sc->evdev_r, REL_X, *x); evdev_push_rel(sc->evdev_r, REL_Y, -*y); evdev_push_mouse_btn(sc->evdev_r, - guest_buttons); + guest_buttons | sc->extended_buttons); evdev_sync(sc->evdev_r); } #endif From owner-svn-src-head@freebsd.org Sun Apr 26 20:08: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 AA9242BB4C7; Sun, 26 Apr 2020 20:08:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499Jrq47l0z3RFh; Sun, 26 Apr 2020 20:08:59 +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 89260266B3; Sun, 26 Apr 2020 20:08:59 +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 03QK8xae038712; Sun, 26 Apr 2020 20:08:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QK8wxQ038706; Sun, 26 Apr 2020 20:08:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004262008.03QK8wxQ038706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 26 Apr 2020 20:08:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360354 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 360354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 20:08:59 -0000 Author: markj Date: Sun Apr 26 20:08:57 2020 New Revision: 360354 URL: https://svnweb.freebsd.org/changeset/base/360354 Log: Use a single VM object for kernel stacks. Previously we allocated a separate VM object for each kernel stack. However, fully constructed kernel stacks are cached by UMA, so there is no harm in using a single global object for all stacks. This reduces memory consumption and makes it easier to define a memory allocation policy for kernel stack pages, with the aim of reducing physical memory fragmentation. Add a global kstack_object, and use the stack KVA address to index into the object like we do with kernel_object. Reviewed by: kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24473 Modified: head/sys/kern/kern_thread.c head/sys/sys/proc.h head/sys/vm/vm_extern.h head/sys/vm/vm_glue.c head/sys/vm/vm_kern.h head/sys/vm/vm_swapout.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sun Apr 26 20:06:08 2020 (r360353) +++ head/sys/kern/kern_thread.c Sun Apr 26 20:08:57 2020 (r360354) @@ -84,7 +84,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0 "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x498, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x6b0, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x6a0, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb0, "struct proc KBI p_flag"); Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Sun Apr 26 20:06:08 2020 (r360353) +++ head/sys/sys/proc.h Sun Apr 26 20:08:57 2020 (r360354) @@ -348,7 +348,6 @@ struct thread { /* LP64 hole */ struct callout td_slpcallout; /* (h) Callout for sleep. */ struct trapframe *td_frame; /* (k) */ - struct vm_object *td_kstack_obj;/* (a) Kstack object. */ vm_offset_t td_kstack; /* (a) Kernel VA of kstack. */ int td_kstack_pages; /* (a) Size of the kstack. */ volatile u_int td_critnest; /* (k*) Critical section nest level. */ Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Sun Apr 26 20:06:08 2020 (r360353) +++ head/sys/vm/vm_extern.h Sun Apr 26 20:08:57 2020 (r360354) @@ -126,6 +126,8 @@ struct sf_buf *vm_imgact_map_page(vm_object_t object, void vm_imgact_unmap_page(struct sf_buf *sf); void vm_thread_dispose(struct thread *td); int vm_thread_new(struct thread *td, int pages); +void vm_thread_stack_back(struct domainset *ds, vm_offset_t kaddr, + vm_page_t ma[], int npages, int req_class); u_int vm_active_count(void); u_int vm_inactive_count(void); u_int vm_laundry_count(void); Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sun Apr 26 20:06:08 2020 (r360353) +++ head/sys/vm/vm_glue.c Sun Apr 26 20:08:57 2020 (r360354) @@ -264,9 +264,9 @@ vm_sync_icache(vm_map_t map, vm_offset_t va, vm_offset pmap_sync_icache(map->pmap, va, sz); } +vm_object_t kstack_object; static uma_zone_t kstack_cache; static int kstack_cache_size; -static int kstack_domain_iter; static int sysctl_kstack_cache_size(SYSCTL_HANDLER_ARGS) @@ -285,23 +285,15 @@ SYSCTL_PROC(_vm, OID_AUTO, kstack_cache_size, /* * Create the kernel stack (including pcb for i386) for a new thread. - * This routine directly affects the fork perf for a process and - * create performance for a thread. */ static vm_offset_t -vm_thread_stack_create(struct domainset *ds, vm_object_t *ksobjp, int pages) +vm_thread_stack_create(struct domainset *ds, int pages) { vm_page_t ma[KSTACK_MAX_PAGES]; - vm_object_t ksobj; vm_offset_t ks; int i; /* - * Allocate an object for the kstack. - */ - ksobj = vm_object_allocate(OBJT_DEFAULT, pages); - - /* * Get a kernel virtual address for this thread's kstack. */ #if defined(__mips__) @@ -319,54 +311,45 @@ vm_thread_stack_create(struct domainset *ds, vm_object #endif if (ks == 0) { printf("%s: kstack allocation failed\n", __func__); - vm_object_deallocate(ksobj); return (0); } - if (vm_ndomains > 1) { - ksobj->domain.dr_policy = ds; - ksobj->domain.dr_iter = - atomic_fetchadd_int(&kstack_domain_iter, 1); - } if (KSTACK_GUARD_PAGES != 0) { pmap_qremove(ks, KSTACK_GUARD_PAGES); ks += KSTACK_GUARD_PAGES * PAGE_SIZE; } - /* - * For the length of the stack, link in a real page of ram for each - * page of stack. + /* + * Allocate physical pages to back the stack. */ - VM_OBJECT_WLOCK(ksobj); - (void)vm_page_grab_pages(ksobj, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED, - ma, pages); + vm_thread_stack_back(ds, ks, ma, pages, VM_ALLOC_NORMAL); for (i = 0; i < pages; i++) vm_page_valid(ma[i]); - VM_OBJECT_WUNLOCK(ksobj); pmap_qenter(ks, ma, pages); - *ksobjp = ksobj; return (ks); } static void -vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t ks, int pages) +vm_thread_stack_dispose(vm_offset_t ks, int pages) { vm_page_t m; + vm_pindex_t pindex; int i; + pindex = atop(ks - VM_MIN_KERNEL_ADDRESS); + pmap_qremove(ks, pages); - VM_OBJECT_WLOCK(ksobj); + VM_OBJECT_WLOCK(kstack_object); for (i = 0; i < pages; i++) { - m = vm_page_lookup(ksobj, i); + m = vm_page_lookup(kstack_object, pindex + i); if (m == NULL) panic("%s: kstack already missing?", __func__); vm_page_xbusy_claim(m); vm_page_unwire_noq(m); vm_page_free(m); } - VM_OBJECT_WUNLOCK(ksobj); - vm_object_deallocate(ksobj); + VM_OBJECT_WUNLOCK(kstack_object); kva_free(ks - (KSTACK_GUARD_PAGES * PAGE_SIZE), (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE); } @@ -377,7 +360,6 @@ vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t int vm_thread_new(struct thread *td, int pages) { - vm_object_t ksobj; vm_offset_t ks; /* Bounds check */ @@ -387,12 +369,8 @@ vm_thread_new(struct thread *td, int pages) pages = KSTACK_MAX_PAGES; ks = 0; - ksobj = NULL; - if (pages == kstack_pages && kstack_cache != NULL) { + if (pages == kstack_pages && kstack_cache != NULL) ks = (vm_offset_t)uma_zalloc(kstack_cache, M_NOWAIT); - if (ks != 0) - ksobj = PHYS_TO_VM_PAGE(pmap_kextract(ks))->object; - } /* * Ensure that kstack objects can draw pages from any memory @@ -401,10 +379,9 @@ vm_thread_new(struct thread *td, int pages) */ if (ks == 0) ks = vm_thread_stack_create(DOMAINSET_PREF(PCPU_GET(domain)), - &ksobj, pages); + pages); if (ks == 0) return (0); - td->td_kstack_obj = ksobj; td->td_kstack = ks; td->td_kstack_pages = pages; return (1); @@ -416,26 +393,52 @@ vm_thread_new(struct thread *td, int pages) void vm_thread_dispose(struct thread *td) { - vm_object_t ksobj; vm_offset_t ks; int pages; pages = td->td_kstack_pages; - ksobj = td->td_kstack_obj; ks = td->td_kstack; td->td_kstack = 0; td->td_kstack_pages = 0; if (pages == kstack_pages) uma_zfree(kstack_cache, (void *)ks); else - vm_thread_stack_dispose(ksobj, ks, pages); + vm_thread_stack_dispose(ks, pages); } +/* + * Allocate physical pages, following the specified NUMA policy, to back a + * kernel stack. + */ +void +vm_thread_stack_back(struct domainset *ds, vm_offset_t ks, vm_page_t ma[], + int npages, int req_class) +{ + vm_pindex_t pindex; + int n; + + pindex = atop(ks - VM_MIN_KERNEL_ADDRESS); + + VM_OBJECT_WLOCK(kstack_object); + for (n = 0; n < npages;) { + if (vm_ndomains > 1) + kstack_object->domain.dr_policy = ds; + + /* + * Use WAITFAIL to force a reset of the domain selection policy + * if we had to sleep for pages. + */ + n += vm_page_grab_pages(kstack_object, pindex + n, + req_class | VM_ALLOC_WIRED | VM_ALLOC_WAITFAIL, + &ma[n], npages - n); + } + VM_OBJECT_WUNLOCK(kstack_object); +} + static int kstack_import(void *arg, void **store, int cnt, int domain, int flags) { struct domainset *ds; - vm_object_t ksobj; int i; if (domain == UMA_ANYDOMAIN) @@ -444,8 +447,7 @@ kstack_import(void *arg, void **store, int cnt, int do ds = DOMAINSET_PREF(domain); for (i = 0; i < cnt; i++) { - store[i] = (void *)vm_thread_stack_create(ds, &ksobj, - kstack_pages); + store[i] = (void *)vm_thread_stack_create(ds, kstack_pages); if (store[i] == NULL) break; } @@ -460,15 +462,15 @@ kstack_release(void *arg, void **store, int cnt) for (i = 0; i < cnt; i++) { ks = (vm_offset_t)store[i]; - vm_thread_stack_dispose( - PHYS_TO_VM_PAGE(pmap_kextract(ks))->object, - ks, kstack_pages); + vm_thread_stack_dispose(ks, kstack_pages); } } static void kstack_cache_init(void *null) { + kstack_object = vm_object_allocate(OBJT_SWAP, + atop(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)); kstack_cache = uma_zcache_create("kstack_cache", kstack_pages * PAGE_SIZE, NULL, NULL, NULL, NULL, kstack_import, kstack_release, NULL, @@ -476,8 +478,7 @@ kstack_cache_init(void *null) kstack_cache_size = imax(128, mp_ncpus * 4); uma_zone_set_maxcache(kstack_cache, kstack_cache_size); } - -SYSINIT(vm_kstacks, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, kstack_cache_init, NULL); +SYSINIT(vm_kstacks, SI_SUB_KMEM, SI_ORDER_ANY, kstack_cache_init, NULL); #ifdef KSTACK_USAGE_PROF /* Modified: head/sys/vm/vm_kern.h ============================================================================== --- head/sys/vm/vm_kern.h Sun Apr 26 20:06:08 2020 (r360353) +++ head/sys/vm/vm_kern.h Sun Apr 26 20:08:57 2020 (r360354) @@ -77,5 +77,6 @@ extern struct vmem *memguard_arena; extern u_long vm_kmem_size; extern u_int exec_map_entries; extern u_int exec_map_entry_size; +extern vm_object_t kstack_object; #endif /* _VM_VM_KERN_H_ */ Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Sun Apr 26 20:06:08 2020 (r360353) +++ head/sys/vm/vm_swapout.c Sun Apr 26 20:08:57 2020 (r360354) @@ -104,6 +104,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -526,24 +527,26 @@ again: static void vm_thread_swapout(struct thread *td) { - vm_object_t ksobj; vm_page_t m; + vm_offset_t kaddr; + vm_pindex_t pindex; int i, pages; cpu_thread_swapout(td); + kaddr = td->td_kstack; pages = td->td_kstack_pages; - ksobj = td->td_kstack_obj; - pmap_qremove(td->td_kstack, pages); - VM_OBJECT_WLOCK(ksobj); + pindex = atop(kaddr - VM_MIN_KERNEL_ADDRESS); + pmap_qremove(kaddr, pages); + VM_OBJECT_WLOCK(kstack_object); for (i = 0; i < pages; i++) { - m = vm_page_lookup(ksobj, i); + m = vm_page_lookup(kstack_object, pindex + i); if (m == NULL) panic("vm_thread_swapout: kstack already missing?"); vm_page_dirty(m); vm_page_xunbusy_unchecked(m); vm_page_unwire(m, PQ_LAUNDRY); } - VM_OBJECT_WUNLOCK(ksobj); + VM_OBJECT_WUNLOCK(kstack_object); } /* @@ -552,38 +555,36 @@ vm_thread_swapout(struct thread *td) static void vm_thread_swapin(struct thread *td, int oom_alloc) { - vm_object_t ksobj; vm_page_t ma[KSTACK_MAX_PAGES]; + vm_offset_t kaddr; int a, count, i, j, pages, rv; + kaddr = td->td_kstack; pages = td->td_kstack_pages; - ksobj = td->td_kstack_obj; - VM_OBJECT_WLOCK(ksobj); - (void)vm_page_grab_pages(ksobj, 0, oom_alloc | VM_ALLOC_WIRED, ma, - pages); - VM_OBJECT_WUNLOCK(ksobj); + vm_thread_stack_back(td->td_domain.dr_policy, kaddr, ma, pages, + oom_alloc); for (i = 0; i < pages;) { vm_page_assert_xbusied(ma[i]); if (vm_page_all_valid(ma[i])) { i++; continue; } - vm_object_pip_add(ksobj, 1); + vm_object_pip_add(kstack_object, 1); for (j = i + 1; j < pages; j++) if (vm_page_all_valid(ma[j])) break; - VM_OBJECT_WLOCK(ksobj); - rv = vm_pager_has_page(ksobj, ma[i]->pindex, NULL, &a); - VM_OBJECT_WUNLOCK(ksobj); + VM_OBJECT_WLOCK(kstack_object); + rv = vm_pager_has_page(kstack_object, ma[i]->pindex, NULL, &a); + VM_OBJECT_WUNLOCK(kstack_object); KASSERT(rv == 1, ("%s: missing page %p", __func__, ma[i])); count = min(a + 1, j - i); - rv = vm_pager_get_pages(ksobj, ma + i, count, NULL, NULL); + rv = vm_pager_get_pages(kstack_object, ma + i, count, NULL, NULL); KASSERT(rv == VM_PAGER_OK, ("%s: cannot get kstack for proc %d", __func__, td->td_proc->p_pid)); - vm_object_pip_wakeup(ksobj); + vm_object_pip_wakeup(kstack_object); i += count; } - pmap_qenter(td->td_kstack, ma, pages); + pmap_qenter(kaddr, ma, pages); cpu_thread_swapin(td); } From owner-svn-src-head@freebsd.org Sun Apr 26 20:16:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 383282BBE5F; Sun, 26 Apr 2020 20:16:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499K1H0mJ9z3xCc; Sun, 26 Apr 2020 20:16:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 155F7268A9; Sun, 26 Apr 2020 20:16:19 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03QKGI4S044584; Sun, 26 Apr 2020 20:16:18 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QKGI0i044583; Sun, 26 Apr 2020 20:16:18 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202004262016.03QKGI0i044583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sun, 26 Apr 2020 20:16:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360355 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 360355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 20:16:19 -0000 Author: wulf Date: Sun Apr 26 20:16:18 2020 New Revision: 360355 URL: https://svnweb.freebsd.org/changeset/base/360355 Log: ig4(4): Add PCI IDs for Intel Bay Trail I2C controllers. PR: 245654 Reported by: MFC after: 1 week Modified: head/sys/dev/ichiic/ig4_pci.c Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Sun Apr 26 20:08:57 2020 (r360354) +++ head/sys/dev/ichiic/ig4_pci.c Sun Apr 26 20:16:18 2020 (r360355) @@ -66,6 +66,13 @@ __FBSDID("$FreeBSD$"); static int ig4iic_pci_detach(device_t dev); +#define PCI_CHIP_BAYTRAIL_I2C_1 0x0f418086 +#define PCI_CHIP_BAYTRAIL_I2C_2 0x0f428086 +#define PCI_CHIP_BAYTRAIL_I2C_3 0x0f438086 +#define PCI_CHIP_BAYTRAIL_I2C_4 0x0f448086 +#define PCI_CHIP_BAYTRAIL_I2C_5 0x0f458086 +#define PCI_CHIP_BAYTRAIL_I2C_6 0x0f468086 +#define PCI_CHIP_BAYTRAIL_I2C_7 0x0f478086 #define PCI_CHIP_LYNXPT_LP_I2C_1 0x9c618086 #define PCI_CHIP_LYNXPT_LP_I2C_2 0x9c628086 #define PCI_CHIP_BRASWELL_I2C_1 0x22c18086 @@ -108,6 +115,13 @@ struct ig4iic_pci_device { }; static struct ig4iic_pci_device ig4iic_pci_devices[] = { + { PCI_CHIP_BAYTRAIL_I2C_1, "Intel BayTrail Serial I/O I2C Port 1", IG4_ATOM}, + { PCI_CHIP_BAYTRAIL_I2C_2, "Intel BayTrail Serial I/O I2C Port 2", IG4_ATOM}, + { PCI_CHIP_BAYTRAIL_I2C_3, "Intel BayTrail Serial I/O I2C Port 3", IG4_ATOM}, + { PCI_CHIP_BAYTRAIL_I2C_4, "Intel BayTrail Serial I/O I2C Port 4", IG4_ATOM}, + { PCI_CHIP_BAYTRAIL_I2C_5, "Intel BayTrail Serial I/O I2C Port 5", IG4_ATOM}, + { PCI_CHIP_BAYTRAIL_I2C_6, "Intel BayTrail Serial I/O I2C Port 6", IG4_ATOM}, + { PCI_CHIP_BAYTRAIL_I2C_7, "Intel BayTrail Serial I/O I2C Port 7", IG4_ATOM}, { PCI_CHIP_LYNXPT_LP_I2C_1, "Intel Lynx Point-LP I2C Controller-1", IG4_HASWELL}, { PCI_CHIP_LYNXPT_LP_I2C_2, "Intel Lynx Point-LP I2C Controller-2", IG4_HASWELL}, { PCI_CHIP_BRASWELL_I2C_1, "Intel Braswell Serial I/O I2C Port 1", IG4_ATOM}, From owner-svn-src-head@freebsd.org Sun Apr 26 20:55: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 830512BC701; Sun, 26 Apr 2020 20:55:12 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499Kt82t9tz3yY7; Sun, 26 Apr 2020 20:55:12 +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 5DD5B27034; Sun, 26 Apr 2020 20:55:12 +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 03QKtC7K068993; Sun, 26 Apr 2020 20:55:12 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QKtC0i068992; Sun, 26 Apr 2020 20:55:12 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202004262055.03QKtC0i068992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Sun, 26 Apr 2020 20:55:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360356 - head/usr.bin/sockstat X-SVN-Group: head X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: head/usr.bin/sockstat X-SVN-Commit-Revision: 360356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 20:55:12 -0000 Author: freqlabs Date: Sun Apr 26 20:55:11 2020 New Revision: 360356 URL: https://svnweb.freebsd.org/changeset/base/360356 Log: sockstat: Attach to jail if in new vnet Attach sockstat -j to the specified jail if the jail is in a new vnet. Otherwise we do not see all sockets belonging to the jail. Reviewed by: jamie Approved by: mmacy (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D24413 Modified: head/usr.bin/sockstat/sockstat.c Modified: head/usr.bin/sockstat/sockstat.c ============================================================================== --- head/usr.bin/sockstat/sockstat.c Sun Apr 26 20:16:18 2020 (r360355) +++ head/usr.bin/sockstat/sockstat.c Sun Apr 26 20:55:11 2020 (r360356) @@ -32,10 +32,11 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include -#include +#include #include #include @@ -1218,7 +1219,8 @@ display(void) } } -static int set_default_protos(void) +static int +set_default_protos(void) { struct protoent *prot; const char *pname; @@ -1237,6 +1239,38 @@ static int set_default_protos(void) return (pindex); } +/* + * Return the vnet property of the jail, or -1 on error. + */ +static int +jail_getvnet(int jid) +{ + struct iovec jiov[6]; + int vnet; + + vnet = -1; + jiov[0].iov_base = __DECONST(char *, "jid"); + jiov[0].iov_len = sizeof("jid"); + jiov[1].iov_base = &jid; + jiov[1].iov_len = sizeof(jid); + jiov[2].iov_base = __DECONST(char *, "vnet"); + jiov[2].iov_len = sizeof("vnet"); + jiov[3].iov_base = &vnet; + jiov[3].iov_len = sizeof(vnet); + jiov[4].iov_base = __DECONST(char *, "errmsg"); + jiov[4].iov_len = sizeof("errmsg"); + jiov[5].iov_base = jail_errmsg; + jiov[5].iov_len = JAIL_ERRMSGLEN; + jail_errmsg[0] = '\0'; + if (jail_get(jiov, nitems(jiov), 0) < 0) { + if (!jail_errmsg[0]) + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "jail_get: %s", strerror(errno)); + return (-1); + } + return (vnet); +} + static void usage(void) { @@ -1310,6 +1344,21 @@ main(int argc, char *argv[]) if (argc > 0) usage(); + + if (opt_j > 0) { + switch (jail_getvnet(opt_j)) { + case -1: + errx(2, "%s", jail_errmsg); + case JAIL_SYS_NEW: + if (jail_attach(opt_j) < 0) + errx(3, "%s", jail_errmsg); + /* Set back to -1 for normal output in vnet jail. */ + opt_j = -1; + break; + default: + break; + } + } if ((!opt_4 && !opt_6) && protos_defined != -1) opt_4 = opt_6 = 1; From owner-svn-src-head@freebsd.org Sun Apr 26 22:04: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 7AC4C2BEB79; Sun, 26 Apr 2020 22:04:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499MQN2kVNz43JY; Sun, 26 Apr 2020 22:04:44 +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 58CEB27EC0; Sun, 26 Apr 2020 22:04:44 +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 03QM4i1p012514; Sun, 26 Apr 2020 22:04:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QM4iO9012513; Sun, 26 Apr 2020 22:04:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004262204.03QM4iO9012513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 26 Apr 2020 22:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360357 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 22:04:44 -0000 Author: markj Date: Sun Apr 26 22:04:43 2020 New Revision: 360357 URL: https://svnweb.freebsd.org/changeset/base/360357 Log: Fix up i386 thread structure layout assertions after r360354. Reported by: Jenkins Modified: head/sys/kern/kern_thread.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Sun Apr 26 20:55:11 2020 (r360356) +++ head/sys/kern/kern_thread.c Sun Apr 26 22:04:43 2020 (r360357) @@ -104,7 +104,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0 "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x2fc, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x344, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x340, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0x68, "struct proc KBI p_flag"); From owner-svn-src-head@freebsd.org Sun Apr 26 22:08: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 8A74B2BECF8; Sun, 26 Apr 2020 22:08:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499MW435rkz43Wr; Sun, 26 Apr 2020 22:08:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60F6827ED2; Sun, 26 Apr 2020 22:08:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03QM8mQh012798; Sun, 26 Apr 2020 22:08:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03QM8mtY012797; Sun, 26 Apr 2020 22:08:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202004262208.03QM8mtY012797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 26 Apr 2020 22:08:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360358 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 360358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 22:08:48 -0000 Author: emaste Date: Sun Apr 26 22:08:47 2020 New Revision: 360358 URL: https://svnweb.freebsd.org/changeset/base/360358 Log: snd_hda: use bool for hdac_reset's boolean wakeup param Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Apr 26 22:04:43 2020 (r360357) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Apr 26 22:08:47 2020 (r360358) @@ -204,7 +204,7 @@ static const struct { * Function prototypes ****************************************************************************/ static void hdac_intr_handler(void *); -static int hdac_reset(struct hdac_softc *, int); +static int hdac_reset(struct hdac_softc *, bool); static int hdac_get_capabilities(struct hdac_softc *); static void hdac_dma_cb(void *, bus_dma_segment_t *, int, int); static int hdac_dma_alloc(struct hdac_softc *, @@ -364,12 +364,12 @@ hdac_poll_callback(void *arg) } /**************************************************************************** - * int hdac_reset(hdac_softc *, int) + * int hdac_reset(hdac_softc *, bool) * * Reset the hdac to a quiescent and known state. ****************************************************************************/ static int -hdac_reset(struct hdac_softc *sc, int wakeup) +hdac_reset(struct hdac_softc *sc, bool wakeup) { uint32_t gctl; int count, i; @@ -1286,7 +1286,7 @@ hdac_attach(device_t dev) HDA_BOOTHVERBOSE( device_printf(dev, "Reset controller...\n"); ); - hdac_reset(sc, 1); + hdac_reset(sc, true); /* Initialize the CORB and RIRB */ hdac_corb_init(sc); @@ -1573,7 +1573,7 @@ hdac_suspend(device_t dev) device_printf(dev, "Reset controller...\n"); ); callout_stop(&sc->poll_callout); - hdac_reset(sc, 0); + hdac_reset(sc, false); hdac_unlock(sc); callout_drain(&sc->poll_callout); taskqueue_drain(taskqueue_thread, &sc->unsolq_task); @@ -1603,7 +1603,7 @@ hdac_resume(device_t dev) HDA_BOOTHVERBOSE( device_printf(dev, "Reset controller...\n"); ); - hdac_reset(sc, 1); + hdac_reset(sc, true); /* Initialize the CORB and RIRB */ hdac_corb_init(sc); @@ -1659,7 +1659,7 @@ hdac_detach(device_t dev) free(devlist, M_TEMP); hdac_lock(sc); - hdac_reset(sc, 0); + hdac_reset(sc, false); hdac_unlock(sc); taskqueue_drain(taskqueue_thread, &sc->unsolq_task); hdac_irq_free(sc); From owner-svn-src-head@freebsd.org Mon Apr 27 02:01: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 870262C429B; Mon, 27 Apr 2020 02:01:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499Sgx34zKz4FVd; Mon, 27 Apr 2020 02:01:49 +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 651FD2B8B; Mon, 27 Apr 2020 02:01:49 +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 03R21nss058860; Mon, 27 Apr 2020 02:01:49 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03R21mdA058857; Mon, 27 Apr 2020 02:01:48 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004270201.03R21mdA058857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 27 Apr 2020 02:01:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360359 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 360359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 02:01:49 -0000 Author: delphij Date: Mon Apr 27 02:01:48 2020 New Revision: 360359 URL: https://svnweb.freebsd.org/changeset/base/360359 Log: Fix a bug with dirty file system handling. r356313 broke handling of dirty file system because we have restricted the correction of "odd" byte sequences to checkfat(), and as a result the dirty bit is never cleared. The old fsck_msdosfs code would write FAT twice to fix the dirty bit, which is also not ideal. Fix this by introducing a new rountine, cleardirty() which will perform the set of clean bit only, and use it in checkfilesys() if we thought the file system was dirty. Reviewed by: cem, emaste MFC after: 3 day Differential Revision: https://reviews.freebsd.org/D24581 Modified: head/sbin/fsck_msdosfs/check.c head/sbin/fsck_msdosfs/ext.h head/sbin/fsck_msdosfs/fat.c Modified: head/sbin/fsck_msdosfs/check.c ============================================================================== --- head/sbin/fsck_msdosfs/check.c Sun Apr 26 22:08:47 2020 (r360358) +++ head/sbin/fsck_msdosfs/check.c Mon Apr 27 02:01:48 2020 (r360359) @@ -169,7 +169,7 @@ checkfilesys(const char *fname) if (mod & FSDIRTY) { pwarn("MARKING FILE SYSTEM CLEAN\n"); - mod |= writefat(fat); + mod |= cleardirty(fat); } else { pwarn("\n***** FILE SYSTEM IS LEFT MARKED AS DIRTY *****\n"); mod |= FSERROR; /* file system not clean */ Modified: head/sbin/fsck_msdosfs/ext.h ============================================================================== --- head/sbin/fsck_msdosfs/ext.h Sun Apr 26 22:08:47 2020 (r360358) +++ head/sbin/fsck_msdosfs/ext.h Mon Apr 27 02:01:48 2020 (r360359) @@ -90,6 +90,8 @@ int writefsinfo(int, struct bootblock *); /* Opaque type */ struct fat_descriptor; +int cleardirty(struct fat_descriptor *); + void fat_clear_cl_head(struct fat_descriptor *, cl_t); bool fat_is_cl_head(struct fat_descriptor *, cl_t); Modified: head/sbin/fsck_msdosfs/fat.c ============================================================================== --- head/sbin/fsck_msdosfs/fat.c Sun Apr 26 22:08:47 2020 (r360358) +++ head/sbin/fsck_msdosfs/fat.c Mon Apr 27 02:01:48 2020 (r360359) @@ -578,7 +578,6 @@ valid_cl(struct fat_descriptor *fat, cl_t cl) * h = hard error flag (1 = ok; 0 = I/O error) * x = any value ok */ - int checkdirty(int fs, struct bootblock *boot) { @@ -636,6 +635,53 @@ checkdirty(int fs, struct bootblock *boot) if ((buffer[7] & 0x0c) == 0x0c) ret = 1; } + +err: + free(buffer); + return ret; +} + +int +cleardirty(struct fat_descriptor *fat) +{ + int fd, ret = FSERROR; + struct bootblock *boot; + u_char *buffer; + size_t len; + off_t off; + + boot = boot_of_(fat); + fd = fd_of_(fat); + + if (boot->ClustMask != CLUST16_MASK && boot->ClustMask != CLUST32_MASK) + return 0; + + off = boot->bpbResSectors; + off *= boot->bpbBytesPerSec; + + buffer = malloc(len = boot->bpbBytesPerSec); + if (buffer == NULL) { + perr("No memory for FAT sectors (%zu)", len); + return 1; + } + + if ((size_t)pread(fd, buffer, len, off) != len) { + perr("Unable to read FAT"); + goto err; + } + + if (boot->ClustMask == CLUST16_MASK) { + buffer[3] |= 0x80; + } else { + buffer[7] |= 0x08; + } + + if ((size_t)pwrite(fd, buffer, len, off) != len) { + perr("Unable to write FAT"); + goto err; + } + + ret = FSOK; err: free(buffer); From owner-svn-src-head@freebsd.org Mon Apr 27 02:48: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 98A7F2C5365; Mon, 27 Apr 2020 02:48:50 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499TkB3DClz4HP9; Mon, 27 Apr 2020 02:48:50 +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 657273461; Mon, 27 Apr 2020 02:48:50 +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 03R2moBg085097; Mon, 27 Apr 2020 02:48:50 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03R2mo4S085096; Mon, 27 Apr 2020 02:48:50 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202004270248.03R2mo4S085096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Mon, 27 Apr 2020 02:48:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360360 - head/usr.sbin/bluetooth/hccontrol X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: head/usr.sbin/bluetooth/hccontrol X-SVN-Commit-Revision: 360360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 02:48:50 -0000 Author: takawata Date: Mon Apr 27 02:48:49 2020 New Revision: 360360 URL: https://svnweb.freebsd.org/changeset/base/360360 Log: Fix advertise packet parsing. Differential Revision: https://reviews.freebsd.org/D21779 Modified: head/usr.sbin/bluetooth/hccontrol/node.c Modified: head/usr.sbin/bluetooth/hccontrol/node.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/node.c Mon Apr 27 02:01:48 2020 (r360359) +++ head/usr.sbin/bluetooth/hccontrol/node.c Mon Apr 27 02:48:49 2020 (r360360) @@ -40,6 +40,7 @@ #include #include #include +#include #include "hccontrol.h" /* Send Read_Node_State command to the node */ @@ -222,23 +223,53 @@ static int hci_dump_adv(uint8_t *data, int length) elemlen = *data; data++; length --; - elemlen--; if(length<=0) break; type = *data; data++; length --; elemlen--; - if(length<=0) + if(length <= 0) break; switch(type){ case 0x1: printf("NDflag:%x\n", *data); break; + case 0x8: case 0x9: printf("LocalName:"); for(i = 0; i < MIN(length,elemlen); i++){ putchar(data[i]); + } + printf("\n"); + break; + case 0x6: + case 0x7: + { + uuid_t uuid; + char *uuidstr; + uint32_t ustatus; + if (elemlen < 16) + break; + uuid.time_low = le32dec(data+12); + uuid.time_mid = le16dec(data+10); + uuid.time_hi_and_version = le16dec(data+8); + uuid.clock_seq_hi_and_reserved = data[7]; + uuid.clock_seq_low = data[6]; + for(i = 0; i < _UUID_NODE_LEN; i++){ + uuid.node[i] = data[5 - i]; + } + uuid_to_string(&uuid, &uuidstr, &ustatus); + + printf("ServiceUUID: %s\n", uuidstr); + break; + } + case 0xff: + if (elemlen < 2) + break; + printf("Vendor:%04x:", data[0]|data[1]<<8); + for (i = 2; i < MIN(length,elemlen); i++) { + printf("%02x ",data[i]); } printf("\n"); break; From owner-svn-src-head@freebsd.org Mon Apr 27 09:13: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 8C4032B02A5; Mon, 27 Apr 2020 09:13:22 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499fFt3DVNz3Crh; Mon, 27 Apr 2020 09:13:22 +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 69BD680A0; Mon, 27 Apr 2020 09:13:22 +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 03R9DMvZ027730; Mon, 27 Apr 2020 09:13:22 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03R9DMnA027729; Mon, 27 Apr 2020 09:13:22 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202004270913.03R9DMnA027729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Mon, 27 Apr 2020 09:13:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360369 - head/usr.sbin/bluetooth/hccontrol X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: head/usr.sbin/bluetooth/hccontrol X-SVN-Commit-Revision: 360369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 09:13:22 -0000 Author: takawata Date: Mon Apr 27 09:13:22 2020 New Revision: 360369 URL: https://svnweb.freebsd.org/changeset/base/360369 Log: Resolve vendor id to string. Modified: head/usr.sbin/bluetooth/hccontrol/node.c Modified: head/usr.sbin/bluetooth/hccontrol/node.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/node.c Mon Apr 27 05:35:26 2020 (r360368) +++ head/usr.sbin/bluetooth/hccontrol/node.c Mon Apr 27 09:13:22 2020 (r360369) @@ -267,7 +267,8 @@ static int hci_dump_adv(uint8_t *data, int length) case 0xff: if (elemlen < 2) break; - printf("Vendor:%04x:", data[0]|data[1]<<8); + printf("Vendor:%s:", + hci_manufacturer2str(data[0]|data[1]<<8)); for (i = 2; i < MIN(length,elemlen); i++) { printf("%02x ",data[i]); } From owner-svn-src-head@freebsd.org Mon Apr 27 10:00: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 939E02B1B7E; Mon, 27 Apr 2020 10:00:46 +0000 (UTC) (envelope-from afedorov@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499gJZ3S5pz3HB2; Mon, 27 Apr 2020 10:00:46 +0000 (UTC) (envelope-from afedorov@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71D6D884C; Mon, 27 Apr 2020 10:00:46 +0000 (UTC) (envelope-from afedorov@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RA0kTY052943; Mon, 27 Apr 2020 10:00:46 GMT (envelope-from afedorov@FreeBSD.org) Received: (from afedorov@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RA0kXK052942; Mon, 27 Apr 2020 10:00:46 GMT (envelope-from afedorov@FreeBSD.org) Message-Id: <202004271000.03RA0kXK052942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: afedorov set sender to afedorov@FreeBSD.org using -f From: Aleksandr Fedorov Date: Mon, 27 Apr 2020 10:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360372 - head/sys/netgraph X-SVN-Group: head X-SVN-Commit-Author: afedorov X-SVN-Commit-Paths: head/sys/netgraph X-SVN-Commit-Revision: 360372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 10:00:46 -0000 Author: afedorov Date: Mon Apr 27 10:00:46 2020 New Revision: 360372 URL: https://svnweb.freebsd.org/changeset/base/360372 Log: ng_eiface: fix kernel panic due to the racecondition in ng_eiface shutdown. PR: 244247 Reported by: Vladislav V. Prodan Reviewed by: vmaffione, lutz_donnerhacke.de Approved by: vmaffione (mentor) Sponsored by: vstack.com Differential Revision: https://reviews.freebsd.org/D24557 Modified: head/sys/netgraph/ng_eiface.c Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Mon Apr 27 09:45:19 2020 (r360371) +++ head/sys/netgraph/ng_eiface.c Mon Apr 27 10:00:46 2020 (r360372) @@ -623,8 +623,8 @@ ng_eiface_rmnode(node_p node) * hence we have to change the current vnet context here. */ CURVNET_SET_QUIET(ifp->if_vnet); - ifmedia_removeall(&priv->media); ether_ifdetach(ifp); + ifmedia_removeall(&priv->media); if_free(ifp); CURVNET_RESTORE(); free_unr(V_ng_eiface_unit, priv->unit); From owner-svn-src-head@freebsd.org Mon Apr 27 13:26: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 BC2412B841C; Mon, 27 Apr 2020 13:26:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499ltC4fLkz42Bb; Mon, 27 Apr 2020 13:26:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98A0BB0A0; Mon, 27 Apr 2020 13:26:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RDQhJU083385; Mon, 27 Apr 2020 13:26:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RDQhw8083384; Mon, 27 Apr 2020 13:26:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004271326.03RDQhw8083384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Apr 2020 13:26:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360373 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 360373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 13:26:43 -0000 Author: markj Date: Mon Apr 27 13:26:43 2020 New Revision: 360373 URL: https://svnweb.freebsd.org/changeset/base/360373 Log: iwm: Print the command code for any unhandled commands. Reported by: Marc Veldman MFC after: 1 week Modified: head/sys/dev/iwm/if_iwm.c Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Mon Apr 27 10:00:46 2020 (r360372) +++ head/sys/dev/iwm/if_iwm.c Mon Apr 27 13:26:43 2020 (r360373) @@ -5623,9 +5623,8 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) default: device_printf(sc->sc_dev, - "frame %d/%d %x UNHANDLED (this should " - "not happen)\n", qid & ~0x80, idx, - pkt->len_n_flags); + "code %x, frame %d/%d %x unhandled\n", + code, qid & ~0x80, idx, pkt->len_n_flags); break; } From owner-svn-src-head@freebsd.org Mon Apr 27 13: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 2E8B92B96B4; Mon, 27 Apr 2020 13:54:01 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499mTj0TtSz44Jp; Mon, 27 Apr 2020 13:54:01 +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 0BC5AB65B; Mon, 27 Apr 2020 13:54:01 +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 03RDs0aU002275; Mon, 27 Apr 2020 13:54:00 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RDs0bP002272; Mon, 27 Apr 2020 13:54:00 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202004271354.03RDs0bP002272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 27 Apr 2020 13:54:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360374 - 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: 360374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 13:54:01 -0000 Author: mjg Date: Mon Apr 27 13:54:00 2020 New Revision: 360374 URL: https://svnweb.freebsd.org/changeset/base/360374 Log: pwd: unbreak repeated calls to set_rootvnode Prior to the change the once set pointer would never be updated. Unbreaks reboot -r. Reported by: Ross Gohlke Modified: head/sys/kern/kern_descrip.c head/sys/kern/vfs_mountroot.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Apr 27 13:26:43 2020 (r360373) +++ head/sys/kern/kern_descrip.c Mon Apr 27 13:54:00 2020 (r360374) @@ -3475,6 +3475,27 @@ pwd_ensure_dirs(void) pwd_drop(oldpwd); } +void +pwd_set_rootvnode(void) +{ + struct filedesc *fdp; + struct pwd *oldpwd, *newpwd; + + fdp = curproc->p_fd; + + newpwd = pwd_alloc(); + FILEDESC_XLOCK(fdp); + oldpwd = FILEDESC_XLOCKED_LOAD_PWD(fdp); + vrefact(rootvnode); + newpwd->pwd_cdir = rootvnode; + vrefact(rootvnode); + newpwd->pwd_rdir = rootvnode; + pwd_fill(oldpwd, newpwd); + pwd_set(fdp, newpwd); + FILEDESC_XUNLOCK(fdp); + pwd_drop(oldpwd); +} + /* * Scan all active processes and prisons to see if any of them have a current * or root directory of `olddp'. If so, replace them with the new mount point. Modified: head/sys/kern/vfs_mountroot.c ============================================================================== --- head/sys/kern/vfs_mountroot.c Mon Apr 27 13:26:43 2020 (r360373) +++ head/sys/kern/vfs_mountroot.c Mon Apr 27 13:54:00 2020 (r360374) @@ -243,7 +243,7 @@ set_rootvnode(void) VOP_UNLOCK(rootvnode); - pwd_ensure_dirs(); + pwd_set_rootvnode(); } static int Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Mon Apr 27 13:26:43 2020 (r360373) +++ head/sys/sys/filedesc.h Mon Apr 27 13:54:00 2020 (r360374) @@ -298,6 +298,7 @@ fd_modified(struct filedesc *fdp, int fd, seqc_t seqc) void pwd_chdir(struct thread *td, struct vnode *vp); int pwd_chroot(struct thread *td, struct vnode *vp); void pwd_ensure_dirs(void); +void pwd_set_rootvnode(void); struct pwd *pwd_hold_filedesc(struct filedesc *fdp); struct pwd *pwd_hold(struct thread *td); From owner-svn-src-head@freebsd.org Mon Apr 27 14:35: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 3E32B2BA6B8; Mon, 27 Apr 2020 14:35: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499nPn0sh9z4731; Mon, 27 Apr 2020 14:35: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 1894EBFEF; Mon, 27 Apr 2020 14:35:41 +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 03REZeup027216; Mon, 27 Apr 2020 14:35:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03REZegW027212; Mon, 27 Apr 2020 14:35:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202004271435.03REZegW027212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 27 Apr 2020 14:35:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360377 - in head/sys/dev/mlx5: . mlx5_en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_en X-SVN-Commit-Revision: 360377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 14:35:41 -0000 Author: hselasky Date: Mon Apr 27 14:35:39 2020 New Revision: 360377 URL: https://svnweb.freebsd.org/changeset/base/360377 Log: Add support for reading temperature in mlx5en(4). MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_ifc.h Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Mon Apr 27 14:03:24 2020 (r360376) +++ head/sys/dev/mlx5/mlx5_en/en.h Mon Apr 27 14:35:39 2020 (r360377) @@ -728,6 +728,8 @@ struct mlx5e_params_ethtool { u16 fec_avail_50x[MLX5E_MAX_FEC_50X]; u32 fec_mode_active; u32 hw_mtu_msb; + s32 hw_val_temp[MLX5_MAX_TEMPERATURE]; + u32 hw_num_temp; }; struct mlx5e_cq { @@ -1199,6 +1201,7 @@ void mlx5e_update_sq_inline(struct mlx5e_sq *sq); void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); int mlx5e_update_buf_lossy(struct mlx5e_priv *priv); int mlx5e_fec_update(struct mlx5e_priv *priv); +int mlx5e_hw_temperature_update(struct mlx5e_priv *priv); if_snd_tag_alloc_t mlx5e_ul_snd_tag_alloc; if_snd_tag_modify_t mlx5e_ul_snd_tag_modify; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Apr 27 14:03:24 2020 (r360376) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Mon Apr 27 14:35:39 2020 (r360377) @@ -821,6 +821,65 @@ mlx5e_cable_length_handler(SYSCTL_HANDLER_ARGS) return (error); } +static int +mlx5e_hw_temperature_handler(SYSCTL_HANDLER_ARGS) +{ + struct mlx5e_priv *priv = arg1; + int err; + + PRIV_LOCK(priv); + err = SYSCTL_OUT(req, priv->params_ethtool.hw_val_temp, + sizeof(priv->params_ethtool.hw_val_temp[0]) * + priv->params_ethtool.hw_num_temp); + if (err == 0 && req->newptr != NULL) + err = EOPNOTSUPP; + PRIV_UNLOCK(priv); + return (err); +} + +int +mlx5e_hw_temperature_update(struct mlx5e_priv *priv) +{ + int err; + u32 x; + + if (priv->params_ethtool.hw_num_temp == 0) { + u32 out_cap[MLX5_ST_SZ_DW(mtcap)] = {}; + const int sz_cap = MLX5_ST_SZ_BYTES(mtcap); + u32 value; + + err = -mlx5_core_access_reg(priv->mdev, NULL, 0, out_cap, sz_cap, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTCAP, 0, 0); + if (err) + goto done; + value = MLX5_GET(mtcap, out_cap, sensor_count); + if (value == 0) + return (0); + if (value > MLX5_MAX_TEMPERATURE) + value = MLX5_MAX_TEMPERATURE; + /* update number of temperature sensors */ + priv->params_ethtool.hw_num_temp = value; + } + + for (x = 0; x != priv->params_ethtool.hw_num_temp; x++) { + u32 out_sensor[MLX5_ST_SZ_DW(mtmp_reg)] = {}; + const int sz_sensor = MLX5_ST_SZ_BYTES(mtmp_reg); + + MLX5_SET(mtmp_reg, out_sensor, sensor_index, x); + + err = -mlx5_core_access_reg(priv->mdev, out_sensor, sz_sensor, + out_sensor, sz_sensor, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTMP, 0, 0); + if (err) + goto done; + /* convert from 0.125 celcius to millicelcius */ + priv->params_ethtool.hw_val_temp[x] = + (s16)MLX5_GET(mtmp_reg, out_sensor, temperature) * 125; + } +done: + return (err); +} + #define MLX5_PARAM_OFFSET(n) \ __offsetof(struct mlx5e_priv, params_ethtool.n) @@ -1562,5 +1621,13 @@ mlx5e_create_ethtool(struct mlx5e_priv *priv) CTLTYPE_UINT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, priv, 0, mlx5e_cable_length_handler, "IU", "Set cable length in meters for xoff threshold calculation"); + } + + if (mlx5e_hw_temperature_update(priv) == 0) { + SYSCTL_ADD_PROC(&priv->sysctl_ctx, SYSCTL_CHILDREN(priv->sysctl_ifnet), + OID_AUTO, "hw_temperature", + CTLTYPE_S32 | CTLFLAG_RD | CTLFLAG_MPSAFE, + priv, 0, mlx5e_hw_temperature_handler, "I", + "HW temperature in millicelcius"); } } Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 27 14:03:24 2020 (r360376) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Mon Apr 27 14:35:39 2020 (r360377) @@ -1042,6 +1042,15 @@ free_out: mlx5_en_err(priv->ifp, "Updating FEC failed: %d\n", error); } + + /* Update temperature, if any */ + if (priv->params_ethtool.hw_num_temp != 0) { + error = mlx5e_hw_temperature_update(priv); + if (error != 0 && error != EOPNOTSUPP) { + mlx5_en_err(priv->ifp, + "Updating temperature failed: %d\n", error); + } + } } static void Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Mon Apr 27 14:03:24 2020 (r360376) +++ head/sys/dev/mlx5/mlx5_ifc.h Mon Apr 27 14:35:39 2020 (r360377) @@ -10607,4 +10607,163 @@ struct mlx5_ifc_mfrl_reg_bits { u8 reset_level[0x8]; }; +enum { + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTCAP = 0x9009, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTECR = 0x9109, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTMP = 0x900a, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTWE = 0x900b, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTBR = 0x900f, + MLX5_ACCESS_REG_SUMMARY_CTRL_ID_MTEWE = 0x910b, + MLX5_MAX_TEMPERATURE = 16, +}; + +struct mlx5_ifc_mtbr_temp_record_bits { + u8 max_temperature[0x10]; + u8 temperature[0x10]; +}; + +struct mlx5_ifc_mtbr_reg_bits { + u8 reserved_at_0[0x14]; + u8 base_sensor_index[0xc]; + + u8 reserved_at_20[0x18]; + u8 num_rec[0x8]; + + u8 reserved_at_40[0x40]; + + struct mlx5_ifc_mtbr_temp_record_bits temperature_record[MLX5_MAX_TEMPERATURE]; +}; + +struct mlx5_ifc_mtbr_reg_ext_bits { + u8 reserved_at_0[0x14]; + u8 base_sensor_index[0xc]; + + u8 reserved_at_20[0x18]; + u8 num_rec[0x8]; + + u8 reserved_at_40[0x40]; + + struct mlx5_ifc_mtbr_temp_record_bits temperature_record[MLX5_MAX_TEMPERATURE]; +}; + +struct mlx5_ifc_mtcap_bits { + u8 reserved_at_0[0x19]; + u8 sensor_count[0x7]; + + u8 reserved_at_20[0x19]; + u8 internal_sensor_count[0x7]; + + u8 sensor_map[0x40]; +}; + +struct mlx5_ifc_mtcap_ext_bits { + u8 reserved_at_0[0x19]; + u8 sensor_count[0x7]; + + u8 reserved_at_20[0x20]; + + u8 sensor_map[0x40]; +}; + +struct mlx5_ifc_mtecr_bits { + u8 reserved_at_0[0x4]; + u8 last_sensor[0xc]; + u8 reserved_at_10[0x4]; + u8 sensor_count[0xc]; + + u8 reserved_at_20[0x19]; + u8 internal_sensor_count[0x7]; + + u8 sensor_map_0[0x20]; + + u8 reserved_at_60[0x2a0]; +}; + +struct mlx5_ifc_mtecr_ext_bits { + u8 reserved_at_0[0x4]; + u8 last_sensor[0xc]; + u8 reserved_at_10[0x4]; + u8 sensor_count[0xc]; + + u8 reserved_at_20[0x20]; + + u8 sensor_map_0[0x20]; + + u8 reserved_at_60[0x2a0]; +}; + +struct mlx5_ifc_mtewe_bits { + u8 reserved_at_0[0x4]; + u8 last_sensor[0xc]; + u8 reserved_at_10[0x4]; + u8 sensor_count[0xc]; + + u8 sensor_warning_0[0x20]; + + u8 reserved_at_40[0x2a0]; +}; + +struct mlx5_ifc_mtewe_ext_bits { + u8 reserved_at_0[0x4]; + u8 last_sensor[0xc]; + u8 reserved_at_10[0x4]; + u8 sensor_count[0xc]; + + u8 sensor_warning_0[0x20]; + + u8 reserved_at_40[0x2a0]; +}; + +struct mlx5_ifc_mtmp_bits { + u8 reserved_at_0[0x14]; + u8 sensor_index[0xc]; + + u8 reserved_at_20[0x10]; + u8 temperature[0x10]; + + u8 mte[0x1]; + u8 mtr[0x1]; + u8 reserved_at_42[0xe]; + u8 max_temperature[0x10]; + + u8 tee[0x2]; + u8 reserved_at_62[0xe]; + u8 temperature_threshold_hi[0x10]; + + u8 reserved_at_80[0x10]; + u8 temperature_threshold_lo[0x10]; + + u8 reserved_at_a0[0x20]; + + u8 sensor_name_hi[0x20]; + + u8 sensor_name_lo[0x20]; +}; + +struct mlx5_ifc_mtmp_ext_bits { + u8 reserved_at_0[0x14]; + u8 sensor_index[0xc]; + + u8 reserved_at_20[0x10]; + u8 temperature[0x10]; + + u8 mte[0x1]; + u8 mtr[0x1]; + u8 reserved_at_42[0xe]; + u8 max_temperature[0x10]; + + u8 tee[0x2]; + u8 reserved_at_62[0xe]; + u8 temperature_threshold_hi[0x10]; + + u8 reserved_at_80[0x10]; + u8 temperature_threshold_lo[0x10]; + + u8 reserved_at_a0[0x20]; + + u8 sensor_name_hi[0x20]; + + u8 sensor_name_lo[0x20]; +}; + #endif /* MLX5_IFC_H */ From owner-svn-src-head@freebsd.org Mon Apr 27 15:58: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 619392BD6D2; Mon, 27 Apr 2020 15:58:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499qFr1yV1z4F2C; Mon, 27 Apr 2020 15:58:56 +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 3E776CF7B; Mon, 27 Apr 2020 15:58:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RFwuw5076622; Mon, 27 Apr 2020 15:58:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RFwuti076621; Mon, 27 Apr 2020 15:58:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004271558.03RFwuti076621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Apr 2020 15:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360378 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 15:58:56 -0000 Author: markj Date: Mon Apr 27 15:58:55 2020 New Revision: 360378 URL: https://svnweb.freebsd.org/changeset/base/360378 Log: Avoid returning POLLIN if the pipe descriptor is not open for reading. Submitted by: Jan Kokemüller MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24528 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Apr 27 14:35:39 2020 (r360377) +++ head/sys/kern/sys_pipe.c Mon Apr 27 15:58:55 2020 (r360378) @@ -1430,7 +1430,8 @@ pipe_poll(struct file *fp, int events, struct ucred *a if ((events & POLLINIGNEOF) == 0) { if (rpipe->pipe_state & PIPE_EOF) { - revents |= (events & (POLLIN | POLLRDNORM)); + if (fp->f_flag & FREAD) + revents |= (events & (POLLIN | POLLRDNORM)); if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) revents |= POLLHUP; From owner-svn-src-head@freebsd.org Mon Apr 27 15:59:08 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B4FE2BD721; Mon, 27 Apr 2020 15:59:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499qG41rqYz4F8K; Mon, 27 Apr 2020 15:59:08 +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 3AA94CF7C; Mon, 27 Apr 2020 15:59:08 +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 03RFx8OA076680; Mon, 27 Apr 2020 15:59:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RFx7i3076678; Mon, 27 Apr 2020 15:59:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004271559.03RFx7i3076678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Apr 2020 15:59:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360379 - in head/sys: fs/fifofs kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: fs/fifofs kern X-SVN-Commit-Revision: 360379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 15:59:08 -0000 Author: markj Date: Mon Apr 27 15:59:07 2020 New Revision: 360379 URL: https://svnweb.freebsd.org/changeset/base/360379 Log: Call pipeselwakeup() after toggling PIPE_EOF. This ensures that pipe_poll() and the pipe kqueue filters observe PIPE_EOF and set EV_EOF accordingly. As a result an extra call to knote() after setting PIPE_EOF is unnecessary. Submitted by: Jan Kokemüller MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24528 Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/sys_pipe.c Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Mon Apr 27 15:58:55 2020 (r360378) +++ head/sys/fs/fifofs/fifo_vnops.c Mon Apr 27 15:59:07 2020 (r360379) @@ -174,8 +174,10 @@ fifo_open(ap) fip->fi_rgen++; if (fip->fi_readers == 1) { fpipe->pipe_state &= ~PIPE_EOF; - if (fip->fi_writers > 0) + if (fip->fi_writers > 0) { wakeup(&fip->fi_writers); + pipeselwakeup(fpipe); + } } fp->f_pipegen = fpipe->pipe_wgen - fip->fi_writers; } @@ -190,8 +192,10 @@ fifo_open(ap) fip->fi_wgen++; if (fip->fi_writers == 1) { fpipe->pipe_state &= ~PIPE_EOF; - if (fip->fi_readers > 0) + if (fip->fi_readers > 0) { wakeup(&fip->fi_readers); + pipeselwakeup(fpipe); + } } } if ((ap->a_mode & O_NONBLOCK) == 0) { @@ -210,6 +214,7 @@ fifo_open(ap) fpipe->pipe_state |= PIPE_EOF; if (fpipe->pipe_state & PIPE_WANTW) wakeup(fpipe); + pipeselwakeup(fpipe); PIPE_UNLOCK(fpipe); fifo_cleanup(vp); } @@ -238,6 +243,7 @@ fifo_open(ap) if (fpipe->pipe_state & PIPE_WANTR) wakeup(fpipe); fpipe->pipe_wgen++; + pipeselwakeup(fpipe); PIPE_UNLOCK(fpipe); fifo_cleanup(vp); } Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Apr 27 15:58:55 2020 (r360378) +++ head/sys/kern/sys_pipe.c Mon Apr 27 15:59:07 2020 (r360379) @@ -1606,8 +1606,6 @@ pipeclose(struct pipe *cpipe) pipelock(cpipe, 0); pp = cpipe->pipe_pair; - pipeselwakeup(cpipe); - /* * If the other side is blocked, wake it up saying that * we want to close it down. @@ -1621,16 +1619,16 @@ pipeclose(struct pipe *cpipe) pipelock(cpipe, 0); } + pipeselwakeup(cpipe); + /* * Disconnect from peer, if any. */ ppipe = cpipe->pipe_peer; if (ppipe->pipe_present == PIPE_ACTIVE) { - pipeselwakeup(ppipe); - ppipe->pipe_state |= PIPE_EOF; wakeup(ppipe); - KNOTE_LOCKED(&ppipe->pipe_sel.si_note, 0); + pipeselwakeup(ppipe); } /* From owner-svn-src-head@freebsd.org Mon Apr 27 15:59: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 3CE0F2BD782; Mon, 27 Apr 2020 15:59:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499qGJ2P1wz4FGS; Mon, 27 Apr 2020 15:59:20 +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 4D7A9CF7D; Mon, 27 Apr 2020 15:59:20 +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 03RFxKvR076732; Mon, 27 Apr 2020 15:59:20 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RFxJ9N076730; Mon, 27 Apr 2020 15:59:19 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004271559.03RFxJ9N076730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Apr 2020 15:59:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360380 - in head: lib/libc/sys sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: lib/libc/sys sys/kern X-SVN-Commit-Revision: 360380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 15:59:21 -0000 Author: markj Date: Mon Apr 27 15:59:19 2020 New Revision: 360380 URL: https://svnweb.freebsd.org/changeset/base/360380 Log: Fix handling of EV_EOF for named pipes. Contrary to the kevent man page, EV_EOF on a fifo is not cleared by EV_CLEAR. Modify the read and write filters to clear EV_EOF when the fifo's PIPE_EOF flag is clear, and update the man page to document the new behaviour. Modify the write filter to return the amount of buffer space available even if no readers are present. This matches the behaviour for sockets. When reading from a pipe, only call pipeselwakeup() if some data was actually read. This prevents the continuous re-triggering of a EVFILT_READ event on EOF when in edge-triggered mode. PR: 203366, 224615 Submitted by: Jan Kokemüller MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24528 Modified: head/lib/libc/sys/kqueue.2 head/sys/kern/sys_pipe.c Modified: head/lib/libc/sys/kqueue.2 ============================================================================== --- head/lib/libc/sys/kqueue.2 Mon Apr 27 15:59:07 2020 (r360379) +++ head/lib/libc/sys/kqueue.2 Mon Apr 27 15:59:19 2020 (r360380) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 21, 2020 +.Dd April 27, 2020 .Dt KQUEUE 2 .Os .Sh NAME @@ -323,8 +323,7 @@ When the last writer disconnects, the filter will set .Dv EV_EOF in .Va flags . -This may be cleared by passing in -.Dv EV_CLEAR , +This will be cleared by the filter when a new writer connects, at which point the filter will resume waiting for data to become available before returning. @@ -343,9 +342,10 @@ For sockets, pipes and fifos, .Va data will contain the amount of space remaining in the write buffer. -The filter will set EV_EOF when the reader disconnects, and for -the fifo case, this may be cleared by use of -.Dv EV_CLEAR . +The filter will set +.Dv EV_EOF +when the reader disconnects, and for the fifo case, this will be cleared +when a new reader connects. Note that this filter is not supported for vnodes or BPF devices. .Pp For sockets, the low water mark and socket error handling is Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Mon Apr 27 15:59:07 2020 (r360379) +++ head/sys/kern/sys_pipe.c Mon Apr 27 15:59:19 2020 (r360380) @@ -824,7 +824,12 @@ unlocked_error: } } - if ((rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt) >= PIPE_BUF) + /* + * Only wake up writers if there was actually something read. + * Otherwise, when calling read(2) at EOF, a spurious wakeup occurs. + */ + if (nread > 0 && + rpipe->pipe_buffer.size - rpipe->pipe_buffer.cnt >= PIPE_BUF) pipeselwakeup(rpipe); PIPE_UNLOCK(rpipe); @@ -1726,48 +1731,54 @@ filt_pipedetach(struct knote *kn) static int filt_piperead(struct knote *kn, long hint) { + struct file *fp = kn->kn_fp; struct pipe *rpipe = kn->kn_hook; - struct pipe *wpipe = rpipe->pipe_peer; - int ret; PIPE_LOCK_ASSERT(rpipe, MA_OWNED); kn->kn_data = rpipe->pipe_buffer.cnt; if (kn->kn_data == 0) kn->kn_data = rpipe->pipe_map.cnt; - if ((rpipe->pipe_state & PIPE_EOF) || - wpipe->pipe_present != PIPE_ACTIVE || - (wpipe->pipe_state & PIPE_EOF)) { + if ((rpipe->pipe_state & PIPE_EOF) != 0 && + ((rpipe->pipe_state & PIPE_NAMED) == 0 || + fp->f_pipegen != rpipe->pipe_wgen)) { kn->kn_flags |= EV_EOF; return (1); } - ret = kn->kn_data > 0; - return ret; + kn->kn_flags &= ~EV_EOF; + return (kn->kn_data > 0); } /*ARGSUSED*/ static int filt_pipewrite(struct knote *kn, long hint) { - struct pipe *wpipe; + struct pipe *wpipe = kn->kn_hook; /* * If this end of the pipe is closed, the knote was removed from the * knlist and the list lock (i.e., the pipe lock) is therefore not held. */ - wpipe = kn->kn_hook; + if (wpipe->pipe_present == PIPE_ACTIVE || + (wpipe->pipe_state & PIPE_NAMED) != 0) { + PIPE_LOCK_ASSERT(wpipe, MA_OWNED); + + if (wpipe->pipe_state & PIPE_DIRECTW) { + kn->kn_data = 0; + } else if (wpipe->pipe_buffer.size > 0) { + kn->kn_data = wpipe->pipe_buffer.size - + wpipe->pipe_buffer.cnt; + } else { + kn->kn_data = PIPE_BUF; + } + } + if (wpipe->pipe_present != PIPE_ACTIVE || (wpipe->pipe_state & PIPE_EOF)) { - kn->kn_data = 0; kn->kn_flags |= EV_EOF; return (1); } - PIPE_LOCK_ASSERT(wpipe, MA_OWNED); - kn->kn_data = (wpipe->pipe_buffer.size > 0) ? - (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt) : PIPE_BUF; - if (wpipe->pipe_state & PIPE_DIRECTW) - kn->kn_data = 0; - + kn->kn_flags &= ~EV_EOF; return (kn->kn_data >= PIPE_BUF); } From owner-svn-src-head@freebsd.org Mon Apr 27 15:59: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 0BE542BD809; Mon, 27 Apr 2020 15:59:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499qGb4CxSz4FP1; Mon, 27 Apr 2020 15:59:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BF6BCF80; Mon, 27 Apr 2020 15:59:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RFxZON076812; Mon, 27 Apr 2020 15:59:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RFxYhB076807; Mon, 27 Apr 2020 15:59:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004271559.03RFxYhB076807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Apr 2020 15:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360381 - in head/tests/sys: fifo kern/pipe X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/tests/sys: fifo kern/pipe X-SVN-Commit-Revision: 360381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 15:59:36 -0000 Author: markj Date: Mon Apr 27 15:59:34 2020 New Revision: 360381 URL: https://svnweb.freebsd.org/changeset/base/360381 Log: Add some regression tests for read and write kevents on pipes. Submitted by: Jan Kokemüller MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24528 Added: head/tests/sys/fifo/fifo_kqueue.c (contents, props changed) head/tests/sys/kern/pipe/pipe_kqueue_test.c (contents, props changed) Modified: head/tests/sys/fifo/Makefile head/tests/sys/kern/pipe/Makefile Modified: head/tests/sys/fifo/Makefile ============================================================================== --- head/tests/sys/fifo/Makefile Mon Apr 27 15:59:19 2020 (r360380) +++ head/tests/sys/fifo/Makefile Mon Apr 27 15:59:34 2020 (r360381) @@ -4,6 +4,7 @@ TESTSDIR= ${TESTSBASE}/sys/fifo PLAIN_TESTS_C+= fifo_create PLAIN_TESTS_C+= fifo_io +ATF_TESTS_C+= fifo_kqueue PLAIN_TESTS_C+= fifo_misc PLAIN_TESTS_C+= fifo_open Added: head/tests/sys/fifo/fifo_kqueue.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/fifo/fifo_kqueue.c Mon Apr 27 15:59:34 2020 (r360381) @@ -0,0 +1,430 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Jan Kokemüller + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(fifo_kqueue__writes); +ATF_TC_BODY(fifo_kqueue__writes, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(mkfifo("testfifo", 0600) == 0); + + ATF_REQUIRE((p[0] = open("testfifo", + O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + ATF_REQUIRE((p[1] = open("testfifo", + O_WRONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[1], EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, 0); + EV_SET(&kev[1], p[1], EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); + + ATF_REQUIRE(kevent(kq, kev, 2, NULL, 0, NULL) == 0); + + /* A new writer should immediately get a EVFILT_WRITE event. */ + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 16384); + ATF_REQUIRE(kev[0].udata == 0); + + /* Filling up the pipe should make the EVFILT_WRITE disappear. */ + + char c = 0; + ssize_t r; + while ((r = write(p[1], &c, 1)) == 1) { + } + ATF_REQUIRE(r < 0); + ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* Reading (PIPE_BUF - 1) bytes will not trigger a EVFILT_WRITE yet. */ + + for (int i = 0; i < PIPE_BUF - 1; ++i) { + ATF_REQUIRE(read(p[0], &c, 1) == 1); + } + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* Reading one additional byte triggers the EVFILT_WRITE. */ + + ATF_REQUIRE(read(p[0], &c, 1) == 1); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == PIPE_BUF); + ATF_REQUIRE(kev[0].udata == 0); + + /* + * Reading another byte triggers the EVFILT_WRITE again with a changed + * 'data' field. + */ + + ATF_REQUIRE(read(p[0], &c, 1) == 1); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == PIPE_BUF + 1); + ATF_REQUIRE(kev[0].udata == 0); + + /* + * Closing the read end should make a EV_EOF appear but leave the 'data' + * field unchanged. + */ + + ATF_REQUIRE(close(p[0]) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), NULL) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == (EV_CLEAR | EV_EOF)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == PIPE_BUF + 1); + ATF_REQUIRE(kev[0].udata == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[1]) == 0); +} + +ATF_TC_WITHOUT_HEAD(fifo_kqueue__connecting_reader); +ATF_TC_BODY(fifo_kqueue__connecting_reader, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(mkfifo("testfifo", 0600) == 0); + + ATF_REQUIRE((p[0] = open("testfifo", + O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + ATF_REQUIRE((p[1] = open("testfifo", + O_WRONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[1], EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, 0); + EV_SET(&kev[1], p[1], EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); + + ATF_REQUIRE(kevent(kq, kev, 2, NULL, 0, NULL) == 0); + + /* A new writer should immediately get a EVFILT_WRITE event. */ + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* + * Filling the pipe, reading (PIPE_BUF + 1) bytes, then closing the + * read end leads to a EVFILT_WRITE with EV_EOF set. + */ + + char c = 0; + ssize_t r; + while ((r = write(p[1], &c, 1)) == 1) { + } + ATF_REQUIRE(r < 0); + ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK); + + for (int i = 0; i < PIPE_BUF + 1; ++i) { + ATF_REQUIRE(read(p[0], &c, 1) == 1); + } + + ATF_REQUIRE(close(p[0]) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), NULL) == 1); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE((kev[0].flags & EV_EOF) != 0); + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* Opening the reader again must trigger the EVFILT_WRITE. */ + + ATF_REQUIRE((p[0] = open("testfifo", + O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + r = kevent(kq, NULL, 0, kev, nitems(kev), &(struct timespec) { 1, 0 }); + ATF_REQUIRE(r == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == PIPE_BUF + 1); + ATF_REQUIRE(kev[0].udata == 0); + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[0]) == 0); + ATF_REQUIRE(close(p[1]) == 0); +} + +ATF_TC_WITHOUT_HEAD(fifo_kqueue__reads); +ATF_TC_BODY(fifo_kqueue__reads, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(mkfifo("testfifo", 0600) == 0); + + ATF_REQUIRE((p[0] = open("testfifo", + O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + ATF_REQUIRE((p[1] = open("testfifo", + O_WRONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + /* Check that EVFILT_READ behaves sensibly on a FIFO reader. */ + + char c = 0; + ssize_t r; + while ((r = write(p[1], &c, 1)) == 1) { + } + ATF_REQUIRE(r < 0); + ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK); + + for (int i = 0; i < PIPE_BUF + 1; ++i) { + ATF_REQUIRE(read(p[0], &c, 1) == 1); + } + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[0], EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); + + ATF_REQUIRE(kevent(kq, kev, 1, NULL, 0, NULL) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[0]); + ATF_REQUIRE(kev[0].filter == EVFILT_READ); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 65023); + ATF_REQUIRE(kev[0].udata == 0); + + while ((r = read(p[0], &c, 1)) == 1) { + } + ATF_REQUIRE(r < 0); + ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[0]) == 0); + ATF_REQUIRE(close(p[1]) == 0); +} + +ATF_TC_WITHOUT_HEAD(fifo_kqueue__read_eof_wakeups); +ATF_TC_BODY(fifo_kqueue__read_eof_wakeups, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(mkfifo("testfifo", 0600) == 0); + + ATF_REQUIRE((p[0] = open("testfifo", + O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + ATF_REQUIRE((p[1] = open("testfifo", + O_WRONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + + EV_SET(&kev[0], p[0], EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); + ATF_REQUIRE(kevent(kq, kev, 1, NULL, 0, NULL) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* + * Closing the writer must trigger a EVFILT_READ edge with EV_EOF set. + */ + + ATF_REQUIRE(close(p[1]) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[0]); + ATF_REQUIRE(kev[0].filter == EVFILT_READ); + ATF_REQUIRE(kev[0].flags == (EV_EOF | EV_CLEAR)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 0); + ATF_REQUIRE(kev[0].udata == 0); + + /* + * Trying to read from a closed pipe should not trigger EVFILT_READ + * edges. + */ + + char c; + ATF_REQUIRE(read(p[0], &c, 1) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[0]) == 0); +} + +ATF_TC_WITHOUT_HEAD(fifo_kqueue__read_eof_state_when_reconnecting); +ATF_TC_BODY(fifo_kqueue__read_eof_state_when_reconnecting, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(mkfifo("testfifo", 0600) == 0); + + ATF_REQUIRE((p[0] = open("testfifo", + O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + ATF_REQUIRE((p[1] = open("testfifo", + O_WRONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + + EV_SET(&kev[0], p[0], EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); + ATF_REQUIRE(kevent(kq, kev, 1, NULL, 0, NULL) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* + * Closing the writer must trigger a EVFILT_READ edge with EV_EOF set. + */ + + ATF_REQUIRE(close(p[1]) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[0]); + ATF_REQUIRE(kev[0].filter == EVFILT_READ); + ATF_REQUIRE(kev[0].flags == (EV_EOF | EV_CLEAR)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 0); + ATF_REQUIRE(kev[0].udata == 0); + + /* A new reader shouldn't see the EOF flag. */ + + { + int new_reader; + ATF_REQUIRE((new_reader = open("testfifo", + O_RDONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + int new_kq = kqueue(); + ATF_REQUIRE(new_kq >= 0); + + struct kevent new_kev[32]; + EV_SET(&new_kev[0], new_reader, EVFILT_READ, EV_ADD | EV_CLEAR, + 0, 0, 0); + ATF_REQUIRE(kevent(new_kq, new_kev, 1, NULL, 0, NULL) == 0); + + ATF_REQUIRE(kevent(new_kq, NULL, 0, new_kev, nitems(new_kev), + &(struct timespec) { 0, 0 }) == 0); + + ATF_REQUIRE(close(new_kq) == 0); + ATF_REQUIRE(close(new_reader) == 0); + } + + /* + * Simply reopening the writer does not trigger the EVFILT_READ again -- + * EV_EOF should be cleared, but there is no data yet so the filter + * does not trigger. + */ + + ATF_REQUIRE((p[1] = open("testfifo", + O_WRONLY | O_CLOEXEC | O_NONBLOCK)) >= 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* Writing a byte should trigger a EVFILT_READ. */ + + char c = 0; + ATF_REQUIRE(write(p[1], &c, 1) == 1); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[0]); + ATF_REQUIRE(kev[0].filter == EVFILT_READ); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 1); + ATF_REQUIRE(kev[0].udata == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[0]) == 0); + ATF_REQUIRE(close(p[1]) == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, fifo_kqueue__writes); + ATF_TP_ADD_TC(tp, fifo_kqueue__connecting_reader); + ATF_TP_ADD_TC(tp, fifo_kqueue__reads); + ATF_TP_ADD_TC(tp, fifo_kqueue__read_eof_wakeups); + ATF_TP_ADD_TC(tp, fifo_kqueue__read_eof_state_when_reconnecting); + + return atf_no_error(); +} Modified: head/tests/sys/kern/pipe/Makefile ============================================================================== --- head/tests/sys/kern/pipe/Makefile Mon Apr 27 15:59:19 2020 (r360380) +++ head/tests/sys/kern/pipe/Makefile Mon Apr 27 15:59:34 2020 (r360381) @@ -5,6 +5,7 @@ TESTSDIR= ${TESTSBASE}/sys/kern/pipe PLAIN_TESTS_C+= big_pipe_test PLAIN_TESTS_C+= pipe_fstat_bug_test PLAIN_TESTS_C+= pipe_ino_test +ATF_TESTS_C+= pipe_kqueue_test PLAIN_TESTS_C+= pipe_overcommit1_test PLAIN_TESTS_C+= pipe_overcommit2_test PLAIN_TESTS_C+= pipe_reverse2_test Added: head/tests/sys/kern/pipe/pipe_kqueue_test.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/kern/pipe/pipe_kqueue_test.c Mon Apr 27 15:59:34 2020 (r360381) @@ -0,0 +1,366 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Jan Kokemüller + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +ATF_TC_WITHOUT_HEAD(pipe_kqueue__write_end); +ATF_TC_BODY(pipe_kqueue__write_end, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(pipe2(p, O_CLOEXEC | O_NONBLOCK) == 0); + ATF_REQUIRE(p[0] >= 0); + ATF_REQUIRE(p[1] >= 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[1], EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, 0); + + ATF_REQUIRE(kevent(kq, kev, 1, NULL, 0, NULL) == 0); + + /* Test that EVFILT_WRITE behaves sensibly on the write end. */ + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 16384); + ATF_REQUIRE(kev[0].udata == 0); + + /* Filling up the pipe should make the EVFILT_WRITE disappear. */ + + char c = 0; + ssize_t r; + while ((r = write(p[1], &c, 1)) == 1) { + } + ATF_REQUIRE(r < 0); + ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* Reading (PIPE_BUF - 1) bytes will not trigger a EVFILT_WRITE yet. */ + + for (int i = 0; i < PIPE_BUF - 1; ++i) { + ATF_REQUIRE(read(p[0], &c, 1) == 1); + } + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 0); + + /* Reading one additional byte triggers the EVFILT_WRITE. */ + + ATF_REQUIRE(read(p[0], &c, 1) == 1); + + r = kevent(kq, NULL, 0, kev, nitems(kev), &(struct timespec) { 0, 0 }); + ATF_REQUIRE(r == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == PIPE_BUF); + ATF_REQUIRE(kev[0].udata == 0); + + /* + * Reading another byte triggers the EVFILT_WRITE again with a changed + * 'data' field. + */ + + ATF_REQUIRE(read(p[0], &c, 1) == 1); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == EV_CLEAR); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == PIPE_BUF + 1); + ATF_REQUIRE(kev[0].udata == 0); + + /* + * Closing the read end should make a EV_EOF appear but leave the 'data' + * field unchanged. + */ + + ATF_REQUIRE(close(p[0]) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == (EV_CLEAR | EV_EOF | EV_ONESHOT)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == PIPE_BUF + 1); + ATF_REQUIRE(kev[0].udata == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[1]) == 0); +} + +ATF_TC_WITHOUT_HEAD(pipe_kqueue__closed_read_end); +ATF_TC_BODY(pipe_kqueue__closed_read_end, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(pipe2(p, O_CLOEXEC | O_NONBLOCK) == 0); + ATF_REQUIRE(p[0] >= 0); + ATF_REQUIRE(p[1] >= 0); + + ATF_REQUIRE(close(p[0]) == 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[1], EVFILT_READ, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + EV_SET(&kev[1], p[1], EVFILT_WRITE, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + + /* + * Trying to register EVFILT_WRITE when the pipe is closed leads to an + * EPIPE error. + */ + + ATF_REQUIRE(kevent(kq, kev, 2, kev, 2, NULL) == 2); + ATF_REQUIRE((kev[0].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[0].data == 0); + ATF_REQUIRE((kev[1].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[1].data == EPIPE); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_READ); + ATF_REQUIRE(kev[0].flags == (EV_EOF | EV_CLEAR | EV_RECEIPT)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 0); + ATF_REQUIRE(kev[0].udata == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[1]) == 0); +} + +ATF_TC_WITHOUT_HEAD(pipe_kqueue__closed_read_end_register_before_close); +ATF_TC_BODY(pipe_kqueue__closed_read_end_register_before_close, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(pipe2(p, O_CLOEXEC | O_NONBLOCK) == 0); + ATF_REQUIRE(p[0] >= 0); + ATF_REQUIRE(p[1] >= 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[1], EVFILT_READ, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + EV_SET(&kev[1], p[1], EVFILT_WRITE, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + + /* + * Registering EVFILT_WRITE before the pipe is closed leads to a + * EVFILT_WRITE event with EV_EOF set. + */ + + ATF_REQUIRE(kevent(kq, kev, 2, kev, 2, NULL) == 2); + ATF_REQUIRE((kev[0].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[0].data == 0); + ATF_REQUIRE((kev[1].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[1].data == 0); + + ATF_REQUIRE(close(p[0]) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 2); + { + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == + (EV_EOF | EV_CLEAR | EV_ONESHOT | EV_RECEIPT)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 16384); + ATF_REQUIRE(kev[0].udata == 0); + } + { + ATF_REQUIRE(kev[1].ident == (uintptr_t)p[1]); + ATF_REQUIRE(kev[1].filter == EVFILT_READ); + ATF_REQUIRE(kev[1].flags == (EV_EOF | EV_CLEAR | EV_RECEIPT)); + ATF_REQUIRE(kev[1].fflags == 0); + ATF_REQUIRE(kev[1].data == 0); + ATF_REQUIRE(kev[1].udata == 0); + } + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[1]) == 0); +} + +ATF_TC_WITHOUT_HEAD(pipe_kqueue__closed_write_end); +ATF_TC_BODY(pipe_kqueue__closed_write_end, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(pipe2(p, O_CLOEXEC | O_NONBLOCK) == 0); + ATF_REQUIRE(p[0] >= 0); + ATF_REQUIRE(p[1] >= 0); + + char c = 0; + ssize_t r; + while ((r = write(p[1], &c, 1)) == 1) { + } + ATF_REQUIRE(r < 0); + ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK); + + ATF_REQUIRE(close(p[1]) == 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[0], EVFILT_READ, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + EV_SET(&kev[1], p[0], EVFILT_WRITE, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + + /* + * Trying to register EVFILT_WRITE when the pipe is closed leads to an + * EPIPE error. + */ + + ATF_REQUIRE(kevent(kq, kev, 2, kev, 2, NULL) == 2); + ATF_REQUIRE((kev[0].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[0].data == 0); + ATF_REQUIRE((kev[1].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[1].data == EPIPE); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 1); + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[0]); + ATF_REQUIRE(kev[0].filter == EVFILT_READ); + ATF_REQUIRE(kev[0].flags == (EV_EOF | EV_CLEAR | EV_RECEIPT)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 65536); + ATF_REQUIRE(kev[0].udata == 0); + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[0]) == 0); +} + +ATF_TC_WITHOUT_HEAD(pipe_kqueue__closed_write_end_register_before_close); +ATF_TC_BODY(pipe_kqueue__closed_write_end_register_before_close, tc) +{ + int p[2] = { -1, -1 }; + + ATF_REQUIRE(pipe2(p, O_CLOEXEC | O_NONBLOCK) == 0); + ATF_REQUIRE(p[0] >= 0); + ATF_REQUIRE(p[1] >= 0); + + int kq = kqueue(); + ATF_REQUIRE(kq >= 0); + + struct kevent kev[32]; + EV_SET(&kev[0], p[0], EVFILT_READ, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + EV_SET(&kev[1], p[0], EVFILT_WRITE, EV_ADD | EV_CLEAR | EV_RECEIPT, /**/ + 0, 0, 0); + + /* + * Registering EVFILT_WRITE before the pipe is closed leads to a + * EVFILT_WRITE event with EV_EOF set. + */ + + ATF_REQUIRE(kevent(kq, kev, 2, kev, 2, NULL) == 2); + ATF_REQUIRE((kev[0].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[0].data == 0); + ATF_REQUIRE((kev[1].flags & EV_ERROR) != 0); + ATF_REQUIRE(kev[1].data == 0); + + char c = 0; + ssize_t r; + while ((r = write(p[1], &c, 1)) == 1) { + } + ATF_REQUIRE(r < 0); + ATF_REQUIRE(errno == EAGAIN || errno == EWOULDBLOCK); + + ATF_REQUIRE(close(p[1]) == 0); + + ATF_REQUIRE(kevent(kq, NULL, 0, kev, nitems(kev), + &(struct timespec) { 0, 0 }) == 2); + { + ATF_REQUIRE(kev[0].ident == (uintptr_t)p[0]); + ATF_REQUIRE(kev[0].filter == EVFILT_WRITE); + ATF_REQUIRE(kev[0].flags == + (EV_EOF | EV_CLEAR | EV_ONESHOT | EV_RECEIPT)); + ATF_REQUIRE(kev[0].fflags == 0); + ATF_REQUIRE(kev[0].data == 4096 || + kev[0].data == 512 /* on FreeBSD 11.3 */); + ATF_REQUIRE(kev[0].udata == 0); + } + { + ATF_REQUIRE(kev[1].ident == (uintptr_t)p[0]); + ATF_REQUIRE(kev[1].filter == EVFILT_READ); + ATF_REQUIRE(kev[1].flags == (EV_EOF | EV_CLEAR | EV_RECEIPT)); + ATF_REQUIRE(kev[1].fflags == 0); + ATF_REQUIRE(kev[1].data == 65536); + ATF_REQUIRE(kev[1].udata == 0); + } + + ATF_REQUIRE(close(kq) == 0); + ATF_REQUIRE(close(p[0]) == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, pipe_kqueue__write_end); + ATF_TP_ADD_TC(tp, pipe_kqueue__closed_read_end); + ATF_TP_ADD_TC(tp, pipe_kqueue__closed_read_end_register_before_close); + ATF_TP_ADD_TC(tp, pipe_kqueue__closed_write_end); + ATF_TP_ADD_TC(tp, pipe_kqueue__closed_write_end_register_before_close); + + return atf_no_error(); +} From owner-svn-src-head@freebsd.org Mon Apr 27 16:12: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 6B3BD2BE29E; Mon, 27 Apr 2020 16:12:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499qYY2HJhz4GtV; Mon, 27 Apr 2020 16:12:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4923FD35D; Mon, 27 Apr 2020 16:12:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RGCXY4089434; Mon, 27 Apr 2020 16:12:33 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RGCX2E089433; Mon, 27 Apr 2020 16:12:33 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004271612.03RGCX2E089433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Apr 2020 16:12:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360384 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 360384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 16:12:33 -0000 Author: markj Date: Mon Apr 27 16:12:32 2020 New Revision: 360384 URL: https://svnweb.freebsd.org/changeset/base/360384 Log: Document handling of connection-mode sockets by sendto(2). sendto(2), sendmsg(2) and sendmmsg(2) return ENOTCONN if a destination address is specified and the socket is not connected and the socket protocol does not automatically connect ("implied connect"). Document that. Also document the fact that the destination address is ignored for connection-mode sockets if the socket is already connected. PR: 245817 Submitted by: Erik Inge Bolsø MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D24530 Modified: head/lib/libc/sys/send.2 Modified: head/lib/libc/sys/send.2 ============================================================================== --- head/lib/libc/sys/send.2 Mon Apr 27 16:11:59 2020 (r360383) +++ head/lib/libc/sys/send.2 Mon Apr 27 16:12:32 2020 (r360384) @@ -28,7 +28,7 @@ .\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 .\" $FreeBSD$ .\" -.Dd January 4, 2019 +.Dd April 27, 2020 .Dt SEND 2 .Os .Sh NAME @@ -69,18 +69,35 @@ The function may be used only when the socket is in a .Em connected -state, while +state. +The functions .Fn sendto , .Fn sendmsg and .Fn sendmmsg -may be used at any time. +may be used at any time if the socket is connectionless-mode. +If the socket is connection-mode, the protocol +must support implied connect (currently +.Xr tcp 4 +is the only protocol with support) or the socket must be in a +connected state before use. .Pp The address of the target is given by .Fa to with .Fa tolen -specifying its size. +specifying its size, or the equivalent +.Fa msg_name +and +.Fa msg_namelen +in +.Fa struct msghdr . +If the socket is in a connected state, the target address passed to +.Fn sendto , +.Fn sendmsg +or +.Fn sendmmsg +is ignored. The length of the message is given by .Fa len . If the message is too long to pass atomically through the @@ -195,6 +212,8 @@ An invalid descriptor was specified. The destination address is a broadcast address, and .Dv SO_BROADCAST has not been set on the socket. +.It Bq Er ENOTCONN +The socket is connection-mode but is not connected. .It Bq Er ENOTSOCK The argument .Fa s @@ -242,6 +261,7 @@ This typically means that the socket is not connected. .El .Sh SEE ALSO +.Xr connect 2 , .Xr fcntl 2 , .Xr getsockopt 2 , .Xr recv 2 , From owner-svn-src-head@freebsd.org Mon Apr 27 16:30: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 A97AD2BEEE9; Mon, 27 Apr 2020 16:30:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499qyG46zpz4JP4; Mon, 27 Apr 2020 16:30:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8848CD5DB; Mon, 27 Apr 2020 16:30:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RGUUds096037; Mon, 27 Apr 2020 16:30:30 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RGUTdu096033; Mon, 27 Apr 2020 16:30:29 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <202004271630.03RGUTdu096033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Mon, 27 Apr 2020 16:30:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360385 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 360385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 16:30:30 -0000 Author: rrs Date: Mon Apr 27 16:30:29 2020 New Revision: 360385 URL: https://svnweb.freebsd.org/changeset/base/360385 Log: This change does a small prepratory step in getting the latest rack and bbr in from the NF repo. When those come in the OOB data handling will be fixed where Skyzaller crashes. Differential Revision: https://reviews.freebsd.org/D24575 Modified: head/sys/netinet/tcp.h head/sys/netinet/tcp_log_buf.h head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Mon Apr 27 16:12:32 2020 (r360384) +++ head/sys/netinet/tcp.h Mon Apr 27 16:30:29 2020 (r360385) @@ -181,6 +181,9 @@ struct tcphdr { #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ #define TCP_DELACK 72 /* socket option for delayed ack */ +#define TCP_FIN_IS_RST 73 /* A fin from the peer is treated has a RST */ +#define TCP_LOG_LIMIT 74 /* Limit to number of records in tcp-log */ +#define TCP_SHARED_CWND_ALLOWED 75 /* Use of a shared cwnd is allowed */ #define TCP_KEEPINIT 128 /* N, time to establish connection */ #define TCP_KEEPIDLE 256 /* L,N,X start keeplives after this period */ #define TCP_KEEPINTVL 512 /* L,N interval between keepalives */ @@ -190,10 +193,11 @@ struct tcphdr { #define TCP_PCAP_IN 4096 /* number of input packets to keep */ #define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */ /* Options for Rack and BBR */ +#define TCP_RACK_MBUF_QUEUE 1050 /* Do we allow mbuf queuing if supported */ #define TCP_RACK_PROP 1051 /* RACK proportional rate reduction (bool) */ #define TCP_RACK_TLP_REDUCE 1052 /* RACK TLP cwnd reduction (bool) */ #define TCP_RACK_PACE_REDUCE 1053 /* RACK Pacing reduction factor (divisor) */ -#define TCP_RACK_PACE_MAX_SEG 1054 /* Max segments in a pace */ +#define TCP_RACK_PACE_MAX_SEG 1054 /* Max TSO size we will send */ #define TCP_RACK_PACE_ALWAYS 1055 /* Use the always pace method */ #define TCP_RACK_PROP_RATE 1056 /* The proportional reduction rate */ #define TCP_RACK_PRR_SENDALOT 1057 /* Allow PRR to send more than one seg */ @@ -236,7 +240,7 @@ struct tcphdr { #define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ #define TCP_RACK_MIN_PACE 1093 /* Do we enforce rack min pace time */ #define TCP_RACK_MIN_PACE_SEG 1094 /* If so what is the seg threshould */ -#define TCP_RACK_GP_INCREASE 1094 /* After 4.1 its the GP increase */ +#define TCP_RACK_GP_INCREASE 1094 /* After 4.1 its the GP increase in older rack */ #define TCP_RACK_TLP_USE 1095 #define TCP_BBR_ACK_COMP_ALG 1096 /* Not used */ #define TCP_BBR_TMR_PACE_OH 1096 /* Recycled in 4.2 */ @@ -248,7 +252,8 @@ struct tcphdr { #define TCP_BBR_PROBE_RTT_GAIN 1101 #define TCP_BBR_PROBE_RTT_LEN 1102 #define TCP_BBR_SEND_IWND_IN_TSO 1103 /* Do we burst out whole iwin size chunks at start? */ -#define TCP_BBR_USE_RACK_CHEAT 1104 /* Do we use the rack cheat for pacing rxt's */ +#define TCP_BBR_USE_RACK_RR 1104 /* Do we use the rack rapid recovery for pacing rxt's */ +#define TCP_BBR_USE_RACK_CHEAT TCP_BBR_USE_RACK_RR /* Compat. */ #define TCP_BBR_HDWR_PACE 1105 /* Enable/disable hardware pacing */ #define TCP_BBR_UTTER_MAX_TSO 1106 /* Do we enforce an utter max TSO size */ #define TCP_BBR_EXTRA_STATE 1107 /* Special exit-persist catch up */ @@ -256,6 +261,24 @@ struct tcphdr { #define TCP_BBR_MIN_TOPACEOUT 1109 /* Do we suspend pacing until */ #define TCP_BBR_TSTMP_RAISES 1110 /* Can a timestamp measurement raise the b/w */ #define TCP_BBR_POLICER_DETECT 1111 /* Turn on/off google mode policer detection */ +#define TCP_BBR_RACK_INIT_RATE 1112 /* Set an initial pacing rate for when we have no b/w in kbits per sec */ +#define TCP_RACK_RR_CONF 1113 /* Rack rapid recovery configuration control*/ +#define TCP_RACK_CHEAT_NOT_CONF_RATE TCP_RACK_RR_CONF +#define TCP_RACK_GP_INCREASE_CA 1114 /* GP increase for Congestion Avoidance */ +#define TCP_RACK_GP_INCREASE_SS 1115 /* GP increase for Slow Start */ +#define TCP_RACK_GP_INCREASE_REC 1116 /* GP increase for Recovery */ +#define TCP_RACK_FORCE_MSEG 1117 /* Override to use the user set max-seg value */ +#define TCP_RACK_PACE_RATE_CA 1118 /* Pacing rate for Congestion Avoidance */ +#define TCP_RACK_PACE_RATE_SS 1119 /* Pacing rate for Slow Start */ +#define TCP_RACK_PACE_RATE_REC 1120 /* Pacing rate for Recovery */ +#define TCP_NO_PRR 1122 /* If pacing, don't use prr */ +#define TCP_RACK_NONRXT_CFG_RATE 1123 /* In recovery does a non-rxt use the cfg rate */ +#define TCP_SHARED_CWND_ENABLE 1124 /* Use a shared cwnd if allowed */ +#define TCP_TIMELY_DYN_ADJ 1125 /* Do we attempt dynamic multipler adjustment with timely. */ +#define TCP_RACK_NO_PUSH_AT_MAX 1126 /* For timely do not push if we are over max rtt */ +#define TCP_RACK_PACE_TO_FILL 1127 /* If we are not in recovery, always pace to fill the cwnd in 1 RTT */ +#define TCP_SHARED_CWND_TIME_LIMIT 1128 /* we should limit to low time values the scwnd life */ +#define TCP_RACK_PROFILE 1129 /* Select a profile that sets multiple options */ /* Start of reserved space for third-party user-settable options. */ Modified: head/sys/netinet/tcp_log_buf.h ============================================================================== --- head/sys/netinet/tcp_log_buf.h Mon Apr 27 16:12:32 2020 (r360384) +++ head/sys/netinet/tcp_log_buf.h Mon Apr 27 16:30:29 2020 (r360385) @@ -225,7 +225,11 @@ enum tcp_log_events { TCP_LOG_LRO, /* LRO entry 55 */ TCP_SACK_FILTER_RES, /* Results of SACK Filter 56 */ TCP_SAD_DETECTION, /* Sack Attack Detection 57 */ - TCP_LOG_END /* End (keep at end) 58 */ + TCP_TIMELY_WORK, /* Logs regarding Timely CC tweaks 58 */ + TCP_LOG_USER_EVENT, /* User space event data 59 */ + TCP_LOG_SENDFILE, /* sendfile() logging for TCP connections 60 */ + TCP_LOG_HTTP_T, /* logging of http request tracking 61 */ + TCP_LOG_END /* End (keep at end) 62 */ }; enum tcp_log_states { Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Mon Apr 27 16:12:32 2020 (r360384) +++ head/sys/netinet/tcp_subr.c Mon Apr 27 16:30:29 2020 (r360385) @@ -3465,3 +3465,32 @@ tcp_inptoxtp(const struct inpcb *inp, struct xtcpcb *x if (inp->inp_socket == NULL) xt->xt_inp.xi_socket.xso_protocol = IPPROTO_TCP; } + +void +tcp_log_end_status(struct tcpcb *tp, uint8_t status) +{ + uint32_t bit, i; + + if ((tp == NULL) || + (status > TCP_EI_STATUS_MAX_VALUE) || + (status == 0)) { + /* Invalid */ + return; + } + if (status > (sizeof(uint32_t) * 8)) { + /* Should this be a KASSERT? */ + return; + } + bit = 1U << (status - 1); + if (bit & tp->t_end_info_status) { + /* already logged */ + return; + } + for (i = 0; i < TCP_END_BYTE_INFO; i++) { + if (tp->t_end_info_bytes[i] == TCP_EI_EMPTY_SLOT) { + tp->t_end_info_bytes[i] = status; + tp->t_end_info_status |= bit; + break; + } + } +} Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Mon Apr 27 16:12:32 2020 (r360384) +++ head/sys/netinet/tcp_var.h Mon Apr 27 16:30:29 2020 (r360385) @@ -43,6 +43,41 @@ #include #endif +#define TCP_END_BYTE_INFO 8 /* Bytes that makeup the "end information array" */ +/* Types of ending byte info */ +#define TCP_EI_EMPTY_SLOT 0 +#define TCP_EI_STATUS_CLIENT_FIN 0x1 +#define TCP_EI_STATUS_CLIENT_RST 0x2 +#define TCP_EI_STATUS_SERVER_FIN 0x3 +#define TCP_EI_STATUS_SERVER_RST 0x4 +#define TCP_EI_STATUS_RETRAN 0x5 +#define TCP_EI_STATUS_PROGRESS 0x6 +#define TCP_EI_STATUS_PERSIST_MAX 0x7 +#define TCP_EI_STATUS_KEEP_MAX 0x8 +#define TCP_EI_STATUS_DATA_A_CLOSE 0x9 +#define TCP_EI_STATUS_RST_IN_FRONT 0xa +#define TCP_EI_STATUS_2MSL 0xb +#define TCP_EI_STATUS_MAX_VALUE 0xb + +/************************************************/ +/* Status bits we track to assure no duplicates, + * the bits here are not used by the code but + * for human representation. To check a bit we + * take and shift over by 1 minus the value (1-8). + */ +/************************************************/ +#define TCP_EI_BITS_CLIENT_FIN 0x001 +#define TCP_EI_BITS_CLIENT_RST 0x002 +#define TCP_EI_BITS_SERVER_FIN 0x004 +#define TCP_EI_BITS_SERVER_RST 0x008 +#define TCP_EI_BITS_RETRAN 0x010 +#define TCP_EI_BITS_PROGRESS 0x020 +#define TCP_EI_BITS_PRESIST_MAX 0x040 +#define TCP_EI_BITS_KEEP_MAX 0x080 +#define TCP_EI_BITS_DATA_A_CLO 0x100 +#define TCP_EI_BITS_RST_IN_FR 0x200 /* a front state reset */ +#define TCP_EI_BITS_2MS_TIMER 0x400 /* 2 MSL timer expired */ + #if defined(_KERNEL) || defined(_WANT_TCPCB) /* TCP segment queue entry */ struct tseg_qent { @@ -219,11 +254,16 @@ struct tcpcb { tcp_seq gput_ack; /* Inbound measurement ack */ int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ uint8_t t_tfo_client_cookie_len; /* TCP Fast Open client cookie length */ + uint32_t t_end_info_status; /* Status flag of end info */ unsigned int *t_tfo_pending; /* TCP Fast Open server pending counter */ union { uint8_t client[TCP_FASTOPEN_MAX_COOKIE_LEN]; uint64_t server; } t_tfo_cookie; /* TCP Fast Open cookie to send */ + union { + uint8_t t_end_info_bytes[TCP_END_BYTE_INFO]; + uint64_t t_end_info; + }; #ifdef TCPPCAP struct mbufq t_inpkts; /* List of saved input packets. */ struct mbufq t_outpkts; /* List of saved output packets. */ @@ -1010,6 +1050,7 @@ struct mbuf * int32_t seglimit, int32_t segsize, struct sockbuf *sb, bool hw_tls); int tcp_stats_init(void); +void tcp_log_end_status(struct tcpcb *tp, uint8_t status); static inline void tcp_fields_to_host(struct tcphdr *th) From owner-svn-src-head@freebsd.org Mon Apr 27 17:53: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 0FC592C11B2; Mon, 27 Apr 2020 17:53:39 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499spB6DCYz4PWk; Mon, 27 Apr 2020 17:53:38 +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 D0DAFE874; Mon, 27 Apr 2020 17:53:38 +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 03RHrcRC052006; Mon, 27 Apr 2020 17:53:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RHrciw052004; Mon, 27 Apr 2020 17:53:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004271753.03RHrciw052004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 17:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360386 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 360386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 17:53:39 -0000 Author: jhb Date: Mon Apr 27 17:53:38 2020 New Revision: 360386 URL: https://svnweb.freebsd.org/changeset/base/360386 Log: Extend support in sysctls for supporting multiple native ABIs. This extends some of the changes in place to support reporting support for 32-bit ABIs to permit reporting hard-float vs soft-float ABIs. Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24542 Modified: head/sys/kern/kern_mib.c head/sys/sys/sysent.h Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Mon Apr 27 16:30:29 2020 (r360385) +++ head/sys/kern/kern_mib.c Mon Apr 27 17:53:38 2020 (r360386) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -252,39 +253,49 @@ SYSCTL_PROC(_hw, OID_AUTO, pagesizes, sysctl_hw_pagesizes, "LU", "Supported page sizes"); -#ifdef SCTL_MASK32 int adaptive_machine_arch = 1; SYSCTL_INT(_debug, OID_AUTO, adaptive_machine_arch, CTLFLAG_RW, &adaptive_machine_arch, 1, "Adapt reported machine architecture to the ABI of the binary"); + +static const char * +proc_machine_arch(struct proc *p) +{ + + if (p->p_sysent->sv_machine_arch != NULL) + return (p->p_sysent->sv_machine_arch(p)); +#ifdef COMPAT_FREEBSD32 + if (SV_PROC_FLAG(p, SV_ILP32)) + return (MACHINE_ARCH32); #endif + return (MACHINE_ARCH); +} static int sysctl_hw_machine_arch(SYSCTL_HANDLER_ARGS) { - int error; - static const char machine_arch[] = MACHINE_ARCH; -#ifdef SCTL_MASK32 - static const char machine_arch32[] = MACHINE_ARCH32; + const char *machine_arch; - if ((req->flags & SCTL_MASK32) != 0 && adaptive_machine_arch) - error = SYSCTL_OUT(req, machine_arch32, sizeof(machine_arch32)); + if (adaptive_machine_arch) + machine_arch = proc_machine_arch(curproc); else -#endif - error = SYSCTL_OUT(req, machine_arch, sizeof(machine_arch)); - return (error); - + machine_arch = MACHINE_ARCH; + return (SYSCTL_OUT(req, machine_arch, strlen(machine_arch) + 1)); } SYSCTL_PROC(_hw, HW_MACHINE_ARCH, machine_arch, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine_arch, "A", "System architecture"); -SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, +#ifndef MACHINE_ARCHES #ifdef COMPAT_FREEBSD32 - MACHINE_ARCH " " MACHINE_ARCH32, 0, "Supported architectures for binaries"); +#define MACHINE_ARCHES MACHINE_ARCH " " MACHINE_ARCH32 #else - MACHINE_ARCH, 0, "Supported architectures for binaries"); +#define MACHINE_ARCHES MACHINE_ARCH #endif +#endif + +SYSCTL_STRING(_kern, OID_AUTO, supported_archs, CTLFLAG_RD | CTLFLAG_MPSAFE, + MACHINE_ARCHES, 0, "Supported architectures for binaries"); static int sysctl_hostname(SYSCTL_HANDLER_ARGS) Modified: head/sys/sys/sysent.h ============================================================================== --- head/sys/sys/sysent.h Mon Apr 27 16:30:29 2020 (r360385) +++ head/sys/sys/sysent.h Mon Apr 27 17:53:38 2020 (r360386) @@ -94,6 +94,7 @@ struct sysent { /* system call table */ #endif struct image_params; +struct proc; struct __sigset; struct trapframe; struct vnode; @@ -144,6 +145,7 @@ struct sysentvec { int (*sv_trap)(struct thread *); u_long *sv_hwcap; /* Value passed in AT_HWCAP. */ u_long *sv_hwcap2; /* Value passed in AT_HWCAP2. */ + const char *(*sv_machine_arch)(struct proc *); }; #define SV_ILP32 0x000100 /* 32-bit executable. */ From owner-svn-src-head@freebsd.org Mon Apr 27 17: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 17C0A2C1260; Mon, 27 Apr 2020 17:55:42 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499srY6xwfz4PgM; Mon, 27 Apr 2020 17:55:41 +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 D06F4E87E; Mon, 27 Apr 2020 17:55:41 +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 03RHtfBu052198; Mon, 27 Apr 2020 17:55:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RHtfKp052195; Mon, 27 Apr 2020 17:55:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004271755.03RHtfKp052195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 17:55:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360387 - in head/sys: kern riscv/include riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: kern riscv/include riscv/riscv X-SVN-Commit-Revision: 360387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 17:55:42 -0000 Author: jhb Date: Mon Apr 27 17:55:40 2020 New Revision: 360387 URL: https://svnweb.freebsd.org/changeset/base/360387 Log: Improve MACHINE_ARCH handling for hard vs soft-float on RISC-V. For userland, MACHINE_ARCH reflects the current ABI via preprocessor directives. For the kernel, the hw.machine_arch sysctl uses the ELF header flags of the current process to select the correct MACHINE_ARCH value. Reviewed by: imp, kp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24543 Modified: head/sys/kern/kern_mib.c head/sys/riscv/include/param.h head/sys/riscv/riscv/elf_machdep.c Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Mon Apr 27 17:53:38 2020 (r360386) +++ head/sys/kern/kern_mib.c Mon Apr 27 17:55:40 2020 (r360387) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include Modified: head/sys/riscv/include/param.h ============================================================================== --- head/sys/riscv/include/param.h Mon Apr 27 17:53:38 2020 (r360386) +++ head/sys/riscv/include/param.h Mon Apr 27 17:55:40 2020 (r360387) @@ -46,18 +46,16 @@ #define MACHINE "riscv" #endif #ifndef MACHINE_ARCH -/* - * Check to see if we're building with hardware floating instructions - * allowed. We check this instead of hard vs soft float ABI because we build the - * kernel with soft float ABI to avoid hard float instruction generation. If - * we ever allow a 'soft ABI but with hard floats' userland, then we'll need - * to rethink this. - */ -#ifdef __riscv_flen -#define MACHINE_ARCH "riscv64" -#else + +/* Always use the hard-float arch for the kernel. */ +#if !defined(_KERNEL) && defined(__riscv_float_abi_soft) #define MACHINE_ARCH "riscv64sf" +#else +#define MACHINE_ARCH "riscv64" #endif +#endif +#ifdef _KERNEL +#define MACHINE_ARCHES "riscv64 riscv64sf" #endif #ifdef SMP Modified: head/sys/riscv/riscv/elf_machdep.c ============================================================================== --- head/sys/riscv/riscv/elf_machdep.c Mon Apr 27 17:53:38 2020 (r360386) +++ head/sys/riscv/riscv/elf_machdep.c Mon Apr 27 17:55:40 2020 (r360387) @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include +static const char *riscv_machine_arch(struct proc *p); + u_long elf_hwcap; struct sysentvec elf64_freebsd_sysvec = { @@ -94,8 +96,19 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_thread_detach = NULL, .sv_trap = NULL, .sv_hwcap = &elf_hwcap, + .sv_machine_arch = riscv_machine_arch, }; INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec); + +static const char * +riscv_machine_arch(struct proc *p) +{ + + if ((p->p_elf_flags & EF_RISCV_FLOAT_ABI_MASK) == + EF_RISCV_FLOAT_ABI_SOFT) + return (MACHINE_ARCH "sf"); + return (MACHINE_ARCH); +} static Elf64_Brandinfo freebsd_brand_info = { .brand = ELFOSABI_FREEBSD, From owner-svn-src-head@freebsd.org Mon Apr 27 18:04: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 0D8352C14C8; Mon, 27 Apr 2020 18:04:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499t2y6Rc1z4Q8s; Mon, 27 Apr 2020 18:04:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D86A3EA8A; Mon, 27 Apr 2020 18:04:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RI4gjJ058503; Mon, 27 Apr 2020 18:04:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RI4g3j058502; Mon, 27 Apr 2020 18:04:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004271804.03RI4g3j058502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 18:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360388 - head/sys/dev/iscsi_initiator X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/iscsi_initiator X-SVN-Commit-Revision: 360388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 18:04:43 -0000 Author: jhb Date: Mon Apr 27 18:04:42 2020 New Revision: 360388 URL: https://svnweb.freebsd.org/changeset/base/360388 Log: Don't run strcmp() against strings stored in user memory. Instead, copy the strings into a temporary buffer on the stack and run strcmp on the copies. Reviewed by: brooks, kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24567 Modified: head/sys/dev/iscsi_initiator/isc_subr.c Modified: head/sys/dev/iscsi_initiator/isc_subr.c ============================================================================== --- head/sys/dev/iscsi_initiator/isc_subr.c Mon Apr 27 17:55:40 2020 (r360387) +++ head/sys/dev/iscsi_initiator/isc_subr.c Mon Apr 27 18:04:42 2020 (r360388) @@ -97,6 +97,9 @@ i_crc32c(const void *buf, size_t size, uint32_t crc) int i_setopt(isc_session_t *sp, isc_opt_t *opt) { + char buf[16]; + int error; + if(opt->maxRecvDataSegmentLength > 0) { sp->opt.maxRecvDataSegmentLength = opt->maxRecvDataSegmentLength; sdebug(2, "maxRecvDataSegmentLength=%d", sp->opt.maxRecvDataSegmentLength); @@ -138,15 +141,21 @@ i_setopt(isc_session_t *sp, isc_opt_t *opt) } if(opt->headerDigest != NULL) { - sdebug(2, "opt.headerDigest='%s'", opt->headerDigest); - if(strcmp(opt->headerDigest, "CRC32C") == 0) { + error = copyinstr(opt->headerDigest, buf, sizeof(buf), NULL); + if (error != 0) + return (error); + sdebug(2, "opt.headerDigest='%s'", buf); + if(strcmp(buf, "CRC32C") == 0) { sp->hdrDigest = (digest_t *)i_crc32c; sdebug(2, "opt.headerDigest set"); } } if(opt->dataDigest != NULL) { - sdebug(2, "opt.dataDigest='%s'", opt->headerDigest); - if(strcmp(opt->dataDigest, "CRC32C") == 0) { + error = copyinstr(opt->dataDigest, buf, sizeof(buf), NULL); + if (error != 0) + return (error); + sdebug(2, "opt.dataDigest='%s'", opt->dataDigest); + if(strcmp(buf, "CRC32C") == 0) { sp->dataDigest = (digest_t *)i_crc32c; sdebug(2, "opt.dataDigest set"); } From owner-svn-src-head@freebsd.org Mon Apr 27 21:44: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 CD9672C7865; Mon, 27 Apr 2020 21:44:02 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499yw24tFMz3FSb; Mon, 27 Apr 2020 21:44:02 +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 A2B7D1962F; Mon, 27 Apr 2020 21:44:02 +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 03RLi2LD000352; Mon, 27 Apr 2020 21:44:02 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RLi2F7000351; Mon, 27 Apr 2020 21:44:02 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <202004272144.03RLi2F7000351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 27 Apr 2020 21:44:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360396 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 360396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 21:44:02 -0000 Author: cperciva Date: Mon Apr 27 21:44:02 2020 New Revision: 360396 URL: https://svnweb.freebsd.org/changeset/base/360396 Log: Set use_nvd=0 in EC2 AMIs. FreeBSD is in the process of switching from nvd(4) to nda(4) as the disk device front-end to NVMe. Changing the default in the kernel is tricky since existing systems may have /dev/nvd* hard-coded e.g. in /etc/fstab; however, there's no reason to not change the default in HEAD for *new* systems. At present I have no intention of MFCing this to stable branches, since someone might reasonably expect scripts they use for launching and configuring FreeBSD 12.1 instances to work with FreeBSD 12.2 AMIs, for example. Reviewed by: gjb, imp Relnotes: NVMe disks in EC2 instances launched from 13.0 and later now show up as nda(4) devices. Differential Revision: https://reviews.freebsd.org/D24583 Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Mon Apr 27 21:41:00 2020 (r360395) +++ head/release/tools/ec2.conf Mon Apr 27 21:44:02 2020 (r360396) @@ -98,6 +98,10 @@ vm_extra_pre_umount() { # Load the kernel module for the Amazon "Elastic Network Adapter" echo 'if_ena_load="YES"' >> ${DESTDIR}/boot/loader.conf + # Use the "nda" driver for accessing NVMe disks rather than the + # historical "nvd" driver. + echo 'hw.nvme.use_nvd="0"' >> ${DESTDIR}/boot/loader.conf + # Disable ChallengeResponseAuthentication according to EC2 # requirements. sed -i '' -e \ From owner-svn-src-head@freebsd.org Mon Apr 27 21:51: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 A0F482C7A70; Mon, 27 Apr 2020 21:51:23 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499z4W3ghdz3FtL; Mon, 27 Apr 2020 21:51:23 +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 7972619795; Mon, 27 Apr 2020 21:51:23 +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 03RLpN4P002294; Mon, 27 Apr 2020 21:51:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RLpNLG002293; Mon, 27 Apr 2020 21:51:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004272151.03RLpNLG002293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 21:51:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360397 - in head/sys: conf riscv/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: conf riscv/conf X-SVN-Commit-Revision: 360397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 21:51:23 -0000 Author: jhb Date: Mon Apr 27 21:51:22 2020 New Revision: 360397 URL: https://svnweb.freebsd.org/changeset/base/360397 Log: Retire the GENERICSF kernel config. Now that hw.machine_arch handles soft-float vs hard-float there is no longer a reason for this config. Submitted by: mhorne (kern.mk hunk) Reviewed by: imp (earlier version), kp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24544 Deleted: head/sys/riscv/conf/GENERICSF Modified: head/sys/conf/Makefile.riscv head/sys/conf/kern.mk Modified: head/sys/conf/Makefile.riscv ============================================================================== --- head/sys/conf/Makefile.riscv Mon Apr 27 21:44:02 2020 (r360396) +++ head/sys/conf/Makefile.riscv Mon Apr 27 21:51:22 2020 (r360397) @@ -19,7 +19,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600017 +%VERSREQ= 600012 .if !defined(S) S= ../../.. Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Mon Apr 27 21:44:02 2020 (r360396) +++ head/sys/conf/kern.mk Mon Apr 27 21:51:22 2020 (r360397) @@ -150,11 +150,7 @@ INLINE_LIMIT?= 8000 # code model as "medium" and "medany" respectively. # .if ${MACHINE_CPUARCH} == "riscv" -.if ${MACHINE_ARCH:Mriscv*sf} -CFLAGS+= -march=rv64imac -.else CFLAGS+= -march=rv64imafdc -.endif CFLAGS+= -mabi=lp64 CFLAGS.clang+= -mcmodel=medium CFLAGS.gcc+= -mcmodel=medany From owner-svn-src-head@freebsd.org Mon Apr 27 22:02: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 24DB22C8067; Mon, 27 Apr 2020 22:02:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499zKd0C1Bz3GgM; Mon, 27 Apr 2020 22:02:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0219219A09; Mon, 27 Apr 2020 22:02:45 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RM2iU2012759; Mon, 27 Apr 2020 22:02:44 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RM2iR2012757; Mon, 27 Apr 2020 22:02:44 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202004272202.03RM2iR2012757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 27 Apr 2020 22:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360398 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 360398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 22:02:45 -0000 Author: erj Date: Mon Apr 27 22:02:44 2020 New Revision: 360398 URL: https://svnweb.freebsd.org/changeset/base/360398 Log: iflib: Stop interface before (un)registering VLAN This patch is intended to solve a specific problem that iavf(4) encounters, but what it does can be extended to solve other issues. To summarize the iavf(4) issue, if the PF driver configures VLAN anti-spoof, then the VF driver needs to make sure no untagged traffic is sent if a VLAN is configured, and vice-versa. This can be an issue when a VLAN is being registered or unregistered, e.g. when a packet may be on the ring with a VLAN in it, but the VLANs are being unregistered. This can cause that tagged packet to go out and cause an MDD event. To fix this, include a new interface-dependent function that drivers can implement named IFDI_NEEDS_RESTART(). Right now, this function is called in iflib_vlan_unregister/register() to determine whether the interface needs to be stopped and started when a VLAN is registered or unregistered. The default return value of IFDI_NEEDS_RESTART() is true, so this fixes the MDD problem that iavf(4) encounters, since the interface rings are flushed during a stop/init. A future change to iavf(4) will implement that function just in case the default value changes, and to make it explicit that this interface reset is required when a VLAN is added or removed. Reviewed by: gallatin@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22086 Modified: head/sys/net/ifdi_if.m head/sys/net/iflib.c head/sys/net/iflib.h Modified: head/sys/net/ifdi_if.m ============================================================================== --- head/sys/net/ifdi_if.m Mon Apr 27 21:51:22 2020 (r360397) +++ head/sys/net/ifdi_if.m Mon Apr 27 22:02:44 2020 (r360398) @@ -169,6 +169,12 @@ CODE { } return (0); } + + static bool + null_needs_restart(if_ctx_t _ctx __unused, enum iflib_restart_event _event __unused) + { + return (true); + } }; # @@ -456,3 +462,8 @@ METHOD int sysctl_int_delay { METHOD void debug { if_ctx_t _ctx; } DEFAULT null_void_op; + +METHOD bool needs_restart { + if_ctx_t _ctx; + enum iflib_restart_event _event; +} DEFAULT null_needs_restart; Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Mon Apr 27 21:51:22 2020 (r360397) +++ head/sys/net/iflib.c Mon Apr 27 22:02:44 2020 (r360398) @@ -4308,10 +4308,13 @@ iflib_vlan_register(void *arg, if_t ifp, uint16_t vtag return; CTX_LOCK(ctx); + /* Driver may need all untagged packets to be flushed */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_stop(ctx); IFDI_VLAN_REGISTER(ctx, vtag); - /* Re-init to load the changes */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - iflib_if_init_locked(ctx); + /* Re-init to load the changes, if required */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_init_locked(ctx); CTX_UNLOCK(ctx); } @@ -4327,10 +4330,13 @@ iflib_vlan_unregister(void *arg, if_t ifp, uint16_t vt return; CTX_LOCK(ctx); + /* Driver may need all tagged packets to be flushed */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_stop(ctx); IFDI_VLAN_UNREGISTER(ctx, vtag); - /* Re-init to load the changes */ - if (if_getcapenable(ifp) & IFCAP_VLAN_HWFILTER) - iflib_if_init_locked(ctx); + /* Re-init to load the changes, if required */ + if (IFDI_NEEDS_RESTART(ctx, IFLIB_RESTART_VLAN_CONFIG)) + iflib_init_locked(ctx); CTX_UNLOCK(ctx); } Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Mon Apr 27 21:51:22 2020 (r360397) +++ head/sys/net/iflib.h Mon Apr 27 22:02:44 2020 (r360398) @@ -377,6 +377,15 @@ typedef enum { #define IFLIB_SINGLE_IRQ_RX_ONLY 0x40000 /* + * These enum values are used in iflib_needs_restart to indicate to iflib + * functions whether or not the interface needs restarting when certain events + * happen. + */ +enum iflib_restart_event { + IFLIB_RESTART_VLAN_CONFIG, +}; + +/* * field accessors */ void *iflib_get_softc(if_ctx_t ctx); From owner-svn-src-head@freebsd.org Mon Apr 27 22:27:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48B172C8664; Mon, 27 Apr 2020 22:27:36 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499ztJ1Cc3z3HqN; Mon, 27 Apr 2020 22:27:36 +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 0AB5E19E03; Mon, 27 Apr 2020 22:27:36 +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 03RMRZkg025515; Mon, 27 Apr 2020 22:27:35 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RMRZOf025514; Mon, 27 Apr 2020 22:27:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004272227.03RMRZOf025514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 22:27:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360399 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 360399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 22:27:36 -0000 Author: jhb Date: Mon Apr 27 22:27:35 2020 New Revision: 360399 URL: https://svnweb.freebsd.org/changeset/base/360399 Log: Update the cached MSI state when any MSI capability register is written. bhyve uses cached copies of the MSI capability registers to generate MSI interrupts for device models. Previously, these cached fields were only set when the MSI capability control register was updated. The Linux kernel recently adopted a change to deal with races in MSI interrupt delivery that writes to the MSI capability address and data registers to alter the destination of MSI interrupts without writing to the MSI capability control register. bhyve was not updating its cached registers for these writes and continued to send interrupts with the old data value to the old address. Fix this by recomputing the cached values for every write to any MSI capability register. Reported by: Jason Tubnor, Ryan Moeller Reported by: Marc Dionne (bisected the Linux kernel commit) Reviewed by: grehan MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D24593 Modified: head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Mon Apr 27 22:02:44 2020 (r360398) +++ head/usr.sbin/bhyve/pci_emul.c Mon Apr 27 22:27:35 2020 (r360399) @@ -915,26 +915,26 @@ msicap_cfgwrite(struct pci_devinst *pi, int capoff, in msgctrl &= ~rwmask; msgctrl |= val & rwmask; val = msgctrl; + } + CFGWRITE(pi, offset, val, bytes); - addrlo = pci_get_cfgdata32(pi, capoff + 4); - if (msgctrl & PCIM_MSICTRL_64BIT) - msgdata = pci_get_cfgdata16(pi, capoff + 12); - else - msgdata = pci_get_cfgdata16(pi, capoff + 8); + msgctrl = pci_get_cfgdata16(pi, capoff + 2); + addrlo = pci_get_cfgdata32(pi, capoff + 4); + if (msgctrl & PCIM_MSICTRL_64BIT) + msgdata = pci_get_cfgdata16(pi, capoff + 12); + else + msgdata = pci_get_cfgdata16(pi, capoff + 8); - mme = msgctrl & PCIM_MSICTRL_MME_MASK; - pi->pi_msi.enabled = msgctrl & PCIM_MSICTRL_MSI_ENABLE ? 1 : 0; - if (pi->pi_msi.enabled) { - pi->pi_msi.addr = addrlo; - pi->pi_msi.msg_data = msgdata; - pi->pi_msi.maxmsgnum = 1 << (mme >> 4); - } else { - pi->pi_msi.maxmsgnum = 0; - } - pci_lintr_update(pi); + mme = msgctrl & PCIM_MSICTRL_MME_MASK; + pi->pi_msi.enabled = msgctrl & PCIM_MSICTRL_MSI_ENABLE ? 1 : 0; + if (pi->pi_msi.enabled) { + pi->pi_msi.addr = addrlo; + pi->pi_msi.msg_data = msgdata; + pi->pi_msi.maxmsgnum = 1 << (mme >> 4); + } else { + pi->pi_msi.maxmsgnum = 0; } - - CFGWRITE(pi, offset, val, bytes); + pci_lintr_update(pi); } void From owner-svn-src-head@freebsd.org Mon Apr 27 22:31: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 56F6E2C8AB4; Mon, 27 Apr 2020 22:31:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 499zz31gzXz3JS4; Mon, 27 Apr 2020 22:31:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34EDC19E91; Mon, 27 Apr 2020 22:31: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 03RMVhQJ028694; Mon, 27 Apr 2020 22:31:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RMVgeR028690; Mon, 27 Apr 2020 22:31:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004272231.03RMVgeR028690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 22:31:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360402 - in head/sys: kern netinet sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: kern netinet sys X-SVN-Commit-Revision: 360402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 22:31:43 -0000 Author: jhb Date: Mon Apr 27 22:31:42 2020 New Revision: 360402 URL: https://svnweb.freebsd.org/changeset/base/360402 Log: Add the initial sequence number to the TLS enable socket option. This will be needed for KTLS RX. Reviewed by: gallatin Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24451 Modified: head/sys/kern/uipc_ktls.c head/sys/netinet/tcp_usrreq.c head/sys/sys/ktls.h Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Mon Apr 27 22:29:24 2020 (r360401) +++ head/sys/kern/uipc_ktls.c Mon Apr 27 22:31:42 2020 (r360402) @@ -957,6 +957,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *e } SOCKBUF_LOCK(&so->so_snd); + so->so_snd.sb_tls_seqno = be64dec(en->rec_seq); so->so_snd.sb_tls_info = tls; if (tls->mode != TCP_TLS_MODE_SW) so->so_snd.sb_flags |= SB_TLS_IFNET; Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Mon Apr 27 22:29:24 2020 (r360401) +++ head/sys/netinet/tcp_usrreq.c Mon Apr 27 22:31:42 2020 (r360402) @@ -1823,6 +1823,37 @@ CTASSERT(TCP_CA_NAME_MAX <= TCP_LOG_ID_LEN); CTASSERT(TCP_LOG_REASON_LEN <= TCP_LOG_ID_LEN); #endif +#ifdef KERN_TLS +static int +copyin_tls_enable(struct sockopt *sopt, struct tls_enable *tls) +{ + struct tls_enable_v0 tls_v0; + int error; + + if (sopt->sopt_valsize == sizeof(tls_v0)) { + error = sooptcopyin(sopt, &tls_v0, sizeof(tls_v0), + sizeof(tls_v0)); + if (error) + return (error); + memset(tls, 0, sizeof(*tls)); + tls->cipher_key = tls_v0.cipher_key; + tls->iv = tls_v0.iv; + tls->auth_key = tls_v0.auth_key; + tls->cipher_algorithm = tls_v0.cipher_algorithm; + tls->cipher_key_len = tls_v0.cipher_key_len; + tls->iv_len = tls_v0.iv_len; + tls->auth_algorithm = tls_v0.auth_algorithm; + tls->auth_key_len = tls_v0.auth_key_len; + tls->flags = tls_v0.flags; + tls->tls_vmajor = tls_v0.tls_vmajor; + tls->tls_vminor = tls_v0.tls_vminor; + return (0); + } + + return (sooptcopyin(sopt, tls, sizeof(*tls), sizeof(*tls))); +} +#endif + int tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb *inp, struct tcpcb *tp) { @@ -2034,8 +2065,7 @@ unlock_and_done: #ifdef KERN_TLS case TCP_TXTLS_ENABLE: INP_WUNLOCK(inp); - error = sooptcopyin(sopt, &tls, sizeof(tls), - sizeof(tls)); + error = copyin_tls_enable(sopt, &tls); if (error) break; error = ktls_enable_tx(so, &tls); Modified: head/sys/sys/ktls.h ============================================================================== --- head/sys/sys/ktls.h Mon Apr 27 22:29:24 2020 (r360401) +++ head/sys/sys/ktls.h Mon Apr 27 22:31:42 2020 (r360402) @@ -99,6 +99,22 @@ struct tls_mac_data { #define TLS_MINOR_VER_THREE 4 /* 3, 4 */ /* For TCP_TXTLS_ENABLE */ +#ifdef _KERNEL +struct tls_enable_v0 { + const uint8_t *cipher_key; + const uint8_t *iv; /* Implicit IV. */ + const uint8_t *auth_key; + int cipher_algorithm; /* e.g. CRYPTO_AES_CBC */ + int cipher_key_len; + int iv_len; + int auth_algorithm; /* e.g. CRYPTO_SHA2_256_HMAC */ + int auth_key_len; + int flags; + uint8_t tls_vmajor; + uint8_t tls_vminor; +}; +#endif + struct tls_enable { const uint8_t *cipher_key; const uint8_t *iv; /* Implicit IV. */ @@ -111,6 +127,7 @@ struct tls_enable { int flags; uint8_t tls_vmajor; uint8_t tls_vminor; + uint8_t rec_seq[8]; }; struct tls_session_params { From owner-svn-src-head@freebsd.org Mon Apr 27 23:17: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 F39BA2C9E90; Mon, 27 Apr 2020 23:17:21 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B0zj6XkBz3MmW; Mon, 27 Apr 2020 23:17:21 +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 D71801A7D8; Mon, 27 Apr 2020 23:17:21 +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 03RNHL8i057379; Mon, 27 Apr 2020 23:17:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNHJ8G057366; Mon, 27 Apr 2020 23:17:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004272317.03RNHJ8G057366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 23:17:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360408 - in head: share/man/man4 sys/dev/cxgbe/tom sys/kern sys/netinet sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/cxgbe/tom sys/kern sys/netinet sys/sys X-SVN-Commit-Revision: 360408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:17:22 -0000 Author: jhb Date: Mon Apr 27 23:17:19 2020 New Revision: 360408 URL: https://svnweb.freebsd.org/changeset/base/360408 Log: Initial support for kernel offload of TLS receive. - Add a new TCP_RXTLS_ENABLE socket option to set the encryption and authentication algorithms and keys as well as the initial sequence number. - When reading from a socket using KTLS receive, applications must use recvmsg(). Each successful call to recvmsg() will return a single TLS record. A new TCP control message, TLS_GET_RECORD, will contain the TLS record header of the decrypted record. The regular message buffer passed to recvmsg() will receive the decrypted payload. This is similar to the interface used by Linux's KTLS RX except that Linux does not return the full TLS header in the control message. - Add plumbing to the TOE KTLS interface to request either transmit or receive KTLS sessions. - When a socket is using receive KTLS, redirect reads from soreceive_stream() into soreceive_generic(). - Note that this interface is currently only defined for TLS 1.1 and 1.2, though I believe we will be able to reuse the same interface and structures for 1.3. Modified: head/share/man/man4/tcp.4 head/sys/dev/cxgbe/tom/t4_tom.c head/sys/kern/uipc_ktls.c head/sys/kern/uipc_socket.c head/sys/netinet/tcp.h head/sys/netinet/tcp_offload.c head/sys/netinet/tcp_offload.h head/sys/netinet/tcp_usrreq.c head/sys/netinet/toecore.c head/sys/netinet/toecore.h head/sys/sys/ktls.h Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Mon Apr 27 22:50:08 2020 (r360407) +++ head/share/man/man4/tcp.4 Mon Apr 27 23:17:19 2020 (r360408) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 16, 2020 +.Dd April 27, 2020 .Dt TCP 4 .Os .Sh NAME @@ -319,14 +319,11 @@ control message. The payload of this control message is a single byte holding the desired TLS record type. .Pp -Data read from this socket will still be encrypted and must be parsed by -a TLS-aware consumer. -.Pp -At present, only a single key may be set on a socket. +At present, only a single transmit key may be set on a socket. As such, users of this option must disable rekeying. .It Dv TCP_TXTLS_MODE -The integer argument can be used to get or set the current TLS mode of a -socket. +The integer argument can be used to get or set the current TLS transmit mode +of a socket. Setting the mode can only used to toggle between software and NIC TLS after TLS has been initially enabled via the .Dv TCP_TXTLS_ENABLE @@ -344,6 +341,33 @@ TLS records are encrypted by the network interface car .It Dv TCP_TLS_MODE_TOE TLS records are encrypted by the NIC using a TCP offload engine (TOE). .El +.It Dv TCP_RXTLS_ENABLE +Enable in-kernel TLS for data read from this socket. +The +.Vt struct tls_so_enable +argument defines the encryption and authentication algorithms and keys +used to decrypt the socket data. +.Pp +Each received TLS record must be read from the socket using +.Xr recvmsg 2 . +Each received TLS record will contain a +.Dv TLS_GET_RECORD +control message along with the decrypted payload. +The control message contains a +.Vt struct tls_get_record +which includes fields from the TLS record header. +If a corrupted TLS record is received, +recvmsg 2 +will fail with +.Dv EBADMSG . +.Pp +At present, only a single receive key may be set on a socket. +As such, users of this option must disable rekeying. +.It Dv TCP_RXTLS_MODE +The integer argument can be used to get the current TLS receive mode +of a socket. +The available modes are the same as for +.Dv TCP_TXTLS_MODE . .El .Pp The option level for the Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 27 23:17:19 2020 (r360408) @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KERN_TLS +#include +#endif #include #include #include @@ -814,12 +817,15 @@ t4_tcp_info(struct toedev *tod, struct tcpcb *tp, stru #ifdef KERN_TLS static int t4_alloc_tls_session(struct toedev *tod, struct tcpcb *tp, - struct ktls_session *tls) + struct ktls_session *tls, int direction) { struct toepcb *toep = tp->t_toe; INP_WLOCK_ASSERT(tp->t_inpcb); MPASS(tls != NULL); + + if (direction != KTLS_TX) + return (EOPNOTSUPP); return (tls_alloc_ktls(toep, tls)); } Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/kern/uipc_ktls.c Mon Apr 27 23:17:19 2020 (r360408) @@ -702,7 +702,7 @@ ktls_cleanup(struct ktls_session *tls) #ifdef TCP_OFFLOAD static int -ktls_try_toe(struct socket *so, struct ktls_session *tls) +ktls_try_toe(struct socket *so, struct ktls_session *tls, int direction) { struct inpcb *inp; struct tcpcb *tp; @@ -728,7 +728,7 @@ ktls_try_toe(struct socket *so, struct ktls_session *t return (EOPNOTSUPP); } - error = tcp_offload_alloc_tls_session(tp, tls); + error = tcp_offload_alloc_tls_session(tp, tls, direction); INP_WUNLOCK(inp); if (error == 0) { tls->mode = TCP_TLS_MODE_TOE; @@ -901,6 +901,60 @@ ktls_try_sw(struct socket *so, struct ktls_session *tl } int +ktls_enable_rx(struct socket *so, struct tls_enable *en) +{ + struct ktls_session *tls; + int error; + + if (!ktls_offload_enable) + return (ENOTSUP); + + counter_u64_add(ktls_offload_enable_calls, 1); + + /* + * This should always be true since only the TCP socket option + * invokes this function. + */ + if (so->so_proto->pr_protocol != IPPROTO_TCP) + return (EINVAL); + + /* + * XXX: Don't overwrite existing sessions. We should permit + * this to support rekeying in the future. + */ + if (so->so_rcv.sb_tls_info != NULL) + return (EALREADY); + + if (en->cipher_algorithm == CRYPTO_AES_CBC && !ktls_cbc_enable) + return (ENOTSUP); + + error = ktls_create_session(so, en, &tls); + if (error) + return (error); + + /* TLS RX offload is only supported on TOE currently. */ +#ifdef TCP_OFFLOAD + error = ktls_try_toe(so, tls, KTLS_RX); +#else + error = EOPNOTSUPP; +#endif + + if (error) { + ktls_cleanup(tls); + return (error); + } + + /* Mark the socket as using TLS offload. */ + SOCKBUF_LOCK(&so->so_rcv); + so->so_rcv.sb_tls_info = tls; + SOCKBUF_UNLOCK(&so->so_rcv); + + counter_u64_add(ktls_offload_total, 1); + + return (0); +} + +int ktls_enable_tx(struct socket *so, struct tls_enable *en) { struct ktls_session *tls; @@ -938,7 +992,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *e /* Prefer TOE -> ifnet TLS -> software TLS. */ #ifdef TCP_OFFLOAD - error = ktls_try_toe(so, tls); + error = ktls_try_toe(so, tls, KTLS_TX); if (error) #endif error = ktls_try_ifnet(so, tls, false); @@ -967,6 +1021,25 @@ ktls_enable_tx(struct socket *so, struct tls_enable *e counter_u64_add(ktls_offload_total, 1); return (0); +} + +int +ktls_get_rx_mode(struct socket *so) +{ + struct ktls_session *tls; + struct inpcb *inp; + int mode; + + inp = so->so_pcb; + INP_WLOCK_ASSERT(inp); + SOCKBUF_LOCK(&so->so_rcv); + tls = so->so_rcv.sb_tls_info; + if (tls == NULL) + mode = TCP_TLS_MODE_NONE; + else + mode = tls->mode; + SOCKBUF_UNLOCK(&so->so_rcv); + return (mode); } int Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/kern/uipc_socket.c Mon Apr 27 23:17:19 2020 (r360408) @@ -2372,11 +2372,33 @@ soreceive_stream(struct socket *so, struct sockaddr ** sb = &so->so_rcv; +#ifdef KERN_TLS + /* + * KTLS store TLS records as records with a control message to + * describe the framing. + * + * We check once here before acquiring locks to optimize the + * common case. + */ + if (sb->sb_tls_info != NULL) + return (soreceive_generic(so, psa, uio, mp0, controlp, + flagsp)); +#endif + /* Prevent other readers from entering the socket. */ error = sblock(sb, SBLOCKWAIT(flags)); if (error) return (error); SOCKBUF_LOCK(sb); + +#ifdef KERN_TLS + if (sb->sb_tls_info != NULL) { + SOCKBUF_UNLOCK(sb); + sbunlock(sb); + return (soreceive_generic(so, psa, uio, mp0, controlp, + flagsp)); + } +#endif /* Easy one, no space to copyout anything. */ if (uio->uio_resid == 0) { Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/netinet/tcp.h Mon Apr 27 23:17:19 2020 (r360408) @@ -178,6 +178,8 @@ struct tcphdr { device */ #define TCP_TXTLS_ENABLE 39 /* TLS framing and encryption for transmit */ #define TCP_TXTLS_MODE 40 /* Transmit TLS mode */ +#define TCP_RXTLS_ENABLE 41 /* TLS framing and encryption for receive */ +#define TCP_RXTLS_MODE 42 /* Receive TLS mode */ #define TCP_CONGESTION 64 /* get/set congestion control algorithm */ #define TCP_CCALGOOPT 65 /* get/set cc algorithm specific options */ #define TCP_DELACK 72 /* socket option for delayed ack */ @@ -388,6 +390,7 @@ struct tcp_function_set { * TCP Control message types */ #define TLS_SET_RECORD_TYPE 1 +#define TLS_GET_RECORD 2 /* * TCP specific variables of interest for tp->t_stats stats(9) accounting. Modified: head/sys/netinet/tcp_offload.c ============================================================================== --- head/sys/netinet/tcp_offload.c Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/netinet/tcp_offload.c Mon Apr 27 23:17:19 2020 (r360408) @@ -198,14 +198,15 @@ tcp_offload_tcp_info(struct tcpcb *tp, struct tcp_info } int -tcp_offload_alloc_tls_session(struct tcpcb *tp, struct ktls_session *tls) +tcp_offload_alloc_tls_session(struct tcpcb *tp, struct ktls_session *tls, + int direction) { struct toedev *tod = tp->tod; KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); INP_WLOCK_ASSERT(tp->t_inpcb); - return (tod->tod_alloc_tls_session(tod, tp, tls)); + return (tod->tod_alloc_tls_session(tod, tp, tls, direction)); } void Modified: head/sys/netinet/tcp_offload.h ============================================================================== --- head/sys/netinet/tcp_offload.h Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/netinet/tcp_offload.h Mon Apr 27 23:17:19 2020 (r360408) @@ -46,7 +46,7 @@ int tcp_offload_output(struct tcpcb *); void tcp_offload_rcvd(struct tcpcb *); void tcp_offload_ctloutput(struct tcpcb *, int, int); void tcp_offload_tcp_info(struct tcpcb *, struct tcp_info *); -int tcp_offload_alloc_tls_session(struct tcpcb *, struct ktls_session *); +int tcp_offload_alloc_tls_session(struct tcpcb *, struct ktls_session *, int); void tcp_offload_detach(struct tcpcb *); #endif Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/netinet/tcp_usrreq.c Mon Apr 27 23:17:19 2020 (r360408) @@ -2080,6 +2080,14 @@ unlock_and_done: error = ktls_set_tx_mode(so, ui); INP_WUNLOCK(inp); break; + case TCP_RXTLS_ENABLE: + INP_WUNLOCK(inp); + error = sooptcopyin(sopt, &tls, sizeof(tls), + sizeof(tls)); + if (error) + break; + error = ktls_enable_rx(so, &tls); + break; #endif case TCP_KEEPIDLE: @@ -2415,6 +2423,11 @@ unhold: #ifdef KERN_TLS case TCP_TXTLS_MODE: optval = ktls_get_tx_mode(so); + INP_WUNLOCK(inp); + error = sooptcopyout(sopt, &optval, sizeof(optval)); + break; + case TCP_RXTLS_MODE: + optval = ktls_get_rx_mode(so); INP_WUNLOCK(inp); error = sooptcopyout(sopt, &optval, sizeof(optval)); break; Modified: head/sys/netinet/toecore.c ============================================================================== --- head/sys/netinet/toecore.c Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/netinet/toecore.c Mon Apr 27 23:17:19 2020 (r360408) @@ -193,7 +193,7 @@ toedev_tcp_info(struct toedev *tod __unused, struct tc static int toedev_alloc_tls_session(struct toedev *tod __unused, struct tcpcb *tp __unused, - struct ktls_session *tls __unused) + struct ktls_session *tls __unused, int direction __unused) { return (EINVAL); Modified: head/sys/netinet/toecore.h ============================================================================== --- head/sys/netinet/toecore.h Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/netinet/toecore.h Mon Apr 27 23:17:19 2020 (r360408) @@ -113,7 +113,7 @@ struct toedev { /* Create a TLS session */ int (*tod_alloc_tls_session)(struct toedev *, struct tcpcb *, - struct ktls_session *); + struct ktls_session *, int); }; typedef void (*tcp_offload_listen_start_fn)(void *, struct tcpcb *); Modified: head/sys/sys/ktls.h ============================================================================== --- head/sys/sys/ktls.h Mon Apr 27 22:50:08 2020 (r360407) +++ head/sys/sys/ktls.h Mon Apr 27 23:17:19 2020 (r360408) @@ -98,7 +98,7 @@ struct tls_mac_data { #define TLS_MINOR_VER_TWO 3 /* 3, 3 */ #define TLS_MINOR_VER_THREE 4 /* 3, 4 */ -/* For TCP_TXTLS_ENABLE */ +/* For TCP_TXTLS_ENABLE and TCP_RXTLS_ENABLE. */ #ifdef _KERNEL struct tls_enable_v0 { const uint8_t *cipher_key; @@ -130,6 +130,17 @@ struct tls_enable { uint8_t rec_seq[8]; }; +/* Structure for TLS_GET_RECORD. */ +struct tls_get_record { + /* TLS record header. */ + uint8_t tls_type; + uint8_t tls_vmajor; + uint8_t tls_vminor; + uint16_t tls_length; +}; + +#ifdef _KERNEL + struct tls_session_params { uint8_t *cipher_key; uint8_t *auth_key; @@ -148,7 +159,9 @@ struct tls_session_params { uint8_t flags; }; -#ifdef _KERNEL +/* Used in APIs to request RX vs TX sessions. */ +#define KTLS_TX 1 +#define KTLS_RX 2 #define KTLS_API_VERSION 6 @@ -192,6 +205,7 @@ struct ktls_session { int ktls_crypto_backend_register(struct ktls_crypto_backend *be); int ktls_crypto_backend_deregister(struct ktls_crypto_backend *be); +int ktls_enable_rx(struct socket *so, struct tls_enable *en); int ktls_enable_tx(struct socket *so, struct tls_enable *en); void ktls_destroy(struct ktls_session *tls); void ktls_frame(struct mbuf *m, struct ktls_session *tls, int *enqueue_cnt, @@ -199,6 +213,7 @@ void ktls_frame(struct mbuf *m, struct ktls_session *t void ktls_seq(struct sockbuf *sb, struct mbuf *m); void ktls_enqueue(struct mbuf *m, struct socket *so, int page_count); void ktls_enqueue_to_free(struct mbuf_ext_pgs *pgs); +int ktls_get_rx_mode(struct socket *so); int ktls_set_tx_mode(struct socket *so, int mode); int ktls_get_tx_mode(struct socket *so); int ktls_output_eagain(struct inpcb *inp, struct ktls_session *tls); From owner-svn-src-head@freebsd.org Mon Apr 27 23:39: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 49F8F2CA529; Mon, 27 Apr 2020 23:39:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1TK1Cdpz3Npm; Mon, 27 Apr 2020 23:39:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24F2A1ABAA; Mon, 27 Apr 2020 23:39:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RNdXiV069688; Mon, 27 Apr 2020 23:39:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNdX1P069687; Mon, 27 Apr 2020 23:39:33 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004272339.03RNdX1P069687@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 27 Apr 2020 23:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360409 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 360409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:39:33 -0000 Author: imp Date: Mon Apr 27 23:39:32 2020 New Revision: 360409 URL: https://svnweb.freebsd.org/changeset/base/360409 Log: Change the flags back to an enum This was changed in the review process for the flags sysctl. The reasons for the change are no longer valid as the code changed after that. Cast the one place where it might make a difference (but I don't think it does). This restores the ability to see flags for softc in gdb. Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Apr 27 23:17:19 2020 (r360408) +++ head/sys/cam/scsi/scsi_da.c Mon Apr 27 23:39:32 2020 (r360409) @@ -342,7 +342,7 @@ struct da_softc { LIST_HEAD(, ccb_hdr) pending_ccbs; int refcount; /* Active xpt_action() calls */ da_state state; - u_int flags; + da_flags flags; da_quirks quirks; int minimum_cmd_size; int error_inject; @@ -2646,7 +2646,7 @@ daflagssysctl(SYSCTL_HANDLER_ARGS) sbuf_new_for_sysctl(&sbuf, NULL, 0, req); if (softc->flags != 0) - sbuf_printf(&sbuf, "0x%b", softc->flags, DA_FLAG_STRING); + sbuf_printf(&sbuf, "0x%b", (unsigned)softc->flags, DA_FLAG_STRING); else sbuf_printf(&sbuf, "0"); error = sbuf_finish(&sbuf); From owner-svn-src-head@freebsd.org Mon Apr 27 23:43: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 9D74C2CA722; Mon, 27 Apr 2020 23:43:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1YN3hpsz3PCX; Mon, 27 Apr 2020 23:43:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A2181AD82; Mon, 27 Apr 2020 23:43:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RNh4a5075561; Mon, 27 Apr 2020 23:43:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNh425075560; Mon, 27 Apr 2020 23:43:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004272343.03RNh425075560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 27 Apr 2020 23:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360410 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 360410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:43:04 -0000 Author: imp Date: Mon Apr 27 23:43:04 2020 New Revision: 360410 URL: https://svnweb.freebsd.org/changeset/base/360410 Log: Add flags sysctl to ada Report the ada device flags like we do the da devices. No booleans have (yet) been converted, but iomapped and rotating are planned. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon Apr 27 23:39:32 2020 (r360409) +++ head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:04 2020 (r360410) @@ -111,6 +111,31 @@ typedef enum { ADA_FLAG_CAN_NCQ_TRIM = 0x00400000, /* CAN_TRIM also set */ ADA_FLAG_PIM_ATA_EXT = 0x00800000 } ada_flags; +#define ADA_FLAG_STRING \ + "\020" \ + "\002CAN_48BIT" \ + "\003CAN_FLUSHCACHE" \ + "\004CAN_NCQ" \ + "\005CAN_DMA" \ + "\006NEED_OTAG" \ + "\007WAS_OTAG" \ + "\010CAN_TRIM" \ + "\011OPEN" \ + "\012SCTX_INIT" \ + "\013CAN_CFA" \ + "\014CAN_POWERMGT" \ + "\015CAN_DMA48" \ + "\016CAN_LOG" \ + "\017CAN_IDLOG" \ + "\020CAN_SUPCAP" \ + "\021CAN_ZONE" \ + "\022CAN_WCACHE" \ + "\023CAN_RAHEAD" \ + "\024PROBED" \ + "\025ANNOUNCED" \ + "\026DIRTY" \ + "\027CAN_NCQ_TRIM" \ + "\030PIM_ATA_EXT" typedef enum { ADA_Q_NONE = 0x00, @@ -806,8 +831,9 @@ static periph_oninv_t adaoninvalidate; static periph_dtor_t adacleanup; static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); -static int adazonemodesysctl(SYSCTL_HANDLER_ARGS); +static int adaflagssysctl(SYSCTL_HANDLER_ARGS); static int adazonesupsysctl(SYSCTL_HANDLER_ARGS); +static int adazonesupsysctl(SYSCTL_HANDLER_ARGS); static void adasysctlinit(void *context, int pending); static int adagetattr(struct bio *bp); static void adasetflags(struct ada_softc *softc, @@ -1518,6 +1544,10 @@ adasysctlinit(void *context, int pending) SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "max_seq_zones", CTLFLAG_RD, &softc->max_seq_zones, "Maximum Number of Open Sequential Write Required Zones"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + softc, 0, adaflagssysctl, "A", + "Flags for drive"); #ifdef CAM_TEST_FAILURE /* @@ -1624,6 +1654,24 @@ adadeletemethodsysctl(SYSCTL_HANDLER_ARGS) return (0); } return (EINVAL); +} + +static int +adaflagssysctl(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sbuf; + struct ada_softc *softc = arg1; + int error; + + sbuf_new_for_sysctl(&sbuf, NULL, 0, req); + if (softc->flags != 0) + sbuf_printf(&sbuf, "0x%b", (unsigned)softc->flags, ADA_FLAG_STRING); + else + sbuf_printf(&sbuf, "0"); + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + + return (error); } static void From owner-svn-src-head@freebsd.org Mon Apr 27 23: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 817552CA746; Mon, 27 Apr 2020 23:43:11 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1YV1TBCz3PGn; Mon, 27 Apr 2020 23:43:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 646B81AD83; Mon, 27 Apr 2020 23:43:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RNh9ug075621; Mon, 27 Apr 2020 23:43:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNh9QS075620; Mon, 27 Apr 2020 23:43:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004272343.03RNh9QS075620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 27 Apr 2020 23:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360411 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 360411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:43:13 -0000 Author: imp Date: Mon Apr 27 23:43:08 2020 New Revision: 360411 URL: https://svnweb.freebsd.org/changeset/base/360411 Log: Convert unmappedio over to a flag. Make unmappedio a flag. Move it to the flags definition. Add compat sysctl for it. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:04 2020 (r360410) +++ head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:08 2020 (r360411) @@ -109,7 +109,8 @@ typedef enum { ADA_FLAG_ANNOUNCED = 0x00100000, ADA_FLAG_DIRTY = 0x00200000, ADA_FLAG_CAN_NCQ_TRIM = 0x00400000, /* CAN_TRIM also set */ - ADA_FLAG_PIM_ATA_EXT = 0x00800000 + ADA_FLAG_PIM_ATA_EXT = 0x00800000, + ADA_FLAG_UNMAPPEDIO = 0x01000000 } ada_flags; #define ADA_FLAG_STRING \ "\020" \ @@ -135,7 +136,8 @@ typedef enum { "\025ANNOUNCED" \ "\026DIRTY" \ "\027CAN_NCQ_TRIM" \ - "\030PIM_ATA_EXT" + "\030PIM_ATA_EXT" \ + "\031UNMAPPEDIO" typedef enum { ADA_Q_NONE = 0x00, @@ -264,7 +266,6 @@ struct ada_softc { int trim_max_ranges; int read_ahead; int write_cache; - int unmappedio; int rotating; #ifdef CAM_TEST_FAILURE int force_read_error; @@ -831,6 +832,7 @@ static periph_oninv_t adaoninvalidate; static periph_dtor_t adacleanup; static void adaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); +static int adabitsysctl(SYSCTL_HANDLER_ARGS); static int adaflagssysctl(SYSCTL_HANDLER_ARGS); static int adazonesupsysctl(SYSCTL_HANDLER_ARGS); static int adazonesupsysctl(SYSCTL_HANDLER_ARGS); @@ -1515,9 +1517,6 @@ adasysctlinit(void *context, int pending) OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "unmapped_io", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->unmappedio, 0, "Unmapped I/O leaf"); - SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "rotating", CTLFLAG_RD | CTLFLAG_MPSAFE, &softc->rotating, 0, "Rotating media"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), @@ -1548,6 +1547,10 @@ adasysctlinit(void *context, int pending) OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, softc, 0, adaflagssysctl, "A", "Flags for drive"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + &softc->flags, (u_int)ADA_FLAG_UNMAPPEDIO, adabitsysctl, "I", + "Unmapped I/O support *DEPRECATED* gone in FreeBSD 14"); #ifdef CAM_TEST_FAILURE /* @@ -1657,6 +1660,21 @@ adadeletemethodsysctl(SYSCTL_HANDLER_ARGS) } static int +adabitsysctl(SYSCTL_HANDLER_ARGS) +{ + u_int *flags = arg1; + u_int test = arg2; + int tmpout, error; + + tmpout = !!(*flags & test); + error = SYSCTL_OUT(req, &tmpout, sizeof(tmpout)); + if (error || !req->newptr) + return (error); + + return (EPERM); +} + +static int adaflagssysctl(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; @@ -3459,7 +3477,7 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev softc->disk->d_delmaxsize = maxio; if ((softc->cpi.hba_misc & PIM_UNMAPPED) != 0) { d_flags |= DISKFLAG_UNMAPPED_BIO; - softc->unmappedio = 1; + softc->flags |= ADA_FLAG_UNMAPPEDIO; } softc->disk->d_flags = d_flags; strlcpy(softc->disk->d_descr, cgd->ident_data.model, From owner-svn-src-head@freebsd.org Mon Apr 27 23:43: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 A02112CA750; Mon, 27 Apr 2020 23:43:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1YY3XRKz3PK7; Mon, 27 Apr 2020 23:43:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 677D41AD84; Mon, 27 Apr 2020 23:43:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RNhDW7075677; Mon, 27 Apr 2020 23:43:13 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNhDj4075676; Mon, 27 Apr 2020 23:43:13 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004272343.03RNhDj4075676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 27 Apr 2020 23:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360412 - head/sys/cam/ata X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/ata X-SVN-Commit-Revision: 360412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:43:13 -0000 Author: imp Date: Mon Apr 27 23:43:12 2020 New Revision: 360412 URL: https://svnweb.freebsd.org/changeset/base/360412 Log: Convert rotating to a flag bit. Move rotating to a flag bit. Add bit definitions for it. Create a compat sysctl for it. Modified: head/sys/cam/ata/ata_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:08 2020 (r360411) +++ head/sys/cam/ata/ata_da.c Mon Apr 27 23:43:12 2020 (r360412) @@ -110,7 +110,8 @@ typedef enum { ADA_FLAG_DIRTY = 0x00200000, ADA_FLAG_CAN_NCQ_TRIM = 0x00400000, /* CAN_TRIM also set */ ADA_FLAG_PIM_ATA_EXT = 0x00800000, - ADA_FLAG_UNMAPPEDIO = 0x01000000 + ADA_FLAG_UNMAPPEDIO = 0x01000000, + ADA_FLAG_ROTATING = 0x02000000 } ada_flags; #define ADA_FLAG_STRING \ "\020" \ @@ -137,7 +138,8 @@ typedef enum { "\026DIRTY" \ "\027CAN_NCQ_TRIM" \ "\030PIM_ATA_EXT" \ - "\031UNMAPPEDIO" + "\031UNMAPPEDIO" \ + "\032ROTATING" typedef enum { ADA_Q_NONE = 0x00, @@ -266,7 +268,6 @@ struct ada_softc { int trim_max_ranges; int read_ahead; int write_cache; - int rotating; #ifdef CAM_TEST_FAILURE int force_read_error; int force_write_error; @@ -1516,9 +1517,6 @@ adasysctlinit(void *context, int pending) SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE, &softc->write_cache, 0, "Enable disk write cache."); - SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "rotating", CTLFLAG_RD | CTLFLAG_MPSAFE, - &softc->rotating, 0, "Rotating media"); SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "zone_mode", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, @@ -1551,6 +1549,10 @@ adasysctlinit(void *context, int pending) OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &softc->flags, (u_int)ADA_FLAG_UNMAPPEDIO, adabitsysctl, "I", "Unmapped I/O support *DEPRECATED* gone in FreeBSD 14"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "rotating", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, + &softc->flags, (u_int)ADA_FLAG_ROTATING, adabitsysctl, "I", + "Rotating media *DEPRECATED* gone in FreeBSD 14"); #ifdef CAM_TEST_FAILURE /* @@ -1873,11 +1875,12 @@ adaregister(struct cam_periph *periph, void *arg) /* Disable queue sorting for non-rotational media by default. */ if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) { - softc->rotating = 0; + softc->flags &= ~ADA_FLAG_ROTATING; } else { - softc->rotating = 1; + softc->flags |= ADA_FLAG_ROTATING; } - cam_iosched_set_sort_queue(softc->cam_iosched, softc->rotating ? -1 : 0); + cam_iosched_set_sort_queue(softc->cam_iosched, + (softc->flags & ADA_FLAG_ROTATING) ? -1 : 0); softc->disk = disk_alloc(); adasetgeom(softc, cgd); softc->disk->d_devstat = devstat_new_entry(periph->periph_name, From owner-svn-src-head@freebsd.org Mon Apr 27 23:43:18 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E55742CA7B4; Mon, 27 Apr 2020 23:43:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1Yf3Rh5z3PN5; Mon, 27 Apr 2020 23:43:18 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 752D01AD85; Mon, 27 Apr 2020 23:43:17 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RNhHj0075731; Mon, 27 Apr 2020 23:43:17 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNhHW7075730; Mon, 27 Apr 2020 23:43:17 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004272343.03RNhHW7075730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 27 Apr 2020 23:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360413 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 360413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:43:20 -0000 Author: imp Date: Mon Apr 27 23:43:17 2020 New Revision: 360413 URL: https://svnweb.freebsd.org/changeset/base/360413 Log: Export the nda device's flags as a sysctl. Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Mon Apr 27 23:43:12 2020 (r360412) +++ head/sys/cam/nvme/nvme_da.c Mon Apr 27 23:43:17 2020 (r360413) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #endif /* _KERNEL */ @@ -75,6 +76,11 @@ typedef enum { NDA_FLAG_DIRTY = 0x0002, NDA_FLAG_SCTX_INIT = 0x0004, } nda_flags; +#define NDA_FLAG_STRING \ + "\020" \ + "\001OPEN" \ + "\002DIRTY" \ + "\003SCTX_INIT" typedef enum { NDA_Q_4K = 0x01, @@ -144,6 +150,7 @@ static periph_init_t ndainit; static void ndaasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg); static void ndasysctlinit(void *context, int pending); +static int ndaflagssysctl(SYSCTL_HANDLER_ARGS); static periph_ctor_t ndaregister; static periph_dtor_t ndacleanup; static periph_start_t ndastart; @@ -659,6 +666,11 @@ ndasysctlinit(void *context, int pending) OID_AUTO, "rotating", CTLFLAG_RD, &nda_rotating_media, 1, "Rotating media"); + SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), + OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + softc, 0, ndaflagssysctl, "A", + "Flags for drive"); + #ifdef CAM_IO_STATS softc->sysctl_stats_tree = SYSCTL_ADD_NODE(&softc->sysctl_stats_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), OID_AUTO, "stats", @@ -696,6 +708,24 @@ ndasysctlinit(void *context, int pending) softc->sysctl_tree); cam_periph_release(periph); +} + +static int +ndaflagssysctl(SYSCTL_HANDLER_ARGS) +{ + struct sbuf sbuf; + struct nda_softc *softc = arg1; + int error; + + sbuf_new_for_sysctl(&sbuf, NULL, 0, req); + if (softc->flags != 0) + sbuf_printf(&sbuf, "0x%b", (unsigned)softc->flags, NDA_FLAG_STRING); + else + sbuf_printf(&sbuf, "0"); + error = sbuf_finish(&sbuf); + sbuf_delete(&sbuf); + + return (error); } static int From owner-svn-src-head@freebsd.org Mon Apr 27 23:55: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 9A0B92CADA2; Mon, 27 Apr 2020 23:55:10 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1qL3RGVz3Qbg; Mon, 27 Apr 2020 23:55:10 +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 6CDBE1AFB9; Mon, 27 Apr 2020 23:55:10 +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 03RNtAKe082948; Mon, 27 Apr 2020 23:55:10 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNtADW082947; Mon, 27 Apr 2020 23:55:10 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202004272355.03RNtADW082947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 27 Apr 2020 23:55:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360416 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:55:10 -0000 Author: rmacklem Date: Mon Apr 27 23:55:09 2020 New Revision: 360416 URL: https://svnweb.freebsd.org/changeset/base/360416 Log: Fix sosend_generic() so that it can handle a list of ext_pgs mbufs. Without this patch, sosend_generic() will try to use top->m_pkthdr.len, assuming that the first mbuf has a pkthdr. When a list of ext_pgs mbufs is passed in, the first mbuf is not a pkthdr and cannot be post-r359919. As such, the value of top->m_pkthdr.len is bogus (0 for my testing). This patch fixes sosend_generic() to handle this case, calculating the total length via m_length() for this case. There is currently nothing that hands a list of ext_pgs mbufs to sosend_generic(), but the nfs-over-tls kernel RPC code in projects/nfs-over-tls will do that and was used to test this patch. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24568 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Mon Apr 27 23:49:13 2020 (r360415) +++ head/sys/kern/uipc_socket.c Mon Apr 27 23:55:09 2020 (r360416) @@ -1557,8 +1557,10 @@ sosend_generic(struct socket *so, struct sockaddr *add #endif if (uio != NULL) resid = uio->uio_resid; - else + else if ((top->m_flags & M_PKTHDR) != 0) resid = top->m_pkthdr.len; + else + resid = m_length(top, NULL); /* * In theory resid should be unsigned. However, space must be * signed, as it might be less than 0 if we over-committed, and we From owner-svn-src-head@freebsd.org Mon Apr 27 23:59: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 F152F2CB0C1; Mon, 27 Apr 2020 23:59:42 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B1wZ6YKKz3Qpc; Mon, 27 Apr 2020 23:59:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D60241AFBD; Mon, 27 Apr 2020 23:59:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03RNxgwX083177; Mon, 27 Apr 2020 23:59:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03RNxggs083175; Mon, 27 Apr 2020 23:59:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004272359.03RNxggs083175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 27 Apr 2020 23:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360417 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 360417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 23:59:43 -0000 Author: jhb Date: Mon Apr 27 23:59:42 2020 New Revision: 360417 URL: https://svnweb.freebsd.org/changeset/base/360417 Log: Add support for KTLS RX over TOE to T6. This largely reuses the TLS TOE support added in r330884. However, this uses the KTLS framework in upstream OpenSSL rather than requiring Chelsio-specific patches to OpenSSL. As with the existing TLS TOE support, use of RX offload requires setting the tls_rx_ports sysctl. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24453 Modified: head/sys/dev/cxgbe/tom/t4_tls.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Mon Apr 27 23:55:09 2020 (r360416) +++ head/sys/dev/cxgbe/tom/t4_tls.c Mon Apr 27 23:59:42 2020 (r360417) @@ -379,7 +379,7 @@ prepare_rxkey_wr(struct tls_keyctx *kwr, struct tls_ke int proto_ver = kctx->proto_ver; kwr->u.rxhdr.flitcnt_hmacctrl = - ((kctx->tx_key_info_size >> 4) << 3) | kctx->hmac_ctrl; + ((kctx->rx_key_info_size >> 4) << 3) | kctx->hmac_ctrl; kwr->u.rxhdr.protover_ciphmode = V_TLS_KEYCTX_TX_WR_PROTOVER(get_proto_ver(proto_ver)) | @@ -408,7 +408,7 @@ prepare_rxkey_wr(struct tls_keyctx *kwr, struct tls_ke (IPAD_SIZE + OPAD_SIZE)); } else { memcpy(kwr->keys.edkey, kctx->rx.key, - (kctx->tx_key_info_size - SALT_SIZE)); + (kctx->rx_key_info_size - SALT_SIZE)); memcpy(kwr->u.rxhdr.rxsalt, kctx->rx.salt, SALT_SIZE); } } @@ -674,6 +674,13 @@ program_key_context(struct tcpcb *tp, struct toepcb *t if ((G_KEY_GET_LOC(k_ctx->l_p_key) == KEY_WRITE_RX) || (tls_ofld->key_location == TLS_SFO_WR_CONTEXTLOC_DDR)) { + + /* + * XXX: The userland library sets tx_key_info_size, not + * rx_key_info_size. + */ + k_ctx->rx_key_info_size = k_ctx->tx_key_info_size; + error = tls_program_key_id(toep, k_ctx); if (error) { /* XXX: Only clear quiesce for KEY_WRITE_RX? */ @@ -866,31 +873,37 @@ t4_ctloutput_tls(struct socket *so, struct sockopt *so #ifdef KERN_TLS static void -init_ktls_key_context(struct ktls_session *tls, struct tls_key_context *k_ctx) +init_ktls_key_context(struct ktls_session *tls, struct tls_key_context *k_ctx, + int direction) { struct auth_hash *axf; - u_int mac_key_size; - char *hash; + u_int key_info_size, mac_key_size; + char *hash, *key; - k_ctx->l_p_key = V_KEY_GET_LOC(KEY_WRITE_TX); - if (tls->params.tls_vminor == TLS_MINOR_VER_ONE) - k_ctx->proto_ver = SCMD_PROTO_VERSION_TLS_1_1; - else - k_ctx->proto_ver = SCMD_PROTO_VERSION_TLS_1_2; + k_ctx->l_p_key = V_KEY_GET_LOC(direction == KTLS_TX ? KEY_WRITE_TX : + KEY_WRITE_RX); + k_ctx->proto_ver = tls->params.tls_vmajor << 8 | tls->params.tls_vminor; k_ctx->cipher_secret_size = tls->params.cipher_key_len; - k_ctx->tx_key_info_size = sizeof(struct tx_keyctx_hdr) + + key_info_size = sizeof(struct tx_keyctx_hdr) + k_ctx->cipher_secret_size; - memcpy(k_ctx->tx.key, tls->params.cipher_key, - tls->params.cipher_key_len); - hash = k_ctx->tx.key + tls->params.cipher_key_len; + if (direction == KTLS_TX) + key = k_ctx->tx.key; + else + key = k_ctx->rx.key; + memcpy(key, tls->params.cipher_key, tls->params.cipher_key_len); + hash = key + tls->params.cipher_key_len; if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) { k_ctx->state.auth_mode = SCMD_AUTH_MODE_GHASH; k_ctx->state.enc_mode = SCMD_CIPH_MODE_AES_GCM; k_ctx->iv_size = 4; k_ctx->mac_first = 0; k_ctx->hmac_ctrl = SCMD_HMAC_CTRL_NOP; - k_ctx->tx_key_info_size += GMAC_BLOCK_LEN; - memcpy(k_ctx->tx.salt, tls->params.iv, SALT_SIZE); + key_info_size += GMAC_BLOCK_LEN; + k_ctx->mac_secret_size = 0; + if (direction == KTLS_TX) + memcpy(k_ctx->tx.salt, tls->params.iv, SALT_SIZE); + else + memcpy(k_ctx->rx.salt, tls->params.iv, SALT_SIZE); t4_init_gmac_hash(tls->params.cipher_key, tls->params.cipher_key_len, hash); } else { @@ -917,29 +930,38 @@ init_ktls_key_context(struct ktls_session *tls, struct k_ctx->iv_size = 8; /* for CBC, iv is 16B, unit of 2B */ k_ctx->mac_first = 1; k_ctx->hmac_ctrl = SCMD_HMAC_CTRL_NO_TRUNC; - k_ctx->tx_key_info_size += roundup2(mac_key_size, 16) * 2; + key_info_size += roundup2(mac_key_size, 16) * 2; k_ctx->mac_secret_size = mac_key_size; t4_init_hmac_digest(axf, mac_key_size, tls->params.auth_key, tls->params.auth_key_len, hash); } + if (direction == KTLS_TX) + k_ctx->tx_key_info_size = key_info_size; + else + k_ctx->rx_key_info_size = key_info_size; k_ctx->frag_size = tls->params.max_frame_len; k_ctx->iv_ctrl = 1; } int -tls_alloc_ktls(struct toepcb *toep, struct ktls_session *tls) +tls_alloc_ktls(struct toepcb *toep, struct ktls_session *tls, int direction) { + struct adapter *sc = td_adapter(toep->td); struct tls_key_context *k_ctx; - int error; + int error, key_offset; if (toep->tls.mode == TLS_MODE_TLSOM) return (EINVAL); if (!can_tls_offload(td_adapter(toep->td))) return (EINVAL); switch (ulp_mode(toep)) { + case ULP_MODE_TLS: + break; case ULP_MODE_NONE: case ULP_MODE_TCPDDP: + if (direction != KTLS_TX) + return (EINVAL); break; default: return (EINVAL); @@ -987,48 +1009,81 @@ tls_alloc_ktls(struct toepcb *toep, struct ktls_sessio tls->params.tls_vminor > TLS_MINOR_VER_TWO) return (EPROTONOSUPPORT); + /* Bail if we already have a key. */ + if (direction == KTLS_TX) { + if (toep->tls.tx_key_addr != -1) + return (EOPNOTSUPP); + } else { + if (toep->tls.rx_key_addr != -1) + return (EOPNOTSUPP); + } + /* * XXX: This assumes no key renegotation. If KTLS ever supports * that we will want to allocate TLS sessions dynamically rather * than as a static member of toep. */ k_ctx = &toep->tls.k_ctx; - init_ktls_key_context(tls, k_ctx); + init_ktls_key_context(tls, k_ctx, direction); - toep->tls.scmd0.seqno_numivs = - (V_SCMD_SEQ_NO_CTRL(3) | - V_SCMD_PROTO_VERSION(k_ctx->proto_ver) | - V_SCMD_ENC_DEC_CTRL(SCMD_ENCDECCTRL_ENCRYPT) | - V_SCMD_CIPH_AUTH_SEQ_CTRL((k_ctx->mac_first == 0)) | - V_SCMD_CIPH_MODE(k_ctx->state.enc_mode) | - V_SCMD_AUTH_MODE(k_ctx->state.auth_mode) | - V_SCMD_HMAC_CTRL(k_ctx->hmac_ctrl) | - V_SCMD_IV_SIZE(k_ctx->iv_size)); + error = tls_program_key_id(toep, k_ctx); + if (error) + return (error); - toep->tls.scmd0.ivgen_hdrlen = - (V_SCMD_IV_GEN_CTRL(k_ctx->iv_ctrl) | - V_SCMD_KEY_CTX_INLINE(0) | - V_SCMD_TLS_FRAG_ENABLE(1)); + if (direction == KTLS_TX) { + toep->tls.scmd0.seqno_numivs = + (V_SCMD_SEQ_NO_CTRL(3) | + V_SCMD_PROTO_VERSION(get_proto_ver(k_ctx->proto_ver)) | + V_SCMD_ENC_DEC_CTRL(SCMD_ENCDECCTRL_ENCRYPT) | + V_SCMD_CIPH_AUTH_SEQ_CTRL((k_ctx->mac_first == 0)) | + V_SCMD_CIPH_MODE(k_ctx->state.enc_mode) | + V_SCMD_AUTH_MODE(k_ctx->state.auth_mode) | + V_SCMD_HMAC_CTRL(k_ctx->hmac_ctrl) | + V_SCMD_IV_SIZE(k_ctx->iv_size)); - if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) - toep->tls.iv_len = 8; - else - toep->tls.iv_len = AES_BLOCK_LEN; + toep->tls.scmd0.ivgen_hdrlen = + (V_SCMD_IV_GEN_CTRL(k_ctx->iv_ctrl) | + V_SCMD_KEY_CTX_INLINE(0) | + V_SCMD_TLS_FRAG_ENABLE(1)); - toep->tls.mac_length = k_ctx->mac_secret_size; + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) + toep->tls.iv_len = 8; + else + toep->tls.iv_len = AES_BLOCK_LEN; - toep->tls.tx_key_addr = -1; + toep->tls.mac_length = k_ctx->mac_secret_size; - error = tls_program_key_id(toep, k_ctx); - if (error) - return (error); + toep->tls.fcplenmax = get_tp_plen_max(&toep->tls); + toep->tls.expn_per_ulp = tls->params.tls_hlen + + tls->params.tls_tlen; + toep->tls.pdus_per_ulp = 1; + toep->tls.adjusted_plen = toep->tls.expn_per_ulp + + toep->tls.k_ctx.frag_size; + } else { + /* Stop timer on handshake completion */ + tls_stop_handshake_timer(toep); - toep->tls.fcplenmax = get_tp_plen_max(&toep->tls); - toep->tls.expn_per_ulp = tls->params.tls_hlen + tls->params.tls_tlen; - toep->tls.pdus_per_ulp = 1; - toep->tls.adjusted_plen = toep->tls.expn_per_ulp + - toep->tls.k_ctx.frag_size; + toep->flags &= ~TPF_FORCE_CREDITS; + /* + * RX key tags are an index into the key portion of MA + * memory stored as an offset from the base address in + * units of 64 bytes. + */ + key_offset = toep->tls.rx_key_addr - sc->vres.key.start; + t4_set_tls_keyid(toep, key_offset / 64); + t4_set_tls_tcb_field(toep, W_TCB_ULP_RAW, + V_TCB_ULP_RAW(M_TCB_ULP_RAW), + V_TCB_ULP_RAW((V_TF_TLS_KEY_SIZE(3) | + V_TF_TLS_CONTROL(1) | + V_TF_TLS_ACTIVE(1) | + V_TF_TLS_ENABLE(1)))); + t4_set_tls_tcb_field(toep, W_TCB_TLS_SEQ, + V_TCB_TLS_SEQ(M_TCB_TLS_SEQ), + V_TCB_TLS_SEQ(0)); + t4_clear_rx_quiesce(toep); + } + toep->tls.mode = TLS_MODE_KTLS; return (0); @@ -1671,7 +1726,7 @@ t4_push_ktls(struct adapter *sc, struct toepcb *toep, ("%s: flowc_wr not sent for tid %u.", __func__, toep->tid)); KASSERT(ulp_mode(toep) == ULP_MODE_NONE || - ulp_mode(toep) == ULP_MODE_TCPDDP, + ulp_mode(toep) == ULP_MODE_TCPDDP || ulp_mode(toep) == ULP_MODE_TLS, ("%s: ulp_mode %u for toep %p", __func__, ulp_mode(toep), toep)); KASSERT(tls_tx_key(toep), ("%s: TX key not set for toep %p", __func__, toep)); @@ -1956,6 +2011,10 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head struct socket *so; struct sockbuf *sb; struct mbuf *tls_data; +#ifdef KERN_TLS + struct tls_get_record *tgr; + struct mbuf *control; +#endif int len, pdu_length, rx_credits; KASSERT(toep->tid == tid, ("%s: toep tid/atid mismatch", __func__)); @@ -1982,6 +2041,7 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head pdu_length = G_CPL_RX_TLS_CMP_PDULENGTH(be32toh(cpl->pdulength_length)); + so = inp_inpcbtosocket(inp); tp = intotcpcb(inp); #ifdef VERBOSE_TRACES @@ -2006,35 +2066,94 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head ("%s: payload too small", __func__)); tls_hdr_pkt = mtod(m, void *); - /* - * Only the TLS header is sent to OpenSSL, so report errors by - * altering the record type. - */ - if ((tls_hdr_pkt->res_to_mac_error & M_TLSRX_HDR_PKT_ERROR) != 0) - tls_hdr_pkt->type = CONTENT_TYPE_ERROR; - - /* Trim this CPL's mbuf to only include the TLS header. */ - KASSERT(m->m_len == len && m->m_next == NULL, - ("%s: CPL spans multiple mbufs", __func__)); - m->m_len = TLS_HEADER_LENGTH; - m->m_pkthdr.len = TLS_HEADER_LENGTH; - tls_data = mbufq_dequeue(&toep->ulp_pdu_reclaimq); if (tls_data != NULL) { KASSERT(be32toh(cpl->seq) == tls_data->m_pkthdr.tls_tcp_seq, ("%s: sequence mismatch", __func__)); + } +#ifdef KERN_TLS + if (toep->tls.mode == TLS_MODE_KTLS) { + /* Report decryption errors as EBADMSG. */ + if ((tls_hdr_pkt->res_to_mac_error & M_TLSRX_HDR_PKT_ERROR) != + 0) { + m_freem(m); + m_freem(tls_data); + + CURVNET_SET(toep->vnet); + so->so_error = EBADMSG; + sorwakeup(so); + + INP_WUNLOCK(inp); + CURVNET_RESTORE(); + + return (0); + } + + /* Allocate the control message mbuf. */ + control = sbcreatecontrol(NULL, sizeof(*tgr), TLS_GET_RECORD, + IPPROTO_TCP); + if (control == NULL) { + m_freem(m); + m_freem(tls_data); + + CURVNET_SET(toep->vnet); + so->so_error = ENOBUFS; + sorwakeup(so); + + INP_WUNLOCK(inp); + CURVNET_RESTORE(); + + return (0); + } + + tgr = (struct tls_get_record *) + CMSG_DATA(mtod(control, struct cmsghdr *)); + tgr->tls_type = tls_hdr_pkt->type; + tgr->tls_vmajor = be16toh(tls_hdr_pkt->version) >> 8; + tgr->tls_vminor = be16toh(tls_hdr_pkt->version) & 0xff; + + m_freem(m); + + if (tls_data != NULL) { + m_last(tls_data)->m_flags |= M_EOR; + tgr->tls_length = htobe16(tls_data->m_pkthdr.len); + } else + tgr->tls_length = 0; + m = tls_data; + } else +#endif + { /* - * Update the TLS header length to be the length of - * the payload data. + * Only the TLS header is sent to OpenSSL, so report + * errors by altering the record type. */ - tls_hdr_pkt->length = htobe16(tls_data->m_pkthdr.len); + if ((tls_hdr_pkt->res_to_mac_error & M_TLSRX_HDR_PKT_ERROR) != + 0) + tls_hdr_pkt->type = CONTENT_TYPE_ERROR; - m->m_next = tls_data; - m->m_pkthdr.len += tls_data->m_len; + /* Trim this CPL's mbuf to only include the TLS header. */ + KASSERT(m->m_len == len && m->m_next == NULL, + ("%s: CPL spans multiple mbufs", __func__)); + m->m_len = TLS_HEADER_LENGTH; + m->m_pkthdr.len = TLS_HEADER_LENGTH; + + if (tls_data != NULL) { + /* + * Update the TLS header length to be the length of + * the payload data. + */ + tls_hdr_pkt->length = htobe16(tls_data->m_pkthdr.len); + + m->m_next = tls_data; + m->m_pkthdr.len += tls_data->m_len; + } + +#ifdef KERN_TLS + control = NULL; +#endif } - so = inp_inpcbtosocket(inp); sb = &so->so_rcv; SOCKBUF_LOCK(sb); @@ -2044,6 +2163,9 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head CTR3(KTR_CXGBE, "%s: tid %u, excess rx (%d bytes)", __func__, tid, pdu_length); m_freem(m); +#ifdef KERN_TLS + m_freem(control); +#endif SOCKBUF_UNLOCK(sb); INP_WUNLOCK(inp); @@ -2080,7 +2202,12 @@ do_rx_tls_cmp(struct sge_iq *iq, const struct rss_head sb->sb_flags &= ~SB_AUTOSIZE; } - sbappendstream_locked(sb, m, 0); +#ifdef KERN_TLS + if (control != NULL) + sbappendcontrol_locked(sb, m, control, 0); + else +#endif + sbappendstream_locked(sb, m, 0); rx_credits = sbspace(sb) > tp->rcv_wnd ? sbspace(sb) - tp->rcv_wnd : 0; #ifdef VERBOSE_TRACES CTR4(KTR_CXGBE, "%s: tid %u rx_credits %u rcv_wnd %u", Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 27 23:55:09 2020 (r360416) +++ head/sys/dev/cxgbe/tom/t4_tom.c Mon Apr 27 23:59:42 2020 (r360417) @@ -40,9 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef KERN_TLS -#include -#endif #include #include #include @@ -824,10 +821,7 @@ t4_alloc_tls_session(struct toedev *tod, struct tcpcb INP_WLOCK_ASSERT(tp->t_inpcb); MPASS(tls != NULL); - if (direction != KTLS_TX) - return (EOPNOTSUPP); - - return (tls_alloc_ktls(toep, tls)); + return (tls_alloc_ktls(toep, tls, direction)); } #endif Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Mon Apr 27 23:55:09 2020 (r360416) +++ head/sys/dev/cxgbe/tom/t4_tom.h Mon Apr 27 23:59:42 2020 (r360417) @@ -452,6 +452,6 @@ int tls_rx_key(struct toepcb *); void tls_stop_handshake_timer(struct toepcb *); int tls_tx_key(struct toepcb *); void tls_uninit_toep(struct toepcb *); -int tls_alloc_ktls(struct toepcb *, struct ktls_session *); +int tls_alloc_ktls(struct toepcb *, struct ktls_session *, int); #endif From owner-svn-src-head@freebsd.org Tue Apr 28 00:06: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 078DD2CB701; Tue, 28 Apr 2020 00:06:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B24n6PjWz3whm; Tue, 28 Apr 2020 00:06:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFCA61B1B1; Tue, 28 Apr 2020 00:06:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03S06nxZ089354; Tue, 28 Apr 2020 00:06:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S06n0t089353; Tue, 28 Apr 2020 00:06:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004280006.03S06n0t089353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 28 Apr 2020 00:06:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360418 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 360418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 00:06:50 -0000 Author: jhb Date: Tue Apr 28 00:06:49 2020 New Revision: 360418 URL: https://svnweb.freebsd.org/changeset/base/360418 Log: Bump __FreeBSD_version for KTLS RX support. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Apr 27 23:59:42 2020 (r360417) +++ head/sys/sys/param.h Tue Apr 28 00:06:49 2020 (r360418) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300092 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300093 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Tue Apr 28 01:39: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 08E822CE93B; Tue, 28 Apr 2020 01:39:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B47p6ShJz436T; Tue, 28 Apr 2020 01:39:34 +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 D913E1C3A5; Tue, 28 Apr 2020 01:39:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03S1dYqP045878; Tue, 28 Apr 2020 01:39:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S1dYCG045877; Tue, 28 Apr 2020 01:39:34 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004280139.03S1dYCG045877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Apr 2020 01:39:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360420 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 01:39:35 -0000 Author: kevans Date: Tue Apr 28 01:39:34 2020 New Revision: 360420 URL: https://svnweb.freebsd.org/changeset/base/360420 Log: lualoader config: don't call loader.getenv() as much We don't actually need to fetch loader_conf_files as much as we do; we've already fetched it once at the beginning, we only really need to fetch it again after each file we've processed. If it changes, then we can stash that off into our local prefiles. While here, drop a note about the recursion so that I stop trying to change it. It may very well make redundant some of the work we're doing, but that's OK. MFC after: 3 days Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Apr 28 00:44:05 2020 (r360419) +++ head/stand/lua/config.lua Tue Apr 28 01:39:34 2020 (r360420) @@ -343,13 +343,12 @@ end local function readConfFiles(loaded_files) local f = loader.getenv("loader_conf_files") if f ~= nil then + local prefiles = f for name in f:gmatch("([%w%p]+)%s*") do if loaded_files[name] ~= nil then goto continue end - local prefiles = loader.getenv("loader_conf_files") - print("Loading " .. name) -- These may or may not exist, and that's ok. Do a -- silent parse so that we complain on parse errors but @@ -361,7 +360,12 @@ local function readConfFiles(loaded_files) loaded_files[name] = true local newfiles = loader.getenv("loader_conf_files") if prefiles ~= newfiles then + -- Recurse; process the new files immediately. + -- If we come back and it turns out we've + -- already loaded the rest of what was in the + -- original loader_conf_files, no big deal. readConfFiles(loaded_files) + prefiles = newfiles end ::continue:: end From owner-svn-src-head@freebsd.org Tue Apr 28 02:03: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 6B6272CF445; Tue, 28 Apr 2020 02:03:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B4fw28dYz44SZ; Tue, 28 Apr 2020 02:03:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 452971C9E6; Tue, 28 Apr 2020 02:03:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03S234DI063540; Tue, 28 Apr 2020 02:03:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S233NJ063538; Tue, 28 Apr 2020 02:03:03 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004280203.03S233NJ063538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Apr 2020 02:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360421 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 02:03:04 -0000 Author: kevans Date: Tue Apr 28 02:03:03 2020 New Revision: 360421 URL: https://svnweb.freebsd.org/changeset/base/360421 Log: lualoader: config: start exporting readConfFiles In the process, change it slightly: readConfFiles will take a string like loader_conf_files in addition to the loaded_files table that it normally takes. This is to facilitate the addition of a read-conf CLI command, which will just pass in the single file to read and an empty table. MFC after: 3 days Modified: head/stand/lua/config.lua head/stand/lua/config.lua.8 Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Tue Apr 28 01:39:34 2020 (r360420) +++ head/stand/lua/config.lua Tue Apr 28 02:03:03 2020 (r360421) @@ -340,38 +340,6 @@ local function loadModule(mod, silent) return status end -local function readConfFiles(loaded_files) - local f = loader.getenv("loader_conf_files") - if f ~= nil then - local prefiles = f - for name in f:gmatch("([%w%p]+)%s*") do - if loaded_files[name] ~= nil then - goto continue - end - - print("Loading " .. name) - -- These may or may not exist, and that's ok. Do a - -- silent parse so that we complain on parse errors but - -- not for them simply not existing. - if not config.processFile(name, true) then - print(MSG_FAILPARSECFG:format(name)) - end - - loaded_files[name] = true - local newfiles = loader.getenv("loader_conf_files") - if prefiles ~= newfiles then - -- Recurse; process the new files immediately. - -- If we come back and it turns out we've - -- already loaded the rest of what was in the - -- original loader_conf_files, no big deal. - readConfFiles(loaded_files) - prefiles = newfiles - end - ::continue:: - end - end -end - local function readFile(name, silent) local f = io.open(name) if f == nil then @@ -492,6 +460,40 @@ function config.parse(text) return status end +function config.readConfFiles(files, loaded_files) + if files ~= nil then + -- The caller may not have passed in loader_conf_files; we could + -- have instead gotten some other string of files. We don't + -- want to trigger any redundant re-read/loads based on this. + local prefiles = loader.getenv("loader_conf_files") + for name in files:gmatch("([%w%p]+)%s*") do + if loaded_files[name] ~= nil then + goto continue + end + + print("Loading " .. name) + -- These may or may not exist, and that's ok. Do a + -- silent parse so that we complain on parse errors but + -- not for them simply not existing. + if not config.processFile(name, true) then + print(MSG_FAILPARSECFG:format(name)) + end + + loaded_files[name] = true + local newfiles = loader.getenv("loader_conf_files") + if prefiles ~= newfiles then + -- Recurse; process the new files immediately. + -- If we come back and it turns out we've + -- already loaded the rest of what was in the + -- original loader_conf_files, no big deal. + config.readConfFiles(newfiles, loaded_files) + prefiles = newfiles + end + ::continue:: + end + end +end + -- other_kernel is optionally the name of a kernel to load, if not the default -- or autoloaded default from the module_path function config.loadKernel(other_kernel) @@ -605,7 +607,7 @@ function config.load(file, reloading) end local loaded_files = {file = true} - readConfFiles(loaded_files) + config.readConfFiles(loader.getenv("loader_conf_files"), loaded_files) checkNextboot() Modified: head/stand/lua/config.lua.8 ============================================================================== --- head/stand/lua/config.lua.8 Tue Apr 28 01:39:34 2020 (r360420) +++ head/stand/lua/config.lua.8 Tue Apr 28 02:03:03 2020 (r360421) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 9, 2018 +.Dd April 27, 2020 .Dt CONFIG.LUA 8 .Os .Sh NAME @@ -59,6 +59,15 @@ to A lookup will be done as needed to determine what value .Ev idx actually corresponds to. +.It Fn config.readConfFiles files loaded_files +Process +.Ev files +as if it were +.Ev loader_conf_files . +The caller may should pass in a table as the +.Ev loaded_files +argument, which uses filenames as keys and any non-nil value to indicate that +the file named by the key has been loaded. .It Fn config.processFile name silent Process and parse .Ev name From owner-svn-src-head@freebsd.org Tue Apr 28 02:04: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 7F3192CF5BB; Tue, 28 Apr 2020 02:04:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B4j02nyLz44fV; Tue, 28 Apr 2020 02:04:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B3361C9F5; Tue, 28 Apr 2020 02:04:52 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03S24qnl063663; Tue, 28 Apr 2020 02:04:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S24qZ9063662; Tue, 28 Apr 2020 02:04:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004280204.03S24qZ9063662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Apr 2020 02:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360422 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 02:04:52 -0000 Author: kevans Date: Tue Apr 28 02:04:51 2020 New Revision: 360422 URL: https://svnweb.freebsd.org/changeset/base/360422 Log: lualoader: cli: add read-conf This is a straightforward match to the command used by many in forthloader; it uses the newly-exported config.readConfFiles() to make sure that any loader_conf_files gets done as appropriate. PR: 244640 Submitted by: Olivier Certner MFC after: 3 days Modified: head/stand/lua/cli.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Tue Apr 28 02:03:03 2020 (r360421) +++ head/stand/lua/cli.lua Tue Apr 28 02:04:51 2020 (r360422) @@ -125,6 +125,11 @@ cli['boot-conf'] = function(...) core.autoboot(argstr) end +cli['read-conf'] = function(...) + local _, argv = cli.arguments(...) + config.readConfFiles(assert(core.popFrontTable(argv)), {}) +end + cli['reload-conf'] = function(...) config.reload() end From owner-svn-src-head@freebsd.org Tue Apr 28 02:08: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 C94142CF9D9; Tue, 28 Apr 2020 02:08:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B4ng4s2dz44wv; Tue, 28 Apr 2020 02:08:55 +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 A1D341CA0E; Tue, 28 Apr 2020 02:08:55 +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 03S28tW0063901; Tue, 28 Apr 2020 02:08:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S28t2s063900; Tue, 28 Apr 2020 02:08:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004280208.03S28t2s063900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Apr 2020 02:08:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360423 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 02:08:55 -0000 Author: kevans Date: Tue Apr 28 02:08:55 2020 New Revision: 360423 URL: https://svnweb.freebsd.org/changeset/base/360423 Log: lualoader: cli: clobber loader_conf_files before proceeding This makes sure that config.readConfFiles doesn't see a stale loader_conf_files from before, in case the newly loaded file doesn't set it. MFC after: 3 days Modified: head/stand/lua/cli.lua Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Tue Apr 28 02:04:51 2020 (r360422) +++ head/stand/lua/cli.lua Tue Apr 28 02:08:55 2020 (r360423) @@ -127,6 +127,9 @@ end cli['read-conf'] = function(...) local _, argv = cli.arguments(...) + -- Don't trigger a reload of previously loaded loader_conf_files, in + -- case this config file doesn't set it. + loader.setenv("loader_conf_files", "") config.readConfFiles(assert(core.popFrontTable(argv)), {}) end From owner-svn-src-head@freebsd.org Tue Apr 28 02: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 191FD2CFBCA; Tue, 28 Apr 2020 02:11:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B4r66vgNz45BK; Tue, 28 Apr 2020 02:11:02 +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 CDF6B1CA53; Tue, 28 Apr 2020 02:11:02 +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 03S2B2nM066697; Tue, 28 Apr 2020 02:11:02 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S2B2fJ066696; Tue, 28 Apr 2020 02:11:02 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202004280211.03S2B2fJ066696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 28 Apr 2020 02:11:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360424 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 360424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 02:11:03 -0000 Author: rmacklem Date: Tue Apr 28 02:11:02 2020 New Revision: 360424 URL: https://svnweb.freebsd.org/changeset/base/360424 Log: Get rid of uio_XXX macros used for the Mac OS/X port. The NFS code had a bunch of Mac OS/X accessor functions named uio_XXX left over from the port to Mac OS/X. Since that port is long forgotten, replace the calls with the code generated by the FreeBSD macros for these in nfskpiport.h. This allows the macros to be deleted from nfskpiport.h and I think makes the code more readable. This patch should not result in any semantic change. Modified: head/sys/fs/nfs/nfskpiport.h head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfs/nfskpiport.h ============================================================================== --- head/sys/fs/nfs/nfskpiport.h Tue Apr 28 02:08:55 2020 (r360423) +++ head/sys/fs/nfs/nfskpiport.h Tue Apr 28 02:11:02 2020 (r360424) @@ -43,20 +43,4 @@ typedef struct vnode * vnode_t; #define vnode_mount(v) ((v)->v_mount) #define vnode_vtype(v) ((v)->v_type) -/* - * This stuff is needed by Darwin for handling the uio structure. - */ -#define uio_uio_resid(p) ((p)->uio_resid) -#define uio_uio_resid_add(p, v) ((p)->uio_resid += (v)) -#define uio_uio_resid_set(p, v) ((p)->uio_resid = (v)) -#define uio_iov_base(p) ((p)->uio_iov->iov_base) -#define uio_iov_base_add(p, v) do { \ - char *pp; \ - pp = (char *)(p)->uio_iov->iov_base; \ - pp += (v); \ - (p)->uio_iov->iov_base = (void *)pp; \ - } while (0) -#define uio_iov_len(p) ((p)->uio_iov->iov_len) -#define uio_iov_len_add(p, v) ((p)->uio_iov->iov_len += (v)) - #endif /* _NFS_NFSKPIPORT_H */ Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 28 02:08:55 2020 (r360423) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 28 02:11:02 2020 (r360424) @@ -1617,7 +1617,7 @@ nfsrpc_readrpc(vnode_t vp, struct uio *uiop, struct uc off_t tmp_off; *attrflagp = 0; - tsiz = uio_uio_resid(uiop); + tsiz = uiop->uio_resid; tmp_off = uiop->uio_offset + tsiz; NFSLOCKMNT(nmp); if (tmp_off > nmp->nm_maxfilesize || tmp_off < uiop->uio_offset) { @@ -1793,7 +1793,7 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom KASSERT(uiop->uio_iovcnt == 1, ("nfs: writerpc iovcnt > 1")); *attrflagp = 0; - tsiz = uio_uio_resid(uiop); + tsiz = uiop->uio_resid; tmp_off = uiop->uio_offset + tsiz; NFSLOCKMNT(nmp); if (tmp_off > nmp->nm_maxfilesize || tmp_off < uiop->uio_offset) { @@ -1878,9 +1878,10 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom * back. */ uiop->uio_offset -= len; - uio_uio_resid_add(uiop, len); - uio_iov_base_add(uiop, -len); - uio_iov_len_add(uiop, len); + uiop->uio_resid += len; + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base - len; + uiop->uio_iov->iov_len += len; } if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) { error = nfscl_wcc_data(nd, vp, nap, attrflagp, @@ -1898,10 +1899,12 @@ nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom goto nfsmout; } else if (rlen < len) { backup = len - rlen; - uio_iov_base_add(uiop, -(backup)); - uio_iov_len_add(uiop, backup); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base - + backup; + uiop->uio_iov->iov_len += backup; uiop->uio_offset -= backup; - uio_uio_resid_add(uiop, backup); + uiop->uio_resid += backup; len = rlen; } commit = fxdr_unsigned(int, *tl++); @@ -2925,7 +2928,7 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 size_t tresid; KASSERT(uiop->uio_iovcnt == 1 && - (uio_uio_resid(uiop) & (DIRBLKSIZ - 1)) == 0, + (uiop->uio_resid & (DIRBLKSIZ - 1)) == 0, ("nfs readdirrpc bad uio")); ncookie.lval[0] = ncookie.lval[1] = 0; /* @@ -2935,13 +2938,13 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 * will never make readsize > nm_readdirsize. */ readsize = nmp->nm_readdirsize; - if (readsize > uio_uio_resid(uiop)) - readsize = uio_uio_resid(uiop) + DIRBLKSIZ; + if (readsize > uiop->uio_resid) + readsize = uiop->uio_resid + DIRBLKSIZ; *attrflagp = 0; if (eofp) *eofp = 0; - tresid = uio_uio_resid(uiop); + tresid = uiop->uio_resid; cookie.lval[0] = cookiep->nfsuquad[0]; cookie.lval[1] = cookiep->nfsuquad[1]; nd->nd_mrep = NULL; @@ -3036,7 +3039,7 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 if (error) return (error); nd->nd_mrep = NULL; - dp = (struct dirent *)uio_iov_base(uiop); + dp = (struct dirent *)uiop->uio_iov->iov_base; dp->d_pad0 = dp->d_pad1 = 0; dp->d_off = 0; dp->d_type = DT_DIR; @@ -3052,11 +3055,12 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *tl++ = 0; *tl = 0; blksiz += dp->d_reclen; - uio_uio_resid_add(uiop, -(dp->d_reclen)); + uiop->uio_resid -= dp->d_reclen; uiop->uio_offset += dp->d_reclen; - uio_iov_base_add(uiop, dp->d_reclen); - uio_iov_len_add(uiop, -(dp->d_reclen)); - dp = (struct dirent *)uio_iov_base(uiop); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + dp->d_reclen; + uiop->uio_iov->iov_len -= dp->d_reclen; + dp = (struct dirent *)uiop->uio_iov->iov_base; dp->d_pad0 = dp->d_pad1 = 0; dp->d_off = 0; dp->d_type = DT_DIR; @@ -3073,10 +3077,11 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 *tl++ = 0; *tl = 0; blksiz += dp->d_reclen; - uio_uio_resid_add(uiop, -(dp->d_reclen)); + uiop->uio_resid -= dp->d_reclen; uiop->uio_offset += dp->d_reclen; - uio_iov_base_add(uiop, dp->d_reclen); - uio_iov_len_add(uiop, -(dp->d_reclen)); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + dp->d_reclen; + uiop->uio_iov->iov_len -= dp->d_reclen; } NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_RDATTRERROR); } else { @@ -3171,19 +3176,20 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 tlen += 8; /* To ensure null termination. */ left = DIRBLKSIZ - blksiz; if (_GENERIC_DIRLEN(len) + NFSX_HYPER > left) { - NFSBZERO(uio_iov_base(uiop), left); + NFSBZERO(uiop->uio_iov->iov_base, left); dp->d_reclen += left; - uio_iov_base_add(uiop, left); - uio_iov_len_add(uiop, -(left)); - uio_uio_resid_add(uiop, -(left)); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; + uiop->uio_iov->iov_len -= left; + uiop->uio_resid -= left; uiop->uio_offset += left; blksiz = 0; } if (_GENERIC_DIRLEN(len) + NFSX_HYPER > - uio_uio_resid(uiop)) + uiop->uio_resid) bigenough = 0; if (bigenough) { - dp = (struct dirent *)uio_iov_base(uiop); + dp = (struct dirent *)uiop->uio_iov->iov_base; dp->d_pad0 = dp->d_pad1 = 0; dp->d_off = 0; dp->d_namlen = len; @@ -3193,21 +3199,24 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 blksiz += dp->d_reclen; if (blksiz == DIRBLKSIZ) blksiz = 0; - uio_uio_resid_add(uiop, -(DIRHDSIZ)); + uiop->uio_resid -= DIRHDSIZ; uiop->uio_offset += DIRHDSIZ; - uio_iov_base_add(uiop, DIRHDSIZ); - uio_iov_len_add(uiop, -(DIRHDSIZ)); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + DIRHDSIZ; + uiop->uio_iov->iov_len -= DIRHDSIZ; error = nfsm_mbufuio(nd, uiop, len); if (error) goto nfsmout; - cp = uio_iov_base(uiop); + cp = uiop->uio_iov->iov_base; tlen -= len; NFSBZERO(cp, tlen); cp += tlen; /* points to cookie storage */ tl2 = (u_int32_t *)cp; - uio_iov_base_add(uiop, (tlen + NFSX_HYPER)); - uio_iov_len_add(uiop, -(tlen + NFSX_HYPER)); - uio_uio_resid_add(uiop, -(tlen + NFSX_HYPER)); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + tlen + + NFSX_HYPER; + uiop->uio_iov->iov_len -= tlen + NFSX_HYPER; + uiop->uio_resid -= tlen + NFSX_HYPER; uiop->uio_offset += (tlen + NFSX_HYPER); } else { error = nfsm_advance(nd, NFSM_RNDUP(len), -1); @@ -3290,11 +3299,12 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 */ if (blksiz > 0) { left = DIRBLKSIZ - blksiz; - NFSBZERO(uio_iov_base(uiop), left); + NFSBZERO(uiop->uio_iov->iov_base, left); dp->d_reclen += left; - uio_iov_base_add(uiop, left); - uio_iov_len_add(uiop, -(left)); - uio_uio_resid_add(uiop, -(left)); + uiop->uio_iov->iov_base = (char *)uiop->uio_iov->iov_base + + left; + uiop->uio_iov->iov_len -= left; + uiop->uio_resid -= left; uiop->uio_offset += left; } @@ -3305,7 +3315,7 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 * Otherwise, return the eof flag from the server. */ if (eofp) { - if (tresid == ((size_t)(uio_uio_resid(uiop)))) + if (tresid == ((size_t)(uiop->uio_resid))) *eofp = 1; else if (!bigenough) *eofp = 0; @@ -3316,17 +3326,18 @@ nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 /* * Add extra empty records to any remaining DIRBLKSIZ chunks. */ - while (uio_uio_resid(uiop) > 0 && uio_uio_resid(uiop) != tresid) { - dp = (struct dirent *)uio_iov_base(uiop); + while (uiop->uio_resid > 0 && uiop->uio_resid != tresid) { + dp = (struct dirent *)uiop->uio_iov->iov_base; NFSBZERO(dp, DIRBLKSIZ); dp->d_type = DT_UNKNOWN; tl = (u_int32_t *)&dp->d_name[4]; *tl++ = cookie.lval[0]; *tl = cookie.lval[1]; dp->d_reclen = DIRBLKSIZ; - uio_iov_base_add(uiop, DIRBLKSIZ); - uio_iov_len_add(uiop, -(DIRBLKSIZ)); - uio_uio_resid_add(uiop, -(DIRBLKSIZ)); + uiop->uio_iov->iov_base = (char *)uiop->uio_iov->iov_base + + DIRBLKSIZ; + uiop->uio_iov->iov_len -= DIRBLKSIZ; + uiop->uio_resid -= DIRBLKSIZ; uiop->uio_offset += DIRBLKSIZ; } @@ -3371,7 +3382,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui struct timespec dctime; KASSERT(uiop->uio_iovcnt == 1 && - (uio_uio_resid(uiop) & (DIRBLKSIZ - 1)) == 0, + (uiop->uio_resid & (DIRBLKSIZ - 1)) == 0, ("nfs readdirplusrpc bad uio")); ncookie.lval[0] = ncookie.lval[1] = 0; timespecclear(&dctime); @@ -3382,7 +3393,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui nd->nd_mrep = NULL; cookie.lval[0] = cookiep->nfsuquad[0]; cookie.lval[1] = cookiep->nfsuquad[1]; - tresid = uio_uio_resid(uiop); + tresid = uiop->uio_resid; /* * For NFSv4, first create the "." and ".." entries. @@ -3473,7 +3484,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui if (error) return (error); nd->nd_mrep = NULL; - dp = (struct dirent *)uio_iov_base(uiop); + dp = (struct dirent *)uiop->uio_iov->iov_base; dp->d_pad0 = dp->d_pad1 = 0; dp->d_off = 0; dp->d_type = DT_DIR; @@ -3489,11 +3500,12 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui *tl++ = 0; *tl = 0; blksiz += dp->d_reclen; - uio_uio_resid_add(uiop, -(dp->d_reclen)); + uiop->uio_resid -= dp->d_reclen; uiop->uio_offset += dp->d_reclen; - uio_iov_base_add(uiop, dp->d_reclen); - uio_iov_len_add(uiop, -(dp->d_reclen)); - dp = (struct dirent *)uio_iov_base(uiop); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + dp->d_reclen; + uiop->uio_iov->iov_len -= dp->d_reclen; + dp = (struct dirent *)uiop->uio_iov->iov_base; dp->d_pad0 = dp->d_pad1 = 0; dp->d_off = 0; dp->d_type = DT_DIR; @@ -3510,10 +3522,11 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui *tl++ = 0; *tl = 0; blksiz += dp->d_reclen; - uio_uio_resid_add(uiop, -(dp->d_reclen)); + uiop->uio_resid -= dp->d_reclen; uiop->uio_offset += dp->d_reclen; - uio_iov_base_add(uiop, dp->d_reclen); - uio_iov_len_add(uiop, -(dp->d_reclen)); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + dp->d_reclen; + uiop->uio_iov->iov_len -= dp->d_reclen; } NFSREADDIRPLUS_ATTRBIT(&attrbits); if (gotmnton) @@ -3589,19 +3602,20 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui tlen += 8; /* To ensure null termination. */ left = DIRBLKSIZ - blksiz; if (_GENERIC_DIRLEN(len) + NFSX_HYPER > left) { - NFSBZERO(uio_iov_base(uiop), left); + NFSBZERO(uiop->uio_iov->iov_base, left); dp->d_reclen += left; - uio_iov_base_add(uiop, left); - uio_iov_len_add(uiop, -(left)); - uio_uio_resid_add(uiop, -(left)); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + left; + uiop->uio_iov->iov_len -= left; + uiop->uio_resid -= left; uiop->uio_offset += left; blksiz = 0; } if (_GENERIC_DIRLEN(len) + NFSX_HYPER > - uio_uio_resid(uiop)) + uiop->uio_resid) bigenough = 0; if (bigenough) { - dp = (struct dirent *)uio_iov_base(uiop); + dp = (struct dirent *)uiop->uio_iov->iov_base; dp->d_pad0 = dp->d_pad1 = 0; dp->d_off = 0; dp->d_namlen = len; @@ -3611,17 +3625,18 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui blksiz += dp->d_reclen; if (blksiz == DIRBLKSIZ) blksiz = 0; - uio_uio_resid_add(uiop, -(DIRHDSIZ)); + uiop->uio_resid -= DIRHDSIZ; uiop->uio_offset += DIRHDSIZ; - uio_iov_base_add(uiop, DIRHDSIZ); - uio_iov_len_add(uiop, -(DIRHDSIZ)); - cnp->cn_nameptr = uio_iov_base(uiop); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + DIRHDSIZ; + uiop->uio_iov->iov_len -= DIRHDSIZ; + cnp->cn_nameptr = uiop->uio_iov->iov_base; cnp->cn_namelen = len; NFSCNHASHZERO(cnp); error = nfsm_mbufuio(nd, uiop, len); if (error) goto nfsmout; - cp = uio_iov_base(uiop); + cp = uiop->uio_iov->iov_base; tlen -= len; NFSBZERO(cp, tlen); cp += tlen; /* points to cookie storage */ @@ -3631,9 +3646,11 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui isdotdot = 1; else isdotdot = 0; - uio_iov_base_add(uiop, (tlen + NFSX_HYPER)); - uio_iov_len_add(uiop, -(tlen + NFSX_HYPER)); - uio_uio_resid_add(uiop, -(tlen + NFSX_HYPER)); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + tlen + + NFSX_HYPER; + uiop->uio_iov->iov_len -= tlen + NFSX_HYPER; + uiop->uio_resid -= tlen + NFSX_HYPER; uiop->uio_offset += (tlen + NFSX_HYPER); } else { error = nfsm_advance(nd, NFSM_RNDUP(len), -1); @@ -3793,11 +3810,12 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui */ if (blksiz > 0) { left = DIRBLKSIZ - blksiz; - NFSBZERO(uio_iov_base(uiop), left); + NFSBZERO(uiop->uio_iov->iov_base, left); dp->d_reclen += left; - uio_iov_base_add(uiop, left); - uio_iov_len_add(uiop, -(left)); - uio_uio_resid_add(uiop, -(left)); + uiop->uio_iov->iov_base = (char *)uiop->uio_iov->iov_base + + left; + uiop->uio_iov->iov_len -= left; + uiop->uio_resid -= left; uiop->uio_offset += left; } @@ -3808,7 +3826,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui * Otherwise, return the eof flag from the server. */ if (eofp != NULL) { - if (tresid == uio_uio_resid(uiop)) + if (tresid == uiop->uio_resid) *eofp = 1; else if (!bigenough) *eofp = 0; @@ -3819,17 +3837,18 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui /* * Add extra empty records to any remaining DIRBLKSIZ chunks. */ - while (uio_uio_resid(uiop) > 0 && uio_uio_resid(uiop) != tresid) { - dp = (struct dirent *)uio_iov_base(uiop); + while (uiop->uio_resid > 0 && uiop->uio_resid != tresid) { + dp = (struct dirent *)uiop->uio_iov->iov_base; NFSBZERO(dp, DIRBLKSIZ); dp->d_type = DT_UNKNOWN; tl = (u_int32_t *)&dp->d_name[4]; *tl++ = cookie.lval[0]; *tl = cookie.lval[1]; dp->d_reclen = DIRBLKSIZ; - uio_iov_base_add(uiop, DIRBLKSIZ); - uio_iov_len_add(uiop, -(DIRBLKSIZ)); - uio_uio_resid_add(uiop, -(DIRBLKSIZ)); + uiop->uio_iov->iov_base = (char *)uiop->uio_iov->iov_base + + DIRBLKSIZ; + uiop->uio_iov->iov_len -= DIRBLKSIZ; + uiop->uio_resid -= DIRBLKSIZ; uiop->uio_offset += DIRBLKSIZ; } @@ -6395,9 +6414,9 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo * back. */ uiop->uio_offset -= len; - uio_uio_resid_add(uiop, len); - uio_iov_base_add(uiop, -len); - uio_iov_len_add(uiop, len); + uiop->uio_resid += len; + uiop->uio_iov->iov_base = (char *)uiop->uio_iov->iov_base - len; + uiop->uio_iov->iov_len += len; error = nd->nd_repstat; } else { if (vers == NFS_VER3) { @@ -6415,10 +6434,11 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo goto nfsmout; } else if (rlen < len) { backup = len - rlen; - uio_iov_base_add(uiop, -(backup)); - uio_iov_len_add(uiop, backup); + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base - backup; + uiop->uio_iov->iov_len += backup; uiop->uio_offset -= backup; - uio_uio_resid_add(uiop, backup); + uiop->uio_resid += backup; len = rlen; } commit = fxdr_unsigned(int, *tl++); From owner-svn-src-head@freebsd.org Tue Apr 28 02:13: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 4E9D12CFEED; Tue, 28 Apr 2020 02:13:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B4tk1R9yz45cL; Tue, 28 Apr 2020 02:13:18 +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 2C6841CC38; Tue, 28 Apr 2020 02:13:18 +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 03S2DIhW070121; Tue, 28 Apr 2020 02:13:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S2DI0k070120; Tue, 28 Apr 2020 02:13:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004280213.03S2DI0k070120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Apr 2020 02:13:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360425 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 02:13:18 -0000 Author: kevans Date: Tue Apr 28 02:13:17 2020 New Revision: 360425 URL: https://svnweb.freebsd.org/changeset/base/360425 Log: config.lua(8): "may should" is not proper grammar Reported by: rpokala X-MFC-With: r360421 Modified: head/stand/lua/config.lua.8 Modified: head/stand/lua/config.lua.8 ============================================================================== --- head/stand/lua/config.lua.8 Tue Apr 28 02:11:02 2020 (r360424) +++ head/stand/lua/config.lua.8 Tue Apr 28 02:13:17 2020 (r360425) @@ -64,7 +64,7 @@ Process .Ev files as if it were .Ev loader_conf_files . -The caller may should pass in a table as the +The caller should pass in a table as the .Ev loaded_files argument, which uses filenames as keys and any non-nil value to indicate that the file named by the key has been loaded. From owner-svn-src-head@freebsd.org Tue Apr 28 03:43: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 D552F2AA5A2; Tue, 28 Apr 2020 03:43:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B6vH5G2Cz4Bhs; Tue, 28 Apr 2020 03:43:55 +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 AFCFD1DDF5; Tue, 28 Apr 2020 03:43:55 +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 03S3htTk027111; Tue, 28 Apr 2020 03:43:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S3htVq027110; Tue, 28 Apr 2020 03:43:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004280343.03S3htVq027110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Apr 2020 03:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360427 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 03:43:55 -0000 Author: kevans Date: Tue Apr 28 03:43:55 2020 New Revision: 360427 URL: https://svnweb.freebsd.org/changeset/base/360427 Log: config.lua(8): catch up to recently added hooks While we're here, let's stylize these as functions instead of just raw text. A future change may allow arbitrary data arguments to be passed some of these, and the distinction is useful. Modified: head/stand/lua/config.lua.8 Modified: head/stand/lua/config.lua.8 ============================================================================== --- head/stand/lua/config.lua.8 Tue Apr 28 02:13:59 2020 (r360426) +++ head/stand/lua/config.lua.8 Tue Apr 28 03:43:55 2020 (r360427) @@ -180,8 +180,10 @@ commands. The following hooks are defined in .Nm : .Bl -tag -width "config.reloaded" -offset indent -.It config.loaded -.It config.reloaded +.It Fn config.loaded +.It Fn config.reloaded +.It Fn kernel.loaded +.It Fn modules.loaded .El .Sh SEE ALSO .Xr loader.conf 5 , From owner-svn-src-head@freebsd.org Tue Apr 28 05:10: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 CBFCB2AC064; Tue, 28 Apr 2020 05:10:34 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49B8qG5213z4G4J; Tue, 28 Apr 2020 05:10:34 +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 A7CF91ED68; Tue, 28 Apr 2020 05:10:34 +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 03S5AYvC076661; Tue, 28 Apr 2020 05:10:34 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S5AYuJ076660; Tue, 28 Apr 2020 05:10:34 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <202004280510.03S5AYuJ076660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Apr 2020 05:10:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360428 - head/sbin/fsck_msdosfs X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/fsck_msdosfs X-SVN-Commit-Revision: 360428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 05:10:34 -0000 Author: delphij Date: Tue Apr 28 05:10:34 2020 New Revision: 360428 URL: https://svnweb.freebsd.org/changeset/base/360428 Log: Do not overflow when calculating file system size. Reported by: Hyeongseok Kim Reviewed by: cem, Hyeongseok Kim MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D24603 Modified: head/sbin/fsck_msdosfs/check.c Modified: head/sbin/fsck_msdosfs/check.c ============================================================================== --- head/sbin/fsck_msdosfs/check.c Tue Apr 28 03:43:55 2020 (r360427) +++ head/sbin/fsck_msdosfs/check.c Tue Apr 28 05:10:34 2020 (r360428) @@ -54,6 +54,8 @@ checkfilesys(const char *fname) int finish_dosdirsection=0; int mod = 0; int ret = 8; + int64_t freebytes; + int64_t badbytes; rdonly = alwaysno; if (!preen) @@ -129,37 +131,33 @@ checkfilesys(const char *fname) mod |= FSERROR; } + freebytes = (int64_t)boot.NumFree * boot.ClusterSize; + badbytes = (int64_t)boot.NumBad * boot.ClusterSize; + #ifdef HAVE_LIBUTIL_H char freestr[7], badstr[7]; - int64_t freebytes = boot.NumFree * boot.ClusterSize; humanize_number(freestr, sizeof(freestr), freebytes, "", HN_AUTOSCALE, HN_DECIMAL | HN_IEC_PREFIXES); if (boot.NumBad) { - int64_t badbytes = boot.NumBad * boot.ClusterSize; - humanize_number(badstr, sizeof(badstr), badbytes, "", HN_AUTOSCALE, HN_B | HN_DECIMAL | HN_IEC_PREFIXES); pwarn("%d files, %sB free (%d clusters), %sB bad (%d clusters)\n", - boot.NumFiles, - freestr, boot.NumFree, + boot.NumFiles, freestr, boot.NumFree, badstr, boot.NumBad); } else { pwarn("%d files, %sB free (%d clusters)\n", - boot.NumFiles, - freestr, boot.NumFree); + boot.NumFiles, freestr, boot.NumFree); } #else if (boot.NumBad) - pwarn("%d files, %d KiB free (%d clusters), %d KiB bad (%d clusters)\n", - boot.NumFiles, - boot.NumFree * boot.ClusterSize / 1024, boot.NumFree, - boot.NumBad * boot.ClusterSize / 1024, boot.NumBad); + pwarn("%d files, %jd KiB free (%d clusters), %jd KiB bad (%d clusters)\n", + boot.NumFiles, (intmax_t)freebytes / 1024, boot.NumFree, + (intmax_t)badbytes / 1024, boot.NumBad); else - pwarn("%d files, %d KiB free (%d clusters)\n", - boot.NumFiles, - boot.NumFree * boot.ClusterSize / 1024, boot.NumFree); + pwarn("%d files, %jd KiB free (%d clusters)\n", + boot.NumFiles, (intmax_t)freebytes / 1024, boot.NumFree); #endif if (mod && (mod & FSERROR) == 0) { From owner-svn-src-head@freebsd.org Tue Apr 28 07:23: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 B42DE2AF0E2; Tue, 28 Apr 2020 07:23:41 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BCms4MVnz4MdC; Tue, 28 Apr 2020 07:23:41 +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 90FA720802; Tue, 28 Apr 2020 07:23:41 +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 03S7NfBa062889; Tue, 28 Apr 2020 07:23:41 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S7NfZO062888; Tue, 28 Apr 2020 07:23:41 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004280723.03S7NfZO062888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 28 Apr 2020 07:23:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360429 - head/sys/nfs X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/nfs X-SVN-Commit-Revision: 360429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 07:23:41 -0000 Author: melifaro Date: Tue Apr 28 07:23:41 2020 New Revision: 360429 URL: https://svnweb.freebsd.org/changeset/base/360429 Log: Remove rtable dumping code from bootp. This debugging code printing routing table data was introduced in rS25723, 22+ years ago. The last functional commit to this code was rS67534, 19 years ago. The code has been turned off by default all this time. Lastly, this code directly iterates radix tree and rtentries, which is not not a proper interaction with routing system. Differential Revision: https://reviews.freebsd.org/D24554 Modified: head/sys/nfs/bootp_subr.c Modified: head/sys/nfs/bootp_subr.c ============================================================================== --- head/sys/nfs/bootp_subr.c Tue Apr 28 05:10:34 2020 (r360428) +++ head/sys/nfs/bootp_subr.c Tue Apr 28 07:23:41 2020 (r360429) @@ -68,9 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef BOOTP_DEBUG -#include -#endif #include #include @@ -263,10 +260,6 @@ static void bootpc_tag_helper(struct bootpc_tagcontext unsigned char *start, int len, int tag); #ifdef BOOTP_DEBUG -void bootpboot_p_sa(struct sockaddr *sa, struct sockaddr *ma); -void bootpboot_p_rtentry(struct rtentry *rt); -void bootpboot_p_tree(struct radix_node *rn); -void bootpboot_p_rtlist(void); void bootpboot_p_if(struct ifnet *ifp, struct ifaddr *ifa); void bootpboot_p_iflist(void); #endif @@ -299,95 +292,6 @@ static __inline int bootpc_ifctx_isfailed(struct bootp */ #ifdef BOOTP_DEBUG -void -bootpboot_p_sa(struct sockaddr *sa, struct sockaddr *ma) -{ - - if (sa == NULL) { - printf("(sockaddr *) "); - return; - } - switch (sa->sa_family) { - case AF_INET: - { - struct sockaddr_in *sin; - - sin = (struct sockaddr_in *) sa; - printf("inet "); - print_sin_addr(sin); - if (ma != NULL) { - sin = (struct sockaddr_in *) ma; - printf(" mask "); - print_sin_addr(sin); - } - } - break; - case AF_LINK: - { - struct sockaddr_dl *sli; - int i; - - sli = (struct sockaddr_dl *) sa; - printf("link %.*s ", sli->sdl_nlen, sli->sdl_data); - for (i = 0; i < sli->sdl_alen; i++) { - if (i > 0) - printf(":"); - printf("%x", ((unsigned char *) LLADDR(sli))[i]); - } - } - break; - default: - printf("af%d", sa->sa_family); - } -} - -void -bootpboot_p_rtentry(struct rtentry *rt) -{ - - bootpboot_p_sa(rt_key(rt), rt_mask(rt)); - printf(" "); - bootpboot_p_sa(rt->rt_gateway, NULL); - printf(" "); - printf("flags %x", (unsigned short) rt->rt_flags); - printf(" %d", (int) rt->rt_expire); - printf(" %s\n", rt->rt_ifp->if_xname); -} - -void -bootpboot_p_tree(struct radix_node *rn) -{ - - while (rn != NULL) { - if (rn->rn_bit < 0) { - if ((rn->rn_flags & RNF_ROOT) != 0) { - } else { - bootpboot_p_rtentry((struct rtentry *) rn); - } - rn = rn->rn_dupedkey; - } else { - bootpboot_p_tree(rn->rn_left); - bootpboot_p_tree(rn->rn_right); - return; - } - } -} - -void -bootpboot_p_rtlist(void) -{ - RIB_RLOCK_TRACKER; - struct rib_head *rnh; - - printf("Routing table:\n"); - rnh = rt_tables_get_rnh(0, AF_INET); - if (rnh == NULL) - return; - RIB_RLOCK(rnh); /* could sleep XXX */ - bootpboot_p_tree(rnh->rnh_treetop); - RIB_RUNLOCK(rnh); -} - void bootpboot_p_if(struct ifnet *ifp, struct ifaddr *ifa) { From owner-svn-src-head@freebsd.org Tue Apr 28 07:25:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D1AF2AF34D; Tue, 28 Apr 2020 07:25:36 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BCq41svkz4Mw2; Tue, 28 Apr 2020 07:25:36 +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 3B4982082D; Tue, 28 Apr 2020 07:25:36 +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 03S7Pa76063026; Tue, 28 Apr 2020 07:25:36 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S7PZmV063021; Tue, 28 Apr 2020 07:25:35 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004280725.03S7PZmV063021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 28 Apr 2020 07:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360430 - in head/sys: net netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet netinet6 X-SVN-Commit-Revision: 360430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 07:25:36 -0000 Author: melifaro Date: Tue Apr 28 07:25:34 2020 New Revision: 360430 URL: https://svnweb.freebsd.org/changeset/base/360430 Log: Eliminate now-unused parts of old routing KPI. r360292 switched most of the remaining routing customers to a new KPI, leaving a bunch of wrappers for old routing lookup functions unused. Remove them from the tree as a part of routing cleanup. Differential Revision: https://reviews.freebsd.org/D24569 Modified: head/sys/net/route.c head/sys/net/route.h head/sys/netinet/in_rmx.c head/sys/netinet/in_var.h head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_var.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Apr 28 07:23:41 2020 (r360429) +++ head/sys/net/route.c Tue Apr 28 07:25:34 2020 (r360430) @@ -434,28 +434,6 @@ sys_setfib(struct thread *td, struct setfib_args *uap) } /* - * Packet routing routines. - */ -void -rtalloc_ign_fib(struct route *ro, u_long ignore, u_int fibnum) -{ - struct rtentry *rt; - - if (ro->ro_nh != NULL) { - if (NH_IS_VALID(ro->ro_nh)) - return; - NH_FREE(ro->ro_nh); - ro->ro_nh = NULL; - } - rt = rtalloc1_fib(&ro->ro_dst, 1, ignore, fibnum); - if (rt != NULL) { - ro->ro_nh = rt->rt_nhop; - nhop_ref_object(rt->rt_nhop); - RT_UNLOCK(rt); - } -} - -/* * Look up the route that matches the address given * Or, at least try.. Create a cloned route if needed. * Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Tue Apr 28 07:23:41 2020 (r360429) +++ head/sys/net/route.h Tue Apr 28 07:25:34 2020 (r360430) @@ -503,7 +503,6 @@ int rtinit(struct ifaddr *, int, int); * For now the protocol indepedent versions are the same as the AF_INET ones * but this will change.. */ -void rtalloc_ign_fib(struct route *ro, u_long ignflags, u_int fibnum); struct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int); int rtioctl_fib(u_long, caddr_t, u_int); int rtrequest_fib(int, struct sockaddr *, Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Tue Apr 28 07:23:41 2020 (r360429) +++ head/sys/netinet/in_rmx.c Tue Apr 28 07:25:34 2020 (r360430) @@ -257,14 +257,3 @@ in_ifadown(struct ifaddr *ifa, int delete) ifa->ifa_flags &= ~IFA_ROUTE; /* XXXlocking? */ } -/* - * inet versions of rt functions. These have fib extensions and - * for now will just reference the _fib variants. - * eventually this order will be reversed, - */ -void -in_rtalloc_ign(struct route *ro, u_long ignflags, u_int fibnum) -{ - rtalloc_ign_fib(ro, ignflags, fibnum); -} - Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Tue Apr 28 07:23:41 2020 (r360429) +++ head/sys/netinet/in_var.h Tue Apr 28 07:25:34 2020 (r360430) @@ -471,9 +471,6 @@ struct mbuf *ip_tryforward(struct mbuf *); void *in_domifattach(struct ifnet *); void in_domifdetach(struct ifnet *, void *); - -/* XXX */ -void in_rtalloc_ign(struct route *ro, u_long ignflags, u_int fibnum); #endif /* _KERNEL */ /* INET6 stuff */ Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Tue Apr 28 07:23:41 2020 (r360429) +++ head/sys/netinet6/in6_rmx.c Tue Apr 28 07:25:34 2020 (r360430) @@ -239,23 +239,3 @@ in6_rtrequest(int req, struct sockaddr *dst, struct so return (rtrequest_fib(req, dst, gw, mask, flags, ret_nrt, fibnum)); } -void -in6_rtalloc(struct route_in6 *ro, u_int fibnum) -{ - - rtalloc_ign_fib((struct route *)ro, 0ul, fibnum); -} - -void -in6_rtalloc_ign(struct route_in6 *ro, u_long ignflags, u_int fibnum) -{ - - rtalloc_ign_fib((struct route *)ro, ignflags, fibnum); -} - -struct rtentry * -in6_rtalloc1(struct sockaddr *dst, int report, u_long ignflags, u_int fibnum) -{ - - return (rtalloc1_fib(dst, report, ignflags, fibnum)); -} Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Tue Apr 28 07:23:41 2020 (r360429) +++ head/sys/netinet6/in6_var.h Tue Apr 28 07:25:34 2020 (r360430) @@ -917,9 +917,6 @@ void in6_newaddrmsg(struct in6_ifaddr *, int); struct mbuf *ip6_tryforward(struct mbuf *); int in6_rtrequest(int, struct sockaddr *, struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int); -void in6_rtalloc(struct route_in6 *, u_int); -void in6_rtalloc_ign(struct route_in6 *, u_long, u_int); -struct rtentry *in6_rtalloc1(struct sockaddr *, int, u_long, u_int); #endif /* _KERNEL */ #endif /* _NETINET6_IN6_VAR_H_ */ From owner-svn-src-head@freebsd.org Tue Apr 28 08:06: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 2F87A2B0C00; Tue, 28 Apr 2020 08:06:58 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BDkp0RbFz4QD2; Tue, 28 Apr 2020 08:06:58 +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 0A5BD21025; Tue, 28 Apr 2020 08:06:58 +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 03S86vx1087711; Tue, 28 Apr 2020 08:06:57 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03S86vQC087708; Tue, 28 Apr 2020 08:06:57 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004280806.03S86vQC087708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 28 Apr 2020 08:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360431 - in head/sys: net netinet X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet X-SVN-Commit-Revision: 360431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 08:06:58 -0000 Author: melifaro Date: Tue Apr 28 08:06:56 2020 New Revision: 360431 URL: https://svnweb.freebsd.org/changeset/base/360431 Log: Convert rtalloc_mpath_fib() users to the new KPI. New fib[46]_lookup() functions support multipath transparently. Given that, switch the last rtalloc_mpath_fib() calls to dib4_lookup() and eliminate the function itself. Note: proper flowid generation (especially for the outbound traffic) is a bigger topic and will be handled in a separate review. This change leaves flowid generation intact. Differential Revision: https://reviews.freebsd.org/D24595 Modified: head/sys/net/radix_mpath.c head/sys/net/radix_mpath.h head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c Modified: head/sys/net/radix_mpath.c ============================================================================== --- head/sys/net/radix_mpath.c Tue Apr 28 07:25:34 2020 (r360430) +++ head/sys/net/radix_mpath.c Tue Apr 28 08:06:56 2020 (r360431) @@ -257,46 +257,6 @@ rt_mpath_select(struct rtentry *rte, uint32_t hash) } void -rtalloc_mpath_fib(struct route *ro, uint32_t hash, u_int fibnum) -{ - struct rtentry *rt, *rt_tmp; - - /* - * XXX we don't attempt to lookup cached route again; what should - * be done for sendto(3) case? - */ - if (ro->ro_nh && RT_LINK_IS_UP(ro->ro_nh->nh_ifp)) - return; - ro->ro_nh = NULL; - rt_tmp = rtalloc1_fib(&ro->ro_dst, 1, 0, fibnum); - - /* if the route does not exist or it is not multipath, don't care */ - if (rt_tmp == NULL) - return; - if (rn_mpath_next((struct radix_node *)rt_tmp) == NULL) { - ro->ro_nh = rt_tmp->rt_nhop; - nhop_ref_object(ro->ro_nh); - RT_UNLOCK(rt_tmp); - return; - } - - rt = rt_mpath_selectrte(rt_tmp, hash); - /* XXX try filling rt_gwroute and avoid unreachable gw */ - - /* gw selection has failed - there must be only zero weight routes */ - if (!rt) { - RT_UNLOCK(rt_tmp); - return; - } - if (rt_tmp != rt) { - RTFREE_LOCKED(rt_tmp); - ro->ro_nh = rt->rt_nhop; - nhop_ref_object(ro->ro_nh); - } else - RT_UNLOCK(rt_tmp); -} - -void rt_mpath_init_rnh(struct rib_head *rnh) { Modified: head/sys/net/radix_mpath.h ============================================================================== --- head/sys/net/radix_mpath.h Tue Apr 28 07:25:34 2020 (r360430) +++ head/sys/net/radix_mpath.h Tue Apr 28 08:06:56 2020 (r360431) @@ -54,7 +54,6 @@ u_int32_t rn_mpath_count(struct radix_node *); struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *); int rt_mpath_conflict(struct rib_head *, struct rtentry *, struct sockaddr *); -void rtalloc_mpath_fib(struct route *, u_int32_t, u_int); struct rtentry *rt_mpath_select(struct rtentry *, uint32_t); struct rtentry *rt_mpath_selectrte(struct rtentry *, uint32_t); int rt_mpath_deldup(struct rtentry *, struct rtentry *); Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Tue Apr 28 07:25:34 2020 (r360430) +++ head/sys/netinet/ip_input.c Tue Apr 28 08:06:56 2020 (r360431) @@ -954,6 +954,7 @@ ip_forward(struct mbuf *m, int srcrt) struct sockaddr_in *sin; struct in_addr dest; struct route ro; + uint32_t flowid; int error, type = 0, code = 0, mtu = 0; NET_EPOCH_ASSERT(); @@ -978,13 +979,11 @@ ip_forward(struct mbuf *m, int srcrt) sin->sin_len = sizeof(*sin); sin->sin_addr = ip->ip_dst; #ifdef RADIX_MPATH - rtalloc_mpath_fib(&ro, - ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), - M_GETFIB(m)); + flowid = ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr); #else - ro.ro_nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_REF, - m->m_pkthdr.flowid); + flowid = m->m_pkthdr.flowid; #endif + ro.ro_nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_REF, flowid); if (ro.ro_nh != NULL) { ia = ifatoia(ro.ro_nh->nh_ifa); } else Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Tue Apr 28 07:25:34 2020 (r360430) +++ head/sys/netinet/ip_output.c Tue Apr 28 08:06:56 2020 (r360431) @@ -68,9 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef RADIX_MPATH -#include -#endif #include #include @@ -470,14 +467,15 @@ again: * layer, as this is probably required in all cases * for correct operation (as it is for ARP). */ + uint32_t flowid; #ifdef RADIX_MPATH - rtalloc_mpath_fib(ro, - ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), - fibnum); + flowid = ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr); #else - ro->ro_nh = fib4_lookup(fibnum, dst->sin_addr, 0, - NHR_REF, m->m_pkthdr.flowid); + flowid = m->m_pkthdr.flowid; #endif + ro->ro_nh = fib4_lookup(fibnum, dst->sin_addr, 0, + NHR_REF, flowid); + if (ro->ro_nh == NULL || (!NH_IS_VALID(ro->ro_nh)) || !RT_LINK_IS_UP(ro->ro_nh->nh_ifp)) { #if defined(IPSEC) || defined(IPSEC_SUPPORT) From owner-svn-src-head@freebsd.org Tue Apr 28 11:52: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 17C152B622B; Tue, 28 Apr 2020 11:52:35 +0000 (UTC) (envelope-from jbeich@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) server-signature RSA-PSS (4096 bits) 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 49BKl66q1Xz4c0F; Tue, 28 Apr 2020 11:52:34 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id E242B13EAF; Tue, 28 Apr 2020 11:52:34 +0000 (UTC) From: Jan Beich To: Kyle Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r360125 - in head/usr.bin/diff: . tests References: <202004201614.03KGEitC073880@repo.freebsd.org> Date: Tue, 28 Apr 2020 13:52:31 +0200 In-Reply-To: <202004201614.03KGEitC073880@repo.freebsd.org> (Kyle Evans's message of "Mon, 20 Apr 2020 16:14:44 +0000 (UTC)") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 11:52:35 -0000 Kyle Evans writes: > Author: kevans > Date: Mon Apr 20 16:14:44 2020 > New Revision: 360125 > URL: https://svnweb.freebsd.org/changeset/base/360125 > > Log: > diff(1): reject conflicting formatting options > > This matches GNU diff(1) behavior and, more importantly, eliminates any > source of confusion if multiple formatting options are specified. > > Note that the committed diff differs slightly from the submitted: I've > modified it so that we initialize diff_format to something that isn't an > accepted format option so that we can also reject --normal -c and -c > --normal, which would've otherwise been accepted because the default was > --normal. After option parsing we default it to D_NORMAL if it's still > unset. > > PR: 243975 > Submitted by: fehmi noyan isi > MFC after: 1 week Appears to break ability to specify number of context lines e.g., $ diff -U999 /usr/include/sha256.h /usr/include/sha512.h error: conflicting output format options. usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case] [...] From owner-svn-src-head@freebsd.org Tue Apr 28 12:25: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 E8A372B807A; Tue, 28 Apr 2020 12:25:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BLT75rlKz4f5l; Tue, 28 Apr 2020 12:25:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (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 B806810C9; Tue, 28 Apr 2020 12:25:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f174.google.com with SMTP id e17so13627498qtp.7; Tue, 28 Apr 2020 05:25:31 -0700 (PDT) X-Gm-Message-State: AGi0PuYXXnyJe6ZQm6YvKRzQhdan+cyKi6kdBCNS1bo39itTljJc5Oeu tdxprVnWr0A82HfthDEXfnK3vbfdvGCOaeWKXyg= X-Google-Smtp-Source: APiQypJHcEOn7Z2c4J9nt2KFfihOPMw+WIImv35BL572rfblas11UkgYX451vmRjYZbIBZ5kEZRFzy6pKZAovhlffB4= X-Received: by 2002:ac8:7301:: with SMTP id x1mr28981090qto.53.1588076731052; Tue, 28 Apr 2020 05:25:31 -0700 (PDT) MIME-Version: 1.0 References: <202004201614.03KGEitC073880@repo.freebsd.org> In-Reply-To: From: Kyle Evans Date: Tue, 28 Apr 2020 07:25:18 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r360125 - in head/usr.bin/diff: . tests To: Jan Beich Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 12:25:32 -0000 On Tue, Apr 28, 2020 at 6:52 AM Jan Beich wrote: > > Kyle Evans writes: > > > Author: kevans > > Date: Mon Apr 20 16:14:44 2020 > > New Revision: 360125 > > URL: https://svnweb.freebsd.org/changeset/base/360125 > > > > Log: > > diff(1): reject conflicting formatting options > > > > This matches GNU diff(1) behavior and, more importantly, eliminates any > > source of confusion if multiple formatting options are specified. > > > > Note that the committed diff differs slightly from the submitted: I've > > modified it so that we initialize diff_format to something that isn't an > > accepted format option so that we can also reject --normal -c and -c > > --normal, which would've otherwise been accepted because the default was > > --normal. After option parsing we default it to D_NORMAL if it's still > > unset. > > > > PR: 243975 > > Submitted by: fehmi noyan isi > > MFC after: 1 week > > Appears to break ability to specify number of context lines e.g., > > $ diff -U999 /usr/include/sha256.h /usr/include/sha512.h > error: conflicting output format options. > usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case] > [...] Hmm, bizarre. =-\ This example works on my machine, and I don't see off-hand what would be preventing it for you: root@viper:/usr/src/usr.bin/diff# diff -U999 /usr/include/sha256.h /usr/include/sha512.h --- /usr/include/sha256.h 2020-04-22 21:38:54.000000000 -0500 +++ /usr/include/sha512.h 2020-04-22 21:38:54.000000000 -0500 @@ -1,99 +1,99 @@ /*- * Copyright 2005 Colin Percival * All rights reserved. * [... omitted ...] root@viper:/usr/src/usr.bin/diff# strings /usr/bin/diff | grep 'conflicting' error: conflicting output format options. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Tue Apr 28 12:43: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 32A822B86DA; Tue, 28 Apr 2020 12:43:00 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BLsJ09Mhz4g1X; Tue, 28 Apr 2020 12:42:59 +0000 (UTC) (envelope-from gljennjohn@gmail.com) Received: by mail-wm1-x343.google.com with SMTP id r26so2716902wmh.0; Tue, 28 Apr 2020 05:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=+AGVnDbmsgROvhJymkcfikIqQmonKbKjKB5hiAYmdUo=; b=FZaM2RyxRx7vj+a+IGmZjUsGvx8bQ3CRwgLQCnmkGSf+4pe3EL+0A+VAw1GC1Ij8dY W90r2SWQoYZdWjMfawJ52B517VzN81pJ2khuILSUfoVPqeAODZzHYHYbgC2htjKXZ/Bg up8LEq4S2KDx89HhxdWqgaWLMjjfQEsFZDFSpOyPTQCMWmbGyuUp5r5P2diX8fv7+QhU bTNvXpunHb/F8BZvJDPKwPN24mhlGwCPQoRoL2PFsEUNX0p2RisMPjcGF5tUuYb8TzGB h5JImHCcWMMqLPE/1uEHWlWvCQkUVCubIFHTorC3FXS91vvHa6UOlPLXO6BmzqX5yspQ dTYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=+AGVnDbmsgROvhJymkcfikIqQmonKbKjKB5hiAYmdUo=; b=SDf+5y7BEJ57G1Uwpru2Upo/yDH//NqJ00WCu+cIRLYeUqnIAwu2OXi5eR7RKjTUaK zCoDAp6RdQ7YZR91p/zR6AVi4UtMqIN+/ez5pC+86K6BN4MkKQzPjDqkx7MW9r75ad9y XV+HMXiO4L/UKNxBuwrTOQDnLq2EPjvy97pRnDoHpqGx/fmEDJ35zBLaESRjKU0NDOxi WWFnlFzYTieZzPX/OKCJ1wuwBwDy9hp2+eu2Iy1OS1+VW2599m03PgjR3uVPDMEUoUp+ z0rhSpM2W7EdNGBks/Qmc1RMhe7mNsk/rukWhdG505nTiJtCx6JbULE/+r0NwzDsUmJr xOBQ== X-Gm-Message-State: AGi0PuYYcWfcaJcQYhDogfqYcSWX1Me6EcchDmE3Y7QrL9wyjJPmej9K 0tl7qHaAroKSX76L4/P1bAYrQvmT X-Google-Smtp-Source: APiQypLjxDTGH8u6zjcTHP/pE7KF3F+PXmkzpH3HRUvMTaRyVwcPARPPFlvsorixgXkGcsn7rFtUvg== X-Received: by 2002:a1c:bb08:: with SMTP id l8mr4865515wmf.168.1588077778053; Tue, 28 Apr 2020 05:42:58 -0700 (PDT) Received: from ernst.home (p5B3BE186.dip0.t-ipconnect.de. [91.59.225.134]) by smtp.gmail.com with ESMTPSA id w10sm26477778wrg.52.2020.04.28.05.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 05:42:57 -0700 (PDT) Date: Tue, 28 Apr 2020 14:42:55 +0200 From: Gary Jennejohn To: Kyle Evans Cc: Jan Beich , svn-src-head , svn-src-all , src-committers Subject: Re: svn commit: r360125 - in head/usr.bin/diff: . tests Message-ID: <20200428144255.1b75d9b5@ernst.home> In-Reply-To: References: <202004201614.03KGEitC073880@repo.freebsd.org> Reply-To: gljennjohn@gmail.com X-Mailer: Claws Mail 3.17.4 (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: 49BLsJ09Mhz4g1X X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 12:43:00 -0000 On Tue, 28 Apr 2020 07:25:18 -0500 Kyle Evans wrote: > On Tue, Apr 28, 2020 at 6:52 AM Jan Beich wrote: > > > > Kyle Evans writes: > > > > > Author: kevans > > > Date: Mon Apr 20 16:14:44 2020 > > > New Revision: 360125 > > > URL: https://svnweb.freebsd.org/changeset/base/360125 > > > > > > Log: > > > diff(1): reject conflicting formatting options > > > > > > This matches GNU diff(1) behavior and, more importantly, eliminates any > > > source of confusion if multiple formatting options are specified. > > > > > > Note that the committed diff differs slightly from the submitted: I've > > > modified it so that we initialize diff_format to something that isn't an > > > accepted format option so that we can also reject --normal -c and -c > > > --normal, which would've otherwise been accepted because the default was > > > --normal. After option parsing we default it to D_NORMAL if it's still > > > unset. > > > > > > PR: 243975 > > > Submitted by: fehmi noyan isi > > > MFC after: 1 week > > > > Appears to break ability to specify number of context lines e.g., > > > > $ diff -U999 /usr/include/sha256.h /usr/include/sha512.h > > error: conflicting output format options. > > usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case] > > [...] > > Hmm, bizarre. =-\ This example works on my machine, and I don't see > off-hand what would be preventing it for you: > > root@viper:/usr/src/usr.bin/diff# diff -U999 /usr/include/sha256.h > /usr/include/sha512.h > --- /usr/include/sha256.h 2020-04-22 21:38:54.000000000 -0500 > +++ /usr/include/sha512.h 2020-04-22 21:38:54.000000000 -0500 > @@ -1,99 +1,99 @@ > /*- > * Copyright 2005 Colin Percival > * All rights reserved. > * > [... omitted ...] > > root@viper:/usr/src/usr.bin/diff# strings /usr/bin/diff | grep 'conflicting' > error: conflicting output format options. > My /usr/bin/diff was built and installed on April 26, after this commit, and I don't see the error either. -- Gary Jennejohn From owner-svn-src-head@freebsd.org Tue Apr 28 12:55: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 D616E2B89CC; Tue, 28 Apr 2020 12:55:48 +0000 (UTC) (envelope-from jbeich@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) server-signature RSA-PSS (4096 bits) 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 49BM845Jp7z3BvP; Tue, 28 Apr 2020 12:55:48 +0000 (UTC) (envelope-from jbeich@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1354) id AAE7C14C2A; Tue, 28 Apr 2020 12:55:48 +0000 (UTC) From: Jan Beich To: Gary Jennejohn Cc: Kyle Evans , svn-src-head , svn-src-all , src-committers Subject: Re: svn commit: r360125 - in head/usr.bin/diff: . tests References: <202004201614.03KGEitC073880@repo.freebsd.org> <20200428144255.1b75d9b5@ernst.home> Date: Tue, 28 Apr 2020 14:55:44 +0200 In-Reply-To: <20200428144255.1b75d9b5@ernst.home> (Gary Jennejohn's message of "Tue, 28 Apr 2020 14:42:55 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 12:55:48 -0000 Gary Jennejohn writes: > On Tue, 28 Apr 2020 07:25:18 -0500 > Kyle Evans wrote: > >> On Tue, Apr 28, 2020 at 6:52 AM Jan Beich wrote: >> > >> > Kyle Evans writes: >> > >> > > Author: kevans >> > > Date: Mon Apr 20 16:14:44 2020 >> > > New Revision: 360125 >> > > URL: https://svnweb.freebsd.org/changeset/base/360125 >> > > >> > > Log: >> > > diff(1): reject conflicting formatting options >> > > >> > > This matches GNU diff(1) behavior and, more importantly, eliminates any >> > > source of confusion if multiple formatting options are specified. >> > > >> > > Note that the committed diff differs slightly from the submitted: I've >> > > modified it so that we initialize diff_format to something that isn't an >> > > accepted format option so that we can also reject --normal -c and -c >> > > --normal, which would've otherwise been accepted because the default was >> > > --normal. After option parsing we default it to D_NORMAL if it's still >> > > unset. >> > > >> > > PR: 243975 >> > > Submitted by: fehmi noyan isi >> > > MFC after: 1 week >> > >> > Appears to break ability to specify number of context lines e.g., >> > >> > $ diff -U999 /usr/include/sha256.h /usr/include/sha512.h >> > error: conflicting output format options. >> > usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case] >> > [...] >> >> Hmm, bizarre. =-\ This example works on my machine, and I don't see >> off-hand what would be preventing it for you: >> >> root@viper:/usr/src/usr.bin/diff# diff -U999 /usr/include/sha256.h >> /usr/include/sha512.h >> --- /usr/include/sha256.h 2020-04-22 21:38:54.000000000 -0500 >> +++ /usr/include/sha512.h 2020-04-22 21:38:54.000000000 -0500 >> @@ -1,99 +1,99 @@ >> /*- >> * Copyright 2005 Colin Percival >> * All rights reserved. >> * >> [... omitted ...] >> >> root@viper:/usr/src/usr.bin/diff# strings /usr/bin/diff | grep 'conflicting' >> error: conflicting output format options. >> > > My /usr/bin/diff was built and installed on April 26, after this > commit, and I don't see the error either. Thanks for confirming. Looks like my "diff" was aliased to "diff -up". Indeed, -u and -U are no longer compatible unlike GNU diff. From owner-svn-src-head@freebsd.org Tue Apr 28 12:58:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7A7A2B8A69; Tue, 28 Apr 2020 12:58:17 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BMBx4zZqz3C45; Tue, 28 Apr 2020 12:58:17 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (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 9824F147F; Tue, 28 Apr 2020 12:58:17 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f54.google.com with SMTP id q2so10287275qvd.1; Tue, 28 Apr 2020 05:58:17 -0700 (PDT) X-Gm-Message-State: AGi0PubK5ZBTjtr70JDhg708hmG9Ao3V1THKWKAOe6CbDGpBH5X4E84F ahScy9iVEVdynevkPzwsmthERHpAKx2kjnJVK+U= X-Google-Smtp-Source: APiQypIA6zVJvuri6dDpSgJNtg7/mD8mdUGgzuhC2QqMNi/qvYyZl6tm2GwH1HH30TIPG0NgsJJUddz6+0ImL1LvZTg= X-Received: by 2002:a05:6214:1853:: with SMTP id d19mr26983014qvy.150.1588078697114; Tue, 28 Apr 2020 05:58:17 -0700 (PDT) MIME-Version: 1.0 References: <202004201614.03KGEitC073880@repo.freebsd.org> <20200428144255.1b75d9b5@ernst.home> In-Reply-To: From: Kyle Evans Date: Tue, 28 Apr 2020 07:58:04 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r360125 - in head/usr.bin/diff: . tests To: Jan Beich Cc: Gary Jennejohn , svn-src-head , svn-src-all , src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 12:58:17 -0000 On Tue, Apr 28, 2020 at 7:55 AM Jan Beich wrote: > > Gary Jennejohn writes: > > > On Tue, 28 Apr 2020 07:25:18 -0500 > > Kyle Evans wrote: > > > >> On Tue, Apr 28, 2020 at 6:52 AM Jan Beich wrote: > >> > > >> > Kyle Evans writes: > >> > > >> > > Author: kevans > >> > > Date: Mon Apr 20 16:14:44 2020 > >> > > New Revision: 360125 > >> > > URL: https://svnweb.freebsd.org/changeset/base/360125 > >> > > > >> > > Log: > >> > > diff(1): reject conflicting formatting options > >> > > > >> > > This matches GNU diff(1) behavior and, more importantly, eliminates any > >> > > source of confusion if multiple formatting options are specified. > >> > > > >> > > Note that the committed diff differs slightly from the submitted: I've > >> > > modified it so that we initialize diff_format to something that isn't an > >> > > accepted format option so that we can also reject --normal -c and -c > >> > > --normal, which would've otherwise been accepted because the default was > >> > > --normal. After option parsing we default it to D_NORMAL if it's still > >> > > unset. > >> > > > >> > > PR: 243975 > >> > > Submitted by: fehmi noyan isi > >> > > MFC after: 1 week > >> > > >> > Appears to break ability to specify number of context lines e.g., > >> > > >> > $ diff -U999 /usr/include/sha256.h /usr/include/sha512.h > >> > error: conflicting output format options. > >> > usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case] > >> > [...] > >> > >> Hmm, bizarre. =-\ This example works on my machine, and I don't see > >> off-hand what would be preventing it for you: > >> > >> root@viper:/usr/src/usr.bin/diff# diff -U999 /usr/include/sha256.h > >> /usr/include/sha512.h > >> --- /usr/include/sha256.h 2020-04-22 21:38:54.000000000 -0500 > >> +++ /usr/include/sha512.h 2020-04-22 21:38:54.000000000 -0500 > >> @@ -1,99 +1,99 @@ > >> /*- > >> * Copyright 2005 Colin Percival > >> * All rights reserved. > >> * > >> [... omitted ...] > >> > >> root@viper:/usr/src/usr.bin/diff# strings /usr/bin/diff | grep 'conflicting' > >> error: conflicting output format options. > >> > > > > My /usr/bin/diff was built and installed on April 26, after this > > commit, and I don't see the error either. > > Thanks for confirming. Looks like my "diff" was aliased to "diff -up". > Indeed, -u and -U are no longer compatible unlike GNU diff. Whoops, *facepalm*, you certainly shouldn't be restricted from specifying the same output style multiple times. Will fix ASAP. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Tue Apr 28 13:28: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 5E35F2B961F; Tue, 28 Apr 2020 13:28:59 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BMtM1r1Mz3DqL; Tue, 28 Apr 2020 13:28:59 +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 35C6F24CFA; Tue, 28 Apr 2020 13:28:59 +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 03SDSx6D012770; Tue, 28 Apr 2020 13:28:59 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SDSx8A012769; Tue, 28 Apr 2020 13:28:59 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202004281328.03SDSx8A012769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Tue, 28 Apr 2020 13:28:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360435 - head/usr.sbin/bluetooth/hccontrol X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: head/usr.sbin/bluetooth/hccontrol X-SVN-Commit-Revision: 360435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 13:28:59 -0000 Author: takawata Date: Tue Apr 28 13:28:58 2020 New Revision: 360435 URL: https://svnweb.freebsd.org/changeset/base/360435 Log: Improve error handling Check return values from hci_request() Check rp.status Print error messages with hci_status2str() PR: 245769 Submitted by: Marc Veldman Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 13:16:35 2020 (r360434) +++ head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 13:28:58 2020 (r360435) @@ -69,20 +69,20 @@ le_set_scan_param(int s, int argc, char *argv[]) int window; int adrtype; int policy; - int e, n; + int n; ng_hci_le_set_scan_parameters_cp cp; ng_hci_le_set_scan_parameters_rp rp; if (argc != 5) - return USAGE; + return (USAGE); if (strcmp(argv[0], "active") == 0) type = 1; else if (strcmp(argv[0], "passive") == 0) type = 0; else - return USAGE; + return (USAGE); interval = (int)(atof(argv[1])/0.625); interval = (interval < 4)? 4: interval; @@ -94,14 +94,14 @@ le_set_scan_param(int s, int argc, char *argv[]) else if (strcmp(argv[3], "random") == 0) adrtype = 1; else - return USAGE; + return (USAGE); if (strcmp(argv[4], "all") == 0) policy = 0; else if (strcmp(argv[4], "whitelist") == 0) policy = 1; else - return USAGE; + return (USAGE); cp.le_scan_type = type; cp.le_scan_interval = interval; @@ -109,11 +109,19 @@ le_set_scan_param(int s, int argc, char *argv[]) cp.le_scan_window = window; cp.scanning_filter_policy = policy; n = sizeof(rp); - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_SET_SCAN_PARAMETERS), - (void *)&cp, sizeof(cp), (void *)&rp, &n); + (void *)&cp, sizeof(cp), (void *)&rp, &n) == ERROR) + return (ERROR); - return 0; + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + return (OK); } static int @@ -121,27 +129,35 @@ le_set_scan_enable(int s, int argc, char *argv[]) { ng_hci_le_set_scan_enable_cp cp; ng_hci_le_set_scan_enable_rp rp; - int e, n, enable = 0; + int n, enable = 0; if (argc != 1) - return USAGE; + return (USAGE); if (strcmp(argv[0], "enable") == 0) enable = 1; else if (strcmp(argv[0], "disable") != 0) - return USAGE; + return (USAGE); n = sizeof(rp); cp.le_scan_enable = enable; cp.filter_duplicates = 0; - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_SET_SCAN_ENABLE), - (void *)&cp, sizeof(cp), (void *)&rp, &n); + (void *)&cp, sizeof(cp), + (void *)&rp, &n) == ERROR) + return (ERROR); - if (e != 0 || rp.status != 0) - return ERROR; + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } - return OK; + fprintf(stdout, "LE Scan: %s\n", + enable? "Enabled" : "Disabled"); + + return (OK); } static int @@ -197,7 +213,7 @@ parse_param(int argc, char *argv[], char *buf, int *le done: *len = curbuf - buf; - return OK; + return (OK); } static int @@ -206,7 +222,6 @@ le_set_scan_response(int s, int argc, char *argv[]) ng_hci_le_set_scan_response_data_cp cp; ng_hci_le_set_scan_response_data_rp rp; int n; - int e; int len; char buf[NG_HCI_ADVERTISING_DATA_SIZE]; @@ -216,13 +231,19 @@ le_set_scan_response(int s, int argc, char *argv[]) cp.scan_response_data_length = len; memcpy(cp.scan_response_data, buf, len); n = sizeof(rp); - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA), - (void *)&cp, sizeof(cp), (void *)&rp, &n); + (void *)&cp, sizeof(cp), + (void *)&rp, &n) == ERROR) + return (ERROR); - printf("SET SCAN RESPONSE %d %d %d\n", e, rp.status, n); + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } - return OK; + return (OK); } static int @@ -259,7 +280,7 @@ le_read_local_supported_features(int s, int argc ,char buffer, sizeof(buffer))); fprintf(stdout, "\n"); - return OK; + return (OK); } static int @@ -290,7 +311,7 @@ set_le_event_mask(int s, uint64_t mask) { ng_hci_le_set_event_mask_cp semc; ng_hci_le_set_event_mask_rp rp; - int i, n ,e; + int i, n; n = sizeof(rp); @@ -298,11 +319,18 @@ set_le_event_mask(int s, uint64_t mask) semc.event_mask[i] = mask&0xff; mask >>= 8; } - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + if(hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_SET_EVENT_MASK), - (void *)&semc, sizeof(semc), (void *)&rp, &n); + (void *)&semc, sizeof(semc), (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } - return 0; + return (OK); } static int @@ -310,7 +338,7 @@ set_event_mask(int s, uint64_t mask) { ng_hci_set_event_mask_cp semc; ng_hci_set_event_mask_rp rp; - int i, n, e; + int i, n; n = sizeof(rp); @@ -318,29 +346,48 @@ set_event_mask(int s, uint64_t mask) semc.event_mask[i] = mask&0xff; mask >>= 8; } - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, NG_HCI_OCF_SET_EVENT_MASK), - (void *)&semc, sizeof(semc), (void *)&rp, &n); + (void *)&semc, sizeof(semc), (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } - return 0; + return (OK); } static int le_enable(int s, int argc, char *argv[]) { + int result; + if (argc != 1) - return USAGE; + return (USAGE); if (strcasecmp(argv[0], "enable") == 0) { - set_event_mask(s, NG_HCI_EVENT_MASK_DEFAULT | + result = set_event_mask(s, NG_HCI_EVENT_MASK_DEFAULT | NG_HCI_EVENT_MASK_LE); - set_le_event_mask(s, NG_HCI_LE_EVENT_MASK_ALL); - } else if (strcasecmp(argv[0], "disable") == 0) - set_event_mask(s, NG_HCI_EVENT_MASK_DEFAULT); - else - return USAGE; - - return OK; + if (result != OK) + return result; + result = set_le_event_mask(s, NG_HCI_LE_EVENT_MASK_ALL); + if (result == OK) { + fprintf(stdout, "LE enabled\n"); + return (OK); + } else + return result; + } else if (strcasecmp(argv[0], "disable") == 0) { + result = set_event_mask(s, NG_HCI_EVENT_MASK_DEFAULT); + if (result == OK) { + fprintf(stdout, "LE disabled\n"); + return (OK); + } else + return result; + } else + return (USAGE); } static int From owner-svn-src-head@freebsd.org Tue Apr 28 13:51: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 237082BA011; Tue, 28 Apr 2020 13:51:42 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BNNZ03DPz3GDj; Tue, 28 Apr 2020 13:51:42 +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 F13282528F; Tue, 28 Apr 2020 13:51:41 +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 03SDpfWl028430; Tue, 28 Apr 2020 13:51:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SDpfv7028428; Tue, 28 Apr 2020 13:51:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004281351.03SDpfv7028428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 28 Apr 2020 13:51:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360436 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 360436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 13:51:42 -0000 Author: markj Date: Tue Apr 28 13:51:41 2020 New Revision: 360436 URL: https://svnweb.freebsd.org/changeset/base/360436 Log: Re-check for wirings after busying the page in vm_page_release_locked(). A concurrent unlocked lookup can wire the page after vm_page_release_locked() releases the last wiring, in which case vm_page_release_locked() must not free the page. Once the xbusy lock is acquired, that, the object lock and the fact that the page is unmapped ensure that the wire count cannot increase, so re-check for new wirings after the page is xbusied. Update the comment above vm_page_wired() to reflect the new synchronization rules. Reported by: glebius Reviewed by: alc, jeff, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24592 Modified: head/sys/vm/vm_page.c head/sys/vm/vm_page.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Apr 28 13:28:58 2020 (r360435) +++ head/sys/vm/vm_page.c Tue Apr 28 13:51:41 2020 (r360436) @@ -4165,7 +4165,16 @@ vm_page_release_locked(vm_page_t m, int flags) if ((flags & VPR_TRYFREE) != 0 && (m->object->ref_count == 0 || !pmap_page_is_mapped(m)) && m->dirty == 0 && vm_page_tryxbusy(m)) { - vm_page_free(m); + /* + * An unlocked lookup may have wired the page before the + * busy lock was acquired, in which case the page must + * not be freed. + */ + if (__predict_true(!vm_page_wired(m))) { + vm_page_free(m); + return; + } + vm_page_xunbusy(m); } else { vm_page_release_toq(m, PQ_INACTIVE, flags != 0); } Modified: head/sys/vm/vm_page.h ============================================================================== --- head/sys/vm/vm_page.h Tue Apr 28 13:28:58 2020 (r360435) +++ head/sys/vm/vm_page.h Tue Apr 28 13:51:41 2020 (r360436) @@ -958,8 +958,8 @@ vm_page_drop(vm_page_t m, u_int val) * * Perform a racy check to determine whether a reference prevents the page * from being reclaimable. If the page's object is locked, and the page is - * unmapped and unbusied or exclusively busied by the current thread, no - * new wirings may be created. + * unmapped and exclusively busied by the current thread, no new wirings + * may be created. */ static inline bool vm_page_wired(vm_page_t m) From owner-svn-src-head@freebsd.org Tue Apr 28 14:33: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 7253F2BADC0; Tue, 28 Apr 2020 14:33:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BPJt2K8Pz3JJ7; Tue, 28 Apr 2020 14:33:34 +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 4AD4625A7E; Tue, 28 Apr 2020 14:33:34 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SEXYlA056469; Tue, 28 Apr 2020 14:33:34 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SEXXj1056467; Tue, 28 Apr 2020 14:33:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004281433.03SEXXj1056467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 28 Apr 2020 14:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360437 - in head/usr.bin/diff: . tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/usr.bin/diff: . tests X-SVN-Commit-Revision: 360437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 14:33:34 -0000 Author: kevans Date: Tue Apr 28 14:33:33 2020 New Revision: 360437 URL: https://svnweb.freebsd.org/changeset/base/360437 Log: diff(1): don't reject specifying the same format multiple times This may happen, for instance, if one happens to have an alias of diff to diff -up and attempts to specify the amount of context on top of that. Aliases like this may cause other problems, but if they're really not ever generating non-unified diffs then we should at least not break that use-case. In addition, we'll now pick up a format mismatch if -p is specified with !contextual && !unified && !unset. Fix up a small trailing whitespace nit in the tests while we're here, and add tests to make sure that we can double up all the formatting options. Reported by: jbeich MFC after: 3 days Modified: head/usr.bin/diff/diff.c head/usr.bin/diff/tests/diff_test.sh Modified: head/usr.bin/diff/diff.c ============================================================================== --- head/usr.bin/diff/diff.c Tue Apr 28 13:51:41 2020 (r360436) +++ head/usr.bin/diff/diff.c Tue Apr 28 14:33:33 2020 (r360437) @@ -122,6 +122,8 @@ main(int argc, char **argv) newarg = 1; diff_context = 3; diff_format = D_UNSET; +#define FORMAT_MISMATCHED(type) \ + (diff_format != D_UNSET && diff_format != (type)) while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) { switch (ch) { case '0': case '1': case '2': case '3': case '4': @@ -142,7 +144,7 @@ main(int argc, char **argv) break; case 'C': case 'c': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_CONTEXT)) conflicting_format(); cflag = 1; diff_format = D_CONTEXT; @@ -157,18 +159,18 @@ main(int argc, char **argv) dflags |= D_MINIMAL; break; case 'D': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_IFDEF)) conflicting_format(); diff_format = D_IFDEF; ifdefname = optarg; break; case 'e': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_EDIT)) conflicting_format(); diff_format = D_EDIT; break; case 'f': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_REVERSE)) conflicting_format(); diff_format = D_REVERSE; break; @@ -202,11 +204,20 @@ main(int argc, char **argv) Nflag = 1; break; case 'n': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_NREVERSE)) conflicting_format(); diff_format = D_NREVERSE; break; case 'p': + /* + * If it's not unset and it's not set to context or + * unified, we'll error out here as a conflicting + * format. If it's unset, we'll go ahead and set it to + * context. + */ + if (FORMAT_MISMATCHED(D_CONTEXT) && + FORMAT_MISMATCHED(D_UNIFIED)) + conflicting_format(); if (diff_format == D_UNSET) diff_format = D_CONTEXT; dflags |= D_PROTOTYPE; @@ -218,7 +229,7 @@ main(int argc, char **argv) rflag = 1; break; case 'q': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_BRIEF)) conflicting_format(); diff_format = D_BRIEF; break; @@ -236,7 +247,7 @@ main(int argc, char **argv) break; case 'U': case 'u': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_UNIFIED)) conflicting_format(); diff_format = D_UNIFIED; if (optarg != NULL) { @@ -264,12 +275,12 @@ main(int argc, char **argv) push_excludes(optarg); break; case 'y': - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_SIDEBYSIDE)) conflicting_format(); diff_format = D_SIDEBYSIDE; break; case OPT_CHANGED_GROUP_FORMAT: - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_GFORMAT)) conflicting_format(); diff_format = D_GFORMAT; group_format = optarg; @@ -283,7 +294,7 @@ main(int argc, char **argv) ignore_file_case = 0; break; case OPT_NORMAL: - if (diff_format != D_UNSET) + if (FORMAT_MISMATCHED(D_NORMAL)) conflicting_format(); diff_format = D_NORMAL; break; Modified: head/usr.bin/diff/tests/diff_test.sh ============================================================================== --- head/usr.bin/diff/tests/diff_test.sh Tue Apr 28 13:51:41 2020 (r360436) +++ head/usr.bin/diff/tests/diff_test.sh Tue Apr 28 14:33:33 2020 (r360437) @@ -186,6 +186,13 @@ conflicting_format_body() atf_check -s exit:2 -e ignore diff -q -c A B atf_check -s exit:2 -e ignore diff --normal -c A B atf_check -s exit:2 -e ignore diff -c --normal A B + + atf_check -s exit:1 -o ignore -e ignore diff -u -u A B + atf_check -s exit:1 -o ignore -e ignore diff -e -e A B + atf_check -s exit:1 -o ignore -e ignore diff -y -y A B + atf_check -s exit:1 -o ignore -e ignore diff -q -q A B + atf_check -s exit:1 -o ignore -e ignore diff -c -c A B + atf_check -s exit:1 -o ignore -e ignore diff --normal --normal A B } atf_init_test_cases() @@ -201,5 +208,5 @@ atf_init_test_cases() atf_add_test_case b230049 atf_add_test_case Bflag atf_add_test_case tabsize - atf_add_test_case conflicting_format + atf_add_test_case conflicting_format } From owner-svn-src-head@freebsd.org Tue Apr 28 14:34: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 0AC182BAEA0 for ; Tue, 28 Apr 2020 14:34:55 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BPLQ6cjmz3JVX for ; Tue, 28 Apr 2020 14:34:54 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (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 CB40520DA for ; Tue, 28 Apr 2020 14:34:54 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f50.google.com with SMTP id h6so10464181qvz.8 for ; Tue, 28 Apr 2020 07:34:54 -0700 (PDT) X-Gm-Message-State: AGi0PuYdLE+SJ+hSRe/PMkIofhmmDYmkLwfQYkKGBI5ndnJ9yApKK9YA Dzs5UCuOqi2K1+pZkO4gTMLEQ3AzsdiXpZtPdWQ= X-Received: by 2002:a05:6214:1853:: with SMTP id d19mt28359564qvy.150.1588084494312; Tue, 28 Apr 2020 07:34:54 -0700 (PDT) MIME-Version: 1.0 References: <202004201614.03KGEitC073880@repo.freebsd.org> <20200428144255.1b75d9b5@ernst.home> In-Reply-To: From: Kyle Evans Date: Tue, 28 Apr 2020 09:34:41 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r360125 - in head/usr.bin/diff: . tests Cc: Jan Beich , Gary Jennejohn , svn-src-head , svn-src-all , src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 14:34:55 -0000 On Tue, Apr 28, 2020 at 7:58 AM Kyle Evans wrote: > > On Tue, Apr 28, 2020 at 7:55 AM Jan Beich wrote: > > > > Gary Jennejohn writes: > > > > > On Tue, 28 Apr 2020 07:25:18 -0500 > > > Kyle Evans wrote: > > > > > >> On Tue, Apr 28, 2020 at 6:52 AM Jan Beich wrote: > > >> > > > >> > Kyle Evans writes: > > >> > > > >> > > Author: kevans > > >> > > Date: Mon Apr 20 16:14:44 2020 > > >> > > New Revision: 360125 > > >> > > URL: https://svnweb.freebsd.org/changeset/base/360125 > > >> > > > > >> > > Log: > > >> > > diff(1): reject conflicting formatting options > > >> > > > > >> > > This matches GNU diff(1) behavior and, more importantly, eliminates any > > >> > > source of confusion if multiple formatting options are specified. > > >> > > > > >> > > Note that the committed diff differs slightly from the submitted: I've > > >> > > modified it so that we initialize diff_format to something that isn't an > > >> > > accepted format option so that we can also reject --normal -c and -c > > >> > > --normal, which would've otherwise been accepted because the default was > > >> > > --normal. After option parsing we default it to D_NORMAL if it's still > > >> > > unset. > > >> > > > > >> > > PR: 243975 > > >> > > Submitted by: fehmi noyan isi > > >> > > MFC after: 1 week > > >> > > > >> > Appears to break ability to specify number of context lines e.g., > > >> > > > >> > $ diff -U999 /usr/include/sha256.h /usr/include/sha512.h > > >> > error: conflicting output format options. > > >> > usage: diff [-aBbdilpTtw] [-c | -e | -f | -n | -q | -u] [--ignore-case] > > >> > [...] > > >> > > >> Hmm, bizarre. =-\ This example works on my machine, and I don't see > > >> off-hand what would be preventing it for you: > > >> > > >> root@viper:/usr/src/usr.bin/diff# diff -U999 /usr/include/sha256.h > > >> /usr/include/sha512.h > > >> --- /usr/include/sha256.h 2020-04-22 21:38:54.000000000 -0500 > > >> +++ /usr/include/sha512.h 2020-04-22 21:38:54.000000000 -0500 > > >> @@ -1,99 +1,99 @@ > > >> /*- > > >> * Copyright 2005 Colin Percival > > >> * All rights reserved. > > >> * > > >> [... omitted ...] > > >> > > >> root@viper:/usr/src/usr.bin/diff# strings /usr/bin/diff | grep 'conflicting' > > >> error: conflicting output format options. > > >> > > > > > > My /usr/bin/diff was built and installed on April 26, after this > > > commit, and I don't see the error either. > > > > Thanks for confirming. Looks like my "diff" was aliased to "diff -up". > > Indeed, -u and -U are no longer compatible unlike GNU diff. > > Whoops, *facepalm*, you certainly shouldn't be restricted from > specifying the same output style multiple times. Will fix ASAP. > As of r360437, this is no longer an issue and the test case has been amended. Apologies for the hassle. =-) From owner-svn-src-head@freebsd.org Tue Apr 28 15:02: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 B6BBE2BBF74; Tue, 28 Apr 2020 15:02:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BPyX4MkLz3LWb; Tue, 28 Apr 2020 15:02:44 +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 914CF2607B; Tue, 28 Apr 2020 15:02:44 +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 03SF2iXI075266; Tue, 28 Apr 2020 15:02:44 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SF2iFP075265; Tue, 28 Apr 2020 15:02:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004281502.03SF2iFP075265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 28 Apr 2020 15:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360438 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 15:02:44 -0000 Author: markj Date: Tue Apr 28 15:02:44 2020 New Revision: 360438 URL: https://svnweb.freebsd.org/changeset/base/360438 Log: Make sendfile(SF_SYNC)'s CV wait interruptible. Otherwise, since the CV is not signalled until data is drained from the socket, it is trivial to create an unkillable process using sendfile(SF_SYNC) and a process-private PF_LOCAL socket pair. In particular, the cv_wait() in sendfile() does not get interrupted until data is drained from the receiving socket buffer. Reported by: pho Discussed with: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_sendfile.c Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Tue Apr 28 14:33:33 2020 (r360437) +++ head/sys/kern/kern_sendfile.c Tue Apr 28 15:02:44 2020 (r360438) @@ -106,8 +106,36 @@ struct sendfile_sync { struct mtx mtx; struct cv cv; unsigned count; + bool waiting; }; +static void +sendfile_sync_destroy(struct sendfile_sync *sfs) +{ + KASSERT(sfs->count == 0, ("sendfile sync %p still busy", sfs)); + + cv_destroy(&sfs->cv); + mtx_destroy(&sfs->mtx); + free(sfs, M_SENDFILE); +} + +static void +sendfile_sync_signal(struct sendfile_sync *sfs) +{ + mtx_lock(&sfs->mtx); + KASSERT(sfs->count > 0, ("sendfile sync %p not busy", sfs)); + if (--sfs->count == 0) { + if (!sfs->waiting) { + /* The sendfile() waiter was interrupted by a signal. */ + sendfile_sync_destroy(sfs); + return; + } else { + cv_signal(&sfs->cv); + } + } + mtx_unlock(&sfs->mtx); +} + counter_u64_t sfstat[sizeof(struct sfstat) / sizeof(uint64_t)]; static void @@ -153,12 +181,7 @@ sendfile_free_mext(struct mbuf *m) if (m->m_ext.ext_flags & EXT_FLAG_SYNC) { struct sendfile_sync *sfs = m->m_ext.ext_arg2; - - mtx_lock(&sfs->mtx); - KASSERT(sfs->count > 0, ("Sendfile sync botchup count == 0")); - if (--sfs->count == 0) - cv_signal(&sfs->cv); - mtx_unlock(&sfs->mtx); + sendfile_sync_signal(sfs); } } @@ -186,12 +209,7 @@ sendfile_free_mext_pg(struct mbuf *m) if (m->m_ext.ext_flags & EXT_FLAG_SYNC) { struct sendfile_sync *sfs = m->m_ext.ext_arg1; - - mtx_lock(&sfs->mtx); - KASSERT(sfs->count > 0, ("Sendfile sync botchup count == 0")); - if (--sfs->count == 0) - cv_signal(&sfs->cv); - mtx_unlock(&sfs->mtx); + sendfile_sync_signal(sfs); } } @@ -719,6 +737,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *h sfs = malloc(sizeof(*sfs), M_SENDFILE, M_WAITOK | M_ZERO); mtx_init(&sfs->mtx, "sendfile", NULL, MTX_DEF); cv_init(&sfs->cv, "sendfile"); + sfs->waiting = true; } rem = nbytes ? omin(nbytes, obj_size - offset) : obj_size - offset; @@ -1221,11 +1240,13 @@ out: if (sfs != NULL) { mtx_lock(&sfs->mtx); if (sfs->count != 0) - cv_wait(&sfs->cv, &sfs->mtx); - KASSERT(sfs->count == 0, ("sendfile sync still busy")); - cv_destroy(&sfs->cv); - mtx_destroy(&sfs->mtx); - free(sfs, M_SENDFILE); + error = cv_wait_sig(&sfs->cv, &sfs->mtx); + if (sfs->count == 0) { + sendfile_sync_destroy(sfs); + } else { + sfs->waiting = false; + mtx_unlock(&sfs->mtx); + } } #ifdef KERN_TLS if (tls != NULL) From owner-svn-src-head@freebsd.org Tue Apr 28 16:00: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 801AB2BDCFA; Tue, 28 Apr 2020 16:00:35 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BRFH2xhcz3QG8; Tue, 28 Apr 2020 16:00:35 +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 602D526A4C; Tue, 28 Apr 2020 16:00:35 +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 03SG0ZJm007226; Tue, 28 Apr 2020 16:00:35 GMT (envelope-from takawata@FreeBSD.org) Received: (from takawata@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SG0YJQ007221; Tue, 28 Apr 2020 16:00:34 GMT (envelope-from takawata@FreeBSD.org) Message-Id: <202004281600.03SG0YJQ007221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: takawata set sender to takawata@FreeBSD.org using -f From: Takanori Watanabe Date: Tue, 28 Apr 2020 16:00:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360440 - in head: sys/netgraph/bluetooth/include usr.sbin/bluetooth/hccontrol X-SVN-Group: head X-SVN-Commit-Author: takawata X-SVN-Commit-Paths: in head: sys/netgraph/bluetooth/include usr.sbin/bluetooth/hccontrol X-SVN-Commit-Revision: 360440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 16:00:35 -0000 Author: takawata Date: Tue Apr 28 16:00:34 2020 New Revision: 360440 URL: https://svnweb.freebsd.org/changeset/base/360440 Log: Add le_read_buffer_size command and manpage. It supports both v1 and v2 command. PR:245964 Submitted by: Marc Veldman Modified: head/sys/netgraph/bluetooth/include/ng_hci.h head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/sys/netgraph/bluetooth/include/ng_hci.h ============================================================================== --- head/sys/netgraph/bluetooth/include/ng_hci.h Tue Apr 28 15:44:39 2020 (r360439) +++ head/sys/netgraph/bluetooth/include/ng_hci.h Tue Apr 28 16:00:34 2020 (r360440) @@ -1672,6 +1672,15 @@ typedef struct { u_int16_t connection_handle; }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp; +#define NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2 0x0060 +/*No command parameter */ +typedef struct { + u_int8_t status; + u_int16_t hc_le_data_packet_length; + u_int8_t hc_total_num_le_data_packets; + u_int16_t hc_iso_data_packet_length; + u_int8_t hc_total_num_iso_data_packets; +} __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp_v2; #define NG_HCI_OCF_LE_READ_SUPPORTED_STATES 0x001c /*No command parameter*/ Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue Apr 28 15:44:39 2020 (r360439) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue Apr 28 16:00:34 2020 (r360440) @@ -25,7 +25,7 @@ .\" $Id: hccontrol.8,v 1.6 2003/08/06 21:26:38 max Exp $ .\" $FreeBSD$ .\" -.Dd April 24, 2020 +.Dd April 27, 2020 .Dt HCCONTROL 8 .Os .Sh NAME @@ -154,6 +154,7 @@ are: .It Cm LE_Set_Scan_Parameters .It Cm LE_Set_Scan_Enable .It Cm LE_Read_Supported_States +.It Cm LE_Read_Buffer_Size .El .Pp The currently supported node commands in Modified: head/usr.sbin/bluetooth/hccontrol/le.c ============================================================================== --- head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 15:44:39 2020 (r360439) +++ head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 16:00:34 2020 (r360440) @@ -554,7 +554,65 @@ le_set_advertising_data(int s, int argc, char *argv[]) return (OK); } +static int +le_read_buffer_size(int s, int argc, char *argv[]) +{ + union { + ng_hci_le_read_buffer_size_rp v1; + ng_hci_le_read_buffer_size_rp_v2 v2; + } rp; + int n, ch; + uint8_t v; + uint16_t cmd; + + optreset = 1; + optind = 0; + + /* Default to version 1*/ + v = 1; + cmd = NG_HCI_OCF_LE_READ_BUFFER_SIZE; + + while ((ch = getopt(argc, argv , "v:")) != -1) { + switch(ch) { + case 'v': + v = (uint8_t)strtol(optarg, NULL, 16); + if (v == 2) + cmd = NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2; + else if (v > 2) + return (USAGE); + break; + default: + v = 1; + } + } + + n = sizeof(rp); + if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, cmd), + (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.v1.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.v1.status), rp.v1.status); + return (FAILED); + } + + fprintf(stdout, "ACL data packet length: %d\n", + rp.v1.hc_le_data_packet_length); + fprintf(stdout, "Number of ACL data packets: %d\n", + rp.v1.hc_total_num_le_data_packets); + + if (v == 2) { + fprintf(stdout, "ISO data packet length: %d\n", + rp.v2.hc_iso_data_packet_length); + fprintf(stdout, "Number of ISO data packets: %d\n", + rp.v2.hc_total_num_iso_data_packets); + } + + return (OK); +} + struct hci_command le_commands[] = { { "le_enable", @@ -620,5 +678,11 @@ struct hci_command le_commands[] = { "le_set_advertising_data -n $name -f $flag -u $uuid16,$uuid16 \n" "set LE device advertising packed data", &le_set_advertising_data + }, + { + "le_read_buffer_size", + "le_read_buffer_size [-v 1|2]\n" + "Read the maximum size of ACL and ISO data packets", + &le_read_buffer_size }, }; From owner-svn-src-head@freebsd.org Tue Apr 28 16:07: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 7ED7D2BE048; Tue, 28 Apr 2020 16:07:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BRP02q3Vz3R1B; Tue, 28 Apr 2020 16:07:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4244A26C66; Tue, 28 Apr 2020 16:07:16 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SG7Gp9012940; Tue, 28 Apr 2020 16:07:16 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SG7GZY012939; Tue, 28 Apr 2020 16:07:16 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004281607.03SG7GZY012939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Apr 2020 16:07:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360441 - head/usr.sbin/syslogd X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/usr.sbin/syslogd X-SVN-Commit-Revision: 360441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 16:07:16 -0000 Author: bdrewery Date: Tue Apr 28 16:07:15 2020 New Revision: 360441 URL: https://svnweb.freebsd.org/changeset/base/360441 Log: Restore local kernel "prog" filtering lost in r332099. This behavior is most relevant for ipfw(4) as documented in syslog.conf(5). The recent addition of property-based regex filters in r359327 is a fine workaround for this but the behavior was present since 1997 and documented. This only fixes local matching of the "kernel program". It does not change the forwarded format at all. On the remote side it will still be "kernel: ipfw:" and not be parsed as a kernel message. This matches old behavior. MFC after: 2 weeks Reviewed by: markj Relnotes: yes Differential Revision: https://reviews.freebsd.org/D24286 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Tue Apr 28 16:00:34 2020 (r360440) +++ head/usr.sbin/syslogd/syslogd.c Tue Apr 28 16:07:15 2020 (r360441) @@ -137,6 +137,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -206,6 +207,7 @@ static STAILQ_HEAD(, socklist) shead = STAILQ_HEAD_INI #define IGN_CONS 0x001 /* don't print on console */ #define SYNC_FILE 0x002 /* do fsync on file after printing */ #define MARK 0x008 /* this message is a mark */ +#define ISKERNEL 0x010 /* kernel generated message */ /* Timestamps of log entries. */ struct logtime { @@ -1151,19 +1153,19 @@ parsemsg_rfc5424(const char *from, int pri, char *msg) } /* - * Trims the application name ("TAG" in RFC 3164 terminology) and - * process ID from a message if present. + * Returns the length of the application name ("TAG" in RFC 3164 + * terminology) and process ID from a message if present. */ static void -parsemsg_rfc3164_app_name_procid(char **msg, const char **app_name, - const char **procid) { - char *m, *app_name_begin, *procid_begin; +parsemsg_rfc3164_get_app_name_procid(const char *msg, size_t *app_name_length_p, + ptrdiff_t *procid_begin_offset_p, size_t *procid_length_p) +{ + const char *m, *procid_begin; size_t app_name_length, procid_length; - m = *msg; + m = msg; /* Application name. */ - app_name_begin = m; app_name_length = strspn(m, "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -1191,12 +1193,52 @@ parsemsg_rfc3164_app_name_procid(char **msg, const cha if (m[0] != ':' || m[1] != ' ') goto bad; + *app_name_length_p = app_name_length; + if (procid_begin_offset_p != NULL) + *procid_begin_offset_p = + procid_begin == NULL ? 0 : procid_begin - msg; + if (procid_length_p != NULL) + *procid_length_p = procid_length; + return; +bad: + *app_name_length_p = 0; + if (procid_begin_offset_p != NULL) + *procid_begin_offset_p = 0; + if (procid_length_p != NULL) + *procid_length_p = 0; +} + +/* + * Trims the application name ("TAG" in RFC 3164 terminology) and + * process ID from a message if present. + */ +static void +parsemsg_rfc3164_app_name_procid(char **msg, const char **app_name, + const char **procid) +{ + char *m, *app_name_begin, *procid_begin; + size_t app_name_length, procid_length; + ptrdiff_t procid_begin_offset; + + m = *msg; + app_name_begin = m; + + parsemsg_rfc3164_get_app_name_procid(app_name_begin, &app_name_length, + &procid_begin_offset, &procid_length); + if (app_name_length == 0) + goto bad; + procid_begin = procid_begin_offset == 0 ? NULL : + app_name_begin + procid_begin_offset; + /* Split strings from input. */ app_name_begin[app_name_length] = '\0'; - if (procid_begin != 0) + m += app_name_length + 1; + if (procid_begin != NULL) { procid_begin[procid_length] = '\0'; + m += procid_length + 2; + } - *msg = m + 2; + *msg = m + 1; *app_name = app_name_begin; *procid = procid_begin; return; @@ -1401,7 +1443,7 @@ printsys(char *msg) long n; int flags, isprintf, pri; - flags = SYNC_FILE; /* fsync after write */ + flags = ISKERNEL | SYNC_FILE; /* fsync after write */ p = msg; pri = DEFSPRI; isprintf = 1; @@ -1551,7 +1593,7 @@ logmsg(int pri, const struct logtime *timestamp, const struct filed *f; size_t savedlen; int fac, prilev; - char saved[MAXSVLINE]; + char saved[MAXSVLINE], kernel_app_name[100]; dprintf("logmsg: pri %o, flags %x, from %s, msg %s\n", pri, flags, hostname, msg); @@ -1576,6 +1618,23 @@ logmsg(int pri, const struct logtime *timestamp, const prilev = LOG_PRI(pri); + /* + * Lookup kernel app name from log prefix if present. + * This is only used for local program specification matching. + */ + if (flags & ISKERNEL) { + size_t kernel_app_name_length; + + parsemsg_rfc3164_get_app_name_procid(msg, + &kernel_app_name_length, NULL, NULL); + if (kernel_app_name_length != 0) { + strlcpy(kernel_app_name, msg, + MIN(sizeof(kernel_app_name), + kernel_app_name_length + 1)); + } else + kernel_app_name[0] = '\0'; + } + /* log the message to the particular outputs */ if (!Initialized) { f = &consfile; @@ -1622,7 +1681,10 @@ logmsg(int pri, const struct logtime *timestamp, const continue; /* skip messages with the incorrect program name */ - if (skip_message(app_name == NULL ? "" : app_name, + if (flags & ISKERNEL && kernel_app_name[0] != '\0') { + if (skip_message(kernel_app_name, f->f_program, 1)) + continue; + } else if (skip_message(app_name == NULL ? "" : app_name, f->f_program, 1)) continue; From owner-svn-src-head@freebsd.org Tue Apr 28 16:09: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 DC8612BE14C; Tue, 28 Apr 2020 16:09:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BRRM5ZfTz3RFc; Tue, 28 Apr 2020 16:09:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1F8326C6B; Tue, 28 Apr 2020 16:09:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SG9JiU013183; Tue, 28 Apr 2020 16:09:19 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SG9Isv013179; Tue, 28 Apr 2020 16:09:18 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004281609.03SG9Isv013179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Apr 2020 16:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360442 - in head/sys/modules: cxgb/cxgb cxgbe/iw_cxgbe rdma/krping sfxge X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head/sys/modules: cxgb/cxgb cxgbe/iw_cxgbe rdma/krping sfxge X-SVN-Commit-Revision: 360442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 16:09:19 -0000 Author: bdrewery Date: Tue Apr 28 16:09:18 2020 New Revision: 360442 URL: https://svnweb.freebsd.org/changeset/base/360442 Log: None of these use opt_sched.h Modified: head/sys/modules/cxgb/cxgb/Makefile head/sys/modules/cxgbe/iw_cxgbe/Makefile head/sys/modules/rdma/krping/Makefile head/sys/modules/sfxge/Makefile Modified: head/sys/modules/cxgb/cxgb/Makefile ============================================================================== --- head/sys/modules/cxgb/cxgb/Makefile Tue Apr 28 16:07:15 2020 (r360441) +++ head/sys/modules/cxgb/cxgb/Makefile Tue Apr 28 16:09:18 2020 (r360442) @@ -8,7 +8,7 @@ SRCS= cxgb_mc5.c cxgb_vsc8211.c cxgb_ael1002.c cxgb_mv SRCS+= cxgb_xgmac.c cxgb_vsc7323.c cxgb_t3_hw.c cxgb_main.c cxgb_aq100x.c SRCS+= cxgb_sge.c cxgb_tn1010.c SRCS+= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h opt_sched.h +SRCS+= opt_inet.h opt_inet6.h SRCS+= uipc_mvec.c CFLAGS+= -g -DDEFAULT_JUMBO -I${CXGB} Modified: head/sys/modules/cxgbe/iw_cxgbe/Makefile ============================================================================== --- head/sys/modules/cxgbe/iw_cxgbe/Makefile Tue Apr 28 16:07:15 2020 (r360441) +++ head/sys/modules/cxgbe/iw_cxgbe/Makefile Tue Apr 28 16:09:18 2020 (r360442) @@ -14,7 +14,7 @@ SRCS+= provider.c SRCS+= qp.c SRCS+= resource.c SRCS+= ${LINUXKPI_GENSRCS} -SRCS+= opt_inet.h opt_inet6.h opt_ktr.h opt_ofed.h opt_sched.h +SRCS+= opt_inet.h opt_inet6.h opt_ktr.h opt_ofed.h CFLAGS+= -I${CXGBE} -I${SRCTOP}/sys/ofed/include -DLINUX_TYPES_DEFINED CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi Modified: head/sys/modules/rdma/krping/Makefile ============================================================================== --- head/sys/modules/rdma/krping/Makefile Tue Apr 28 16:07:15 2020 (r360441) +++ head/sys/modules/rdma/krping/Makefile Tue Apr 28 16:09:18 2020 (r360442) @@ -4,7 +4,7 @@ KMOD= krping SRCS= krping.c krping_dev.c getopt.c SRCS+= ${LINUXKPI_GENSRCS} -SRCS+= opt_sched.h opt_inet.h opt_inet6.h +SRCS+= opt_inet.h opt_inet6.h CFLAGS+= -I${SRCTOP}/sys/ofed/include CFLAGS+= -I${SRCTOP}/sys/ofed/include/uapi CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include Modified: head/sys/modules/sfxge/Makefile ============================================================================== --- head/sys/modules/sfxge/Makefile Tue Apr 28 16:07:15 2020 (r360441) +++ head/sys/modules/sfxge/Makefile Tue Apr 28 16:09:18 2020 (r360442) @@ -5,7 +5,7 @@ KMOD= sfxge SFXGE= ${SRCTOP}/sys/dev/sfxge SRCS= device_if.h bus_if.h pci_if.h -SRCS+= opt_inet.h opt_inet6.h opt_sched.h opt_rss.h +SRCS+= opt_inet.h opt_inet6.h opt_rss.h .PATH: ${SRCTOP}/sys/dev/sfxge SRCS+= sfxge.c sfxge_dma.c sfxge_ev.c From owner-svn-src-head@freebsd.org Tue Apr 28 16:09: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 F00632BE16E; Tue, 28 Apr 2020 16:09:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BRRQ6BdJz3RGT; Tue, 28 Apr 2020 16:09:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFE9C26C6C; Tue, 28 Apr 2020 16:09:22 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SG9MMZ013231; Tue, 28 Apr 2020 16:09:22 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SG9MgM013228; Tue, 28 Apr 2020 16:09:22 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004281609.03SG9MgM013228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Apr 2020 16:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360443 - head/usr.sbin/config X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/usr.sbin/config X-SVN-Commit-Revision: 360443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 16:09:23 -0000 Author: bdrewery Date: Tue Apr 28 16:09:22 2020 New Revision: 360443 URL: https://svnweb.freebsd.org/changeset/base/360443 Log: config: Add no-ctfconvert support. Bump CONFIGVERS to 600018 for this support. Some files may purposely have debug info disabled or are *source files* that attempt to run ctfconvert on them. Currently ctfconvert ignores these errors but I have a change to make the errors real so we can catch real problems like exceeding type limits. Sponsored by: Dell EMC Reviewed by: imp, cem, kevans Differential Revision: https://reviews.freebsd.org/D24535 Modified: head/usr.sbin/config/config.h head/usr.sbin/config/configvers.h head/usr.sbin/config/mkmakefile.c Modified: head/usr.sbin/config/config.h ============================================================================== --- head/usr.sbin/config/config.h Tue Apr 28 16:09:18 2020 (r360442) +++ head/usr.sbin/config/config.h Tue Apr 28 16:09:22 2020 (r360443) @@ -82,6 +82,7 @@ struct files_name { #define NO_OBJ 2 #define BEFORE_DEPEND 4 #define NOWERROR 16 +#define NO_CTFCONVERT 32 struct device { int d_done; /* processed */ Modified: head/usr.sbin/config/configvers.h ============================================================================== --- head/usr.sbin/config/configvers.h Tue Apr 28 16:09:18 2020 (r360442) +++ head/usr.sbin/config/configvers.h Tue Apr 28 16:09:22 2020 (r360443) @@ -49,7 +49,7 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600017 +#define CONFIGVERS 600018 #define MAJOR_VERS(x) ((x) / 100000) /* Last config(8) version to require envmode/hintmode */ Modified: head/usr.sbin/config/mkmakefile.c ============================================================================== --- head/usr.sbin/config/mkmakefile.c Tue Apr 28 16:09:18 2020 (r360442) +++ head/usr.sbin/config/mkmakefile.c Tue Apr 28 16:09:22 2020 (r360443) @@ -397,7 +397,7 @@ read_file(char *fname) char *wd, *this, *compilewith, *depends, *clean, *warning; const char *objprefix; int compile, match, nreqs, std, filetype, not, - imp_rule, no_obj, before_depend, nowerror; + imp_rule, no_ctfconvert, no_obj, before_depend, nowerror; fp = fopen(fname, "r"); if (fp == NULL) @@ -452,6 +452,7 @@ next: warning = 0; std = 0; imp_rule = 0; + no_ctfconvert = 0; no_obj = 0; before_depend = 0; nowerror = 0; @@ -479,6 +480,10 @@ next: nreqs = 0; continue; } + if (eq(wd, "no-ctfconvert")) { + no_ctfconvert++; + continue; + } if (eq(wd, "no-obj")) { no_obj++; continue; @@ -591,8 +596,10 @@ nextparam:; tp->f_srcprefix = "$S/"; if (imp_rule) tp->f_flags |= NO_IMPLCT_RULE; + if (no_ctfconvert) + tp->f_flags |= NO_CTFCONVERT; if (no_obj) - tp->f_flags |= NO_OBJ; + tp->f_flags |= NO_OBJ | NO_CTFCONVERT; if (before_depend) tp->f_flags |= BEFORE_DEPEND; if (nowerror) @@ -805,7 +812,7 @@ do_rules(FILE *f) else fprintf(f, "\t%s\n", compilewith); - if (!(ftp->f_flags & NO_OBJ)) + if (!(ftp->f_flags & NO_CTFCONVERT)) fprintf(f, "\t${NORMAL_CTFCONVERT}\n\n"); else fprintf(f, "\n"); From owner-svn-src-head@freebsd.org Tue Apr 28 16:09: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 BD1B02BE199; Tue, 28 Apr 2020 16:09:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BRRW0dR0z3RK9; Tue, 28 Apr 2020 16:09:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E321C26C6D; Tue, 28 Apr 2020 16:09:25 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SG9Pko013279; Tue, 28 Apr 2020 16:09:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SG9PHU013278; Tue, 28 Apr 2020 16:09:25 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004281609.03SG9PHU013278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Apr 2020 16:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360444 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 360444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 16:09:29 -0000 Author: bdrewery Date: Tue Apr 28 16:09:25 2020 New Revision: 360444 URL: https://svnweb.freebsd.org/changeset/base/360444 Log: Don't try ctfconvert on file without debug info. This was currently an ignored error but will change to a hard error eventually. Differential Revision: https://reviews.freebsd.org/D24536 Modified: head/sys/conf/Makefile.amd64 head/sys/conf/files.amd64 Modified: head/sys/conf/Makefile.amd64 ============================================================================== --- head/sys/conf/Makefile.amd64 Tue Apr 28 16:09:22 2020 (r360443) +++ head/sys/conf/Makefile.amd64 Tue Apr 28 16:09:25 2020 (r360444) @@ -18,7 +18,7 @@ # # Which version of config(8) is required. -%VERSREQ= 600012 +%VERSREQ= 600018 STD8X16FONT?= iso Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Apr 28 16:09:22 2020 (r360443) +++ head/sys/conf/files.amd64 Tue Apr 28 16:09:25 2020 (r360444) @@ -113,7 +113,8 @@ amd64/amd64/initcpu.c standard amd64/amd64/io.c optional io amd64/amd64/locore.S standard no-obj amd64/amd64/xen-locore.S optional xenhvm \ - compile-with "${NORMAL_S} -g0" + compile-with "${NORMAL_S} -g0" \ + no-ctfconvert amd64/amd64/machdep.c standard amd64/amd64/mem.c optional mem amd64/amd64/minidump_machdep.c standard From owner-svn-src-head@freebsd.org Tue Apr 28 16:09: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 095702BE1A2; Tue, 28 Apr 2020 16:09:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BRRY0p4Vz3RLk; Tue, 28 Apr 2020 16:09:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE94926C6E; Tue, 28 Apr 2020 16:09:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SG9S7v013326; Tue, 28 Apr 2020 16:09:28 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SG9S3n013323; Tue, 28 Apr 2020 16:09:28 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004281609.03SG9S3n013323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Apr 2020 16:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360445 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Commit-Revision: 360445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 16:09:30 -0000 Author: bdrewery Date: Tue Apr 28 16:09:28 2020 New Revision: 360445 URL: https://svnweb.freebsd.org/changeset/base/360445 Log: ctfmerge: Assert that there is enough room for types. Sponsord by: Dell EMC Differential Revision: https://reviews.freebsd.org/D24537 Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c Tue Apr 28 16:09:25 2020 (r360444) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c Tue Apr 28 16:09:28 2020 (r360445) @@ -452,6 +452,10 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unus if (ed.ed_tgt->t_type == FORWARD && ctdp->t_type != FORWARD) { int id = mcd->md_tgt->td_nextid++; +#ifdef __FreeBSD__ + if (CTF_TYPE_ISCHILD(id)) + terminate("No room for additional types\n"); +#endif debug(3, "Creating new defn type %d <%x>\n", id, id); add_mapping(mcd->md_ta, ctdp->t_id, id); alist_add(mcd->md_fdida, (void *)(ulong_t)ed.ed_tgt, @@ -473,6 +477,10 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unus } else { int id = mcd->md_tgt->td_nextid++; +#ifdef __FreeBSD__ + if (CTF_TYPE_ISCHILD(id)) + terminate("No room for additional types\n"); +#endif debug(3, "Creating new type %d <%x>\n", id, id); add_mapping(mcd->md_ta, ctdp->t_id, id); hash_add(mcd->md_tdtba, ctdp); Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Tue Apr 28 16:09:25 2020 (r360444) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Tue Apr 28 16:09:28 2020 (r360445) @@ -148,17 +148,7 @@ terminate(const char *format, ...) if (getenv("CTF_ABORT_ON_TERMINATE") != NULL) abort(); -#if defined(__FreeBSD__) -/* - * For the time being just output the termination message, but don't - * return an exit status that would cause the build to fail. We need - * to get as much stuff built as possible before going back and - * figuring out what is wrong with certain files. - */ - exit(0); -#else exit(1); -#endif } /*PRINTFLIKE1*/ From owner-svn-src-head@freebsd.org Tue Apr 28 16:18: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 F3D2E2BEA08; Tue, 28 Apr 2020 16:18:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BRfM68dqz3xmv; Tue, 28 Apr 2020 16:18:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-164.local (unknown [IPv6:2601:648:8203:2990:d41f:e4dd:90e3:84fb]) (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 64A832D37; Tue, 28 Apr 2020 16:18:51 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r360408 - in head: share/man/man4 sys/dev/cxgbe/tom sys/kern sys/netinet sys/sys From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202004272317.03RNHJ8G057366@repo.freebsd.org> 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: <938fc390-316e-ae01-eae9-c17a0dd65fbe@FreeBSD.org> Date: Tue, 28 Apr 2020 09:18:49 -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: <202004272317.03RNHJ8G057366@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 16:18:52 -0000 On 4/27/20 4:17 PM, John Baldwin wrote: > Author: jhb > Date: Mon Apr 27 23:17:19 2020 > New Revision: 360408 > URL: https://svnweb.freebsd.org/changeset/base/360408 > > Log: > Initial support for kernel offload of TLS receive. > > - Add a new TCP_RXTLS_ENABLE socket option to set the encryption and > authentication algorithms and keys as well as the initial sequence > number. > > - When reading from a socket using KTLS receive, applications must use > recvmsg(). Each successful call to recvmsg() will return a single > TLS record. A new TCP control message, TLS_GET_RECORD, will contain > the TLS record header of the decrypted record. The regular message > buffer passed to recvmsg() will receive the decrypted payload. This > is similar to the interface used by Linux's KTLS RX except that > Linux does not return the full TLS header in the control message. > > - Add plumbing to the TOE KTLS interface to request either transmit > or receive KTLS sessions. > > - When a socket is using receive KTLS, redirect reads from > soreceive_stream() into soreceive_generic(). > > - Note that this interface is currently only defined for TLS 1.1 and > 1.2, though I believe we will be able to reuse the same interface > and structures for 1.3. The OpenSSL changes required for RX support are not yet upstream, but I hope to open the pull request for those later today after retesting them against latest OpenSSL master. -- John Baldwin From owner-svn-src-head@freebsd.org Tue Apr 28 18:42: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 8D5662C1BA0; Tue, 28 Apr 2020 18:42:31 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BVr731tlz476W; Tue, 28 Apr 2020 18:42:31 +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 6331B28B8B; Tue, 28 Apr 2020 18:42:31 +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 03SIgVLf012112; Tue, 28 Apr 2020 18:42:31 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SIgU3D012109; Tue, 28 Apr 2020 18:42:30 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004281842.03SIgU3D012109@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 28 Apr 2020 18:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360447 - in head/sys: net netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet6 X-SVN-Commit-Revision: 360447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 18:42:31 -0000 Author: melifaro Date: Tue Apr 28 18:42:30 2020 New Revision: 360447 URL: https://svnweb.freebsd.org/changeset/base/360447 Log: Move struct rtentry definition to nhop_var.h. One of the goals of the new routing KPI defined in r359823 is to entirely hide`struct rtentry` from the consumers. It will allow to improve routing subsystem internals and deliver features much faster. This is one of the last changes, effectively moving struct rtentry definition to a net/route_var.h header, internal to the routing subsystem. Differential Revision: https://reviews.freebsd.org/D24580 Modified: head/sys/net/route.h head/sys/net/route_var.h head/sys/netinet6/nd6.c Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Tue Apr 28 17:59:37 2020 (r360446) +++ head/sys/net/route.h Tue Apr 28 18:42:30 2020 (r360447) @@ -35,7 +35,6 @@ #ifndef _NET_ROUTE_H_ #define _NET_ROUTE_H_ -#include #include /* @@ -129,42 +128,6 @@ VNET_DECLARE(u_int, rt_add_addr_allfibs); /* Announce * gateways are marked so that the output routines know to address the * gateway rather than the ultimate destination. */ -#ifndef RNF_NORMAL -#include -#ifdef RADIX_MPATH -#include -#endif -#endif - -#if defined(_KERNEL) -struct rtentry { - struct radix_node rt_nodes[2]; /* tree glue, and other values */ - /* - * XXX struct rtentry must begin with a struct radix_node (or two!) - * because the code does some casts of a 'struct radix_node *' - * to a 'struct rtentry *' - */ -#define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key))) -#define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask))) -#define rt_key_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_key))) -#define rt_mask_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_mask))) - struct sockaddr *rt_gateway; /* value */ - struct ifnet *rt_ifp; /* the answer: interface to use */ - struct ifaddr *rt_ifa; /* the answer: interface address to use */ - struct nhop_object *rt_nhop; /* nexthop data */ - int rt_flags; /* up/down?, host/net */ - int rt_refcnt; /* # held references */ - u_int rt_fibnum; /* which FIB */ - u_long rt_mtu; /* MTU for this path */ - u_long rt_weight; /* absolute weight */ - u_long rt_expire; /* lifetime for route, e.g. redirect */ -#define rt_endzero rt_pksent - counter_u64_t rt_pksent; /* packets sent using this route */ - struct mtx rt_mtx; /* mutex for routing entry */ - struct rtentry *rt_chain; /* pointer to next rtentry to delete */ -}; -#endif /* _KERNEL */ - #define RTF_UP 0x1 /* route usable */ #define RTF_GATEWAY 0x2 /* destination is a gateway */ #define RTF_HOST 0x4 /* host entry (net otherwise) */ @@ -369,53 +332,7 @@ struct rt_addrinfo { #define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ || (ifp)->if_link_state == LINK_STATE_UP) -#define RT_LOCK_INIT(_rt) \ - mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW) -#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) -#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) -#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) -#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) -#define RT_UNLOCK_COND(_rt) do { \ - if (mtx_owned(&(_rt)->rt_mtx)) \ - mtx_unlock(&(_rt)->rt_mtx); \ -} while (0) - -#define RT_ADDREF(_rt) do { \ - RT_LOCK_ASSERT(_rt); \ - KASSERT((_rt)->rt_refcnt >= 0, \ - ("negative refcnt %d", (_rt)->rt_refcnt)); \ - (_rt)->rt_refcnt++; \ -} while (0) - -#define RT_REMREF(_rt) do { \ - RT_LOCK_ASSERT(_rt); \ - KASSERT((_rt)->rt_refcnt > 0, \ - ("bogus refcnt %d", (_rt)->rt_refcnt)); \ - (_rt)->rt_refcnt--; \ -} while (0) - -#define RTFREE_LOCKED(_rt) do { \ - if ((_rt)->rt_refcnt <= 1) \ - rtfree(_rt); \ - else { \ - RT_REMREF(_rt); \ - RT_UNLOCK(_rt); \ - } \ - /* guard against invalid refs */ \ - _rt = 0; \ -} while (0) - -#define RTFREE(_rt) do { \ - RT_LOCK(_rt); \ - RTFREE_LOCKED(_rt); \ -} while (0) - #define RTFREE_FUNC(_rt) rtfree_func(_rt) - -#define RO_RTFREE(_ro) do { \ - if ((_ro)->ro_rt) \ - RTFREE((_ro)->ro_rt); \ -} while (0) #define RO_NHFREE(_ro) do { \ if ((_ro)->ro_nh) { \ Modified: head/sys/net/route_var.h ============================================================================== --- head/sys/net/route_var.h Tue Apr 28 17:59:37 2020 (r360446) +++ head/sys/net/route_var.h Tue Apr 28 18:42:30 2020 (r360447) @@ -32,6 +32,11 @@ #ifndef _NET_ROUTE_VAR_H_ #define _NET_ROUTE_VAR_H_ +#ifndef RNF_NORMAL +#include +#endif +#include + struct nh_control; typedef int rnh_preadd_entry_f_t(u_int fibnum, const struct sockaddr *addr, const struct sockaddr *mask, struct nhop_object *nh); @@ -100,6 +105,74 @@ VNET_PCPUSTAT_DECLARE(struct rtstat, rtstat); #define RTSTAT_ADD(name, val) \ VNET_PCPUSTAT_ADD(struct rtstat, rtstat, name, (val)) #define RTSTAT_INC(name) RTSTAT_ADD(name, 1) + +struct rtentry { + struct radix_node rt_nodes[2]; /* tree glue, and other values */ + /* + * XXX struct rtentry must begin with a struct radix_node (or two!) + * because the code does some casts of a 'struct radix_node *' + * to a 'struct rtentry *' + */ +#define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key))) +#define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask))) +#define rt_key_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_key))) +#define rt_mask_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_mask))) + struct sockaddr *rt_gateway; /* value */ + struct ifnet *rt_ifp; /* the answer: interface to use */ + struct ifaddr *rt_ifa; /* the answer: interface address to use */ + struct nhop_object *rt_nhop; /* nexthop data */ + int rt_flags; /* up/down?, host/net */ + int rt_refcnt; /* # held references */ + u_int rt_fibnum; /* which FIB */ + u_long rt_mtu; /* MTU for this path */ + u_long rt_weight; /* absolute weight */ + u_long rt_expire; /* lifetime for route, e.g. redirect */ +#define rt_endzero rt_pksent + counter_u64_t rt_pksent; /* packets sent using this route */ + struct mtx rt_mtx; /* mutex for routing entry */ + struct rtentry *rt_chain; /* pointer to next rtentry to delete */ +}; + +#define RT_LOCK_INIT(_rt) \ + mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW) +#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) +#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) +#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) +#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) +#define RT_UNLOCK_COND(_rt) do { \ + if (mtx_owned(&(_rt)->rt_mtx)) \ + mtx_unlock(&(_rt)->rt_mtx); \ +} while (0) + +#define RT_ADDREF(_rt) do { \ + RT_LOCK_ASSERT(_rt); \ + KASSERT((_rt)->rt_refcnt >= 0, \ + ("negative refcnt %d", (_rt)->rt_refcnt)); \ + (_rt)->rt_refcnt++; \ +} while (0) + +#define RT_REMREF(_rt) do { \ + RT_LOCK_ASSERT(_rt); \ + KASSERT((_rt)->rt_refcnt > 0, \ + ("bogus refcnt %d", (_rt)->rt_refcnt)); \ + (_rt)->rt_refcnt--; \ +} while (0) + +#define RTFREE_LOCKED(_rt) do { \ + if ((_rt)->rt_refcnt <= 1) \ + rtfree(_rt); \ + else { \ + RT_REMREF(_rt); \ + RT_UNLOCK(_rt); \ + } \ + /* guard against invalid refs */ \ + _rt = 0; \ +} while (0) + +#define RTFREE(_rt) do { \ + RT_LOCK(_rt); \ + RTFREE_LOCKED(_rt); \ +} while (0) /* * With the split between the routing entry and the nexthop, Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Tue Apr 28 17:59:37 2020 (r360446) +++ head/sys/netinet6/nd6.c Tue Apr 28 18:42:30 2020 (r360447) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-head@freebsd.org Tue Apr 28 18:53: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 E61FA2C1F2C; Tue, 28 Apr 2020 18:53:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BW595pXWz47tG; Tue, 28 Apr 2020 18:53:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2A5928D95; Tue, 28 Apr 2020 18:53:49 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03SIrntA018133; Tue, 28 Apr 2020 18:53:49 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SIrn4t018131; Tue, 28 Apr 2020 18:53:49 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004281853.03SIrn4t018131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Apr 2020 18:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360448 - head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/tools/ctf/cvt X-SVN-Commit-Revision: 360448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 18:53:50 -0000 Author: bdrewery Date: Tue Apr 28 18:53:49 2020 New Revision: 360448 URL: https://svnweb.freebsd.org/changeset/base/360448 Log: Revert r360445 I did not intend to commit this yet as more work is needed for non-amd64 kernels. Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c Tue Apr 28 18:42:30 2020 (r360447) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c Tue Apr 28 18:53:49 2020 (r360448) @@ -452,10 +452,6 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unus if (ed.ed_tgt->t_type == FORWARD && ctdp->t_type != FORWARD) { int id = mcd->md_tgt->td_nextid++; -#ifdef __FreeBSD__ - if (CTF_TYPE_ISCHILD(id)) - terminate("No room for additional types\n"); -#endif debug(3, "Creating new defn type %d <%x>\n", id, id); add_mapping(mcd->md_ta, ctdp->t_id, id); alist_add(mcd->md_fdida, (void *)(ulong_t)ed.ed_tgt, @@ -477,10 +473,6 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __unus } else { int id = mcd->md_tgt->td_nextid++; -#ifdef __FreeBSD__ - if (CTF_TYPE_ISCHILD(id)) - terminate("No room for additional types\n"); -#endif debug(3, "Creating new type %d <%x>\n", id, id); add_mapping(mcd->md_ta, ctdp->t_id, id); hash_add(mcd->md_tdtba, ctdp); Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Tue Apr 28 18:42:30 2020 (r360447) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Tue Apr 28 18:53:49 2020 (r360448) @@ -148,7 +148,17 @@ terminate(const char *format, ...) if (getenv("CTF_ABORT_ON_TERMINATE") != NULL) abort(); +#if defined(__FreeBSD__) +/* + * For the time being just output the termination message, but don't + * return an exit status that would cause the build to fail. We need + * to get as much stuff built as possible before going back and + * figuring out what is wrong with certain files. + */ + exit(0); +#else exit(1); +#endif } /*PRINTFLIKE1*/ From owner-svn-src-head@freebsd.org Tue Apr 28 18:55: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 1B3912C1FBD; Tue, 28 Apr 2020 18:55:49 +0000 (UTC) (envelope-from bdrewery@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) server-signature RSA-PSS (4096 bits) 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 49BW7S6t2hz483g; Tue, 28 Apr 2020 18:55:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.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 did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 8A0061B67C; Tue, 28 Apr 2020 18:55:48 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 5418A19448; Tue, 28 Apr 2020 18:55:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 3nfo7k7LdyBz; Tue, 28 Apr 2020 18:52:54 +0000 (UTC) Subject: Re: svn commit: r360445 - head/cddl/contrib/opensolaris/tools/ctf/cvt DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 559D919444 From: Bryan Drewery To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202004281609.03SG9S3n013323@repo.freebsd.org> Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+ rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u IUrMm6UAEQEAAYkBPAQYAQoAJgIbDBYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hL4BQkN PvONAAoJEDXXcbtuRpfPCjcH/ivBsOpdpebpgLizSNU5/X4yWN5Aixsc9VBnQhGKAKnMINJQ VMpA55sD2JSPwloXYM/B3qyPJRS/9cwIuX5LDNKKOZU3Qp+TzleynM15/xea14orWYRGRict YHBM3Cnqp7OD8K6Q1uhs0fTxyJP7PZ/G0+7Corlf1DlHhDt6C2HldRPFvAvAgl6sR9Wzgcb7 rzub2HVtbJgl6YHbgyAG7x9NpXFqzx1JLAMdpt2DIYwoi+oMdRQlBIwNuKjQjCGzuXHandd3 kGvBAsyJpQ+coEep9UzwANaV28cXrFr2R4FSOcR50rBA2Nh/vqUYfpsvBvJlwuKAoV1djVHa ihNeL5E= Organization: FreeBSD Message-ID: Date: Tue, 28 Apr 2020 11:52:53 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <202004281609.03SG9S3n013323@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OMaE395LHfPqSyIQOD11KOTheku1TM6Oo" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 18:55:49 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --OMaE395LHfPqSyIQOD11KOTheku1TM6Oo Content-Type: multipart/mixed; boundary="niQeSCGkoXtvW3djFDeK7EIa8mM8RHYlP"; protected-headers="v1" From: Bryan Drewery To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r360445 - head/cddl/contrib/opensolaris/tools/ctf/cvt References: <202004281609.03SG9S3n013323@repo.freebsd.org> In-Reply-To: <202004281609.03SG9S3n013323@repo.freebsd.org> --niQeSCGkoXtvW3djFDeK7EIa8mM8RHYlP Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable I did not mean to commit this yet. Likely broke non-x86. Reverting now. On 4/28/2020 9:09 AM, Bryan Drewery wrote: > Author: bdrewery > Date: Tue Apr 28 16:09:28 2020 > New Revision: 360445 > URL: https://svnweb.freebsd.org/changeset/base/360445 >=20 > Log: > ctfmerge: Assert that there is enough room for types. > =20 > Sponsord by: Dell EMC > Differential Revision: https://reviews.freebsd.org/D24537 >=20 > Modified: > head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c > head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c >=20 > Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c Tue Apr 28 16:0= 9:25 2020 (r360444) > +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/merge.c Tue Apr 28 16:0= 9:28 2020 (r360445) > @@ -452,6 +452,10 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __= unus > if (ed.ed_tgt->t_type =3D=3D FORWARD && ctdp->t_type !=3D FORWARD) {= > int id =3D mcd->md_tgt->td_nextid++; > =20 > +#ifdef __FreeBSD__ > + if (CTF_TYPE_ISCHILD(id)) > + terminate("No room for additional types\n"); > +#endif > debug(3, "Creating new defn type %d <%x>\n", id, id); > add_mapping(mcd->md_ta, ctdp->t_id, id); > alist_add(mcd->md_fdida, (void *)(ulong_t)ed.ed_tgt, > @@ -473,6 +477,10 @@ map_td_tree_post(tdesc_t *ctdp, tdesc_t **ctdpp __= unus > } else { > int id =3D mcd->md_tgt->td_nextid++; > =20 > +#ifdef __FreeBSD__ > + if (CTF_TYPE_ISCHILD(id)) > + terminate("No room for additional types\n"); > +#endif > debug(3, "Creating new type %d <%x>\n", id, id); > add_mapping(mcd->md_ta, ctdp->t_id, id); > hash_add(mcd->md_tdtba, ctdp); >=20 > Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Tue Apr 28 16:09= :25 2020 (r360444) > +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/util.c Tue Apr 28 16:09= :28 2020 (r360445) > @@ -148,17 +148,7 @@ terminate(const char *format, ...) > =20 > if (getenv("CTF_ABORT_ON_TERMINATE") !=3D NULL) > abort(); > -#if defined(__FreeBSD__) > -/* > - * For the time being just output the termination message, but don't > - * return an exit status that would cause the build to fail. We need > - * to get as much stuff built as possible before going back and > - * figuring out what is wrong with certain files. > - */ > - exit(0); > -#else > exit(1); > -#endif > } > =20 > /*PRINTFLIKE1*/ >=20 --=20 Regards, Bryan Drewery --niQeSCGkoXtvW3djFDeK7EIa8mM8RHYlP-- --OMaE395LHfPqSyIQOD11KOTheku1TM6Oo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl6oe4VfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY5 MTczQ0IyQzNBQUVBN0E1QzhBMUYwOTM1RDc3MUJCNkU0Njk3Q0YACgkQNddxu25G l8/s5wf9HFUP4e6xZZlGo/Ev6tkzn0rvy4hvgmIK/r3On9j8A1br7o6aSov9xCkL fG9PgYDbyoVOgpKvWyRXMLoQFmtepYg7k8E6FjQKk51fs21IhR1ky7/pVHp1ac6j WXoCN4npjSY2zK4C5U7iRTEpyDxRLOh/RAf2UR7gC2BaWkC7fZwS9OCP0MrwfRpY OnhS8lBlJ7+UFMauIPv29EebObmwmaybVeNeoyG3pxGfGVZA9X8Swtsa+DKaxd0/ iWPHLVcsuh8dTPNSMQyA1o4pMzh8acEdrGdG/Xru09nD1nfC52xkCwq4K7I6UyMW agfghLiTsKbuSeuZdxQeorTKZkD3Sg== =sC6G -----END PGP SIGNATURE----- --OMaE395LHfPqSyIQOD11KOTheku1TM6Oo-- From owner-svn-src-head@freebsd.org Tue Apr 28 19:14: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 C42532C26E6; Tue, 28 Apr 2020 19:14:13 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BWXj57Npz49MP; Tue, 28 Apr 2020 19:14:13 +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 AB52829176; Tue, 28 Apr 2020 19:14:13 +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 03SJEDBN030916; Tue, 28 Apr 2020 19:14:13 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SJEA7I030898; Tue, 28 Apr 2020 19:14:10 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004281914.03SJEA7I030898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 28 Apr 2020 19:14:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360449 - in head/sys: conf net net/route netinet netinet6 netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: conf net net/route netinet netinet6 netpfil/ipfw X-SVN-Commit-Revision: 360449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 19:14:13 -0000 Author: melifaro Date: Tue Apr 28 19:14:09 2020 New Revision: 360449 URL: https://svnweb.freebsd.org/changeset/base/360449 Log: Move route_temporal.c and route_var.h to net/route. Nexthop objects implementation, defined in r359823, introduced sys/net/route directory intended to hold all routing-related code. Move recently-introduced route_temporal.c and private route_var.h header there. Differential Revision: https://reviews.freebsd.org/D24597 Added: head/sys/net/route/route_temporal.c - copied, changed from r360430, head/sys/net/route_temporal.c head/sys/net/route/route_var.h - copied unchanged from r360447, head/sys/net/route_var.h Deleted: head/sys/net/route_temporal.c head/sys/net/route_var.h Modified: head/sys/conf/files head/sys/net/radix_mpath.c head/sys/net/route.c head/sys/net/route/nhop.c head/sys/net/route/nhop_ctl.c head/sys/net/route/route_ctl.c head/sys/net/route/route_helpers.c head/sys/net/rtsock.c head/sys/netinet/in_fib.c head/sys/netinet/in_rmx.c head/sys/netinet6/in6_fib.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c head/sys/netpfil/ipfw/ip_fw_table_algo.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/conf/files Tue Apr 28 19:14:09 2020 (r360449) @@ -4091,12 +4091,12 @@ net/radix_mpath.c standard net/raw_cb.c standard net/raw_usrreq.c standard net/route.c standard -net/route_temporal.c standard net/route/nhop.c standard net/route/nhop_ctl.c standard net/route/nhop_utils.c standard net/route/route_ctl.c standard net/route/route_helpers.c standard +net/route/route_temporal.c standard net/rss_config.c optional inet rss | inet6 rss net/rtsock.c standard net/slcompress.c optional netgraph_vjc | sppp | \ Modified: head/sys/net/radix_mpath.c ============================================================================== --- head/sys/net/radix_mpath.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/net/radix_mpath.c Tue Apr 28 19:14:09 2020 (r360449) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/net/route.c Tue Apr 28 19:14:09 2020 (r360449) @@ -61,7 +61,7 @@ #include #include #include -#include +#include #include #include #include Modified: head/sys/net/route/nhop.c ============================================================================== --- head/sys/net/route/nhop.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/net/route/nhop.c Tue Apr 28 19:14:09 2020 (r360449) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/net/route/nhop_ctl.c ============================================================================== --- head/sys/net/route/nhop_ctl.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/net/route/nhop_ctl.c Tue Apr 28 19:14:09 2020 (r360449) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/net/route/route_ctl.c Tue Apr 28 19:14:09 2020 (r360449) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/net/route/route_helpers.c ============================================================================== --- head/sys/net/route/route_helpers.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/net/route/route_helpers.c Tue Apr 28 19:14:09 2020 (r360449) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Copied and modified: head/sys/net/route/route_temporal.c (from r360430, head/sys/net/route_temporal.c) ============================================================================== --- head/sys/net/route_temporal.c Tue Apr 28 07:25:34 2020 (r360430, copy source) +++ head/sys/net/route/route_temporal.c Tue Apr 28 19:14:09 2020 (r360449) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include /* Copied: head/sys/net/route/route_var.h (from r360447, head/sys/net/route_var.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/route/route_var.h Tue Apr 28 19:14:09 2020 (r360449, copy of r360447, head/sys/net/route_var.h) @@ -0,0 +1,230 @@ +/*- + * Copyright (c) 2015-2016 + * Alexander V. Chernikov + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * 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$ + */ + +#ifndef _NET_ROUTE_VAR_H_ +#define _NET_ROUTE_VAR_H_ + +#ifndef RNF_NORMAL +#include +#endif +#include + +struct nh_control; +typedef int rnh_preadd_entry_f_t(u_int fibnum, const struct sockaddr *addr, + const struct sockaddr *mask, struct nhop_object *nh); + +struct rib_head { + struct radix_head head; + rn_matchaddr_f_t *rnh_matchaddr; /* longest match for sockaddr */ + rn_addaddr_f_t *rnh_addaddr; /* add based on sockaddr*/ + rn_deladdr_f_t *rnh_deladdr; /* remove based on sockaddr */ + rn_lookup_f_t *rnh_lookup; /* exact match for sockaddr */ + rn_walktree_t *rnh_walktree; /* traverse tree */ + rn_walktree_from_t *rnh_walktree_from; /* traverse tree below a */ + rn_close_t *rnh_close; /*do something when the last ref drops*/ + rnh_preadd_entry_f_t *rnh_preadd; /* hook to alter record prior to insertion */ + rt_gen_t rnh_gen; /* generation counter */ + int rnh_multipath; /* multipath capable ? */ + struct radix_node rnh_nodes[3]; /* empty tree for common case */ + struct rmlock rib_lock; /* config/data path lock */ + struct radix_mask_head rmhead; /* masks radix head */ + struct vnet *rib_vnet; /* vnet pointer */ + int rib_family; /* AF of the rtable */ + u_int rib_fibnum; /* fib number */ + struct callout expire_callout; /* Callout for expiring dynamic routes */ + time_t next_expire; /* Next expire run ts */ + struct nh_control *nh_control; /* nexthop subsystem data */ +}; + +#define RIB_RLOCK_TRACKER struct rm_priotracker _rib_tracker +#define RIB_LOCK_INIT(rh) rm_init(&(rh)->rib_lock, "rib head lock") +#define RIB_LOCK_DESTROY(rh) rm_destroy(&(rh)->rib_lock) +#define RIB_RLOCK(rh) rm_rlock(&(rh)->rib_lock, &_rib_tracker) +#define RIB_RUNLOCK(rh) rm_runlock(&(rh)->rib_lock, &_rib_tracker) +#define RIB_WLOCK(rh) rm_wlock(&(rh)->rib_lock) +#define RIB_WUNLOCK(rh) rm_wunlock(&(rh)->rib_lock) +#define RIB_LOCK_ASSERT(rh) rm_assert(&(rh)->rib_lock, RA_LOCKED) +#define RIB_WLOCK_ASSERT(rh) rm_assert(&(rh)->rib_lock, RA_WLOCKED) + +/* Macro for verifying fields in af-specific 'struct route' structures */ +#define CHK_STRUCT_FIELD_GENERIC(_s1, _f1, _s2, _f2) \ +_Static_assert(sizeof(((_s1 *)0)->_f1) == sizeof(((_s2 *)0)->_f2), \ + "Fields " #_f1 " and " #_f2 " size differs"); \ +_Static_assert(__offsetof(_s1, _f1) == __offsetof(_s2, _f2), \ + "Fields " #_f1 " and " #_f2 " offset differs"); + +#define _CHK_ROUTE_FIELD(_route_new, _field) \ + CHK_STRUCT_FIELD_GENERIC(struct route, _field, _route_new, _field) + +#define CHK_STRUCT_ROUTE_FIELDS(_route_new) \ + _CHK_ROUTE_FIELD(_route_new, ro_nh) \ + _CHK_ROUTE_FIELD(_route_new, ro_lle) \ + _CHK_ROUTE_FIELD(_route_new, ro_prepend)\ + _CHK_ROUTE_FIELD(_route_new, ro_plen) \ + _CHK_ROUTE_FIELD(_route_new, ro_flags) \ + _CHK_ROUTE_FIELD(_route_new, ro_mtu) \ + _CHK_ROUTE_FIELD(_route_new, spare) + +#define CHK_STRUCT_ROUTE_COMPAT(_ro_new, _dst_new) \ +CHK_STRUCT_ROUTE_FIELDS(_ro_new); \ +_Static_assert(__offsetof(struct route, ro_dst) == __offsetof(_ro_new, _dst_new),\ + "ro_dst and " #_dst_new " are at different offset") + +struct rib_head *rt_tables_get_rnh(int fib, int family); +void rt_mpath_init_rnh(struct rib_head *rnh); + +VNET_PCPUSTAT_DECLARE(struct rtstat, rtstat); +#define RTSTAT_ADD(name, val) \ + VNET_PCPUSTAT_ADD(struct rtstat, rtstat, name, (val)) +#define RTSTAT_INC(name) RTSTAT_ADD(name, 1) + +struct rtentry { + struct radix_node rt_nodes[2]; /* tree glue, and other values */ + /* + * XXX struct rtentry must begin with a struct radix_node (or two!) + * because the code does some casts of a 'struct radix_node *' + * to a 'struct rtentry *' + */ +#define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key))) +#define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask))) +#define rt_key_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_key))) +#define rt_mask_const(r) (*((const struct sockaddr * const *)(&(r)->rt_nodes->rn_mask))) + struct sockaddr *rt_gateway; /* value */ + struct ifnet *rt_ifp; /* the answer: interface to use */ + struct ifaddr *rt_ifa; /* the answer: interface address to use */ + struct nhop_object *rt_nhop; /* nexthop data */ + int rt_flags; /* up/down?, host/net */ + int rt_refcnt; /* # held references */ + u_int rt_fibnum; /* which FIB */ + u_long rt_mtu; /* MTU for this path */ + u_long rt_weight; /* absolute weight */ + u_long rt_expire; /* lifetime for route, e.g. redirect */ +#define rt_endzero rt_pksent + counter_u64_t rt_pksent; /* packets sent using this route */ + struct mtx rt_mtx; /* mutex for routing entry */ + struct rtentry *rt_chain; /* pointer to next rtentry to delete */ +}; + +#define RT_LOCK_INIT(_rt) \ + mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK | MTX_NEW) +#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) +#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) +#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) +#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) +#define RT_UNLOCK_COND(_rt) do { \ + if (mtx_owned(&(_rt)->rt_mtx)) \ + mtx_unlock(&(_rt)->rt_mtx); \ +} while (0) + +#define RT_ADDREF(_rt) do { \ + RT_LOCK_ASSERT(_rt); \ + KASSERT((_rt)->rt_refcnt >= 0, \ + ("negative refcnt %d", (_rt)->rt_refcnt)); \ + (_rt)->rt_refcnt++; \ +} while (0) + +#define RT_REMREF(_rt) do { \ + RT_LOCK_ASSERT(_rt); \ + KASSERT((_rt)->rt_refcnt > 0, \ + ("bogus refcnt %d", (_rt)->rt_refcnt)); \ + (_rt)->rt_refcnt--; \ +} while (0) + +#define RTFREE_LOCKED(_rt) do { \ + if ((_rt)->rt_refcnt <= 1) \ + rtfree(_rt); \ + else { \ + RT_REMREF(_rt); \ + RT_UNLOCK(_rt); \ + } \ + /* guard against invalid refs */ \ + _rt = 0; \ +} while (0) + +#define RTFREE(_rt) do { \ + RT_LOCK(_rt); \ + RTFREE_LOCKED(_rt); \ +} while (0) + +/* + * With the split between the routing entry and the nexthop, + * rt_flags has to be split between these 2 entries. As rtentry + * mostly contains prefix data and is thought to be generic enough + * so one can transparently change the nexthop pointer w/o requiring + * any other rtentry changes, most of rt_flags shifts to the particular nexthop. + * / + * + * RTF_UP: rtentry, as an indication that it is linked. + * RTF_HOST: rtentry, nhop. The latter indication is needed for the datapath + * RTF_DYNAMIC: nhop, to make rtentry generic. + * RTF_MODIFIED: nhop, to make rtentry generic. (legacy) + * -- "native" path (nhop) properties: + * RTF_GATEWAY, RTF_STATIC, RTF_PROTO1, RTF_PROTO2, RTF_PROTO3, RTF_FIXEDMTU, + * RTF_PINNED, RTF_REJECT, RTF_BLACKHOLE, RTF_BROADCAST + */ + +/* Nexthop rt flags mask */ +#define NHOP_RT_FLAG_MASK (RTF_GATEWAY | RTF_HOST | RTF_REJECT | RTF_DYNAMIC | \ + RTF_MODIFIED | RTF_STATIC | RTF_BLACKHOLE | RTF_PROTO1 | RTF_PROTO2 | \ + RTF_PROTO3 | RTF_FIXEDMTU | RTF_PINNED | RTF_BROADCAST) + +/* rtentry rt flag mask */ +#define RTE_RT_FLAG_MASK (RTF_UP | RTF_HOST) + +/* Nexthop selection */ +#define _NH2MP(_nh) ((struct nhgrp_object *)(_nh)) +#define _SELECT_NHOP(_nh, _flowid) \ + (_NH2MP(_nh))->nhops[(_flowid) % (_NH2MP(_nh))->mp_size] +#define _RT_SELECT_NHOP(_nh, _flowid) \ + ((!NH_IS_MULTIPATH(_nh)) ? (_nh) : _SELECT_NHOP(_nh, _flowid)) +#define RT_SELECT_NHOP(_rt, _flowid) _RT_SELECT_NHOP((_rt)->rt_nhop, _flowid) + +/* rte<>nhop translation */ +static inline uint16_t +fib_rte_to_nh_flags(int rt_flags) +{ + uint16_t res; + + res = (rt_flags & RTF_REJECT) ? NHF_REJECT : 0; + res |= (rt_flags & RTF_HOST) ? NHF_HOST : 0; + res |= (rt_flags & RTF_BLACKHOLE) ? NHF_BLACKHOLE : 0; + res |= (rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) ? NHF_REDIRECT : 0; + res |= (rt_flags & RTF_BROADCAST) ? NHF_BROADCAST : 0; + res |= (rt_flags & RTF_GATEWAY) ? NHF_GATEWAY : 0; + + return (res); +} + +void tmproutes_update(struct rib_head *rnh, struct rtentry *rt); +void tmproutes_init(struct rib_head *rh); +void tmproutes_destroy(struct rib_head *rh); + +#endif Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/net/rtsock.c Tue Apr 28 19:14:09 2020 (r360449) @@ -67,7 +67,7 @@ #include #include #include -#include +#include #include #include Modified: head/sys/netinet/in_fib.c ============================================================================== --- head/sys/netinet/in_fib.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/netinet/in_fib.c Tue Apr 28 19:14:09 2020 (r360449) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/netinet/in_rmx.c Tue Apr 28 19:14:09 2020 (r360449) @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/netinet6/in6_fib.c ============================================================================== --- head/sys/netinet6/in6_fib.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/netinet6/in6_fib.c Tue Apr 28 19:14:09 2020 (r360449) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/netinet6/in6_rmx.c Tue Apr 28 19:14:09 2020 (r360449) @@ -81,7 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/netinet6/nd6.c Tue Apr 28 19:14:09 2020 (r360449) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/netinet6/nd6_rtr.c Tue Apr 28 19:14:09 2020 (r360449) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_algo.c Tue Apr 28 18:53:49 2020 (r360448) +++ head/sys/netpfil/ipfw/ip_fw_table_algo.c Tue Apr 28 19:14:09 2020 (r360449) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include /* ip_fw.h requires IFNAMSIZ */ #include #include -#include +#include #include #include From owner-svn-src-head@freebsd.org Tue Apr 28 20:00: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 5674D2C38CE; Tue, 28 Apr 2020 20:00:18 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BXYt1tXgz4DQj; Tue, 28 Apr 2020 20:00:18 +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 3BADC29948; Tue, 28 Apr 2020 20:00:18 +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 03SK0Idm055985; Tue, 28 Apr 2020 20:00:18 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SK0HK1055981; Tue, 28 Apr 2020 20:00:17 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004282000.03SK0HK1055981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Tue, 28 Apr 2020 20:00:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360450 - in head/sys: conf net net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: conf net net/route X-SVN-Commit-Revision: 360450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 20:00:18 -0000 Author: melifaro Date: Tue Apr 28 20:00:17 2020 New Revision: 360450 URL: https://svnweb.freebsd.org/changeset/base/360450 Log: Move route-specific ddb commands to route/route_ddb.c Currently functionality resides in rtsock.c, which is a controlling interface, partially external to the routing subsystem. Additionally, DDB-supporting functionality is > 100SLOC, which deserves a separate file. Given that, move this functionality to a newly-created net/route/ subdir. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D24561 Added: head/sys/net/route/route_ddb.c (contents, props changed) Modified: head/sys/conf/files head/sys/net/route.h head/sys/net/rtsock.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Apr 28 19:14:09 2020 (r360449) +++ head/sys/conf/files Tue Apr 28 20:00:17 2020 (r360450) @@ -4095,6 +4095,7 @@ net/route/nhop.c standard net/route/nhop_ctl.c standard net/route/nhop_utils.c standard net/route/route_ctl.c standard +net/route/route_ddb.c optional ddb net/route/route_helpers.c standard net/route/route_temporal.c standard net/rss_config.c optional inet rss | inet6 rss Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Tue Apr 28 19:14:09 2020 (r360449) +++ head/sys/net/route.h Tue Apr 28 20:00:17 2020 (r360450) @@ -388,6 +388,8 @@ int rtsock_addrmsg(int, struct ifaddr *, int); int rtsock_routemsg(int, struct rtentry *, struct ifnet *ifp, int, int); int rtsock_routemsg_info(int, struct rt_addrinfo *, int); +struct sockaddr *rtsock_fix_netmask(const struct sockaddr *dst, + const struct sockaddr *smask, struct sockaddr_storage *dmask); /* * Note the following locking behavior: * Added: head/sys/net/route/route_ddb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/route/route_ddb.c Tue Apr 28 20:00:17 2020 (r360450) @@ -0,0 +1,458 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2019 Conrad Meyer + * + * 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_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Unfortunately, RTF_ values are expressed as raw masks rather than powers of + * 2, so we cannot use them as nice C99 initializer indices below. + */ +static const char * const rtf_flag_strings[] = { + "UP", + "GATEWAY", + "HOST", + "REJECT", + "DYNAMIC", + "MODIFIED", + "DONE", + "UNUSED_0x80", + "UNUSED_0x100", + "XRESOLVE", + "LLDATA", + "STATIC", + "BLACKHOLE", + "UNUSED_0x2000", + "PROTO2", + "PROTO1", + "UNUSED_0x10000", + "UNUSED_0x20000", + "PROTO3", + "FIXEDMTU", + "PINNED", + "LOCAL", + "BROADCAST", + "MULTICAST", + /* Big gap. */ + [28] = "STICKY", + [30] = "RNH_LOCKED", + [31] = "GWFLAG_COMPAT", +}; + +static const char * __pure +rt_flag_name(unsigned idx) +{ + if (idx >= nitems(rtf_flag_strings)) + return ("INVALID_FLAG"); + if (rtf_flag_strings[idx] == NULL) + return ("UNKNOWN"); + return (rtf_flag_strings[idx]); +} + +static void +rt_dumpaddr_ddb(const char *name, const struct sockaddr *sa) +{ + char buf[INET6_ADDRSTRLEN], *res; + + res = NULL; + if (sa == NULL) + res = "NULL"; + else if (sa->sa_family == AF_INET) { + res = inet_ntop(AF_INET, + &((const struct sockaddr_in *)sa)->sin_addr, + buf, sizeof(buf)); + } else if (sa->sa_family == AF_INET6) { + res = inet_ntop(AF_INET6, + &((const struct sockaddr_in6 *)sa)->sin6_addr, + buf, sizeof(buf)); + } else if (sa->sa_family == AF_LINK) { + res = "on link"; + } + + if (res != NULL) { + db_printf("%s <%s> ", name, res); + return; + } + + db_printf("%s ", name, sa->sa_family); +} + +static int +rt_dumpentry_ddb(struct radix_node *rn, void *arg __unused) +{ + struct sockaddr_storage ss; + struct rtentry *rt; + int flags, idx; + + /* If RNTORT is important, put it in a header. */ + rt = (void *)rn; + + rt_dumpaddr_ddb("dst", rt_key(rt)); + rt_dumpaddr_ddb("gateway", &rt->rt_nhop->gw_sa); + rt_dumpaddr_ddb("netmask", rtsock_fix_netmask(rt_key(rt), rt_mask(rt), + &ss)); + if (rt->rt_ifp != NULL && (rt->rt_ifp->if_flags & IFF_DYING) == 0) { + rt_dumpaddr_ddb("ifp", rt->rt_ifp->if_addr->ifa_addr); + rt_dumpaddr_ddb("ifa", rt->rt_ifa->ifa_addr); + } + + db_printf("flags "); + flags = rt->rt_flags; + if (flags == 0) + db_printf("none"); + + while ((idx = ffs(flags)) > 0) { + idx--; + + if (flags != rt->rt_flags) + db_printf(","); + db_printf("%s", rt_flag_name(idx)); + + flags &= ~(1ul << idx); + } + + db_printf("\n"); + return (0); +} + +DB_SHOW_COMMAND(routetable, db_show_routetable_cmd) +{ + struct rib_head *rnh; + int error, i, lim; + + if (have_addr) + i = lim = addr; + else { + i = 1; + lim = AF_MAX; + } + + for (; i <= lim; i++) { + rnh = rt_tables_get_rnh(0, i); + if (rnh == NULL) { + if (have_addr) { + db_printf("%s: AF %d not supported?\n", + __func__, i); + break; + } + continue; + } + + if (!have_addr && i > 1) + db_printf("\n"); + + db_printf("Route table for AF %d%s%s%s:\n", i, + (i == AF_INET || i == AF_INET6) ? " (" : "", + (i == AF_INET) ? "INET" : (i == AF_INET6) ? "INET6" : "", + (i == AF_INET || i == AF_INET6) ? ")" : ""); + + error = rnh->rnh_walktree(&rnh->head, rt_dumpentry_ddb, NULL); + if (error != 0) + db_printf("%s: walktree(%d): %d\n", __func__, i, + error); + } +} + +_DB_FUNC(_show, route, db_show_route_cmd, db_show_table, CS_OWN, NULL) +{ + char buf[INET6_ADDRSTRLEN], *bp; + const void *dst_addrp; + struct sockaddr *dstp; + struct rtentry *rt; + union { + struct sockaddr_in dest_sin; + struct sockaddr_in6 dest_sin6; + } u; + uint16_t hextets[8]; + unsigned i, tets; + int t, af, exp, tokflags; + + /* + * Undecoded address family. No double-colon expansion seen yet. + */ + af = -1; + exp = -1; + /* Assume INET6 to start; we can work back if guess was wrong. */ + tokflags = DRT_WSPACE | DRT_HEX | DRT_HEXADECIMAL; + + /* + * db_command has lexed 'show route' for us. + */ + t = db_read_token_flags(tokflags); + if (t == tWSPACE) + t = db_read_token_flags(tokflags); + + /* + * tEOL: Just 'show route' isn't a valid mode. + * tMINUS: It's either '-h' or some invalid option. Regardless, usage. + */ + if (t == tEOL || t == tMINUS) + goto usage; + + db_unread_token(t); + + tets = nitems(hextets); + + /* + * Each loop iteration, we expect to read one octet (v4) or hextet + * (v6), followed by an appropriate field separator ('.' or ':' or + * '::'). + * + * At the start of each loop, we're looking for a number (octet or + * hextet). + * + * INET6 addresses have a special case where they may begin with '::'. + */ + for (i = 0; i < tets; i++) { + t = db_read_token_flags(tokflags); + + if (t == tCOLONCOLON) { + /* INET6 with leading '::' or invalid. */ + if (i != 0) { + db_printf("Parse error: unexpected extra " + "colons.\n"); + goto exit; + } + + af = AF_INET6; + exp = i; + hextets[i] = 0; + continue; + } else if (t == tNUMBER) { + /* + * Lexer separates out '-' as tMINUS, but make the + * assumption explicit here. + */ + MPASS(db_tok_number >= 0); + + if (af == AF_INET && db_tok_number > UINT8_MAX) { + db_printf("Not a valid v4 octet: %ld\n", + (long)db_tok_number); + goto exit; + } + hextets[i] = db_tok_number; + } else if (t == tEOL) { + /* + * We can only detect the end of an IPv6 address in + * compact representation with EOL. + */ + if (af != AF_INET6 || exp < 0) { + db_printf("Parse failed. Got unexpected EOF " + "when the address is not a compact-" + "representation IPv6 address.\n"); + goto exit; + } + break; + } else { + db_printf("Parse failed. Unexpected token %d.\n", t); + goto exit; + } + + /* Next, look for a separator, if appropriate. */ + if (i == tets - 1) + continue; + + t = db_read_token_flags(tokflags); + if (af < 0) { + if (t == tCOLON) { + af = AF_INET6; + continue; + } + if (t == tCOLONCOLON) { + af = AF_INET6; + i++; + hextets[i] = 0; + exp = i; + continue; + } + if (t == tDOT) { + unsigned hn, dn; + + af = AF_INET; + /* Need to fixup the first parsed number. */ + if (hextets[0] > 0x255 || + (hextets[0] & 0xf0) > 0x90 || + (hextets[0] & 0xf) > 9) { + db_printf("Not a valid v4 octet: %x\n", + hextets[0]); + goto exit; + } + + hn = hextets[0]; + dn = (hn >> 8) * 100 + + ((hn >> 4) & 0xf) * 10 + + (hn & 0xf); + + hextets[0] = dn; + + /* Switch to decimal for remaining octets. */ + tokflags &= ~DRT_RADIX_MASK; + tokflags |= DRT_DECIMAL; + + tets = 4; + continue; + } + + db_printf("Parse error. Unexpected token %d.\n", t); + goto exit; + } else if (af == AF_INET) { + if (t == tDOT) + continue; + db_printf("Expected '.' (%d) between octets but got " + "(%d).\n", tDOT, t); + goto exit; + + } else if (af == AF_INET6) { + if (t == tCOLON) + continue; + if (t == tCOLONCOLON) { + if (exp < 0) { + i++; + hextets[i] = 0; + exp = i; + continue; + } + db_printf("Got bogus second '::' in v6 " + "address.\n"); + goto exit; + } + if (t == tEOL) { + /* + * Handle in the earlier part of the loop + * because we need to handle trailing :: too. + */ + db_unread_token(t); + continue; + } + + db_printf("Expected ':' (%d) or '::' (%d) between " + "hextets but got (%d).\n", tCOLON, tCOLONCOLON, t); + goto exit; + } + } + + /* Check for trailing garbage. */ + if (i == tets) { + t = db_read_token_flags(tokflags); + if (t != tEOL) { + db_printf("Got unexpected garbage after address " + "(%d).\n", t); + goto exit; + } + } + + /* + * Need to expand compact INET6 addresses. + * + * Technically '::' for a single ':0:' is MUST NOT but just in case, + * don't bother expanding that form (exp >= 0 && i == tets case). + */ + if (af == AF_INET6 && exp >= 0 && i < tets) { + if (exp + 1 < i) { + memmove(&hextets[exp + 1 + (nitems(hextets) - i)], + &hextets[exp + 1], + (i - (exp + 1)) * sizeof(hextets[0])); + } + memset(&hextets[exp + 1], 0, (nitems(hextets) - i) * + sizeof(hextets[0])); + } + + memset(&u, 0, sizeof(u)); + if (af == AF_INET) { + u.dest_sin.sin_family = AF_INET; + u.dest_sin.sin_len = sizeof(u.dest_sin); + u.dest_sin.sin_addr.s_addr = htonl( + ((uint32_t)hextets[0] << 24) | + ((uint32_t)hextets[1] << 16) | + ((uint32_t)hextets[2] << 8) | + (uint32_t)hextets[3]); + dstp = (void *)&u.dest_sin; + dst_addrp = &u.dest_sin.sin_addr; + } else if (af == AF_INET6) { + u.dest_sin6.sin6_family = AF_INET6; + u.dest_sin6.sin6_len = sizeof(u.dest_sin6); + for (i = 0; i < nitems(hextets); i++) + u.dest_sin6.sin6_addr.s6_addr16[i] = htons(hextets[i]); + dstp = (void *)&u.dest_sin6; + dst_addrp = &u.dest_sin6.sin6_addr; + } else { + MPASS(false); + /* UNREACHABLE */ + /* Appease Clang false positive: */ + dstp = NULL; + } + + bp = inet_ntop(af, dst_addrp, buf, sizeof(buf)); + if (bp != NULL) + db_printf("Looking up route to destination '%s'\n", bp); + + CURVNET_SET(vnet0); + rt = rtalloc1(dstp, 0, RTF_RNH_LOCKED); + CURVNET_RESTORE(); + + if (rt == NULL) { + db_printf("Could not get route for that server.\n"); + return; + } + + rt_dumpentry_ddb((void *)rt, NULL); + RTFREE_LOCKED(rt); + + return; +usage: + db_printf("Usage: 'show route
'\n" + " Currently accepts only dotted-decimal INET or colon-separated\n" + " hextet INET6 addresses.\n"); +exit: + db_skip_to_eol(); +} + Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Apr 28 19:14:09 2020 (r360449) +++ head/sys/net/rtsock.c Tue Apr 28 20:00:17 2020 (r360450) @@ -54,11 +54,6 @@ #include #include -#ifdef DDB -#include -#include -#endif - #include #include #include @@ -68,6 +63,9 @@ #include #include #include +#ifdef RADIX_MPATH +#include +#endif #include #include @@ -182,8 +180,6 @@ static int sysctl_ifmalist(int af, struct walkarg *w); static int route_output(struct mbuf *m, struct socket *so, ...); static void rt_getmetrics(const struct rtentry *rt, struct rt_metrics *out); static void rt_dispatch(struct mbuf *, sa_family_t); -static struct sockaddr *rtsock_fix_netmask(struct sockaddr *dst, - struct sockaddr *smask, struct sockaddr_storage *dmask); static int handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, struct rt_msghdr *rtm, struct rtentry **ret_nrt); static int update_rtm_from_rte(struct rt_addrinfo *info, @@ -1136,8 +1132,8 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinf * Fill in @dmask with valid netmask leaving original @smask * intact. Mostly used with radix netmasks. */ -static struct sockaddr * -rtsock_fix_netmask(struct sockaddr *dst, struct sockaddr *smask, +struct sockaddr * +rtsock_fix_netmask(const struct sockaddr *dst, const struct sockaddr *smask, struct sockaddr_storage *dmask) { if (dst == NULL || smask == NULL) @@ -2164,407 +2160,3 @@ static struct domain routedomain = { VNET_DOMAIN_SET(route); -#ifdef DDB -/* - * Unfortunately, RTF_ values are expressed as raw masks rather than powers of - * 2, so we cannot use them as nice C99 initializer indices below. - */ -static const char * const rtf_flag_strings[] = { - "UP", - "GATEWAY", - "HOST", - "REJECT", - "DYNAMIC", - "MODIFIED", - "DONE", - "UNUSED_0x80", - "UNUSED_0x100", - "XRESOLVE", - "LLDATA", - "STATIC", - "BLACKHOLE", - "UNUSED_0x2000", - "PROTO2", - "PROTO1", - "UNUSED_0x10000", - "UNUSED_0x20000", - "PROTO3", - "FIXEDMTU", - "PINNED", - "LOCAL", - "BROADCAST", - "MULTICAST", - /* Big gap. */ - [28] = "STICKY", - [30] = "RNH_LOCKED", - [31] = "GWFLAG_COMPAT", -}; - -static const char * __pure -rt_flag_name(unsigned idx) -{ - if (idx >= nitems(rtf_flag_strings)) - return ("INVALID_FLAG"); - if (rtf_flag_strings[idx] == NULL) - return ("UNKNOWN"); - return (rtf_flag_strings[idx]); -} - -static void -rt_dumpaddr_ddb(const char *name, const struct sockaddr *sa) -{ - char buf[INET6_ADDRSTRLEN], *res; - - res = NULL; - if (sa == NULL) - res = "NULL"; - else if (sa->sa_family == AF_INET) { - res = inet_ntop(AF_INET, - &((const struct sockaddr_in *)sa)->sin_addr, - buf, sizeof(buf)); - } else if (sa->sa_family == AF_INET6) { - res = inet_ntop(AF_INET6, - &((const struct sockaddr_in6 *)sa)->sin6_addr, - buf, sizeof(buf)); - } else if (sa->sa_family == AF_LINK) { - res = "on link"; - } - - if (res != NULL) { - db_printf("%s <%s> ", name, res); - return; - } - - db_printf("%s ", name, sa->sa_family); -} - -static int -rt_dumpentry_ddb(struct radix_node *rn, void *arg __unused) -{ - struct sockaddr_storage ss; - struct rtentry *rt; - int flags, idx; - - /* If RNTORT is important, put it in a header. */ - rt = (void *)rn; - - rt_dumpaddr_ddb("dst", rt_key(rt)); - rt_dumpaddr_ddb("gateway", &rt->rt_nhop->gw_sa); - rt_dumpaddr_ddb("netmask", rtsock_fix_netmask(rt_key(rt), rt_mask(rt), - &ss)); - if (rt->rt_ifp != NULL && (rt->rt_ifp->if_flags & IFF_DYING) == 0) { - rt_dumpaddr_ddb("ifp", rt->rt_ifp->if_addr->ifa_addr); - rt_dumpaddr_ddb("ifa", rt->rt_ifa->ifa_addr); - } - - db_printf("flags "); - flags = rt->rt_flags; - if (flags == 0) - db_printf("none"); - - while ((idx = ffs(flags)) > 0) { - idx--; - - if (flags != rt->rt_flags) - db_printf(","); - db_printf("%s", rt_flag_name(idx)); - - flags &= ~(1ul << idx); - } - - db_printf("\n"); - return (0); -} - -DB_SHOW_COMMAND(routetable, db_show_routetable_cmd) -{ - struct rib_head *rnh; - int error, i, lim; - - if (have_addr) - i = lim = addr; - else { - i = 1; - lim = AF_MAX; - } - - for (; i <= lim; i++) { - rnh = rt_tables_get_rnh(0, i); - if (rnh == NULL) { - if (have_addr) { - db_printf("%s: AF %d not supported?\n", - __func__, i); - break; - } - continue; - } - - if (!have_addr && i > 1) - db_printf("\n"); - - db_printf("Route table for AF %d%s%s%s:\n", i, - (i == AF_INET || i == AF_INET6) ? " (" : "", - (i == AF_INET) ? "INET" : (i == AF_INET6) ? "INET6" : "", - (i == AF_INET || i == AF_INET6) ? ")" : ""); - - error = rnh->rnh_walktree(&rnh->head, rt_dumpentry_ddb, NULL); - if (error != 0) - db_printf("%s: walktree(%d): %d\n", __func__, i, - error); - } -} - -_DB_FUNC(_show, route, db_show_route_cmd, db_show_table, CS_OWN, NULL) -{ - char buf[INET6_ADDRSTRLEN], *bp; - const void *dst_addrp; - struct sockaddr *dstp; - struct rtentry *rt; - union { - struct sockaddr_in dest_sin; - struct sockaddr_in6 dest_sin6; - } u; - uint16_t hextets[8]; - unsigned i, tets; - int t, af, exp, tokflags; - - /* - * Undecoded address family. No double-colon expansion seen yet. - */ - af = -1; - exp = -1; - /* Assume INET6 to start; we can work back if guess was wrong. */ - tokflags = DRT_WSPACE | DRT_HEX | DRT_HEXADECIMAL; - - /* - * db_command has lexed 'show route' for us. - */ - t = db_read_token_flags(tokflags); - if (t == tWSPACE) - t = db_read_token_flags(tokflags); - - /* - * tEOL: Just 'show route' isn't a valid mode. - * tMINUS: It's either '-h' or some invalid option. Regardless, usage. - */ - if (t == tEOL || t == tMINUS) - goto usage; - - db_unread_token(t); - - tets = nitems(hextets); - - /* - * Each loop iteration, we expect to read one octet (v4) or hextet - * (v6), followed by an appropriate field separator ('.' or ':' or - * '::'). - * - * At the start of each loop, we're looking for a number (octet or - * hextet). - * - * INET6 addresses have a special case where they may begin with '::'. - */ - for (i = 0; i < tets; i++) { - t = db_read_token_flags(tokflags); - - if (t == tCOLONCOLON) { - /* INET6 with leading '::' or invalid. */ - if (i != 0) { - db_printf("Parse error: unexpected extra " - "colons.\n"); - goto exit; - } - - af = AF_INET6; - exp = i; - hextets[i] = 0; - continue; - } else if (t == tNUMBER) { - /* - * Lexer separates out '-' as tMINUS, but make the - * assumption explicit here. - */ - MPASS(db_tok_number >= 0); - - if (af == AF_INET && db_tok_number > UINT8_MAX) { - db_printf("Not a valid v4 octet: %ld\n", - (long)db_tok_number); - goto exit; - } - hextets[i] = db_tok_number; - } else if (t == tEOL) { - /* - * We can only detect the end of an IPv6 address in - * compact representation with EOL. - */ - if (af != AF_INET6 || exp < 0) { - db_printf("Parse failed. Got unexpected EOF " - "when the address is not a compact-" - "representation IPv6 address.\n"); - goto exit; - } - break; - } else { - db_printf("Parse failed. Unexpected token %d.\n", t); - goto exit; - } - - /* Next, look for a separator, if appropriate. */ - if (i == tets - 1) - continue; - - t = db_read_token_flags(tokflags); - if (af < 0) { - if (t == tCOLON) { - af = AF_INET6; - continue; - } - if (t == tCOLONCOLON) { - af = AF_INET6; - i++; - hextets[i] = 0; - exp = i; - continue; - } - if (t == tDOT) { - unsigned hn, dn; - - af = AF_INET; - /* Need to fixup the first parsed number. */ - if (hextets[0] > 0x255 || - (hextets[0] & 0xf0) > 0x90 || - (hextets[0] & 0xf) > 9) { - db_printf("Not a valid v4 octet: %x\n", - hextets[0]); - goto exit; - } - - hn = hextets[0]; - dn = (hn >> 8) * 100 + - ((hn >> 4) & 0xf) * 10 + - (hn & 0xf); - - hextets[0] = dn; - - /* Switch to decimal for remaining octets. */ - tokflags &= ~DRT_RADIX_MASK; - tokflags |= DRT_DECIMAL; - - tets = 4; - continue; - } - - db_printf("Parse error. Unexpected token %d.\n", t); - goto exit; - } else if (af == AF_INET) { - if (t == tDOT) - continue; - db_printf("Expected '.' (%d) between octets but got " - "(%d).\n", tDOT, t); - goto exit; - - } else if (af == AF_INET6) { - if (t == tCOLON) - continue; - if (t == tCOLONCOLON) { - if (exp < 0) { - i++; - hextets[i] = 0; - exp = i; - continue; - } - db_printf("Got bogus second '::' in v6 " - "address.\n"); - goto exit; - } - if (t == tEOL) { - /* - * Handle in the earlier part of the loop - * because we need to handle trailing :: too. - */ - db_unread_token(t); - continue; - } - - db_printf("Expected ':' (%d) or '::' (%d) between " - "hextets but got (%d).\n", tCOLON, tCOLONCOLON, t); - goto exit; - } - } - - /* Check for trailing garbage. */ - if (i == tets) { - t = db_read_token_flags(tokflags); - if (t != tEOL) { - db_printf("Got unexpected garbage after address " - "(%d).\n", t); - goto exit; - } - } - - /* - * Need to expand compact INET6 addresses. - * - * Technically '::' for a single ':0:' is MUST NOT but just in case, - * don't bother expanding that form (exp >= 0 && i == tets case). - */ - if (af == AF_INET6 && exp >= 0 && i < tets) { - if (exp + 1 < i) { - memmove(&hextets[exp + 1 + (nitems(hextets) - i)], - &hextets[exp + 1], - (i - (exp + 1)) * sizeof(hextets[0])); - } - memset(&hextets[exp + 1], 0, (nitems(hextets) - i) * - sizeof(hextets[0])); - } - - memset(&u, 0, sizeof(u)); - if (af == AF_INET) { - u.dest_sin.sin_family = AF_INET; - u.dest_sin.sin_len = sizeof(u.dest_sin); - u.dest_sin.sin_addr.s_addr = htonl( - ((uint32_t)hextets[0] << 24) | - ((uint32_t)hextets[1] << 16) | - ((uint32_t)hextets[2] << 8) | - (uint32_t)hextets[3]); - dstp = (void *)&u.dest_sin; - dst_addrp = &u.dest_sin.sin_addr; - } else if (af == AF_INET6) { - u.dest_sin6.sin6_family = AF_INET6; - u.dest_sin6.sin6_len = sizeof(u.dest_sin6); - for (i = 0; i < nitems(hextets); i++) - u.dest_sin6.sin6_addr.s6_addr16[i] = htons(hextets[i]); - dstp = (void *)&u.dest_sin6; - dst_addrp = &u.dest_sin6.sin6_addr; - } else { - MPASS(false); - /* UNREACHABLE */ - /* Appease Clang false positive: */ - dstp = NULL; - } - - bp = inet_ntop(af, dst_addrp, buf, sizeof(buf)); - if (bp != NULL) - db_printf("Looking up route to destination '%s'\n", bp); - - CURVNET_SET(vnet0); - rt = rtalloc1(dstp, 0, RTF_RNH_LOCKED); - CURVNET_RESTORE(); - - if (rt == NULL) { - db_printf("Could not get route for that server.\n"); - return; - } - - rt_dumpentry_ddb((void *)rt, NULL); - RTFREE_LOCKED(rt); - - return; -usage: - db_printf("Usage: 'show route
'\n" - " Currently accepts only dotted-decimal INET or colon-separated\n" - " hextet INET6 addresses.\n"); -exit: - db_skip_to_eol(); -} -#endif From owner-svn-src-head@freebsd.org Tue Apr 28 20:34: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 C16DE2C480D; Tue, 28 Apr 2020 20:34:27 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BYKH4mg2z4GbK; Tue, 28 Apr 2020 20:34:27 +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 9E8D82A0D4; Tue, 28 Apr 2020 20:34:27 +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 03SKYRFx079945; Tue, 28 Apr 2020 20:34:27 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03SKYRNb079944; Tue, 28 Apr 2020 20:34:27 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <202004282034.03SKYRNb079944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Tue, 28 Apr 2020 20:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360452 - head/bin/sh X-SVN-Group: head X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: head/bin/sh X-SVN-Commit-Revision: 360452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 20:34:27 -0000 Author: jilles Date: Tue Apr 28 20:34:27 2020 New Revision: 360452 URL: https://svnweb.freebsd.org/changeset/base/360452 Log: sh: Assert INTOFF rather than applying it in ck* As I noted in https://reviews.freebsd.org/D22756, INTOFF should be in effect when calling ckmalloc/ckrealloc/ckfree to avoid memory leaks and double frees. Therefore, change the functions to check if INTOFF is in effect instead of applying it. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D24599 Modified: head/bin/sh/memalloc.c Modified: head/bin/sh/memalloc.c ============================================================================== --- head/bin/sh/memalloc.c Tue Apr 28 20:14:38 2020 (r360451) +++ head/bin/sh/memalloc.c Tue Apr 28 20:34:27 2020 (r360452) @@ -50,6 +50,13 @@ __FBSDID("$FreeBSD$"); #include #include +static void +badalloc(const char *message) +{ + write(2, message, strlen(message)); + abort(); +} + /* * Like malloc, but returns an error when out of space. */ @@ -59,9 +66,9 @@ ckmalloc(size_t nbytes) { pointer p; - INTOFF; + if (!is_int_on()) + badalloc("Unsafe ckmalloc() call\n"); p = malloc(nbytes); - INTON; if (p == NULL) error("Out of space"); return p; @@ -75,9 +82,9 @@ ckmalloc(size_t nbytes) pointer ckrealloc(pointer p, int nbytes) { - INTOFF; + if (!is_int_on()) + badalloc("Unsafe ckrealloc() call\n"); p = realloc(p, nbytes); - INTON; if (p == NULL) error("Out of space"); return p; @@ -86,9 +93,9 @@ ckrealloc(pointer p, int nbytes) void ckfree(pointer p) { - INTOFF; + if (!is_int_on()) + badalloc("Unsafe ckfree() call\n"); free(p); - INTON; } From owner-svn-src-head@freebsd.org Tue Apr 28 22:30: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 37A2B2C6EED; Tue, 28 Apr 2020 22:30:54 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Bbvf0GLXz4NGr; Tue, 28 Apr 2020 22:30:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-164.local (unknown [IPv6:2601:648:8203:2990:d41f:e4dd:90e3:84fb]) (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 75AD55CA4; Tue, 28 Apr 2020 22:30:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r360444 - head/sys/conf To: Bryan Drewery , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202004281609.03SG9PHU013278@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: Date: Tue, 28 Apr 2020 15:30:50 -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: <202004281609.03SG9PHU013278@repo.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.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 22:30:54 -0000 On 4/28/20 9:09 AM, Bryan Drewery wrote: > Author: bdrewery > Date: Tue Apr 28 16:09:25 2020 > New Revision: 360444 > URL: https://svnweb.freebsd.org/changeset/base/360444 > > Log: > Don't try ctfconvert on file without debug info. > > This was currently an ignored error but will change to a hard error > eventually. > > Differential Revision: https://reviews.freebsd.org/D24536 FYI, this just broke make tinderbox entirely for building head on older head or stable/12. The issue is that 'make tinderbox' uses the host's config binary to run 'config -m' against each kernel config file to determine it's MACHINE_ARCH, and when it gets an error make tinderbox just dies, e.g.: > make tinderbox NO_CLEAN=yes JFLAG=-j2 -------------------------------------------------------------- >>> make universe started on Tue Apr 28 09:27:36 PDT 2020 -------------------------------------------------------------- -------------------------------------------------------------- > Toolchain bootstrap started on Tue Apr 28 09:27:36 PDT 2020 -------------------------------------------------------------- -------------------------------------------------------------- > Toolchain bootstrap completed on Tue Apr 28 09:59:35 PDT 2020 -------------------------------------------------------------- >> amd64 started on Tue Apr 28 09:59:35 PDT 2020 >> amd64.amd64 buildworld started on Tue Apr 28 09:59:35 PDT 2020 >> amd64.amd64 buildworld completed on Tue Apr 28 15:28:31 PDT 2020 make[2]: "/usr/home/john/work/freebsd/clean/Makefile" line 717: "Target architecture for amd64/conf/GENERIC unknown. config(8) likely too old." *** Error code 1 The real fix is we somehow need to build a config binary as a build tool and use that instead of the host config binary. I'm not quite sure where to start on fixing that though. Previously riscv broke this when it bumped the config version for GENERICSF, but I just reverted that bump yesterday, however riscv dying meant you still built most of tinderbox before it dies compared to now. -- John Baldwin From owner-svn-src-head@freebsd.org Tue Apr 28 22:39: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 B5C9B2C7281; Tue, 28 Apr 2020 22:39:46 +0000 (UTC) (envelope-from bdrewery@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) server-signature RSA-PSS (4096 bits) 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 49Bc5t4PsZz4Nhd; Tue, 28 Apr 2020 22:39:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 603581F05E; Tue, 28 Apr 2020 22:39:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 889A419542; Tue, 28 Apr 2020 22:39:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id OhCiv_H_IuRG; Tue, 28 Apr 2020 22:38:45 +0000 (UTC) Subject: Re: svn commit: r360444 - head/sys/conf DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 8530819541 To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202004281609.03SG9PHU013278@repo.freebsd.org> From: Bryan Drewery Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+ rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u IUrMm6UAEQEAAYkBPAQYAQoAJgIbDBYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hL4BQkN PvONAAoJEDXXcbtuRpfPCjcH/ivBsOpdpebpgLizSNU5/X4yWN5Aixsc9VBnQhGKAKnMINJQ VMpA55sD2JSPwloXYM/B3qyPJRS/9cwIuX5LDNKKOZU3Qp+TzleynM15/xea14orWYRGRict YHBM3Cnqp7OD8K6Q1uhs0fTxyJP7PZ/G0+7Corlf1DlHhDt6C2HldRPFvAvAgl6sR9Wzgcb7 rzub2HVtbJgl6YHbgyAG7x9NpXFqzx1JLAMdpt2DIYwoi+oMdRQlBIwNuKjQjCGzuXHandd3 kGvBAsyJpQ+coEep9UzwANaV28cXrFr2R4FSOcR50rBA2Nh/vqUYfpsvBvJlwuKAoV1djVHa ihNeL5E= Organization: FreeBSD Message-ID: Date: Tue, 28 Apr 2020 15:38:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.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.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2020 22:39:46 -0000 On 4/28/2020 3:30 PM, John Baldwin wrote: > On 4/28/20 9:09 AM, Bryan Drewery wrote: >> Author: bdrewery >> Date: Tue Apr 28 16:09:25 2020 >> New Revision: 360444 >> URL: https://svnweb.freebsd.org/changeset/base/360444 >> >> Log: >> Don't try ctfconvert on file without debug info. >> >> This was currently an ignored error but will change to a hard error >> eventually. >> >> Differential Revision: https://reviews.freebsd.org/D24536 > > FYI, this just broke make tinderbox entirely for building head on > older head or stable/12. The issue is that 'make tinderbox' uses > the host's config binary to run 'config -m' against each kernel > config file to determine it's MACHINE_ARCH, and when it gets an error > make tinderbox just dies, e.g.: > >> make tinderbox NO_CLEAN=yes JFLAG=-j2 > -------------------------------------------------------------- >>>> make universe started on Tue Apr 28 09:27:36 PDT 2020 > -------------------------------------------------------------- > -------------------------------------------------------------- >> Toolchain bootstrap started on Tue Apr 28 09:27:36 PDT 2020 > -------------------------------------------------------------- > -------------------------------------------------------------- >> Toolchain bootstrap completed on Tue Apr 28 09:59:35 PDT 2020 > -------------------------------------------------------------- >>> amd64 started on Tue Apr 28 09:59:35 PDT 2020 >>> amd64.amd64 buildworld started on Tue Apr 28 09:59:35 PDT 2020 >>> amd64.amd64 buildworld completed on Tue Apr 28 15:28:31 PDT 2020 > make[2]: "/usr/home/john/work/freebsd/clean/Makefile" line 717: "Target architecture for amd64/conf/GENERIC unknown. config(8) likely too old." > *** Error code 1 > > The real fix is we somehow need to build a config binary as a build > tool and use that instead of the host config binary. I'm not quite > sure where to start on fixing that though. It's already in bootstrap-tools. Ah I see the problem is Makefile. Why isn't this already solved by now? The "universe-toolchain" target should be building it already. Just need to get the PATH right. I'm working on a fix. > > Previously riscv broke this when it bumped the config version for > GENERICSF, but I just reverted that bump yesterday, however riscv > dying meant you still built most of tinderbox before it dies compared > to now. > -- Regards, Bryan Drewery From owner-svn-src-head@freebsd.org Wed Apr 29 02:18:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F35382CB83C; Wed, 29 Apr 2020 02:18:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BhyR5t3zz4ZkJ; Wed, 29 Apr 2020 02:18:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C07AF2E052; Wed, 29 Apr 2020 02:18:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03T2IdZj091900; Wed, 29 Apr 2020 02:18:39 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03T2IdZM091899; Wed, 29 Apr 2020 02:18:39 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004290218.03T2IdZM091899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 29 Apr 2020 02:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360453 - head X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 360453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 02:18:40 -0000 Author: bdrewery Date: Wed Apr 29 02:18:39 2020 New Revision: 360453 URL: https://svnweb.freebsd.org/changeset/base/360453 Log: Use universe-toolchain config(8) This is a temporary hack to aid with config(8) changing in r360443. It will not work for all cases. env PATH is used because universe-toolchain is only built when worlds are built, and then only if clang is needed, so it may not exist. universe-toolchain needs to be expanded to always be built, inspected to remove non-cross-build-safe tools, used for buildworld/buildkernel, and potentially incremental build support. Sponsored by: Dell EMC Modified: head/Makefile Modified: head/Makefile ============================================================================== --- head/Makefile Tue Apr 28 20:34:27 2020 (r360452) +++ head/Makefile Wed Apr 29 02:18:39 2020 (r360453) @@ -711,6 +711,7 @@ KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \ universe_kernconfs: universe_kernels_prologue .PHONY .for kernel in ${KERNCONFS} TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \ + env PATH=${HOST_OBJTOP}/tmp/legacy/bin:${PATH:Q} \ config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \ grep -v WARNING: | cut -f 2 .if empty(TARGET_ARCH_${kernel}) From owner-svn-src-head@freebsd.org Wed Apr 29 08:27: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 AF8DA2AC2D4; Wed, 29 Apr 2020 08:27:42 +0000 (UTC) (envelope-from wigneddoom@yandex.ru) Received: from forward500j.mail.yandex.net (forward500j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::110]) (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 49Bs8F07MJz3Qr7; Wed, 29 Apr 2020 08:27:40 +0000 (UTC) (envelope-from wigneddoom@yandex.ru) Received: from mxback24o.mail.yandex.net (mxback24o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::75]) by forward500j.mail.yandex.net (Yandex) with ESMTP id E5F3711C11D8; Wed, 29 Apr 2020 11:27:36 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback24o.mail.yandex.net (mxback/Yandex) with ESMTP id MtI3WYdPkY-Rak8jC4l; Wed, 29 Apr 2020 11:27:36 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1588148856; bh=zX4FeCt+201HfNRjTWR7nYLiRq3s1ttq9DEGgnuXzDA=; h=References:Date:Message-Id:Subject:In-Reply-To:To:From; b=Gv70QT7Oyt12U4lYxAc/Hl/BZG1Y4EcYtoA5GKslHJdiKovGlZDk95YT3xnCB0bSU AYFXaTcgBXTZrrHyU/1OvtuALXyNWUljdaHG3oIB/Qj/nm2+hNHEcwO3Wzn9cMcKU9 LrrxLQQR9V77meJtT46yO8VAo5ZEyPyYTY1EACMk= Received: by iva1-b50b8ed859e3.qloud-c.yandex.net with HTTP; Wed, 29 Apr 2020 11:27:36 +0300 From: Aleksandr Fedorov To: Eric Joyner , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: <202004272202.03RM2iR2012757@repo.freebsd.org> References: <202004272202.03RM2iR2012757@repo.freebsd.org> Subject: Re: svn commit: r360398 - head/sys/net X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 29 Apr 2020 11:27:36 +0300 Message-Id: <122841588148797@mail.yandex.ru> X-Rspamd-Queue-Id: 49Bs8F07MJz3Qr7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yandex.ru header.s=mail header.b=Gv70QT7O; dmarc=pass (policy=none) header.from=yandex.ru; spf=pass (mx1.freebsd.org: domain of wigneddoom@yandex.ru designates 2a02:6b8:0:801:2::110 as permitted sender) smtp.mailfrom=wigneddoom@yandex.ru X-Spamd-Result: default: False [-2.80 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[yandex.ru:s=mail]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a02:6b8:0::/52]; FREEMAIL_FROM(0.00)[yandex.ru]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[yandex.ru:+]; DMARC_POLICY_ALLOW(-0.50)[yandex.ru,none]; MIME_HTML_ONLY(0.20)[]; IP_SCORE(0.00)[ip: (-9.36), ipnet: 2a02:6b8::/32(-4.77), asn: 13238(-3.85), country: RU(0.01)]; RCVD_IN_DNSWL_LOW(-0.10)[0.1.1.0.0.0.0.0.0.0.0.0.2.0.0.0.1.0.8.0.0.0.0.0.8.b.6.0.2.0.a.2.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[yandex.ru]; ASN(0.00)[asn:13238, ipnet:2a02:6b8::/32, country:RU]; MIME_TRACE(0.00)[0:~]; DWL_DNSWL_NONE(0.00)[yandex.ru.dwl.dnswl.org : 127.0.5.0] MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 08:27:42 -0000 From owner-svn-src-head@freebsd.org Wed Apr 29 11:25: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 8161D2B0989; Wed, 29 Apr 2020 11:25:05 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Bx4x2qFQz459H; Wed, 29 Apr 2020 11:25:05 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BFC04AF0; Wed, 29 Apr 2020 11:25:05 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TBP5rq033202; Wed, 29 Apr 2020 11:25:05 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TBP52c033201; Wed, 29 Apr 2020 11:25:05 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <202004291125.03TBP52c033201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Wed, 29 Apr 2020 11:25:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360458 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 360458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 11:25:05 -0000 Author: bcr (doc committer) Date: Wed Apr 29 11:25:04 2020 New Revision: 360458 URL: https://svnweb.freebsd.org/changeset/base/360458 Log: When copying and pasting the code in the EXAMPLE section, it would result in the following error: "ngctl: send msg: Invalid argument" The reason for this is the missing whitespace to separate the arguments. When adding the whitespace, the example works as intended. Submitted by: lutz_donnerhacke.de Approved by: bcr Differential Revision: https://reviews.freebsd.org/D23773 Modified: head/share/man/man4/ng_bpf.4 Modified: head/share/man/man4/ng_bpf.4 ============================================================================== --- head/share/man/man4/ng_bpf.4 Wed Apr 29 10:57:21 2020 (r360457) +++ head/share/man/man4/ng_bpf.4 Wed Apr 29 11:25:04 2020 (r360458) @@ -35,7 +35,7 @@ .\" $FreeBSD$ .\" $Whistle: ng_bpf.8,v 1.2 1999/12/03 01:57:12 archie Exp $ .\" -.Dd November 13, 2012 +.Dd April 29, 2020 .Dt NG_BPF 4 .Os .Sh NAME @@ -158,7 +158,7 @@ NOTMATCHHOOK="hook3" BPFPROG=$( tcpdump -s 8192 -p -ddd ${PATTERN} | \\ ( read len ; \\ - echo -n "bpf_prog_len=$len" ; \\ + echo -n "bpf_prog_len=$len " ; \\ echo -n "bpf_prog=[" ; \\ while read code jt jf k ; do \\ echo -n " { code=$code jt=$jt jf=$jf k=$k }" ; \\ From owner-svn-src-head@freebsd.org Wed Apr 29 11:46: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 706122B104E; Wed, 29 Apr 2020 11:46:02 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BxY62NTWz46Mr; Wed, 29 Apr 2020 11:46:02 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D05D4F2E; Wed, 29 Apr 2020 11:46:02 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TBk2Ml045490; Wed, 29 Apr 2020 11:46:02 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TBk2JB045489; Wed, 29 Apr 2020 11:46:02 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <202004291146.03TBk2JB045489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Wed, 29 Apr 2020 11:46:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360459 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 360459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 11:46:02 -0000 Author: bcr (doc committer) Date: Wed Apr 29 11:46:01 2020 New Revision: 360459 URL: https://svnweb.freebsd.org/changeset/base/360459 Log: Add HISTORY section to domain(9). Submitted by: gbergling_gmail.com Approved by: bcr Differential Revision: https://reviews.freebsd.org/D24150 Modified: head/share/man/man9/domain.9 Modified: head/share/man/man9/domain.9 ============================================================================== --- head/share/man/man9/domain.9 Wed Apr 29 11:25:04 2020 (r360458) +++ head/share/man/man9/domain.9 Wed Apr 29 11:46:01 2020 (r360459) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 1, 2016 +.Dd April 29, 2020 .Dt DOMAIN 9 .Os .Sh NAME @@ -236,6 +236,18 @@ the default protocol may be returned for types if the domain has a default raw protocol. .Sh SEE ALSO .Xr socket 2 +.Sh HISTORY +The functions +.Fn domain_add , +.Fn pfctlinput , +.Fn pfctlinput2 , +.Fn pffinddomain , +.Fn pffindproto , +.Fn pffindtype +and +.Fn DOMAIN_SET +first appeared in +.Fx 4.4 . .Sh AUTHORS This manual page was written by .An Chad David Aq Mt davidc@acns.ab.ca . From owner-svn-src-head@freebsd.org Wed Apr 29 13:41: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 8598B2B4CA3; Wed, 29 Apr 2020 13:41:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C06P2k9Yz4DMt; Wed, 29 Apr 2020 13:41:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58A0C655A; Wed, 29 Apr 2020 13:41:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TDfXo0019046; Wed, 29 Apr 2020 13:41:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TDfWV4019044; Wed, 29 Apr 2020 13:41:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202004291341.03TDfWV4019044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Apr 2020 13:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360460 - head/lib/liblua X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/lib/liblua X-SVN-Commit-Revision: 360460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 13:41:33 -0000 Author: emaste Date: Wed Apr 29 13:41:32 2020 New Revision: 360460 URL: https://svnweb.freebsd.org/changeset/base/360460 Log: liblua: ensure that "require" will fail in bootstrap flua We do not want to support bootstrapping lua modules, so ensure that require will fail by providing a nonexistent path. Reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24610 Modified: head/lib/liblua/Makefile head/lib/liblua/luaconf.h Modified: head/lib/liblua/Makefile ============================================================================== --- head/lib/liblua/Makefile Wed Apr 29 11:46:01 2020 (r360459) +++ head/lib/liblua/Makefile Wed Apr 29 13:41:32 2020 (r360460) @@ -26,4 +26,9 @@ SRCS+= lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldbli CFLAGS+= -I${.CURDIR} -I${.CURDIR}/modules -I${LUASRC} CFLAGS+= -DLUA_PROGNAME="\"${PROG}\"" +.if defined(BOOTSTRAPPING) +CFLAGS+= -DLUA_PATH_DEFAULT="\"/nonexistent/?.lua\"" +CFLAGS+= -DLUA_CPATH_DEFAULT="\"/nonexistent/?.so\"" +.endif + .include Modified: head/lib/liblua/luaconf.h ============================================================================== --- head/lib/liblua/luaconf.h Wed Apr 29 11:46:01 2020 (r360459) +++ head/lib/liblua/luaconf.h Wed Apr 29 13:41:32 2020 (r360460) @@ -208,12 +208,16 @@ #define LUA_ROOT "/usr/local/" #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ "./?.lua;" "./?/init.lua" +#endif +#if !defined(LUA_CPATH_DEFAULT) #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" +#endif #endif /* } */ From owner-svn-src-head@freebsd.org Wed Apr 29 13:43: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 D361A2B4D9A; Wed, 29 Apr 2020 13:43:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C08M5H1Rz4DbS; Wed, 29 Apr 2020 13:43:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B060C65C2; Wed, 29 Apr 2020 13:43:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TDhFka019157; Wed, 29 Apr 2020 13:43:15 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TDhFfN019156; Wed, 29 Apr 2020 13:43:15 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291343.03TDhFfN019156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 13:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360461 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 360461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 13:43:15 -0000 Author: mmel Date: Wed Apr 29 13:43:15 2020 New Revision: 360461 URL: https://svnweb.freebsd.org/changeset/base/360461 Log: Multiple fixes for rockchip iodomain driver: - always initialize selector of voltage signaling standard. Various versions of U-boot leaves voltage signaling standard settings for PMUIO2 domain in different state. Always initialize it into expected state. - start the driver as early as possible, the IO domains should be initialized before other drivers are attached. - rename RK3399 register to its name founds in TRM. This is the second part of fixes for serial port corruption observed after DT 5.6 import. Reviewed by: manu MFC after: 1 week Modified: head/sys/arm64/rockchip/rk_iodomain.c Modified: head/sys/arm64/rockchip/rk_iodomain.c ============================================================================== --- head/sys/arm64/rockchip/rk_iodomain.c Wed Apr 29 13:41:32 2020 (r360460) +++ head/sys/arm64/rockchip/rk_iodomain.c Wed Apr 29 13:43:15 2020 (r360461) @@ -45,17 +45,20 @@ __FBSDID("$FreeBSD$"); #define RK3288_GRF_IO_VSEL 0x380 #define RK3399_GRF_IO_VSEL 0xe640 -#define RK3399_PMUGRF_IO_VSEL 0x180 +#define RK3399_PMUGRF_SOC_CON0 0x180 struct rk_iodomain_supply { char *name; uint32_t bit; }; +struct rk_iodomain_softc; + struct rk_iodomain_conf { struct rk_iodomain_supply *supply; int nsupply; uint32_t grf_reg; + void (*init)(struct rk_iodomain_softc *sc); }; struct rk_iodomain_softc { @@ -101,10 +104,12 @@ static struct rk_iodomain_supply rk3399_pmu_supply[] = {"pmu1830-supply", 9}, }; +static void rk3399_pmu_init(struct rk_iodomain_softc *sc); static struct rk_iodomain_conf rk3399_pmu_conf = { .supply = rk3399_pmu_supply, .nsupply = nitems(rk3399_pmu_supply), - .grf_reg = RK3399_PMUGRF_IO_VSEL, + .grf_reg = RK3399_PMUGRF_SOC_CON0, + .init = rk3399_pmu_init, }; static struct ofw_compat_data compat_data[] = { @@ -115,6 +120,14 @@ static struct ofw_compat_data compat_data[] = { }; static void +rk3399_pmu_init(struct rk_iodomain_softc *sc) +{ + + SYSCON_WRITE_4(sc->grf, RK3399_PMUGRF_SOC_CON0, + (1 << 8) | (1 << (8 + 16))); /* set pmu1830_volsel */ +} + +static void rk_iodomain_set(struct rk_iodomain_softc *sc) { regulator_t supply; @@ -141,6 +154,8 @@ rk_iodomain_set(struct rk_iodomain_softc *sc) } SYSCON_WRITE_4(sc->grf, sc->conf->grf_reg, reg | mask); + if (sc->conf->init != NULL) + sc->conf->init(sc); } static int @@ -204,4 +219,4 @@ static driver_t rk_iodomain_driver = { static devclass_t rk_iodomain_devclass; EARLY_DRIVER_MODULE(rk_iodomain, simplebus, rk_iodomain_driver, - rk_iodomain_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); + rk_iodomain_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); From owner-svn-src-head@freebsd.org Wed Apr 29 13:45: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 B32AD2B4EEF; Wed, 29 Apr 2020 13:45:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C0Bn4J9zz4DmR; Wed, 29 Apr 2020 13:45:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EC4D65C9; Wed, 29 Apr 2020 13:45:21 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TDjLWJ019339; Wed, 29 Apr 2020 13:45:21 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TDjLwQ019338; Wed, 29 Apr 2020 13:45:21 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291345.03TDjLwQ019338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 13:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360462 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 360462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 13:45:21 -0000 Author: mmel Date: Wed Apr 29 13:45:21 2020 New Revision: 360462 URL: https://svnweb.freebsd.org/changeset/base/360462 Log: Don't try to re-initialize already preseted regulator. Don't set initial voltage for regulators having their voltage already in allowed range. As side effect of this change, we don't try to set initial voltage for fixed voltage regulators - these don't have impemented voltage set method so their initialization has always failed. MFC after: 3 weeks Modified: head/sys/arm64/rockchip/rk805.c Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Wed Apr 29 13:43:15 2020 (r360461) +++ head/sys/arm64/rockchip/rk805.c Wed Apr 29 13:45:21 2020 (r360462) @@ -105,6 +105,7 @@ struct rk805_softc { static int rk805_regnode_status(struct regnode *regnode, int *status); static int rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay); +static int rk805_regnode_get_voltage(struct regnode *regnode, int *uvolt); static struct rk805_regdef rk805_regdefs[] = { { @@ -366,13 +367,21 @@ rk805_regnode_init(struct regnode *regnode) { struct rk805_reg_sc *sc; struct regnode_std_param *param; - int rv, udelay, status; + int rv, udelay, uvolt, status; sc = regnode_get_softc(regnode); + dprintf(sc, "Regulator %s init called\n", sc->def->name); param = regnode_get_stdparam(regnode); if (param->min_uvolt == 0) return (0); + /* Check that the regulator is preset to the correct voltage */ + rv = rk805_regnode_get_voltage(regnode, &uvolt); + if (rv != 0) + return(rv); + + if (uvolt >= param->min_uvolt && uvolt <= param->max_uvolt) + return(0); /* * Set the regulator at the correct voltage if it is not enabled. * Do not enable it, this is will be done either by a From owner-svn-src-head@freebsd.org Wed Apr 29 14:06: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 F047F2B59B4; Wed, 29 Apr 2020 14:06:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C0gQ683dz4G0D; Wed, 29 Apr 2020 14:06:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE35569C1; Wed, 29 Apr 2020 14:06:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TE6gpG031339; Wed, 29 Apr 2020 14:06:42 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TE6g1c031338; Wed, 29 Apr 2020 14:06:42 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291406.03TE6g1c031338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 14:06:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360463 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 360463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 14:06:43 -0000 Author: mmel Date: Wed Apr 29 14:06:42 2020 New Revision: 360463 URL: https://svnweb.freebsd.org/changeset/base/360463 Log: Don't allow to use FPU inside of rtld library. Clang10 may use FPU instructions for optimizing operations with memory blocks. But we don't want to do lengthy save/restore of all FPU registers across each rtld_start() call. MFC after: 3 week Modified: head/libexec/rtld-elf/Makefile Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Wed Apr 29 13:45:21 2020 (r360462) +++ head/libexec/rtld-elf/Makefile Wed Apr 29 14:06:42 2020 (r360463) @@ -48,6 +48,9 @@ MLINKS?= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 CFLAGS+= -fpic -DPIC $(DEBUG) +CFLAGS.armv6+= -mfpu=none +CFLAGS.armv7+= -mfpu=none + LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} # Pull in the dependencies that we use from libc .include "rtld-libc/Makefile.inc" From owner-svn-src-head@freebsd.org Wed Apr 29 14:14: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 B8A5E2B5C48; Wed, 29 Apr 2020 14:14:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C0r74T34z4GTM; Wed, 29 Apr 2020 14:14:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94B346B93; Wed, 29 Apr 2020 14:14:15 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TEEF9l038052; Wed, 29 Apr 2020 14:14:15 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TEEFnl038051; Wed, 29 Apr 2020 14:14:15 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291414.03TEEFnl038051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 14:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360464 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 14:14:15 -0000 Author: mmel Date: Wed Apr 29 14:14:15 2020 New Revision: 360464 URL: https://svnweb.freebsd.org/changeset/base/360464 Log: Don't try to set frequendcy for enumerated but newer started CPUs. Openfirmare enumerates and installs the driver for all processors, regardless of whether they will be started later (because of power constrains for example). MFC after: 3 weeks Modified: head/sys/kern/kern_cpu.c Modified: head/sys/kern/kern_cpu.c ============================================================================== --- head/sys/kern/kern_cpu.c Wed Apr 29 14:06:42 2020 (r360463) +++ head/sys/kern/kern_cpu.c Wed Apr 29 14:14:15 2020 (r360464) @@ -325,6 +325,12 @@ cf_set_method(device_t dev, const struct cf_level *lev /* Bind to the target CPU before switching. */ pc = cpu_get_pcpu(set->dev); + + /* Skip settings if CPU is not started. */ + if (pc == NULL) { + error = 0; + goto out; + } thread_lock(curthread); pri = curthread->td_priority; sched_prio(curthread, PRI_MIN); From owner-svn-src-head@freebsd.org Wed Apr 29 14:15: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 2B9582B5CF1; Wed, 29 Apr 2020 14:15:22 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C0sQ0Mf2z4Gc5; Wed, 29 Apr 2020 14:15:22 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 07D156B95; Wed, 29 Apr 2020 14:15:22 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TEFLWx038162; Wed, 29 Apr 2020 14:15:21 GMT (envelope-from olivier@FreeBSD.org) Received: (from olivier@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TEFLYU038161; Wed, 29 Apr 2020 14:15:21 GMT (envelope-from olivier@FreeBSD.org) Message-Id: <202004291415.03TEFLYU038161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: olivier set sender to olivier@FreeBSD.org using -f From: Olivier Cochard Date: Wed, 29 Apr 2020 14:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360465 - head/sbin/bectl/tests X-SVN-Group: head X-SVN-Commit-Author: olivier X-SVN-Commit-Paths: head/sbin/bectl/tests X-SVN-Commit-Revision: 360465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 14:15:22 -0000 Author: olivier (ports committer) Date: Wed Apr 29 14:15:21 2020 New Revision: 360465 URL: https://svnweb.freebsd.org/changeset/base/360465 Log: Skip bectl jail test if jail not installed (WITHOUT_JAIL). Approved by: kevans Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D24613 Modified: head/sbin/bectl/tests/bectl_test.sh Modified: head/sbin/bectl/tests/bectl_test.sh ============================================================================== --- head/sbin/bectl/tests/bectl_test.sh Wed Apr 29 14:14:15 2020 (r360464) +++ head/sbin/bectl/tests/bectl_test.sh Wed Apr 29 14:15:21 2020 (r360465) @@ -343,6 +343,7 @@ bectl_jail_head() atf_set "descr" "Check bectl rename" atf_set "require.user" root + atf_set "require.progs" jail } bectl_jail_body() { From owner-svn-src-head@freebsd.org Wed Apr 29 14:31:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EC782B631A; Wed, 29 Apr 2020 14:31:26 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C1Cy02kfz4HP8; Wed, 29 Apr 2020 14:31:26 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0C006E1D; Wed, 29 Apr 2020 14:31:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TEVPeg046978; Wed, 29 Apr 2020 14:31:25 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TEVPgr046976; Wed, 29 Apr 2020 14:31:25 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291431.03TEVPgr046976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 14:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360466 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 360466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 14:31:26 -0000 Author: mmel Date: Wed Apr 29 14:31:25 2020 New Revision: 360466 URL: https://svnweb.freebsd.org/changeset/base/360466 Log: Export tracing facility of GIC500 ITS block. Possibility of tracing of processing message based interrupts is very useful for debugging of PCIe driver, mainly for its MSI part. MFC after: 1 week Modified: head/sys/arm64/arm64/gic_v3_reg.h head/sys/arm64/arm64/gicv3_its.c Modified: head/sys/arm64/arm64/gic_v3_reg.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_reg.h Wed Apr 29 14:15:21 2020 (r360465) +++ head/sys/arm64/arm64/gic_v3_reg.h Wed Apr 29 14:31:25 2020 (r360466) @@ -220,6 +220,8 @@ (rev) << GITS_IIDR_REVISION_SHIFT | \ (impl) << GITS_IIDR_IMPLEMENTOR_SHIFT) +#define GITS_IIDR_IMPL_ARM (0x43B) +#define GITS_IIDR_PROD_GIC500 (0x0) #define GITS_IIDR_IMPL_CAVIUM (0x34c) #define GITS_IIDR_PROD_THUNDER (0xa1) #define GITS_IIDR_VAR_THUNDER_1 (0x0) @@ -359,6 +361,18 @@ #define LPI_CONF_PRIO_MASK (0xFC) #define LPI_CONF_GROUP1 (1 << 1) #define LPI_CONF_ENABLE (1 << 0) + +/* + * GIC 500 ITS tracking facility + */ +#define GITS_TRKCTLR 0xC000 +#define GITS_TRKR 0xC004 +#define GITS_TRKDIDR 0xC008 +#define GITS_TRKPIDR 0xC00C +#define GITS_TRKVIDR 0xC010 +#define GITS_TRKTGTR 0xC014 +#define GITS_TRKICR 0xC018 +#define GITS_TRKLCR 0xC018 /* * CPU interface Modified: head/sys/arm64/arm64/gicv3_its.c ============================================================================== --- head/sys/arm64/arm64/gicv3_its.c Wed Apr 29 14:15:21 2020 (r360465) +++ head/sys/arm64/arm64/gicv3_its.c Wed Apr 29 14:31:25 2020 (r360466) @@ -49,7 +49,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include @@ -229,6 +231,7 @@ struct gicv3_its_irqsrc { }; struct gicv3_its_softc { + device_t dev; struct intr_pic *sc_pic; struct resource *sc_its_res; @@ -262,6 +265,7 @@ struct gicv3_its_softc { #define ITS_FLAGS_LPI_CONF_FLUSH 0x00000002 #define ITS_FLAGS_ERRATA_CAVIUM_22375 0x00000004 u_int sc_its_flags; + bool trace_enable; }; static void *conf_base; @@ -713,6 +717,86 @@ its_init_cpu(device_t dev, struct gicv3_its_softc *sc) } static int +gicv3_its_sysctl_trace_enable(SYSCTL_HANDLER_ARGS) +{ + struct gicv3_its_softc *sc; + int rv; + + sc = arg1; + + rv = sysctl_handle_bool(oidp, &sc->trace_enable, 0, req); + if (rv != 0 || req->newptr == NULL) + return (rv); + if (sc->trace_enable) + gic_its_write_8(sc, GITS_TRKCTLR, 3); + else + gic_its_write_8(sc, GITS_TRKCTLR, 0); + + return (0); +} + +static int +gicv3_its_sysctl_trace_regs(SYSCTL_HANDLER_ARGS) +{ + struct gicv3_its_softc *sc; + struct sbuf *sb; + int err; + + sc = arg1; + sb = sbuf_new_for_sysctl(NULL, NULL, 128, req); + if (sb == NULL) { + device_printf(sc->dev, "Could not allocate sbuf for output.\n"); + return (ENOMEM); + } + sbuf_cat(sb, "\n"); + sbuf_printf(sb, "GITS_TRKCTLR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKCTLR)); + sbuf_printf(sb, "GITS_TRKR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKR)); + sbuf_printf(sb, "GITS_TRKDIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKDIDR)); + sbuf_printf(sb, "GITS_TRKPIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKPIDR)); + sbuf_printf(sb, "GITS_TRKVIDR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKVIDR)); + sbuf_printf(sb, "GITS_TRKTGTR: 0x%08X\n", + gic_its_read_4(sc, GITS_TRKTGTR)); + + err = sbuf_finish(sb); + if (err) + device_printf(sc->dev, "Error finishing sbuf: %d\n", err); + sbuf_delete(sb); + return(err); +} + +static int +gicv3_its_init_sysctl(struct gicv3_its_softc *sc) +{ + struct sysctl_oid *oid, *child; + struct sysctl_ctx_list *ctx_list; + + ctx_list = device_get_sysctl_ctx(sc->dev); + child = device_get_sysctl_tree(sc->dev); + oid = SYSCTL_ADD_NODE(ctx_list, + SYSCTL_CHILDREN(child), OID_AUTO, "tracing", + CTLFLAG_RD| CTLFLAG_MPSAFE, NULL, "Messages tracing"); + if (oid == NULL) + return (ENXIO); + + /* Add registers */ + SYSCTL_ADD_PROC(ctx_list, + SYSCTL_CHILDREN(oid), OID_AUTO, "enable", + CTLTYPE_U8 | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + gicv3_its_sysctl_trace_enable, "CU", "Enable tracing"); + SYSCTL_ADD_PROC(ctx_list, + SYSCTL_CHILDREN(oid), OID_AUTO, "capture", + CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + gicv3_its_sysctl_trace_regs, "", "Captured tracing registers."); + + return (0); +} + +static int gicv3_its_attach(device_t dev) { struct gicv3_its_softc *sc; @@ -811,6 +895,11 @@ gicv3_its_attach(device_t dev) "%s,%u", name, i); } + /* For GIC-500 install tracking sysctls. */ + if ((iidr & (GITS_IIDR_PRODUCT_MASK | GITS_IIDR_IMPLEMENTOR_MASK)) == + GITS_IIDR_RAW(GITS_IIDR_IMPL_ARM, GITS_IIDR_PROD_GIC500, 0, 0)) + gicv3_its_init_sysctl(sc); + return (0); } @@ -1717,6 +1806,7 @@ gicv3_its_fdt_attach(device_t dev) int err; sc = device_get_softc(dev); + sc->dev = dev; err = gicv3_its_attach(dev); if (err != 0) return (err); @@ -1778,6 +1868,7 @@ gicv3_its_acpi_attach(device_t dev) int err; sc = device_get_softc(dev); + sc->dev = dev; err = gicv3_its_attach(dev); if (err != 0) return (err); From owner-svn-src-head@freebsd.org Wed Apr 29 14:36: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 6FAD32B658E; Wed, 29 Apr 2020 14:36:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C1LC2QcMz4HnY; Wed, 29 Apr 2020 14:36:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E8FD6FA4; Wed, 29 Apr 2020 14:36:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TEapCn050861; Wed, 29 Apr 2020 14:36:51 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TEaoZl050859; Wed, 29 Apr 2020 14:36:50 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291436.03TEaoZl050859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 14:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360467 - head/sys/dev/dwc X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/dwc X-SVN-Commit-Revision: 360467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 14:36:51 -0000 Author: mmel Date: Wed Apr 29 14:36:50 2020 New Revision: 360467 URL: https://svnweb.freebsd.org/changeset/base/360467 Log: Fix style(9). Strip write only variables. Not a functional change. MFC after: 1 week Modified: head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwcvar.h Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Wed Apr 29 14:31:25 2020 (r360466) +++ head/sys/dev/dwc/if_dwc.c Wed Apr 29 14:36:50 2020 (r360467) @@ -252,14 +252,13 @@ dwc_txstart_locked(struct dwc_softc *sc) ifp = sc->ifp; - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) return; - } enqueued = 0; for (;;) { - if (sc->txcount == (TX_DESC_COUNT-1)) { + if (sc->txcount == (TX_DESC_COUNT - 1)) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -268,7 +267,7 @@ dwc_txstart_locked(struct dwc_softc *sc) if (m == NULL) break; if (dwc_setup_txbuf(sc, sc->tx_idx_head, &m) != 0) { - IFQ_DRV_PREPEND(&ifp->if_snd, m); + IFQ_DRV_PREPEND(&ifp->if_snd, m); break; } BPF_MTAP(ifp, m); @@ -469,7 +468,7 @@ dwc_setup_rxdesc(struct dwc_softc *sc, int idx, bus_ad sc->rxdesc_ring[idx].addr = (uint32_t)paddr; nidx = next_rxidx(sc, idx); - sc->rxdesc_ring[idx].addr_next = sc->rxdesc_ring_paddr + \ + sc->rxdesc_ring[idx].addr_next = sc->rxdesc_ring_paddr + (nidx * sizeof(struct dwc_hwdesc)); if (sc->mactype == DWC_GMAC_ALT_DESC) sc->rxdesc_ring[idx].tdes1 = DDESC_CNTL_CHAINED | RX_MAX_PACKET; @@ -493,9 +492,8 @@ dwc_setup_rxbuf(struct dwc_softc *sc, int idx, struct error = bus_dmamap_load_mbuf_sg(sc->rxbuf_tag, sc->rxbuf_map[idx].map, m, &seg, &nsegs, 0); - if (error != 0) { + if (error != 0) return (error); - } KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); @@ -1167,10 +1165,6 @@ dwc_attach(device_t dev) device_printf(dev, "could not allocate resources\n"); return (ENXIO); } - - /* Memory interface */ - sc->bst = rman_get_bustag(sc->res[0]); - sc->bsh = rman_get_bushandle(sc->res[0]); /* Read MAC before reset */ if (dwc_get_hwaddr(sc, macaddr)) { Modified: head/sys/dev/dwc/if_dwcvar.h ============================================================================== --- head/sys/dev/dwc/if_dwcvar.h Wed Apr 29 14:31:25 2020 (r360466) +++ head/sys/dev/dwc/if_dwcvar.h Wed Apr 29 14:36:50 2020 (r360467) @@ -57,8 +57,6 @@ struct dwc_bufmap { struct dwc_softc { struct resource *res[2]; - bus_space_tag_t bst; - bus_space_handle_t bsh; device_t dev; int mactype; int mii_clk; From owner-svn-src-head@freebsd.org Wed Apr 29 14:47: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 340EB2B7256; Wed, 29 Apr 2020 14:47:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C1ZJ0ZgNz4Jpx; Wed, 29 Apr 2020 14:47:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-164.local (unknown [IPv6:2601:648:8203:2990:ed41:5f4c:f27e:76f5]) (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 98B07D360; Wed, 29 Apr 2020 14:47:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r360453 - head To: Bryan Drewery , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202004290218.03T2IdZM091899@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: Date: Wed, 29 Apr 2020 07:47:18 -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: <202004290218.03T2IdZM091899@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 14:47:20 -0000 On 4/28/20 7:18 PM, Bryan Drewery wrote: > Author: bdrewery > Date: Wed Apr 29 02:18:39 2020 > New Revision: 360453 > URL: https://svnweb.freebsd.org/changeset/base/360453 > > Log: > Use universe-toolchain config(8) > > This is a temporary hack to aid with config(8) changing in r360443. > It will not work for all cases. > > env PATH is used because universe-toolchain is only built when worlds > are built, and then only if clang is needed, so it may not exist. > > universe-toolchain needs to be expanded to always be built, inspected to > remove non-cross-build-safe tools, used for buildworld/buildkernel, > and potentially incremental build support. > > Sponsored by: Dell EMC Thanks for the quick fix! -- John Baldwin From owner-svn-src-head@freebsd.org Wed Apr 29 15:20: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 891142B8238; Wed, 29 Apr 2020 15:20:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49C2Jt1yGcz4M29; Wed, 29 Apr 2020 15:20:46 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id 03TFKU3L016674 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 29 Apr 2020 18:20:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 03TFKU3L016674 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id 03TFKU28016673; Wed, 29 Apr 2020 18:20:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 29 Apr 2020 18:20:30 +0300 From: Konstantin Belousov To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r360463 - head/libexec/rtld-elf Message-ID: <20200429152030.GB2522@kib.kiev.ua> References: <202004291406.03TE6g1c031338@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202004291406.03TE6g1c031338@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: 49C2Jt1yGcz4M29 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 15:20:46 -0000 On Wed, Apr 29, 2020 at 02:06:42PM +0000, Michal Meloun wrote: > Author: mmel > Date: Wed Apr 29 14:06:42 2020 > New Revision: 360463 > URL: https://svnweb.freebsd.org/changeset/base/360463 > > Log: > Don't allow to use FPU inside of rtld library. > Clang10 may use FPU instructions for optimizing operations with > memory blocks. But we don't want to do lengthy save/restore of all > FPU registers across each rtld_start() call. > > MFC after: 3 week > > Modified: > head/libexec/rtld-elf/Makefile > > Modified: head/libexec/rtld-elf/Makefile > ============================================================================== > --- head/libexec/rtld-elf/Makefile Wed Apr 29 13:45:21 2020 (r360462) > +++ head/libexec/rtld-elf/Makefile Wed Apr 29 14:06:42 2020 (r360463) > @@ -48,6 +48,9 @@ MLINKS?= rtld.1 ld-elf.so.1.1 \ > rtld.1 ld.so.1 > > CFLAGS+= -fpic -DPIC $(DEBUG) > +CFLAGS.armv6+= -mfpu=none > +CFLAGS.armv7+= -mfpu=none I cleaned rtld-elf/Makefile of all MD bits, please move this to arm/Makefile.inc. > + > LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} > # Pull in the dependencies that we use from libc > .include "rtld-libc/Makefile.inc" From owner-svn-src-head@freebsd.org Wed Apr 29 16:05: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 454362BA474; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C3Jv0k5Pz4SdS; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1403781D1; Wed, 29 Apr 2020 16:05:51 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TG5oEc011214; Wed, 29 Apr 2020 16:05:50 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TG5oxN011201; Wed, 29 Apr 2020 16:05:50 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202004291605.03TG5oxN011201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 29 Apr 2020 16:05:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360469 - in head/libexec/rtld-elf: . arm X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/libexec/rtld-elf: . arm X-SVN-Commit-Revision: 360469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 16:05:51 -0000 Author: mmel Date: Wed Apr 29 16:05:50 2020 New Revision: 360469 URL: https://svnweb.freebsd.org/changeset/base/360469 Log: Move ARM specific flags to arm/Makefile.inc Requested by: kib MFC with: r360463 Modified: head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/arm/Makefile.inc Modified: head/libexec/rtld-elf/Makefile ============================================================================== --- head/libexec/rtld-elf/Makefile Wed Apr 29 16:04:59 2020 (r360468) +++ head/libexec/rtld-elf/Makefile Wed Apr 29 16:05:50 2020 (r360469) @@ -48,9 +48,7 @@ MLINKS?= rtld.1 ld-elf.so.1.1 \ rtld.1 ld.so.1 CFLAGS+= -fpic -DPIC $(DEBUG) -CFLAGS.armv6+= -mfpu=none -CFLAGS.armv7+= -mfpu=none - + LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} # Pull in the dependencies that we use from libc .include "rtld-libc/Makefile.inc" Modified: head/libexec/rtld-elf/arm/Makefile.inc ============================================================================== --- head/libexec/rtld-elf/arm/Makefile.inc Wed Apr 29 16:04:59 2020 (r360468) +++ head/libexec/rtld-elf/arm/Makefile.inc Wed Apr 29 16:05:50 2020 (r360469) @@ -5,3 +5,4 @@ # correctly linked. As some of the functions are used before we have # shared libraries. LIBADD+= compiler_rt +CFLAGS+= -mfpu=none From owner-svn-src-head@freebsd.org Wed Apr 29 16:19: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 9F9402BA8C9; Wed, 29 Apr 2020 16:19:14 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C3cK5xBrz4TNl; Wed, 29 Apr 2020 16:19:13 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wr1-x441.google.com with SMTP id x18so3277217wrq.2; Wed, 29 Apr 2020 09:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:reply-to:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pwsqVopy8MV9a7r+fbaj0LnmP4A5NJ3Cp+flWmeuY3k=; b=XIVxuH4LuVoGM9DMHGu9esG42b/qdVyFHtasVS0p+c7hHgMH0MQ7AHw8obXW9uzYnZ Q0TQQjSVwQnSSnRzN6S3OhKcFmYZlVBHg4RZyCVAzN7TVnhOIEAVzykMJZb0Ky64Uyd+ 39zVnQFhlWkinmC8wo9616it5jnaVRDf7MqnyhshppD4rvlmf3vPE2F9nbi2DWJnTDdn YE/wg1nJpRXs0YlXcQIrSnE+VmnTSUZpGoomzuiAoL0GH7qNxuQ4ZsLLPl4kISmvwMHx M7AFEUfyW81IVZTzHXZMLfIE5XUkOSKeB7YxeE+yAKECNBEDTo+xr3gWEP+LRrGiXoL8 /ZdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=pwsqVopy8MV9a7r+fbaj0LnmP4A5NJ3Cp+flWmeuY3k=; b=CBuvbkj/7acqLxUhe/AMLkVM/wwNYIWaFuGBq+q3+9BpAb3OEe3xL4bSNHFv5Rp2g+ pkUvKv2ophgTT5rM74bsiigi/OLga00He0KTwYtvEhzZJlWF8Viz28ZOkFLIMLKSD3Vb XRRoaEisN3f9yMlyYZltzdsvlyJcHLqxTUsCq+mFwbtOry/1PtNZmUmWmA5UH2HxNA5+ 1ftwoAtSgaaJ/Le5o9NSqHKN4nLbGf6juVXK0ZZ5CQ8u4LgeyepvX8xuodcDIIJ4TH4D 9MxCVxvLnAifmF1Tg3FWrhMxdioIdAfhUZKRmyEONanzY4uJbEpIOzQkDXT4SjVO+LvD usaQ== X-Gm-Message-State: AGi0PuZIqd3fkG+Dwf3Mq0vbTco1ZARL4z1EDf7CKteyqMAx+3kkds0j Y1gozMG6kXwHaQc1HZLL6389OhX1 X-Google-Smtp-Source: APiQypJEDOIdejT9A582LOEE3fZJ4mlDahhSkgMCZ7cIE40QwJF/2acfEKvOXvEKeyvrGQ7UCyaTsg== X-Received: by 2002:a5d:5651:: with SMTP id j17mr39117436wrw.406.1588177152075; Wed, 29 Apr 2020 09:19:12 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id d13sm8292585wmb.39.2020.04.29.09.19.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Apr 2020 09:19:11 -0700 (PDT) Sender: Michal Meloun From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r360463 - head/libexec/rtld-elf To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202004291406.03TE6g1c031338@repo.freebsd.org> <20200429152030.GB2522@kib.kiev.ua> Message-ID: <254296a0-dfde-e562-fc45-d819c41f75ca@freebsd.org> Date: Wed, 29 Apr 2020 18:19:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200429152030.GB2522@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49C3cK5xBrz4TNl X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=XIVxuH4L; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of melounmichal@gmail.com designates 2a00:1450:4864:20::441 as permitted sender) smtp.mailfrom=melounmichal@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[mmel@freebsd.org]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (2.36), ipnet: 2a00:1450::/32(-2.32), asn: 15169(-0.43), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[1.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 16:19:14 -0000 On 29.04.2020 17:20, Konstantin Belousov wrote: > On Wed, Apr 29, 2020 at 02:06:42PM +0000, Michal Meloun wrote: >> Author: mmel >> Date: Wed Apr 29 14:06:42 2020 >> New Revision: 360463 >> URL: https://svnweb.freebsd.org/changeset/base/360463 >> >> Log: >> Don't allow to use FPU inside of rtld library. >> Clang10 may use FPU instructions for optimizing operations with >> memory blocks. But we don't want to do lengthy save/restore of all >> FPU registers across each rtld_start() call. >> >> MFC after: 3 week >> >> Modified: >> head/libexec/rtld-elf/Makefile >> >> Modified: head/libexec/rtld-elf/Makefile >> ============================================================================== >> --- head/libexec/rtld-elf/Makefile Wed Apr 29 13:45:21 2020 (r360462) >> +++ head/libexec/rtld-elf/Makefile Wed Apr 29 14:06:42 2020 (r360463) >> @@ -48,6 +48,9 @@ MLINKS?= rtld.1 ld-elf.so.1.1 \ >> rtld.1 ld.so.1 >> >> CFLAGS+= -fpic -DPIC $(DEBUG) >> +CFLAGS.armv6+= -mfpu=none >> +CFLAGS.armv7+= -mfpu=none > I cleaned rtld-elf/Makefile of all MD bits, please move this to > arm/Makefile.inc. > Done in r360469. arm/Makefile.inc is, of course, much better place for these flags. Thanks for pointing me me on this. Michal >> + >> LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY} >> # Pull in the dependencies that we use from libc >> .include "rtld-libc/Makefile.inc" From owner-svn-src-head@freebsd.org Wed Apr 29 18:13: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 23C4C2BDA44 for ; Wed, 29 Apr 2020 18:13:03 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C67f0TY5z4bVv for ; Wed, 29 Apr 2020 18:13:01 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-lf1-f65.google.com with SMTP id u10so2496334lfo.8 for ; Wed, 29 Apr 2020 11:13:01 -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=uknjBQ+QEF7OJWtxRW/xHx0iUtWVOrfr/PBfjgGAIJA=; b=C3bdnnQynFpe9y9RySwNLqBcNcWO92IjJljJglPbcancQCFrC6FtNgxoXzJ+swZNqk DHJdtHSOM3LHNN0UGzFC3nQVknmm2lf9umlPR5Mf3+4W7Ivoi7R9O2ukczHp2yVU5QSv DY7i4s12IQyk1bScr9OXyBvQ5b2NkZhlI2w8XpN8+UL5RXm2QpJ39zalD2h745OhJViR QpIhl4J2nV3u8jhipaDw80mIGUvQt4ZrYkNcCaIie0vGsYm4edsvcktaPBu5CVyZjq0S 8BgfdMulaULE+I4XeKTVo36lLhbMSyJWB1buFmvqvBQrMu59h+NdrVmFTLOoFmuy6Cxb ZNzA== X-Gm-Message-State: AGi0PuZ/M40t1fJECNQRGKsIlmeSccomJkktfFUqH126Clxl2gWz/KsW 3xVIZ/6zgVYmiXt6VK2aHPW02495 X-Google-Smtp-Source: APiQypJ/QWocVXPmwB8DYfJqF3Wnvb2Ml4gWWTSxK1f62xWlYXzSd52JcYDjeNvhJyctJl8QbSFwiQ== X-Received: by 2002:a05:6512:1095:: with SMTP id j21mr23679968lfg.118.1588183979719; Wed, 29 Apr 2020 11:12:59 -0700 (PDT) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id e20sm2924566lja.81.2020.04.29.11.12.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Apr 2020 11:12:58 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id u10so2496249lfo.8 for ; Wed, 29 Apr 2020 11:12:58 -0700 (PDT) X-Received: by 2002:a19:f806:: with SMTP id a6mr23772383lff.201.1588183978317; Wed, 29 Apr 2020 11:12:58 -0700 (PDT) MIME-Version: 1.0 References: <202004272202.03RM2iR2012757@repo.freebsd.org> <122841588148797@mail.yandex.ru> In-Reply-To: <122841588148797@mail.yandex.ru> From: Eric Joyner Date: Wed, 29 Apr 2020 11:12:46 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r360398 - head/sys/net To: Aleksandr Fedorov Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 49C67f0TY5z4bVv X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of ricera10@gmail.com designates 209.85.167.65 as permitted sender) smtp.mailfrom=ricera10@gmail.com X-Spamd-Result: default: False [-0.94 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; URI_COUNT_ODD(1.00)[9]; RCVD_COUNT_THREE(0.00)[4]; FORGED_SENDER(0.30)[erj@freebsd.org,ricera10@gmail.com]; FREEMAIL_TO(0.00)[yandex.ru]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[erj@freebsd.org,ricera10@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.954,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-0.96)[-0.960,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[65.167.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-0.03)[ip: (0.72), ipnet: 209.85.128.0/17(-0.40), asn: 15169(-0.43), country: US(-0.05)]; RWL_MAILSPIKE_POSSIBLE(0.00)[65.167.85.209.rep.mailspike.net : 127.0.0.17]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 18:13:03 -0000 Hi Aleksandr, Part of this patch was to introduce a driver-dependent iflib function that would allow drivers to tell iflib whether or not to flap the interface when a vlan is registered or unregistered. I think this could be fixed for em(4) by having it implement that function to either always return false (so iflib doesn't do an init/stop), or maybe have it only do a reset when vlanhwfilter is enabled; I'm going to take a look at doing that. - Eric On Wed, Apr 29, 2020 at 1:27 AM Aleksandr Fedorov wrote: > Sorry for the late response, but I think that this changes makes Intel > cards with iflib drivers fully unusable. > We already have a regression which leads to an interface flapping > when adding vlan with enabled vlanhwfilter. But at least there is a > workaround - disabling hwfilter. > After this change, the interface will always flap. > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=241785 > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240818 > https://lists.freebsd.org/pipermail/freebsd-net/2018-November/052184.html > > From owner-svn-src-head@freebsd.org Wed Apr 29 19:28: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 2131C2C0218; Wed, 29 Apr 2020 19:28:57 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49C7qF05F5z3D5m; Wed, 29 Apr 2020 19:28:57 +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 F2817A864; Wed, 29 Apr 2020 19:28:56 +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 03TJSuQu036373; Wed, 29 Apr 2020 19:28:56 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TJSua8036371; Wed, 29 Apr 2020 19:28:56 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004291928.03TJSua8036371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Wed, 29 Apr 2020 19:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360475 - in head/sys: net netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet6 X-SVN-Commit-Revision: 360475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 19:28:57 -0000 Author: melifaro Date: Wed Apr 29 19:28:56 2020 New Revision: 360475 URL: https://svnweb.freebsd.org/changeset/base/360475 Log: Add nhop to the ifa_rtrequest() callback. With the upcoming multipath changes described in D24141, rt->rt_nhop can potentially point to a nexthop group instead of an individual nhop. To simplify caller handling of such cases, change ifa_rtrequest() callback to pass changed nhop directly. Differential Revision: https://reviews.freebsd.org/D24604 Modified: head/sys/net/if_var.h head/sys/net/route.c head/sys/netinet6/nd6.c Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Wed Apr 29 18:59:37 2020 (r360474) +++ head/sys/net/if_var.h Wed Apr 29 19:28:56 2020 (r360475) @@ -61,6 +61,7 @@ */ struct rtentry; /* ifa_rtrequest */ +struct nhop_object; /* ifa_rtrequest */ struct rt_addrinfo; /* ifa_rtrequest */ struct socket; struct carp_if; @@ -551,7 +552,8 @@ struct ifaddr { struct carp_softc *ifa_carp; /* pointer to CARP data */ CK_STAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ - (int, struct rtentry *, struct rt_addrinfo *); + (int, struct rtentry *, struct nhop_object *, + struct rt_addrinfo *); u_short ifa_flags; /* mostly rt_flags for cloning */ #define IFA_ROUTE RTF_UP /* route installed */ #define IFA_RTSELF RTF_HOST /* loopback route to self installed */ Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Wed Apr 29 18:59:37 2020 (r360474) +++ head/sys/net/route.c Wed Apr 29 19:28:56 2020 (r360475) @@ -1239,7 +1239,7 @@ rt_notifydelete(struct rtentry *rt, struct rt_addrinfo */ ifa = rt->rt_ifa; if (ifa != NULL && ifa->ifa_rtrequest != NULL) - ifa->ifa_rtrequest(RTM_DELETE, rt, info); + ifa->ifa_rtrequest(RTM_DELETE, rt, rt->rt_nhop, info); /* * One more rtentry floating around that is not @@ -1761,7 +1761,7 @@ add_route(struct rib_head *rnh, struct rt_addrinfo *in * allow it to do that as well. */ if (ifa->ifa_rtrequest) - ifa->ifa_rtrequest(RTM_ADD, rt, info); + ifa->ifa_rtrequest(RTM_ADD, rt, rt->rt_nhop, info); /* * actually return a resultant rtentry and @@ -1886,7 +1886,8 @@ change_route(struct rib_head *rnh, struct rt_addrinfo if (info->rti_ifa != NULL && info->rti_ifa != rt->rt_ifa && rt->rt_ifa != NULL) { if (rt->rt_ifa->ifa_rtrequest != NULL) - rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info); + rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, rt->rt_nhop, + info); ifa_free(rt->rt_ifa); rt->rt_ifa = NULL; } @@ -1910,7 +1911,7 @@ change_route(struct rib_head *rnh, struct rt_addrinfo rt->rt_flags |= info->rti_flags & RTF_FMASK; if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest != NULL) - rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, info); + rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, nh, info); /* Alter route MTU if necessary */ if (rt->rt_ifp != NULL) { Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Wed Apr 29 18:59:37 2020 (r360474) +++ head/sys/netinet6/nd6.c Wed Apr 29 19:28:56 2020 (r360475) @@ -138,7 +138,8 @@ static void nd6_free_redirect(const struct llentry *); static void nd6_llinfo_timer(void *); static void nd6_llinfo_settimer_locked(struct llentry *, long); static void clear_llinfo_pqueue(struct llentry *); -static void nd6_rtrequest(int, struct rtentry *, struct rt_addrinfo *); +static void nd6_rtrequest(int, struct rtentry *, struct nhop_object *, + struct rt_addrinfo *); static int nd6_resolve_slow(struct ifnet *, int, struct mbuf *, const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **); static int nd6_need_cache(struct ifnet *); @@ -1562,13 +1563,12 @@ nd6_free_redirect(const struct llentry *ln) * processing. */ void -nd6_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info) +nd6_rtrequest(int req, struct rtentry *rt, struct nhop_object *nh, + struct rt_addrinfo *info) { struct sockaddr_in6 *gateway; struct nd_defrouter *dr; - struct nhop_object *nh; - nh = rt->rt_nhop; gateway = &nh->gw6_sa; switch (req) { From owner-svn-src-head@freebsd.org Wed Apr 29 21:12: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 06E092C2C05; Wed, 29 Apr 2020 21:12:33 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CB6m6NFfz3Kt4; Wed, 29 Apr 2020 21:12:32 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D63AEBF33; Wed, 29 Apr 2020 21:12:32 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TLCWQB003687; Wed, 29 Apr 2020 21:12:32 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TLCWck003685; Wed, 29 Apr 2020 21:12:32 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202004292112.03TLCWck003685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 29 Apr 2020 21:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360476 - in head/cddl/usr.sbin/dtrace/tests: . tools X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head/cddl/usr.sbin/dtrace/tests: . tools X-SVN-Commit-Revision: 360476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 21:12:33 -0000 Author: bdrewery Date: Wed Apr 29 21:12:32 2020 New Revision: 360476 URL: https://svnweb.freebsd.org/changeset/base/360476 Log: dtrace tests: Support globbing for excludes Downstream this makes skipping tests like common/ip/tst.*sctp*.ksh simpler. Reviewed by: vangyzen, cem, markj Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D24608 Modified: head/cddl/usr.sbin/dtrace/tests/dtrace.test.mk head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Modified: head/cddl/usr.sbin/dtrace/tests/dtrace.test.mk ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/dtrace.test.mk Wed Apr 29 19:28:56 2020 (r360475) +++ head/cddl/usr.sbin/dtrace/tests/dtrace.test.mk Wed Apr 29 21:12:32 2020 (r360476) @@ -1,7 +1,8 @@ # $FreeBSD$ TESTGROUP= ${.CURDIR:H:T}/${.CURDIR:T} -TESTSRC= ${SRCTOP}/cddl/contrib/opensolaris/cmd/dtrace/test/tst/${TESTGROUP} +TESTBASE= ${SRCTOP}/cddl/contrib/opensolaris/cmd/dtrace/test/tst +TESTSRC= ${TESTBASE}/${TESTGROUP} TESTSDIR= ${TESTSBASE}/cddl/usr.sbin/dtrace/${TESTGROUP} FILESGROUPS+= ${TESTGROUP}EXE @@ -18,7 +19,8 @@ TEST_METADATA.t_dtrace_contrib+= required_user="root" GENTEST?= ${.CURDIR:H:H}/tools/gentest.sh EXCLUDE= ${.CURDIR:H:H}/tools/exclude.sh ${TESTWRAPPER}.sh: ${GENTEST} ${EXCLUDE} ${${PACKAGE}FILES} - sh ${GENTEST} -e ${EXCLUDE} ${TESTGROUP} ${${PACKAGE}FILES:S/ */ /} > ${.TARGET} + env TESTBASE=${TESTBASE:Q} \ + sh ${GENTEST} -e ${EXCLUDE} ${TESTGROUP} ${${PACKAGE}FILES:S/ */ /} > ${.TARGET} CLEANFILES+= ${TESTWRAPPER}.sh Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh ============================================================================== --- head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Wed Apr 29 19:28:56 2020 (r360475) +++ head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh Wed Apr 29 21:12:32 2020 (r360476) @@ -23,7 +23,22 @@ exclude() { - eval $1=\"\$$1\\n$2\" + case $2 in + # Handle globbing later + *"*"*) ;; + # No globbing needed + *) + eval $1=\"\$$1\\n$2\" + return + ;; + esac + for file in ${TESTBASE}/${2}; do + case ${file} in + # Invalid glob + "${TESTBASE}/${2}") echo "Invalid exclude for $2" >&2; exit 1; ;; + esac + exclude "$1" "${file##${TESTBASE}/}" + done } exclude EXFAIL common/aggs/tst.subr.d From owner-svn-src-head@freebsd.org Wed Apr 29 21:48: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 72D272C3B10; Wed, 29 Apr 2020 21:48:53 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CBwj2MSHz3MZb; Wed, 29 Apr 2020 21:48:53 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47EC2C4E7; Wed, 29 Apr 2020 21:48:53 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TLmr8P022649; Wed, 29 Apr 2020 21:48:53 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TLmqX5022644; Wed, 29 Apr 2020 21:48:52 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202004292148.03TLmqX5022644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Wed, 29 Apr 2020 21:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360477 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 360477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 21:48:53 -0000 Author: rscheff Date: Wed Apr 29 21:48:52 2020 New Revision: 360477 URL: https://svnweb.freebsd.org/changeset/base/360477 Log: Correctly set up the initial TCP congestion window in all cases, by not including the SYN bit sequence space in cwnd related calculations. Snd_und is adjusted explicitly in all cases, outside the cwnd update, instead. This fixes an off-by-one conformance issue with regular TCP sessions not using Appropriate Byte Counting (RFC3465), sending one more packet during the initial window than expected. PR: 235256 Reviewed by: tuexen (mentor), rgrimes (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D19000 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Wed Apr 29 21:12:32 2020 (r360476) +++ head/sys/netinet/tcp_input.c Wed Apr 29 21:48:52 2020 (r360477) @@ -1470,7 +1470,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos) { int thflags, acked, ourfinisacked, needoutput = 0, sack_changed; - int rstreason, todrop, win; + int rstreason, todrop, win, incforsyn = 0; uint32_t tiwin; uint16_t nsegs; char *s; @@ -2374,12 +2374,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru if (IS_FASTOPEN(tp->t_flags) && tp->t_tfo_pending) { tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; - - /* - * Account for the ACK of our SYN prior to - * regular ACK processing below. - */ - tp->snd_una++; } if (tp->t_flags & TF_NEEDFIN) { tcp_state_change(tp, TCPS_FIN_WAIT_1); @@ -2400,6 +2394,13 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru tcp_timer_activate(tp, TT_KEEP, TP_KEEPIDLE(tp)); } /* + * Account for the ACK of our SYN prior to + * regular ACK processing below, except for + * simultaneous SYN, which is handled later. + */ + if (SEQ_GT(th->th_ack, tp->snd_una) && !(tp->t_flags & TF_NEEDSYN)) + incforsyn = 1; + /* * If segment contains data or ACK, will call tcp_reass() * later; if not, do so now to pass queued data to user. */ @@ -2693,6 +2694,15 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru process_ACK: INP_WLOCK_ASSERT(tp->t_inpcb); + /* + * Adjust for the SYN bit in sequence space, + * but don't account for it in cwnd calculations. + * This is for the SYN_RECEIVED, non-simultaneous + * SYN case. SYN_SENT and simultaneous SYN are + * treated elsewhere. + */ + if (incforsyn) + tp->snd_una++; acked = BYTES_THIS_ACK(tp, th); KASSERT(acked >= 0, ("%s: acked unexepectedly negative " "(tp->snd_una=%u, th->th_ack=%u, tp=%p, m=%p)", __func__, Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Wed Apr 29 21:12:32 2020 (r360476) +++ head/sys/netinet/tcp_stacks/bbr.c Wed Apr 29 21:48:52 2020 (r360477) @@ -9326,11 +9326,6 @@ bbr_do_syn_recv(struct mbuf *m, struct tcphdr *th, str tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; - /* - * Account for the ACK of our SYN prior to regular - * ACK processing below. - */ - tp->snd_una++; } /* * Make transitions: SYN-RECEIVED -> ESTABLISHED SYN-RECEIVED* -> @@ -9353,6 +9348,13 @@ bbr_do_syn_recv(struct mbuf *m, struct tcphdr *th, str if (!IS_FASTOPEN(tp->t_flags)) cc_conn_init(tp); } + /* + * Account for the ACK of our SYN prior to + * regular ACK processing below, except for + * simultaneous SYN, which is handled later. + */ + if (SEQ_GT(th->th_ack, tp->snd_una) && !(tp->t_flags & TF_NEEDSYN)) + tp->snd_una++; /* * If segment contains data or ACK, will call tcp_reass() later; if * not, do so now to pass queued data to user. Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Wed Apr 29 21:12:32 2020 (r360476) +++ head/sys/netinet/tcp_stacks/rack.c Wed Apr 29 21:48:52 2020 (r360477) @@ -6540,12 +6540,6 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st if (IS_FASTOPEN(tp->t_flags) && tp->t_tfo_pending) { tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; - - /* - * Account for the ACK of our SYN prior to - * regular ACK processing below. - */ - tp->snd_una++; } if (tp->t_flags & TF_NEEDFIN) { tcp_state_change(tp, TCPS_FIN_WAIT_1); @@ -6563,6 +6557,13 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st if (!IS_FASTOPEN(tp->t_flags)) cc_conn_init(tp); } + /* + * Account for the ACK of our SYN prior to + * regular ACK processing below, except for + * simultaneous SYN, which is handled later. + */ + if (SEQ_GT(th->th_ack, tp->snd_una) && !(tp->t_flags & TF_NEEDSYN)) + tp->snd_una++; /* * If segment contains data or ACK, will call tcp_reass() later; if * not, do so now to pass queued data to user. From owner-svn-src-head@freebsd.org Wed Apr 29 21:54: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 38B512C3F37; Wed, 29 Apr 2020 21:54:11 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CC2q0kcmz3N9k; Wed, 29 Apr 2020 21:54:11 +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 139A5C6F8; Wed, 29 Apr 2020 21:54:11 +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 03TLsAZL028311; Wed, 29 Apr 2020 21:54:10 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TLsAp5028307; Wed, 29 Apr 2020 21:54:10 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202004292154.03TLsAp5028307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Wed, 29 Apr 2020 21:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360478 - in head/sys/net: . route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys/net: . route X-SVN-Commit-Revision: 360478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 21:54:11 -0000 Author: melifaro Date: Wed Apr 29 21:54:09 2020 New Revision: 360478 URL: https://svnweb.freebsd.org/changeset/base/360478 Log: Convert more rtentry field accesses into nhop fields accesses. Continue routing subsystem conversion to nhop objects defined in r359823. Use fields from nhop structure instead of "struct rtentry" fields. This is one of the last changes prior to removing rt_ifp, rt_ifa, rt_gateway and rt_mtu from struct rtentry. Differential Revision: https://reviews.freebsd.org/D24609 Modified: head/sys/net/radix_mpath.c head/sys/net/route.c head/sys/net/route/route_ddb.c head/sys/net/rtsock.c Modified: head/sys/net/radix_mpath.c ============================================================================== --- head/sys/net/radix_mpath.c Wed Apr 29 21:48:52 2020 (r360477) +++ head/sys/net/radix_mpath.c Wed Apr 29 21:54:09 2020 (r360478) @@ -183,6 +183,7 @@ rt_mpath_conflict(struct rib_head *rnh, struct rtentry struct sockaddr *netmask) { struct radix_node *rn, *rn1; + struct nhop_object *nh, *nh1; struct rtentry *rt1; rn = (struct radix_node *)rt; @@ -198,15 +199,17 @@ rt_mpath_conflict(struct rib_head *rnh, struct rtentry if (rn1 == rn) continue; - if (rt1->rt_gateway->sa_family == AF_LINK) { - if (rt1->rt_ifa->ifa_addr->sa_len != rt->rt_ifa->ifa_addr->sa_len || - bcmp(rt1->rt_ifa->ifa_addr, rt->rt_ifa->ifa_addr, - rt1->rt_ifa->ifa_addr->sa_len)) + nh = rt->rt_nhop; + nh1 = rt1->rt_nhop; + + if (nh1->gw_sa.sa_family == AF_LINK) { + if (nh1->nh_ifa->ifa_addr->sa_len != nh->nh_ifa->ifa_addr->sa_len || + bcmp(nh1->nh_ifa->ifa_addr, nh->nh_ifa->ifa_addr, + nh1->nh_ifa->ifa_addr->sa_len)) continue; } else { - if (rt1->rt_gateway->sa_len != rt->rt_gateway->sa_len || - bcmp(rt1->rt_gateway, rt->rt_gateway, - rt1->rt_gateway->sa_len)) + if (nh1->gw_sa.sa_len != nh->gw_sa.sa_len || + bcmp(&nh1->gw_sa, &nh->gw_sa, nh1->gw_sa.sa_len)) continue; } Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Wed Apr 29 21:48:52 2020 (r360477) +++ head/sys/net/route.c Wed Apr 29 21:54:09 2020 (r360478) @@ -745,8 +745,8 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst, default: break; } - if (!not_found && rt->rt_ifa != NULL) { - ifa = rt->rt_ifa; + if (!not_found && rt->rt_nhop->nh_ifa != NULL) { + ifa = rt->rt_nhop->nh_ifa; } RT_REMREF(rt); RT_UNLOCK(rt); @@ -909,7 +909,7 @@ rib_lookup_info(uint32_t fibnum, const struct sockaddr if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { rt = RNTORT(rn); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(rt->rt_ifp)) { + if (RT_LINK_IS_UP(rt->rt_nhop->nh_ifp)) { flags = (flags & NHR_REF) | NHR_COPY; error = rt_exportinfo(rt, info, flags); RIB_RUNLOCK(rh); @@ -1064,7 +1064,8 @@ rib_walk_del(u_int fibnum, int family, rt_filter_f_t * rt_notifydelete(rt, &di.info); if (report) - rt_routemsg(RTM_DELETE, rt, rt->rt_ifp, 0, fibnum); + rt_routemsg(RTM_DELETE, rt, rt->rt_nhop->nh_ifp, 0, + fibnum); RTFREE_LOCKED(rt); } } @@ -1237,7 +1238,7 @@ rt_notifydelete(struct rtentry *rt, struct rt_addrinfo /* * give the protocol a chance to keep things in sync. */ - ifa = rt->rt_ifa; + ifa = rt->rt_nhop->nh_ifa; if (ifa != NULL && ifa->ifa_rtrequest != NULL) ifa->ifa_rtrequest(RTM_DELETE, rt, rt->rt_nhop, info); @@ -1863,7 +1864,7 @@ change_route(struct rib_head *rnh, struct rt_addrinfo info->rti_info[RTAX_GATEWAY] != NULL) || info->rti_info[RTAX_IFP] != NULL || (info->rti_info[RTAX_IFA] != NULL && - !sa_equal(info->rti_info[RTAX_IFA], rt->rt_ifa->ifa_addr))) { + !sa_equal(info->rti_info[RTAX_IFA], rt->rt_nhop->nh_ifa->ifa_addr))) { /* * XXX: Temporarily set RTF_RNH_LOCKED flag in the rti_flags * to avoid rlock in the ifa_ifwithroute(). @@ -2162,7 +2163,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int flags, int fi #endif error = (rn == NULL || (rn->rn_flags & RNF_ROOT) || - RNTORT(rn)->rt_ifa != ifa); + RNTORT(rn)->rt_nhop->nh_ifa != ifa); RIB_RUNLOCK(rnh); if (error) { /* this is only an error if bad on ALL tables */ Modified: head/sys/net/route/route_ddb.c ============================================================================== --- head/sys/net/route/route_ddb.c Wed Apr 29 21:48:52 2020 (r360477) +++ head/sys/net/route/route_ddb.c Wed Apr 29 21:54:09 2020 (r360478) @@ -131,18 +131,20 @@ rt_dumpentry_ddb(struct radix_node *rn, void *arg __un { struct sockaddr_storage ss; struct rtentry *rt; + struct nhop_object *nh; int flags, idx; /* If RNTORT is important, put it in a header. */ rt = (void *)rn; + nh = (struct nhop_object *)rt->rt_nhop; rt_dumpaddr_ddb("dst", rt_key(rt)); rt_dumpaddr_ddb("gateway", &rt->rt_nhop->gw_sa); rt_dumpaddr_ddb("netmask", rtsock_fix_netmask(rt_key(rt), rt_mask(rt), &ss)); - if (rt->rt_ifp != NULL && (rt->rt_ifp->if_flags & IFF_DYING) == 0) { - rt_dumpaddr_ddb("ifp", rt->rt_ifp->if_addr->ifa_addr); - rt_dumpaddr_ddb("ifa", rt->rt_ifa->ifa_addr); + if ((nh->nh_ifp->if_flags & IFF_DYING) == 0) { + rt_dumpaddr_ddb("ifp", nh->nh_ifp->if_addr->ifa_addr); + rt_dumpaddr_ddb("ifa", nh->nh_ifa->ifa_addr); } db_printf("flags "); Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Wed Apr 29 21:48:52 2020 (r360477) +++ head/sys/net/rtsock.c Wed Apr 29 21:54:09 2020 (r360478) @@ -929,7 +929,7 @@ route_output(struct mbuf *m, struct socket *so, ...) rti_need_deembed = (V_deembed_scopeid) ? 1 : 0; #endif RT_LOCK(saved_nrt); - rtm->rtm_index = saved_nrt->rt_ifp->if_index; + rtm->rtm_index = saved_nrt->rt_nhop->nh_ifp->if_index; RT_REMREF(saved_nrt); RT_UNLOCK(saved_nrt); } @@ -1714,6 +1714,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) { struct walkarg *w = vw; struct rtentry *rt = (struct rtentry *)rn; + struct nhop_object *nh; int error = 0, size; struct rt_addrinfo info; struct sockaddr_storage ss; @@ -1730,11 +1731,12 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt), rt_mask(rt), &ss); info.rti_info[RTAX_GENMASK] = 0; - if (rt->rt_ifp && !(rt->rt_ifp->if_flags & IFF_DYING)) { - info.rti_info[RTAX_IFP] = rt->rt_ifp->if_addr->ifa_addr; - info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr; - if (rt->rt_ifp->if_flags & IFF_POINTOPOINT) - info.rti_info[RTAX_BRD] = rt->rt_ifa->ifa_dstaddr; + nh = rt->rt_nhop; + if (nh->nh_ifp && !(nh->nh_ifp->if_flags & IFF_DYING)) { + info.rti_info[RTAX_IFP] = nh->nh_ifp->if_addr->ifa_addr; + info.rti_info[RTAX_IFA] = nh->nh_ifa->ifa_addr; + if (nh->nh_ifp->if_flags & IFF_POINTOPOINT) + info.rti_info[RTAX_BRD] = nh->nh_ifa->ifa_dstaddr; } if ((error = rtsock_msg_buffer(RTM_GET, &info, w, &size)) != 0) return (error); @@ -1748,8 +1750,9 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) (rt->rt_flags & ~RTF_GWFLAG_COMPAT); else rtm->rtm_flags = rt->rt_flags; + rtm->rtm_flags |= nhop_get_rtflags(nh); rt_getmetrics(rt, &rtm->rtm_rmx); - rtm->rtm_index = rt->rt_ifp->if_index; + rtm->rtm_index = nh->nh_ifp->if_index; rtm->rtm_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, (caddr_t)rtm, size); return (error); From owner-svn-src-head@freebsd.org Wed Apr 29 22:01: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 985E42C4257; Wed, 29 Apr 2020 22:01:34 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CCCL3Z1Yz3NY8; Wed, 29 Apr 2020 22:01:34 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B8AAC89B; Wed, 29 Apr 2020 22:01:34 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03TM1Y1Y031149; Wed, 29 Apr 2020 22:01:34 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03TM1XgU031146; Wed, 29 Apr 2020 22:01:33 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202004292201.03TM1XgU031146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Wed, 29 Apr 2020 22:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360479 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: in head/sys/netinet: . tcp_stacks X-SVN-Commit-Revision: 360479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Apr 2020 22:01:34 -0000 Author: rscheff Date: Wed Apr 29 22:01:33 2020 New Revision: 360479 URL: https://svnweb.freebsd.org/changeset/base/360479 Log: Prevent premature shrinking of the scaled receive window which can cause a TCP client to use invalid or stale TCP sequence numbers for ACK packets. Packets with old sequence numbers are ignored and not used to update the send window size. This might cause the TCP session to hang indefinitely under some circumstances. Reported by: Cui Cheng Reviewed by: tuexen (mentor), rgrimes (mentor) Approved by: tuexen (mentor), rgrimes (mentor) MFC after: 3 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D24515 Modified: head/sys/netinet/tcp_output.c head/sys/netinet/tcp_stacks/bbr.c head/sys/netinet/tcp_stacks/rack.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Wed Apr 29 21:54:09 2020 (r360478) +++ head/sys/netinet/tcp_output.c Wed Apr 29 22:01:33 2020 (r360479) @@ -1238,8 +1238,11 @@ send: if (flags & TH_SYN) th->th_win = htons((u_short) (min(sbspace(&so->so_rcv), TCP_MAXWIN))); - else + else { + /* Avoid shrinking window with window scaling. */ + recwin = roundup2(recwin, 1 << tp->rcv_scale); th->th_win = htons((u_short)(recwin >> tp->rcv_scale)); + } /* * Adjust the RXWIN0SENT flag - indicate that we have advertised Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Wed Apr 29 21:54:09 2020 (r360478) +++ head/sys/netinet/tcp_stacks/bbr.c Wed Apr 29 22:01:33 2020 (r360479) @@ -13756,8 +13756,11 @@ send: if (flags & TH_SYN) th->th_win = htons((u_short) (min(sbspace(&so->so_rcv), TCP_MAXWIN))); - else + else { + /* Avoid shrinking window with window scaling. */ + recwin = roundup2(recwin, 1 << tp->rcv_scale); th->th_win = htons((u_short)(recwin >> tp->rcv_scale)); + } /* * Adjust the RXWIN0SENT flag - indicate that we have advertised a 0 * window. This may cause the remote transmitter to stall. This Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Wed Apr 29 21:54:09 2020 (r360478) +++ head/sys/netinet/tcp_stacks/rack.c Wed Apr 29 22:01:33 2020 (r360479) @@ -9572,8 +9572,11 @@ send: if (flags & TH_SYN) th->th_win = htons((u_short) (min(sbspace(&so->so_rcv), TCP_MAXWIN))); - else + else { + /* Avoid shrinking window with window scaling. */ + recwin = roundup2(recwin, 1 << tp->rcv_scale); th->th_win = htons((u_short)(recwin >> tp->rcv_scale)); + } /* * Adjust the RXWIN0SENT flag - indicate that we have advertised a 0 * window. This may cause the remote transmitter to stall. This From owner-svn-src-head@freebsd.org Thu Apr 30 00:14: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 22E6A2C75C4; Thu, 30 Apr 2020 00:14:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CG8R04cGz416R; Thu, 30 Apr 2020 00:14:15 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1949E168; Thu, 30 Apr 2020 00:14:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U0EECF014363; Thu, 30 Apr 2020 00:14:14 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U0EE1P014362; Thu, 30 Apr 2020 00:14:14 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202004300014.03U0EE1P014362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Apr 2020 00:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360480 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 360480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 00:14:15 -0000 Author: emaste Date: Thu Apr 30 00:14:14 2020 New Revision: 360480 URL: https://svnweb.freebsd.org/changeset/base/360480 Log: src.conf.5: regen after 359736, ZONEINFO_OLD_TIMEZONES_SUPPORT removal Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Apr 29 22:01:33 2020 (r360479) +++ head/share/man/man5/src.conf.5 Thu Apr 30 00:14:14 2020 (r360480) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd April 5, 2020 +.Dd April 29, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1742,14 +1742,9 @@ When set, it enforces these options: .Bl -item -compact .It .Va WITHOUT_ZONEINFO_LEAPSECONDS_SUPPORT -.It -.Va WITHOUT_ZONEINFO_OLD_TIMEZONES_SUPPORT .El .It Va WITH_ZONEINFO_LEAPSECONDS_SUPPORT Set to build leapsecond information in to the timezone database. -.It Va WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT -Set to build backward compatibility timezone aliases in to the timezone -database. .El .Sh FILES .Bl -tag -compact -width Pa From owner-svn-src-head@freebsd.org Thu Apr 30 00:27: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 281122C7A2B; Thu, 30 Apr 2020 00:27:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CGRX0Fpmz41km; Thu, 30 Apr 2020 00:27:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03BDEE36F; Thu, 30 Apr 2020 00:27:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U0RJw9020413; Thu, 30 Apr 2020 00:27:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U0RJ2j020412; Thu, 30 Apr 2020 00:27:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004300027.03U0RJ2j020412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 00:27:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360482 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 360482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 00:27:20 -0000 Author: imp Date: Thu Apr 30 00:27:19 2020 New Revision: 360482 URL: https://svnweb.freebsd.org/changeset/base/360482 Log: Generate a devctl event for interesting events When we reset the controller, and when the controller tells us about a critical warning, send an event. Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Thu Apr 30 00:20:31 2020 (r360481) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Apr 30 00:27:19 2020 (r360482) @@ -40,7 +40,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include "nvme_private.h" @@ -50,6 +52,34 @@ __FBSDID("$FreeBSD$"); static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr, struct nvme_async_event_request *aer); +static void +nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, const char *type, const char *msg, ...) +{ + struct sbuf sb; + va_list ap; + int error; + + sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT); + sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + error = sbuf_finish(&sb); + if (error == 0) + printf("%s\n", sbuf_data(&sb)); + + sbuf_clear(&sb); + sbuf_printf(&sb, "name=\"%s\" reason=\"", device_get_nameunit(ctrlr->dev)); + va_start(ap, msg); + sbuf_vprintf(&sb, msg, ap); + va_end(ap); + sbuf_printf(&sb, "\""); + error = sbuf_finish(&sb); + if (error == 0) + devctl_notify("nvme", "controller", type, sbuf_data(&sb)); + sbuf_delete(&sb); +} + static int nvme_ctrlr_construct_admin_qpair(struct nvme_controller *ctrlr) { @@ -607,23 +637,28 @@ nvme_ctrlr_log_critical_warnings(struct nvme_controlle { if (state & NVME_CRIT_WARN_ST_AVAILABLE_SPARE) - nvme_printf(ctrlr, "available spare space below threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "available spare space below threshold"); if (state & NVME_CRIT_WARN_ST_TEMPERATURE) - nvme_printf(ctrlr, "temperature above threshold\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "temperature above threshold"); if (state & NVME_CRIT_WARN_ST_DEVICE_RELIABILITY) - nvme_printf(ctrlr, "device reliability degraded\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "device reliability degraded"); if (state & NVME_CRIT_WARN_ST_READ_ONLY) - nvme_printf(ctrlr, "media placed in read only mode\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "media placed in read only mode"); if (state & NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP) - nvme_printf(ctrlr, "volatile memory backup device failed\n"); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "volatile memory backup device failed"); if (state & NVME_CRIT_WARN_ST_RESERVED_MASK) - nvme_printf(ctrlr, - "unknown critical warning(s): state = 0x%02x\n", state); + nvme_ctrlr_devctl_log(ctrlr, "critical", + "unknown critical warning(s): state = 0x%02x", state); } static void @@ -1121,7 +1156,7 @@ nvme_ctrlr_reset_task(void *arg, int pending) struct nvme_controller *ctrlr = arg; int status; - nvme_printf(ctrlr, "resetting controller\n"); + nvme_ctrlr_devctl_log(ctrlr, "RESET", "resetting controller"); status = nvme_ctrlr_hw_reset(ctrlr); /* * Use pause instead of DELAY, so that we yield to any nvme interrupt From owner-svn-src-head@freebsd.org Thu Apr 30 00:43: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 A68B12C81AA; Thu, 30 Apr 2020 00:43:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CGng3zf6z42Z1; Thu, 30 Apr 2020 00:43:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83F0CE728; Thu, 30 Apr 2020 00:43:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U0h3Bm032725; Thu, 30 Apr 2020 00:43:03 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U0h3OB032723; Thu, 30 Apr 2020 00:43:03 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004300043.03U0h3OB032723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 00:43:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360483 - in head/sys: cam dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/sys: cam dev/nvme X-SVN-Commit-Revision: 360483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 00:43:03 -0000 Author: imp Date: Thu Apr 30 00:43:02 2020 New Revision: 360483 URL: https://svnweb.freebsd.org/changeset/base/360483 Log: Return the nvmeX device associated with the ndaX device. Add the nvmeX device to the XPT_PATH_INQ nvme specific information. while one could figure this out by looking up the domain:bus:slot:function, it's a lot easier to have the SIM set it directly since the sim knows this. Modified: head/sys/cam/cam_ccb.h head/sys/dev/nvme/nvme_sim.c Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Thu Apr 30 00:27:19 2020 (r360482) +++ head/sys/cam/cam_ccb.h Thu Apr 30 00:43:02 2020 (r360483) @@ -630,6 +630,7 @@ struct ccb_pathinq_settings_sas { u_int32_t bitrate; /* Mbps */ }; +#define NVME_DEV_NAME_LEN 52 struct ccb_pathinq_settings_nvme { uint32_t nsid; /* Namespace ID for this path */ uint32_t domain; @@ -637,7 +638,10 @@ struct ccb_pathinq_settings_nvme { uint8_t slot; uint8_t function; uint8_t extra; + char dev_name[NVME_DEV_NAME_LEN]; /* nvme controller dev name for this device */ }; +_Static_assert(sizeof(struct ccb_pathinq_settings_nvme) == 64, + "ccb_pathinq_settings_nvme too big"); #define PATHINQ_SETTINGS_SIZE 128 @@ -1030,6 +1034,7 @@ struct ccb_trans_settings_nvme uint8_t speed; /* PCIe generation for each lane */ uint8_t max_lanes; /* Number of PCIe lanes */ uint8_t max_speed; /* PCIe generation for each lane */ + }; #include Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Thu Apr 30 00:27:19 2020 (r360482) +++ head/sys/dev/nvme/nvme_sim.c Thu Apr 30 00:43:02 2020 (r360483) @@ -203,6 +203,8 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvme.slot = pci_get_slot(dev); cpi->xport_specific.nvme.function = pci_get_function(dev); cpi->xport_specific.nvme.extra = 0; + strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(ctrlr->dev), + sizeof(cpi->xport_specific.nvme.dev_name)); cpi->ccb_h.status = CAM_REQ_CMP; break; } From owner-svn-src-head@freebsd.org Thu Apr 30 00:43: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 9D8E92C81CA; Thu, 30 Apr 2020 00:43:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CGnm3kWdz42cK; Thu, 30 Apr 2020 00:43:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23595E729; Thu, 30 Apr 2020 00:43:08 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U0h78J032779; Thu, 30 Apr 2020 00:43:07 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U0h723032778; Thu, 30 Apr 2020 00:43:07 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004300043.03U0h723032778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 00:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360484 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 360484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 00:43:09 -0000 Author: imp Date: Thu Apr 30 00:43:07 2020 New Revision: 360484 URL: https://svnweb.freebsd.org/changeset/base/360484 Log: Implement the NVME_GET_NSID and NVME_PASSTHROUGH_CMD ioctls With these two ioctls implemented in the nda driver, nvmecontrol now works with nda just like it does with nvd. It eliminates the need to jump through odd hoops to get this data. Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Apr 30 00:43:02 2020 (r360483) +++ head/sys/cam/nvme/nvme_da.c Thu Apr 30 00:43:07 2020 (r360484) @@ -95,6 +95,7 @@ typedef enum { NDA_CCB_BUFFER_IO = 0x01, NDA_CCB_DUMP = 0x02, NDA_CCB_TRIM = 0x03, + NDA_CCB_PASS = 0x04, NDA_CCB_TYPE_MASK = 0x0F, } nda_ccb_state; @@ -144,6 +145,7 @@ _Static_assert(NVME_MAX_DSM_TRIM % sizeof(struct nvme_ /* Need quirk table */ +static disk_ioctl_t ndaioctl; static disk_strategy_t ndastrategy; static dumper_t ndadump; static periph_init_t ndainit; @@ -366,6 +368,91 @@ ndaschedule(struct cam_periph *periph) cam_iosched_schedule(softc->cam_iosched, periph); } +static int +ndaioctl(struct disk *dp, u_long cmd, void *data, int fflag, + struct thread *td) +{ + struct cam_periph *periph; + struct nda_softc *softc; + + periph = (struct cam_periph *)dp->d_drv1; + softc = (struct nda_softc *)periph->softc; + + switch (cmd) { + case NVME_IO_TEST: + case NVME_BIO_TEST: + /* + * These don't map well to the underlying CCBs, so + * they are usupported via CAM. + */ + return (ENOTTY); + case NVME_GET_NSID: + { + struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)data; + struct ccb_pathinq cpi; + + xpt_path_inq(&cpi, periph->path); + strncpy(gnsid->cdev, cpi.xport_specific.nvme.dev_name, + sizeof(gnsid->cdev)); + gnsid->nsid = cpi.xport_specific.nvme.nsid; + return (0); + } + case NVME_PASSTHROUGH_CMD: + { + struct nvme_pt_command *pt; + union ccb *ccb; + struct cam_periph_map_info mapinfo; + u_int maxmap = MAXPHYS; /* XXX is this right */ + int error; + + /* + * Create a NVME_IO CCB to do the passthrough command. + */ + pt = (struct nvme_pt_command *)data; + ccb = xpt_alloc_ccb(); + xpt_setup_ccb(&ccb->ccb_h, periph->path, CAM_PRIORITY_NORMAL); + ccb->ccb_state = NDA_CCB_PASS; + cam_fill_nvmeio(&ccb->nvmeio, + 0, /* Retries */ + ndadone, + (pt->is_read ? CAM_DIR_IN : CAM_DIR_OUT) | CAM_DATA_VADDR, + pt->buf, + pt->len, + nda_default_timeout * 1000); + memcpy(&ccb->nvmeio.cmd, &pt->cmd, sizeof(pt->cmd)); + + /* + * Wire the user memory in this request for the I/O + */ + memset(&mapinfo, 0, sizeof(mapinfo)); + error = cam_periph_mapmem(ccb, &mapinfo, maxmap); + if (error) + return (error); + + /* + * Lock the periph and run the command. XXX do we need + * to lock the periph? + */ + cam_periph_lock(periph); + cam_periph_runccb(ccb, NULL, CAM_RETRY_SELTO, SF_RETRY_UA | SF_NO_PRINT, + NULL); + cam_periph_unlock(periph); + + /* + * Tear down mapping and return status. + */ + cam_periph_unmapmem(ccb, &mapinfo); + cam_periph_lock(periph); + error = (ccb->ccb_h.status == CAM_REQ_CMP) ? 0 : EIO; + xpt_release_ccb(ccb); + return (error); + } + default: + break; + } + return (ENOTTY); +} + /* * Actually translate the requested transfer into one the physical driver * can understand. The transfer is described by a buf and will include @@ -782,11 +869,8 @@ ndaregister(struct cam_periph *periph, void *arg) /* ident_data parsing */ periph->softc = softc; - softc->quirks = NDA_Q_NONE; - xpt_path_inq(&cpi, periph->path); - TASK_INIT(&softc->sysctl_task, 0, ndasysctlinit, periph); /* @@ -810,6 +894,7 @@ ndaregister(struct cam_periph *periph, void *arg) disk->d_open = ndaopen; disk->d_close = ndaclose; disk->d_strategy = ndastrategy; + disk->d_ioctl = ndaioctl; disk->d_getattr = ndagetattr; disk->d_dump = ndadump; disk->d_gone = ndadiskgonecb; @@ -1162,6 +1247,8 @@ ndadone(struct cam_periph *periph, union ccb *done_ccb } case NDA_CCB_DUMP: /* No-op. We're polling */ + return; + case NDA_CCB_PASS: return; default: break; From owner-svn-src-head@freebsd.org Thu Apr 30 00:43: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 2A2B22C8204; Thu, 30 Apr 2020 00:43:14 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CGns2wfKz42gR; Thu, 30 Apr 2020 00:43:13 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34D47E72B; Thu, 30 Apr 2020 00:43:12 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U0hCg8032831; Thu, 30 Apr 2020 00:43:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U0hCt1032830; Thu, 30 Apr 2020 00:43:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004300043.03U0hCt1032830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 00:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360485 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 360485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 00:43:14 -0000 Author: imp Date: Thu Apr 30 00:43:11 2020 New Revision: 360485 URL: https://svnweb.freebsd.org/changeset/base/360485 Log: Make sure that we get the sbuf resources we need. Since we're calling sbuf_new with NOWAIT, make sure it can allocate a buffer to use. Don't print anything if we can't get it. Noticed by: rpokala Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Thu Apr 30 00:43:07 2020 (r360484) +++ head/sys/dev/nvme/nvme_ctrlr.c Thu Apr 30 00:43:11 2020 (r360485) @@ -59,7 +59,8 @@ nvme_ctrlr_devctl_log(struct nvme_controller *ctrlr, c va_list ap; int error; - sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT); + if (sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND | SBUF_NOWAIT) == NULL) + return; sbuf_printf(&sb, "%s: ", device_get_nameunit(ctrlr->dev)); va_start(ap, msg); sbuf_vprintf(&sb, msg, ap); From owner-svn-src-head@freebsd.org Thu Apr 30 02:50: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 9F6FA2CB53E; Thu, 30 Apr 2020 02:50:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CKdH3NRnz48ZM; Thu, 30 Apr 2020 02:50:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F644FEDC; Thu, 30 Apr 2020 02:50:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03U2oxa0010374; Thu, 30 Apr 2020 02:50:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03U2oxax010373; Thu, 30 Apr 2020 02:50:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004300250.03U2oxax010373@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 30 Apr 2020 02:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360486 - head/stand/defaults X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/defaults X-SVN-Commit-Revision: 360486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 02:50:59 -0000 Author: kevans Date: Thu Apr 30 02:50:58 2020 New Revision: 360486 URL: https://svnweb.freebsd.org/changeset/base/360486 Log: loader.conf(5): document that loader_conf_files may be clobbered A future change in lualoader may take some liberties with the loader_conf_files in the name of efficiency; namely, it may start omitting it from the loader environment entirely so that it doesn't need to worry about maintaining any specific value. This variable has historically been incredibly volatile anyways, as it may get set to completely different values in any given configuration file to trigger a load of more files. Document now that we may not maintain it in the future, but perhaps we'll reserve the right to change our minds and eventually formally export all of the loader configuration files that were read using this variable. MFC after: 3 days Modified: head/stand/defaults/loader.conf.5 Modified: head/stand/defaults/loader.conf.5 ============================================================================== --- head/stand/defaults/loader.conf.5 Thu Apr 30 00:43:11 2020 (r360485) +++ head/stand/defaults/loader.conf.5 Thu Apr 30 02:50:58 2020 (r360486) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd October 6, 2018 +.Dd April 29, 2020 .Dt LOADER.CONF 5 .Os .Sh NAME @@ -91,6 +91,10 @@ independently. .It Ar loader_conf_files Defines additional configuration files to be processed right after the present file. +.Ar loader_conf_files +should be treated as write-only. +One cannot depend on any value remaining in the loader environment or carried +over into the kernel environment. .It Ar kernel Name of the kernel to be loaded. If no kernel name is set, no additional From owner-svn-src-head@freebsd.org Thu Apr 30 11:11: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 0D6912B847C; Thu, 30 Apr 2020 11:11:29 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CXkm6SLRz4Zn2; Thu, 30 Apr 2020 11:11:28 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8F211DE85; Thu, 30 Apr 2020 11:11:28 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UBBSu3018669; Thu, 30 Apr 2020 11:11:28 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UBBS6i018668; Thu, 30 Apr 2020 11:11:28 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202004301111.03UBBS6i018668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Thu, 30 Apr 2020 11:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360491 - head/sys/netinet/cc X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet/cc X-SVN-Commit-Revision: 360491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 11:11:29 -0000 Author: rscheff Date: Thu Apr 30 11:11:28 2020 New Revision: 360491 URL: https://svnweb.freebsd.org/changeset/base/360491 Log: Introduce a lower bound of 2 MSS to TCP Cubic. Running TCP Cubic together with ECN could end up reducing cwnd down to 1 byte, if the receiver continously sets the ECE flag, resulting in very poor transmission speeds. In line with RFC6582 App. B, a lower bound of 2 MSS is introduced, as well as a typecast to prevent any potential integer overflows during intermediate calculation steps of the adjusted cwnd. Reported by: Cheng Cui Reviewed by: tuexen (mentor) Approved by: tuexen (mentor) MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D23353 Modified: head/sys/netinet/cc/cc_cubic.c Modified: head/sys/netinet/cc/cc_cubic.c ============================================================================== --- head/sys/netinet/cc/cc_cubic.c Thu Apr 30 06:34:34 2020 (r360490) +++ head/sys/netinet/cc/cc_cubic.c Thu Apr 30 11:11:28 2020 (r360491) @@ -366,8 +366,9 @@ cubic_post_recovery(struct cc_var *ccv) CCV(ccv, t_maxseg); else /* Update cwnd based on beta and adjusted max_cwnd. */ - CCV(ccv, snd_cwnd) = max(1, ((CUBIC_BETA * - cubic_data->max_cwnd) >> CUBIC_SHIFT)); + CCV(ccv, snd_cwnd) = max(((uint64_t)cubic_data->max_cwnd * + CUBIC_BETA) >> CUBIC_SHIFT, + 2 * CCV(ccv, t_maxseg)); } cubic_data->t_last_cong = ticks; @@ -433,6 +434,7 @@ static void cubic_ssthresh_update(struct cc_var *ccv) { struct cubic *cubic_data; + uint32_t ssthresh; cubic_data = ccv->cc_data; @@ -441,10 +443,11 @@ cubic_ssthresh_update(struct cc_var *ccv) * subsequent congestion events, set it to cwnd * beta. */ if (cubic_data->num_cong_events == 0) - CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd) >> 1; + ssthresh = CCV(ccv, snd_cwnd) >> 1; else - CCV(ccv, snd_ssthresh) = ((u_long)CCV(ccv, snd_cwnd) * + ssthresh = ((uint64_t)CCV(ccv, snd_cwnd) * CUBIC_BETA) >> CUBIC_SHIFT; + CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * CCV(ccv, t_maxseg)); } From owner-svn-src-head@freebsd.org Thu Apr 30 11:17: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 216BE2B88FA; Thu, 30 Apr 2020 11:17:30 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CXsk00Wyz4b9X; Thu, 30 Apr 2020 11:17:30 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAD3C1E00B; Thu, 30 Apr 2020 11:17:29 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UBHToS021346; Thu, 30 Apr 2020 11:17:29 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UBHTfD021343; Thu, 30 Apr 2020 11:17:29 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <202004301117.03UBHTfD021343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Thu, 30 Apr 2020 11:17:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360492 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 360492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 11:17:30 -0000 Author: bcr (doc committer) Date: Thu Apr 30 11:17:29 2020 New Revision: 360492 URL: https://svnweb.freebsd.org/changeset/base/360492 Log: Add HISTORY sections to disk(9), driver(9), and epoch(9). In one instance, remove a trailing whitespace while here. Submitted by: gbergling_gmail.com Approved by: bcr Differential Revision: https://reviews.freebsd.org/D24243 Modified: head/share/man/man9/disk.9 head/share/man/man9/driver.9 head/share/man/man9/epoch.9 Modified: head/share/man/man9/disk.9 ============================================================================== --- head/share/man/man9/disk.9 Thu Apr 30 11:11:28 2020 (r360491) +++ head/share/man/man9/disk.9 Thu Apr 30 11:17:29 2020 (r360492) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2017 +.Dd April 30, 2020 .Dt DISK 9 .Os .Sh NAME @@ -241,6 +241,11 @@ Typically used to store a pointer to the drivers .Vt softc structure for this disk device. .El +.Sh HISTORY +The +.Nm kernel disk storage API +first appeard in +.Fx 4.9 . .Sh SEE ALSO .Xr GEOM 4 , .Xr devfs 5 , Modified: head/share/man/man9/driver.9 ============================================================================== --- head/share/man/man9/driver.9 Thu Apr 30 11:11:28 2020 (r360491) +++ head/share/man/man9/driver.9 Thu Apr 30 11:17:29 2020 (r360492) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2011 +.Dd April 30, 2020 .Dt DRIVER 9 .Os .Sh NAME @@ -102,6 +102,11 @@ macro will also create the devclass with the name of t can optionally call extra initialisation code in the driver by specifying an extra module event handler and argument as the last two arguments. +.Sh HISTORY +The +.Nm +framework first appeared in +.Fx 2.2.7 . .Sh SEE ALSO .Xr devclass 9 , .Xr device 9 , Modified: head/share/man/man9/epoch.9 ============================================================================== --- head/share/man/man9/epoch.9 Thu Apr 30 11:11:28 2020 (r360491) +++ head/share/man/man9/epoch.9 Thu Apr 30 11:17:29 2020 (r360492) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 16, 2020 +.Dd April 30, 2020 .Dt EPOCH 9 .Os .Sh NAME @@ -281,6 +281,11 @@ The .Nm kernel programming interface is under development and is subject to change. .El +.Sh HISTORY +The +.Nm +framework first appeard in +.Fx 11.0 . .Sh SEE ALSO .Xr locking 9 , .Xr mtx_pool 9 , From owner-svn-src-head@freebsd.org Thu Apr 30 12:02: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 1177A2BA293; Thu, 30 Apr 2020 12:02:14 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CYsK6b3Wz4dtm; Thu, 30 Apr 2020 12:02:13 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD1481E923; Thu, 30 Apr 2020 12:02:13 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UC2DHJ051499; Thu, 30 Apr 2020 12:02:13 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UC2DTf051497; Thu, 30 Apr 2020 12:02:13 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <202004301202.03UC2DTf051497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Thu, 30 Apr 2020 12:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360493 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 360493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 12:02:14 -0000 Author: bcr (doc committer) Date: Thu Apr 30 12:02:13 2020 New Revision: 360493 URL: https://svnweb.freebsd.org/changeset/base/360493 Log: Add a new manual page for unionfs(5), written by Gordon Bergling. Hook it up to the build by adding it to the Makefile. Submitted by: gbergling_gmail.com Approved by: bcr Differential Revision: https://reviews.freebsd.org/D24589 Added: head/share/man/man5/unionfs.5 (contents, props changed) Modified: head/share/man/man5/Makefile Modified: head/share/man/man5/Makefile ============================================================================== --- head/share/man/man5/Makefile Thu Apr 30 11:17:29 2020 (r360492) +++ head/share/man/man5/Makefile Thu Apr 30 12:02:13 2020 (r360493) @@ -69,7 +69,8 @@ MAN= acct.5 \ style.Makefile.5 \ style.mdoc.5 \ sysctl.conf.5 \ - tmpfs.5 + tmpfs.5 \ + unionfs.5 MLINKS= dir.5 dirent.5 MLINKS+=ext2fs.5 ext4fs.5 Added: head/share/man/man5/unionfs.5 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man5/unionfs.5 Thu Apr 30 12:02:13 2020 (r360493) @@ -0,0 +1,87 @@ +.\" Copyright (c) 2020 Gordon Bergling +.\" +.\" 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$ +.\" +.Dd April 27, 2020 +.Dt UNIONFS 5 +.Os +.Sh NAME +.Nm unionfs +.Nd "UNION FS" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "option UNIONFS" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +unionfs_load="YES" +.Ed +.Sh DESCRIPTION +The UNIONFS driver is an implementation of a stackable unification filesystem. +.Sh SEE ALSO +.Xr mount_unionfs 8 +.Sh STANDARDS +.Rs +.%T Union mounts in 4.4BSD-Lite +.%A J. S. Pendry +.%A M. K. McKusick +.%R Proceedings of the USENIX Technical Conference on UNIX and Advanced Computing Systems +.%D December 1995 +.Re +.Pp +.Rs +.%T Jails: Confining the omnipotent root +.%A P. H. Kamp +.%A R. N. M. Watson +.%R Proceedings of the Second International System Administration and Networking Conference (SANE2000) +.%D May 2000 +.Re +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 5.0 . +.Sh AUTHORS +The +.Nm +device driver was written by Jan-Simon Pendry for +.Bx 4.4 +and +.An Masanori OZAWA Aq Mt ozawa@ongs.co.jp +reimplemented the handling of the locking for +.Fx 7.0 . +The manual page was written by +.An Gordon Bergling Aq Mt gbergling@gmail.com . +.Sh BUGS +Please see the +.Xr mount_unionfs 8 +manual page for a list of bugs regarding the +.Nm +filesystem. From owner-svn-src-head@freebsd.org Thu Apr 30 15:39: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 E6A272C0E47; Thu, 30 Apr 2020 15:39: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CfgX5nrNz3DNl; Thu, 30 Apr 2020 15:39: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 C2241211C7; Thu, 30 Apr 2020 15:39: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 03UFd4Wt085413; Thu, 30 Apr 2020 15:39:04 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UFd4EK085412; Thu, 30 Apr 2020 15:39:04 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202004301539.03UFd4EK085412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 30 Apr 2020 15:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360498 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 360498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 15:39:05 -0000 Author: markj Date: Thu Apr 30 15:39:04 2020 New Revision: 360498 URL: https://svnweb.freebsd.org/changeset/base/360498 Log: Increase the iflib txq callout mutex name length to 32 bytes. With a length of 16, the name (":TX():callout") typically gets truncated. PR: 245712 Reported by: ghuckriede@blackberry.com MFC after: 1 week Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Apr 30 15:24:05 2020 (r360497) +++ head/sys/net/iflib.c Thu Apr 30 15:39:04 2020 (r360498) @@ -358,7 +358,7 @@ struct iflib_txq { bus_dma_tag_t ift_buf_tag; bus_dma_tag_t ift_tso_buf_tag; iflib_dma_info_t ift_ifdi; -#define MTX_NAME_LEN 16 +#define MTX_NAME_LEN 32 char ift_mtx_name[MTX_NAME_LEN]; bus_dma_segment_t ift_segs[IFLIB_MAX_TX_SEGS] __aligned(CACHE_LINE_SIZE); #ifdef IFLIB_DIAGNOSTICS From owner-svn-src-head@freebsd.org Thu Apr 30 15:45: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 419462C131D; Thu, 30 Apr 2020 15:45:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CfpQ14D7z3F4b; Thu, 30 Apr 2020 15:45:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AFF1213A0; Thu, 30 Apr 2020 15:45:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UFj1iw091140; Thu, 30 Apr 2020 15:45:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UFj1iX091139; Thu, 30 Apr 2020 15:45:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202004301545.03UFj1iX091139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 30 Apr 2020 15:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360499 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 360499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 15:45:02 -0000 Author: avg Date: Thu Apr 30 15:45:01 2020 New Revision: 360499 URL: https://svnweb.freebsd.org/changeset/base/360499 Log: ig4iic_acpi_probe: remove set but unused variable MFC after: 1 week Modified: head/sys/dev/ichiic/ig4_acpi.c Modified: head/sys/dev/ichiic/ig4_acpi.c ============================================================================== --- head/sys/dev/ichiic/ig4_acpi.c Thu Apr 30 15:39:04 2020 (r360498) +++ head/sys/dev/ichiic/ig4_acpi.c Thu Apr 30 15:45:01 2020 (r360499) @@ -68,10 +68,8 @@ static char *ig4iic_ids[] = { static int ig4iic_acpi_probe(device_t dev) { - ig4iic_softc_t *sc; int rv; - sc = device_get_softc(dev); if (acpi_disabled("ig4iic")) return (ENXIO); rv = ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids, NULL); From owner-svn-src-head@freebsd.org Thu Apr 30 18:11: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 5A4442C48B4; Thu, 30 Apr 2020 18:11:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Ck3x1p0pz3NLx; Thu, 30 Apr 2020 18:11:57 +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 3905D22FFF; Thu, 30 Apr 2020 18:11:57 +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 03UIBvqE082196; Thu, 30 Apr 2020 18:11:57 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UIBv1r082195; Thu, 30 Apr 2020 18:11:57 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202004301811.03UIBv1r082195@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Apr 2020 18:11:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360501 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 360501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 18:11:57 -0000 Author: emaste Date: Thu Apr 30 18:11:56 2020 New Revision: 360501 URL: https://svnweb.freebsd.org/changeset/base/360501 Log: src.opts.mk: add WITHOUT_OPENSSL dependencies A number of components require OpenSSL and fail to build if it is not enabled. As a first phase force these off under WITHOUT_OPENSSL. A second phase should make these more fine-grained, allowing the component to build but without OpenSSL. PR: 245931 Sponsored by: The FreeBSD Foundation Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Thu Apr 30 17:51:26 2020 (r360500) +++ head/share/mk/src.opts.mk Thu Apr 30 18:11:56 2020 (r360501) @@ -435,6 +435,10 @@ MK_OPENSSH:= no MK_KERBEROS:= no MK_KERBEROS_SUPPORT:= no MK_LDNS:= no +MK_PKGBOOTSTRAP:= no +MK_SVN:= no +MK_SVNLITE:= no +MK_WIRELESS:= no .endif .if ${MK_LDNS} == "no" From owner-svn-src-head@freebsd.org Thu Apr 30 19:48: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 2266B2C70D0; Thu, 30 Apr 2020 19:48:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CmCr06ljz3ymG; Thu, 30 Apr 2020 19:48:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3626241AF; Thu, 30 Apr 2020 19:48:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UJmtKt038299; Thu, 30 Apr 2020 19:48:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UJmt43038298; Thu, 30 Apr 2020 19:48:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004301948.03UJmt43038298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 19:48:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360502 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 360502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 19:48:56 -0000 Author: imp Date: Thu Apr 30 19:48:55 2020 New Revision: 360502 URL: https://svnweb.freebsd.org/changeset/base/360502 Log: Remove stray blank line. This was accidentally added in r360483. Modified: head/sys/cam/cam_ccb.h Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Thu Apr 30 18:11:56 2020 (r360501) +++ head/sys/cam/cam_ccb.h Thu Apr 30 19:48:55 2020 (r360502) @@ -1034,7 +1034,6 @@ struct ccb_trans_settings_nvme uint8_t speed; /* PCIe generation for each lane */ uint8_t max_lanes; /* Number of PCIe lanes */ uint8_t max_speed; /* PCIe generation for each lane */ - }; #include From owner-svn-src-head@freebsd.org Thu Apr 30 20:58: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 ABA3C2C8A28; Thu, 30 Apr 2020 20:58:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CnmB43Tbz43MW; Thu, 30 Apr 2020 20:58:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8631F24F55; Thu, 30 Apr 2020 20:58:34 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UKwY1a080989; Thu, 30 Apr 2020 20:58:34 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UKwYja080988; Thu, 30 Apr 2020 20:58:34 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004302058.03UKwYja080988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 20:58:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360503 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 360503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 20:58:34 -0000 Author: imp Date: Thu Apr 30 20:58:33 2020 New Revision: 360503 URL: https://svnweb.freebsd.org/changeset/base/360503 Log: Move / reword a comment. Explain what we're doing with mapping CAM's notion of a LUN to NVMe's notion of a namespace. Modified: head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Thu Apr 30 19:48:55 2020 (r360502) +++ head/sys/dev/nvme/nvme_sim.c Thu Apr 30 20:58:33 2020 (r360503) @@ -172,12 +172,6 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) struct ccb_pathinq *cpi = &ccb->cpi; device_t dev = ctrlr->dev; - /* - * NVMe may have multiple LUNs on the same path. Current generation - * of NVMe devives support only a single name space. Multiple name - * space drives are coming, but it's unclear how we should report - * them up the stack. - */ cpi->version_num = 1; cpi->hba_inquiry = 0; cpi->target_sprt = 0; @@ -332,13 +326,17 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar return (NULL); } + /* + * We map the NVMe namespace idea onto the CAM unit LUN. For + * each new namespace, we create a new CAM path for it. We then + * rescan the path to get it to enumerate. + */ if (xpt_create_path(&ccb->ccb_h.path, /*periph*/NULL, cam_sim_path(sc->s_sim), 0, ns->id) != CAM_REQ_CMP) { printf("unable to create path for rescan\n"); xpt_free_ccb(ccb); return (NULL); } - xpt_rescan(ccb); return (ns); From owner-svn-src-head@freebsd.org Thu Apr 30 20:58:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 801C32C8A49; Thu, 30 Apr 2020 20:58:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CnmH6rJGz43Q6; Thu, 30 Apr 2020 20:58:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1940324F56; Thu, 30 Apr 2020 20:58:39 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UKwc5A081043; Thu, 30 Apr 2020 20:58:38 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UKwcST081042; Thu, 30 Apr 2020 20:58:38 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004302058.03UKwcST081042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 20:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360504 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 360504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 20:58:40 -0000 Author: imp Date: Thu Apr 30 20:58:38 2020 New Revision: 360504 URL: https://svnweb.freebsd.org/changeset/base/360504 Log: Style(9) nit: put function name at start of line. Modified: head/sys/dev/nvme/nvme_ns.c Modified: head/sys/dev/nvme/nvme_ns.c ============================================================================== --- head/sys/dev/nvme/nvme_ns.c Thu Apr 30 20:58:33 2020 (r360503) +++ head/sys/dev/nvme/nvme_ns.c Thu Apr 30 20:58:38 2020 (r360504) @@ -617,7 +617,8 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t return (0); } -void nvme_ns_destruct(struct nvme_namespace *ns) +void +nvme_ns_destruct(struct nvme_namespace *ns) { if (ns->cdev != NULL) From owner-svn-src-head@freebsd.org Thu Apr 30 20:58: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 95B372C8AD4; Thu, 30 Apr 2020 20:58:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Cnmg3G9Fz43bj; Thu, 30 Apr 2020 20:58:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B0CC24F57; Thu, 30 Apr 2020 20:58:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UKwxcM081107; Thu, 30 Apr 2020 20:58:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UKwx3s081106; Thu, 30 Apr 2020 20:58:59 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004302058.03UKwx3s081106@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 30 Apr 2020 20:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360505 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 20:58:59 -0000 Author: kevans Date: Thu Apr 30 20:58:58 2020 New Revision: 360505 URL: https://svnweb.freebsd.org/changeset/base/360505 Log: lualoader: config: add a table for restricted environment vars This new table should be used for transient values that don't need to end up in the loader environment. Generally, these will be things that are internal details that really aren't needed or interesting outside of the config module (e.g. if we changed how ${module}_* directives work, they might use this instead). To start, populate it with loader_conf_files. Any specific value of loader_conf_files isn't all that interesting; if we're going to export it, we should really instead export a loader_conf_files that indicates all of the configuration files we processed. This will be used to reduce bookkeeping overhead in a future commit that cleans up readConfFiles. Modified: head/stand/lua/config.lua Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Thu Apr 30 20:58:38 2020 (r360504) +++ head/stand/lua/config.lua Thu Apr 30 20:58:58 2020 (r360505) @@ -61,6 +61,17 @@ local QVALREPL = QVALEXPR:gsub('%%', '%%%%') local WORDEXPR = "([%w]+)" local WORDREPL = WORDEXPR:gsub('%%', '%%%%') +-- Entries that should never make it into the environment; each one should have +-- a documented reason for its existence, and these should all be implementation +-- details of the config module. +local loader_env_restricted_table = { + -- loader_conf_files should be considered write-only, and consumers + -- should not rely on any particular value; it's a loader implementation + -- detail. Moreover, it's not a particularly useful variable to have in + -- the kenv. Save the overhead, let it get fetched other ways. + loader_conf_files = true, +} + local function restoreEnv() -- Examine changed environment variables for k, v in pairs(env_changed) do @@ -88,14 +99,31 @@ local function restoreEnv() env_restore = {} end +-- XXX This getEnv/setEnv should likely be exported at some point. We can save +-- the call back into loader.getenv for any variable that's been set or +-- overridden by any loader.conf using this implementation with little overhead +-- since we're already tracking the values. +local function getEnv(key) + if loader_env_restricted_table[key] ~= nil or + env_changed[key] ~= nil then + return env_changed[key] + end + + return loader.getenv(key) +end + local function setEnv(key, value) + env_changed[key] = value + + if loader_env_restricted_table[key] ~= nil then + return 0 + end + -- Track the original value for this if we haven't already if env_restore[key] == nil then env_restore[key] = {value = loader.getenv(key)} end - env_changed[key] = value - return loader.setenv(key, value) end @@ -465,7 +493,7 @@ function config.readConfFiles(files, loaded_files) -- The caller may not have passed in loader_conf_files; we could -- have instead gotten some other string of files. We don't -- want to trigger any redundant re-read/loads based on this. - local prefiles = loader.getenv("loader_conf_files") + local prefiles = getEnv("loader_conf_files") for name in files:gmatch("([%w%p]+)%s*") do if loaded_files[name] ~= nil then goto continue @@ -480,7 +508,7 @@ function config.readConfFiles(files, loaded_files) end loaded_files[name] = true - local newfiles = loader.getenv("loader_conf_files") + local newfiles = getEnv("loader_conf_files") if prefiles ~= newfiles then -- Recurse; process the new files immediately. -- If we come back and it turns out we've @@ -607,7 +635,7 @@ function config.load(file, reloading) end local loaded_files = {file = true} - config.readConfFiles(loader.getenv("loader_conf_files"), loaded_files) + config.readConfFiles(getEnv("loader_conf_files"), loaded_files) checkNextboot() From owner-svn-src-head@freebsd.org Thu Apr 30 21:04:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3DA82C8D0C; Thu, 30 Apr 2020 21:04:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CnvD4rmsz444g; Thu, 30 Apr 2020 21:04:40 +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 84F4F25129; Thu, 30 Apr 2020 21:04:40 +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 03UL4e15087361; Thu, 30 Apr 2020 21:04:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UL4dVW087358; Thu, 30 Apr 2020 21:04:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004302104.03UL4dVW087358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 30 Apr 2020 21:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360506 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 360506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 21:04:40 -0000 Author: kevans Date: Thu Apr 30 21:04:39 2020 New Revision: 360506 URL: https://svnweb.freebsd.org/changeset/base/360506 Log: lualoader: config: improve readConfFiles, rename to readConf The previous interface was pretty bad, and required the caller to get some implementation details correct that it really shouldn't need to (e.g. loader_conf_files handling) and pass in an empty table for it to use. The new and much improved interface, readConf, is much less of a hack; hiding these implementation details and just doing the right thing. config.lua will now use it to process /boot/defaults/loader.conf and the subsequent loader_conf_files from there, and read-conf will also use it. This improvement submitted by Olivier (cited below), loader_conf_files handling from the original patch was changed to just clobber it before processing and not bother restoring it after the fact following r360505 where it's now guaranteed to evade the loader environment. PR: 244640 Submitted by: Olivier Certner (olivier freebsd free fr> Modified: head/stand/lua/cli.lua head/stand/lua/config.lua head/stand/lua/config.lua.8 Modified: head/stand/lua/cli.lua ============================================================================== --- head/stand/lua/cli.lua Thu Apr 30 20:58:58 2020 (r360505) +++ head/stand/lua/cli.lua Thu Apr 30 21:04:39 2020 (r360506) @@ -127,10 +127,7 @@ end cli['read-conf'] = function(...) local _, argv = cli.arguments(...) - -- Don't trigger a reload of previously loaded loader_conf_files, in - -- case this config file doesn't set it. - loader.setenv("loader_conf_files", "") - config.readConfFiles(assert(core.popFrontTable(argv)), {}) + config.readConf(assert(core.popFrontTable(argv))) end cli['reload-conf'] = function(...) Modified: head/stand/lua/config.lua ============================================================================== --- head/stand/lua/config.lua Thu Apr 30 20:58:58 2020 (r360505) +++ head/stand/lua/config.lua Thu Apr 30 21:04:39 2020 (r360506) @@ -488,36 +488,36 @@ function config.parse(text) return status end -function config.readConfFiles(files, loaded_files) - if files ~= nil then - -- The caller may not have passed in loader_conf_files; we could - -- have instead gotten some other string of files. We don't - -- want to trigger any redundant re-read/loads based on this. - local prefiles = getEnv("loader_conf_files") - for name in files:gmatch("([%w%p]+)%s*") do - if loaded_files[name] ~= nil then - goto continue - end +function config.readConf(file, loaded_files) + if loaded_files == nil then + loaded_files = {} + end - print("Loading " .. name) - -- These may or may not exist, and that's ok. Do a - -- silent parse so that we complain on parse errors but - -- not for them simply not existing. - if not config.processFile(name, true) then - print(MSG_FAILPARSECFG:format(name)) - end + if loaded_files[file] ~= nil then + return + end - loaded_files[name] = true - local newfiles = getEnv("loader_conf_files") - if prefiles ~= newfiles then - -- Recurse; process the new files immediately. - -- If we come back and it turns out we've - -- already loaded the rest of what was in the - -- original loader_conf_files, no big deal. - config.readConfFiles(newfiles, loaded_files) - prefiles = newfiles - end - ::continue:: + print("Loading " .. file) + + -- The final value of loader_conf_files is not important, so just + -- clobber it here. We'll later check if it's no longer nil and process + -- the new value for files to read. + setEnv("loader_conf_files", nil) + + -- These may or may not exist, and that's ok. Do a + -- silent parse so that we complain on parse errors but + -- not for them simply not existing. + if not config.processFile(file, true) then + print(MSG_FAILPARSECFG:format(file)) + end + + loaded_files[file] = true + + -- Going to process "loader_conf_files" extra-files + local loader_conf_files = getEnv("loader_conf_files") + if loader_conf_files ~= nil then + for name in loader_conf_files:gmatch("[%w%p]+") do + config.readConf(name, loaded_files) end end end @@ -630,12 +630,7 @@ function config.load(file, reloading) file = "/boot/defaults/loader.conf" end - if not config.processFile(file) then - print(MSG_FAILPARSECFG:format(file)) - end - - local loaded_files = {file = true} - config.readConfFiles(getEnv("loader_conf_files"), loaded_files) + config.readConf(file) checkNextboot() Modified: head/stand/lua/config.lua.8 ============================================================================== --- head/stand/lua/config.lua.8 Thu Apr 30 20:58:58 2020 (r360505) +++ head/stand/lua/config.lua.8 Thu Apr 30 21:04:39 2020 (r360506) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 27, 2020 +.Dd April 30, 2020 .Dt CONFIG.LUA 8 .Os .Sh NAME @@ -59,15 +59,24 @@ to A lookup will be done as needed to determine what value .Ev idx actually corresponds to. -.It Fn config.readConfFiles files loaded_files +.It Fn config.readConf file loaded_files Process -.Ev files -as if it were -.Ev loader_conf_files . -The caller should pass in a table as the +.Pa file +as a configuration file +.Po e.g., as +.Pa loader.conf +.Pc +and then processing files listed in +.Ev loader_conf_files +variable +.Po see +.Xr loader.conf 5 +.Pc . +The caller may optionally pass in a table as the .Ev loaded_files -argument, which uses filenames as keys and any non-nil value to indicate that -the file named by the key has been loaded. +argument, which uses filenames as keys and any non-nil value to +indicate that the file named by the key has already been loaded and +should not be loaded again. .It Fn config.processFile name silent Process and parse .Ev name From owner-svn-src-head@freebsd.org Thu Apr 30 21:08: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 7C5CB2C8E30; Thu, 30 Apr 2020 21:08:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CnzW2jTMz44Gg; Thu, 30 Apr 2020 21:08:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52F8B25131; Thu, 30 Apr 2020 21:08:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UL8Nk1087595; Thu, 30 Apr 2020 21:08:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UL8NVw087594; Thu, 30 Apr 2020 21:08:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202004302108.03UL8NVw087594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Apr 2020 21:08:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360507 - head/share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/man/man5 X-SVN-Commit-Revision: 360507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 21:08:23 -0000 Author: emaste Date: Thu Apr 30 21:08:22 2020 New Revision: 360507 URL: https://svnweb.freebsd.org/changeset/base/360507 Log: src.conf.5: regen after WITHOUT_OPENSSL dep changes Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Thu Apr 30 21:04:39 2020 (r360506) +++ head/share/man/man5/src.conf.5 Thu Apr 30 21:08:22 2020 (r360507) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd April 29, 2020 +.Dd April 30, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -414,7 +414,15 @@ When set, it enforces these options: .It .Va WITHOUT_OPENSSL .It +.Va WITHOUT_PKGBOOTSTRAP +.It +.Va WITHOUT_SVN +.It +.Va WITHOUT_SVNLITE +.It .Va WITHOUT_UNBOUND +.It +.Va WITHOUT_WIRELESS .El .Pp When set, these options are also in effect: @@ -1318,7 +1326,15 @@ When set, it enforces these options: .It .Va WITHOUT_OPENSSH .It +.Va WITHOUT_PKGBOOTSTRAP +.It +.Va WITHOUT_SVN +.It +.Va WITHOUT_SVNLITE +.It .Va WITHOUT_UNBOUND +.It +.Va WITHOUT_WIRELESS .El .Pp When set, these options are also in effect: From owner-svn-src-head@freebsd.org Thu Apr 30 21:08: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 CECE52C8E9B; Thu, 30 Apr 2020 21:08:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Cp0C4y02z44Nv; Thu, 30 Apr 2020 21:08:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A515A25132; Thu, 30 Apr 2020 21:08:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UL8xdc087665; Thu, 30 Apr 2020 21:08:59 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UL8xks087664; Thu, 30 Apr 2020 21:08:59 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202004302108.03UL8xks087664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 30 Apr 2020 21:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360508 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 360508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 21:08:59 -0000 Author: imp Date: Thu Apr 30 21:08:59 2020 New Revision: 360508 URL: https://svnweb.freebsd.org/changeset/base/360508 Log: Fix three bugs highlighted by review: - maxio should be dp->d_maxsize. This is often MAXPHYS, but not always (especially if MAXPHYS is > 1MB). - Unlock the periph before returning. We don't need to relock it to release the ccb. - Make sure we release the ccb in error paths. Reviewed by: cperciva Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Apr 30 21:08:22 2020 (r360507) +++ head/sys/cam/nvme/nvme_da.c Thu Apr 30 21:08:59 2020 (r360508) @@ -402,7 +402,7 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int struct nvme_pt_command *pt; union ccb *ccb; struct cam_periph_map_info mapinfo; - u_int maxmap = MAXPHYS; /* XXX is this right */ + u_int maxmap = dp->d_maxsize; int error; /* @@ -426,8 +426,10 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int */ memset(&mapinfo, 0, sizeof(mapinfo)); error = cam_periph_mapmem(ccb, &mapinfo, maxmap); - if (error) + if (error) { + xpt_release_ccb(ccb); return (error); + } /* * Lock the periph and run the command. XXX do we need @@ -442,7 +444,6 @@ ndaioctl(struct disk *dp, u_long cmd, void *data, int * Tear down mapping and return status. */ cam_periph_unmapmem(ccb, &mapinfo); - cam_periph_lock(periph); error = (ccb->ccb_h.status == CAM_REQ_CMP) ? 0 : EIO; xpt_release_ccb(ccb); return (error); From owner-svn-src-head@freebsd.org Thu Apr 30 21:09: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 BA9782C8EB7; Thu, 30 Apr 2020 21:09:01 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Cp0F4czsz44P5; Thu, 30 Apr 2020 21:09:01 +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 98B0125133; Thu, 30 Apr 2020 21:09:01 +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 03UL91XF087720; Thu, 30 Apr 2020 21:09:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UL91A3087719; Thu, 30 Apr 2020 21:09:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202004302109.03UL91A3087719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Apr 2020 21:09:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360509 - head/tests/sys/geom/class X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/tests/sys/geom/class X-SVN-Commit-Revision: 360509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 21:09:01 -0000 Author: emaste Date: Thu Apr 30 21:09:01 2020 New Revision: 360509 URL: https://svnweb.freebsd.org/changeset/base/360509 Log: geli tests require OpenSSL - exclude them under WITHOUT_OPENSSL PR: 245931 Submitted by: The FreeBSD Foundation Modified: head/tests/sys/geom/class/Makefile Modified: head/tests/sys/geom/class/Makefile ============================================================================== --- head/tests/sys/geom/class/Makefile Thu Apr 30 21:08:59 2020 (r360508) +++ head/tests/sys/geom/class/Makefile Thu Apr 30 21:09:01 2020 (r360509) @@ -1,11 +1,15 @@ # $FreeBSD$ +.include + PACKAGE= tests TESTSDIR= ${TESTSBASE}/sys/geom/class TESTS_SUBDIRS+= concat +.if ${MK_OPENSSL} != "no" TESTS_SUBDIRS+= eli +.endif TESTS_SUBDIRS+= gate TESTS_SUBDIRS+= mirror TESTS_SUBDIRS+= multipath From owner-svn-src-head@freebsd.org Thu Apr 30 22:08: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 D00E32CA171; Thu, 30 Apr 2020 22:08:42 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CqK657Y0z47cW; Thu, 30 Apr 2020 22:08:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB4DD25C8A; Thu, 30 Apr 2020 22:08:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03UM8gJx025036; Thu, 30 Apr 2020 22:08:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03UM8e0d025024; Thu, 30 Apr 2020 22:08:40 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202004302208.03UM8e0d025024@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 30 Apr 2020 22:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360511 - in head: lib/libc/db/mpool lib/libc/gen lib/libc/iconv lib/libc/posix1e lib/libc/secure lib/libgcc_s lib/libprocstat share/man/man5 share/mk tools/build/options X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: lib/libc/db/mpool lib/libc/gen lib/libc/iconv lib/libc/posix1e lib/libc/secure lib/libgcc_s lib/libprocstat share/man/man5 share/mk tools/build/options X-SVN-Commit-Revision: 360511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Apr 2020 22:08:42 -0000 Author: jhb Date: Thu Apr 30 22:08:40 2020 New Revision: 360511 URL: https://svnweb.freebsd.org/changeset/base/360511 Log: Remove the SYMVER build option. This option was added as a transition aide when symbol versioning was first added. It was enabled by default in 2007 and is supported even by the old GPLv2 binutils. Trying to disable it currently fails to build in libc and at this point it isn't worth fixing the build. Reported by: Michael Dexter Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D24637 Deleted: head/tools/build/options/WITHOUT_SYMVER Modified: head/lib/libc/db/mpool/Makefile.inc head/lib/libc/gen/Makefile.inc head/lib/libc/iconv/Makefile.inc head/lib/libc/posix1e/Makefile.inc head/lib/libc/secure/Makefile.inc head/lib/libgcc_s/Makefile head/lib/libprocstat/Makefile head/share/man/man5/src.conf.5 head/share/mk/bsd.lib.mk head/share/mk/bsd.opts.mk head/share/mk/bsd.symver.mk Modified: head/lib/libc/db/mpool/Makefile.inc ============================================================================== --- head/lib/libc/db/mpool/Makefile.inc Thu Apr 30 21:16:08 2020 (r360510) +++ head/lib/libc/db/mpool/Makefile.inc Thu Apr 30 22:08:40 2020 (r360511) @@ -3,7 +3,5 @@ .PATH: ${LIBC_SRCTOP}/db/mpool -SRCS+= mpool.c -.if ${MK_SYMVER} == yes -SRCS+= mpool-compat.c -.endif +SRCS+= mpool.c \ + mpool-compat.c Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Thu Apr 30 21:16:08 2020 (r360510) +++ head/lib/libc/gen/Makefile.inc Thu Apr 30 22:08:40 2020 (r360511) @@ -34,6 +34,7 @@ SRCS+= __getosreldate.c \ ctermid.c \ daemon.c \ devname.c \ + devname-compat11.c \ dirfd.c \ dirname.c \ dirname_compat.c \ @@ -58,7 +59,10 @@ SRCS+= __getosreldate.c \ fstab.c \ ftok.c \ fts.c \ + fts-compat.c \ + fts-compat11.c \ ftw.c \ + ftw-compat11.c \ getbootfile.c \ getbsize.c \ getcap.c \ @@ -71,6 +75,7 @@ SRCS+= __getosreldate.c \ getloadavg.c \ getlogin.c \ getmntinfo.c \ + getmntinfo-compat11.c \ getnetgrent.c \ getosreldate.c \ getpagesize.c \ @@ -83,6 +88,7 @@ SRCS+= __getosreldate.c \ getutxent.c \ getvfsbyname.c \ glob.c \ + glob-compat11.c \ initgroups.c \ isatty.c \ isinf.c \ @@ -94,6 +100,7 @@ SRCS+= __getosreldate.c \ lrand48.c \ mrand48.c \ nftw.c \ + nftw-compat11.c \ nice.c \ nlist.c \ nrand48.c \ @@ -107,10 +114,12 @@ SRCS+= __getosreldate.c \ pw_scan.c \ raise.c \ readdir.c \ + readdir-compat11.c \ readpassphrase.c \ recvmmsg.c \ rewinddir.c \ scandir.c \ + scandir-compat11.c \ seed48.c \ seekdir.c \ semctl.c \ @@ -147,6 +156,7 @@ SRCS+= __getosreldate.c \ ualarm.c \ ulimit.c \ uname.c \ + unvis-compat.c \ usleep.c \ utime.c \ utxdb.c \ @@ -156,18 +166,6 @@ SRCS+= __getosreldate.c \ waitpid.c \ waitid.c \ wordexp.c -.if ${MK_SYMVER} == yes -SRCS+= devname-compat11.c \ - fts-compat.c \ - fts-compat11.c \ - ftw-compat11.c \ - getmntinfo-compat11.c \ - glob-compat11.c \ - nftw-compat11.c \ - readdir-compat11.c \ - scandir-compat11.c \ - unvis-compat.c -.endif CFLAGS.arc4random.c= -I${SRCTOP}/sys -I${SRCTOP}/sys/crypto/chacha20 Modified: head/lib/libc/iconv/Makefile.inc ============================================================================== --- head/lib/libc/iconv/Makefile.inc Thu Apr 30 21:16:08 2020 (r360510) +++ head/lib/libc/iconv/Makefile.inc Thu Apr 30 22:08:40 2020 (r360511) @@ -14,10 +14,7 @@ SRCS+= citrus_bcs.c citrus_bcs_strtol.c citrus_bcs_str citrus_esdb.c citrus_hash.c citrus_iconv.c citrus_lookup.c \ citrus_lookup_factory.c citrus_mapper.c citrus_memstream.c \ citrus_mmap.c citrus_module.c citrus_none.c citrus_pivot_factory.c \ - citrus_prop.c citrus_stdenc.c bsd_iconv.c -.if ${MK_SYMVER} == yes -SRCS+= iconv_compat.c -.endif + citrus_prop.c citrus_stdenc.c bsd_iconv.c iconv_compat.c SYM_MAPS+= ${LIBC_SRCTOP}/iconv/Symbol.map Modified: head/lib/libc/posix1e/Makefile.inc ============================================================================== --- head/lib/libc/posix1e/Makefile.inc Thu Apr 30 21:16:08 2020 (r360510) +++ head/lib/libc/posix1e/Makefile.inc Thu Apr 30 22:08:40 2020 (r360511) @@ -11,6 +11,7 @@ subr_acl_nfs4.c: ${SRCTOP}/sys/kern/subr_acl_nfs4.c CONFS+= posix1e/mac.conf SRCS+= acl_branding.c \ acl_calc_mask.c \ + acl_compat.c \ acl_copy.c \ acl_delete.c \ acl_delete_entry.c \ @@ -36,9 +37,6 @@ SRCS+= acl_branding.c \ mac_get.c \ mac_set.c \ subr_acl_nfs4.c -.if ${MK_SYMVER} == yes -SRCS+= acl_compat.c -.endif SYM_MAPS+=${LIBC_SRCTOP}/posix1e/Symbol.map Modified: head/lib/libc/secure/Makefile.inc ============================================================================== --- head/lib/libc/secure/Makefile.inc Thu Apr 30 21:16:08 2020 (r360510) +++ head/lib/libc/secure/Makefile.inc Thu Apr 30 22:08:40 2020 (r360511) @@ -5,9 +5,7 @@ .PATH: ${LIBC_SRCTOP}/secure # Sources common to both syscall interfaces: -SRCS+= stack_protector.c -.if ${MK_SYMVER} == yes -SRCS+= stack_protector_compat.c -.endif +SRCS+= stack_protector.c \ + stack_protector_compat.c SYM_MAPS+= ${LIBC_SRCTOP}/secure/Symbol.map Modified: head/lib/libgcc_s/Makefile ============================================================================== --- head/lib/libgcc_s/Makefile Thu Apr 30 21:16:08 2020 (r360510) +++ head/lib/libgcc_s/Makefile Thu Apr 30 22:08:40 2020 (r360511) @@ -12,7 +12,6 @@ WARNS?= 2 LDFLAGS+= -nodefaultlibs LIBADD+= c -.if ${MK_SYMVER} == "yes" VERSION_DEF= ${.CURDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map # Export ARM AEABI unwind routines needed by libc and libthr. @@ -20,7 +19,6 @@ SYMBOL_MAPS= ${.CURDIR}/Symbol.map SYMBOL_MAPS+= ${.CURDIR}/${MACHINE_CPUARCH}/Symbol.map .else SYMBOL_MAPS+= ${.CURDIR}/SymbolDefault.map -.endif .endif .include "../libcompiler_rt/Makefile.inc" Modified: head/lib/libprocstat/Makefile ============================================================================== --- head/lib/libprocstat/Makefile Thu Apr 30 21:16:08 2020 (r360510) +++ head/lib/libprocstat/Makefile Thu Apr 30 22:08:40 2020 (r360511) @@ -8,13 +8,10 @@ SRCS= cd9660.c \ common_kvm.c \ core.c \ libprocstat.c \ + libprocstat_compat.c \ msdosfs.c \ smbfs.c \ udf.c - -.if ${MK_SYMVER} == yes -SRCS+= libprocstat_compat.c -.endif VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Thu Apr 30 21:16:08 2020 (r360510) +++ head/share/man/man5/src.conf.5 Thu Apr 30 22:08:40 2020 (r360511) @@ -1541,8 +1541,6 @@ as Set to not build .Xr svnlite 1 and related programs. -.It Va WITHOUT_SYMVER -Set to disable symbol versioning when building shared libraries. .It Va WITHOUT_SYSCONS Set to not build .Xr syscons 4 Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Thu Apr 30 21:16:08 2020 (r360510) +++ head/share/mk/bsd.lib.mk Thu Apr 30 22:08:40 2020 (r360511) @@ -227,7 +227,7 @@ SHLIB_NAME_FULL=${SHLIB_NAME} # Allow libraries to specify their own version map or have it # automatically generated (see bsd.symver.mk above). -.if ${MK_SYMVER} == "yes" && !empty(VERSION_MAP) +.if !empty(VERSION_MAP) ${SHLIB_NAME_FULL}: ${VERSION_MAP} LDFLAGS+= -Wl,--version-script=${VERSION_MAP} .endif Modified: head/share/mk/bsd.opts.mk ============================================================================== --- head/share/mk/bsd.opts.mk Thu Apr 30 21:16:08 2020 (r360510) +++ head/share/mk/bsd.opts.mk Thu Apr 30 22:08:40 2020 (r360511) @@ -63,7 +63,6 @@ __DEFAULT_YES_OPTIONS = \ OPENSSH \ PROFILE \ SSP \ - SYMVER \ TESTS \ TOOLCHAIN \ WARNS Modified: head/share/mk/bsd.symver.mk ============================================================================== --- head/share/mk/bsd.symver.mk Thu Apr 30 21:16:08 2020 (r360510) +++ head/share/mk/bsd.symver.mk Thu Apr 30 22:08:40 2020 (r360511) @@ -7,7 +7,7 @@ ____: # Generate the version map given the version definitions # and symbol maps. -.if ${MK_SYMVER} == "yes" && !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) +.if !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) # Find the awk script that generates the version map. VERSION_GEN?= version_gen.awk VERSION_MAP?= Version.map From owner-svn-src-head@freebsd.org Fri May 1 00:36: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 8882B2CC6A8; Fri, 1 May 2020 00:36:15 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CtbM2qpPz4Fdf; Fri, 1 May 2020 00:36:15 +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 425952785B; Fri, 1 May 2020 00:36:15 +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 0410aFiE016655; Fri, 1 May 2020 00:36:15 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0410aErC016653; Fri, 1 May 2020 00:36:14 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202005010036.0410aErC016653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 1 May 2020 00:36:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360514 - 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: 360514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 00:36:15 -0000 Author: rmacklem Date: Fri May 1 00:36:14 2020 New Revision: 360514 URL: https://svnweb.freebsd.org/changeset/base/360514 Log: Factor some code out of nfsm_dissct() into separate functions. Factoring some of the code in nfsm_dissct() out into separate functions allows these functions to be used elsewhere in the NFS mbuf handling code. Other uses of these functions will be done in future commits. It also makes it easier to add support for ext_pgs mbufs, which is needed for nfs-over-tls under development in base/projects/nfs-over-tls. Although the algorithm in nfsm_dissct() is somewhat re-written by this patch, the semantics of nfsm_dissct() should not have changed. Modified: head/sys/fs/nfs/nfs_commonsubs.c head/sys/fs/nfs/nfs_var.h Modified: head/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- head/sys/fs/nfs/nfs_commonsubs.c Thu Apr 30 23:41:22 2020 (r360513) +++ head/sys/fs/nfs/nfs_commonsubs.c Fri May 1 00:36:14 2020 (r360514) @@ -229,6 +229,8 @@ static void nfsrv_removeuser(struct nfsusrgrp *usrp, i static int nfsrv_getrefstr(struct nfsrv_descript *, u_char **, u_char **, int *, int *); static void nfsrv_refstrbigenough(int, u_char **, u_char **, int *); +static int nfsm_copyfrommbuf(struct nfsrv_descript *, char *, enum uio_seg, + int); static struct { int op; @@ -701,52 +703,49 @@ nfsm_dissct(struct nfsrv_descript *nd, int siz, int ho caddr_t retp; retp = NULL; - left = mtod(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos; + left = mtod(nd->nd_md, char *) + nd->nd_md->m_len - + nd->nd_dpos; while (left == 0) { - nd->nd_md = nd->nd_md->m_next; - if (nd->nd_md == NULL) - return (retp); - left = nd->nd_md->m_len; - nd->nd_dpos = mtod(nd->nd_md, caddr_t); + if (!nfsm_shiftnext(nd, &left)) + return (NULL); } if (left >= siz) { retp = nd->nd_dpos; nd->nd_dpos += siz; - } else if (nd->nd_md->m_next == NULL) { - return (retp); } else if (siz > ncl_mbuf_mhlen) { panic("nfs S too big"); } else { + /* Allocate a new mbuf for the "siz" bytes of data. */ MGET(mp2, MT_DATA, how); if (mp2 == NULL) return (NULL); + + /* + * Link the new mp2 mbuf into the list then copy left + * bytes from the mbuf before it and siz - left bytes + * from the mbuf(s) after it. + */ mp2->m_next = nd->nd_md->m_next; nd->nd_md->m_next = mp2; nd->nd_md->m_len -= left; - nd->nd_md = mp2; - retp = p = mtod(mp2, caddr_t); - NFSBCOPY(nd->nd_dpos, p, left); /* Copy what was left */ + retp = p = mtod(mp2, char *); + memcpy(p, nd->nd_dpos, left); /* Copy what was left */ siz2 = siz - left; p += left; - mp2 = mp2->m_next; + mp2->m_len = siz; + nd->nd_md = mp2->m_next; /* Loop around copying up the siz2 bytes */ while (siz2 > 0) { - if (mp2 == NULL) + if (nd->nd_md == NULL) return (NULL); - xfer = (siz2 > mp2->m_len) ? mp2->m_len : siz2; - if (xfer > 0) { - NFSBCOPY(mtod(mp2, caddr_t), p, xfer); - mp2->m_data += xfer; - mp2->m_len -= xfer; - p += xfer; - siz2 -= xfer; - } + nfsm_set(nd, 0, false); + xfer = nfsm_copyfrommbuf(nd, p, + UIO_SYSSPACE, siz2); + p += xfer; + siz2 -= xfer; if (siz2 > 0) - mp2 = mp2->m_next; + nd->nd_md = nd->nd_md->m_next; } - nd->nd_md->m_len = siz; - nd->nd_md = mp2; - nd->nd_dpos = mtod(mp2, caddr_t); } return (retp); } @@ -4825,5 +4824,76 @@ nfsv4_findmirror(struct nfsmount *nmp) } } return (ds); +} + +/* + * Fill in the fields of "struct nfsrv_descript" for a new ext_pgs mbuf. + * The build argument is true for build and false for dissect. + */ +int +nfsm_set(struct nfsrv_descript *nd, u_int offs, bool build) +{ + struct mbuf *m; + int rlen; + + if (build) + m = nd->nd_mb; + else + m = nd->nd_md; + if (build) { + nd->nd_bpos = mtod(m, char *) + offs; + rlen = m->m_len - offs; + } else { + nd->nd_dpos = mtod(m, char *); + rlen = m->m_len; + } + return (rlen); +} + +/* + * Copy up to "len" bytes from the mbuf into "cp" and adjust the + * mbuf accordingly. + * If cp == NULL, do not do the actual copy, but adjust the mbuf. + * Return the number of bytes actually copied. + * Adjust m_data and m_len so that a future calculation of what + * is left using mtod() will work correctly. + */ +static int +nfsm_copyfrommbuf(struct nfsrv_descript *nd, char *cp, enum uio_seg segflg, + int len) +{ + struct mbuf *m; + int xfer; + + m = nd->nd_md; + xfer = mtod(m, char *) + m->m_len - nd->nd_dpos; + xfer = min(xfer, len); + if (xfer > 0) { + if (cp != NULL) { + if (segflg == UIO_SYSSPACE) + memcpy(cp, nd->nd_dpos, xfer); + else + copyout(nd->nd_dpos, cp, xfer); + } + nd->nd_dpos += xfer; + m->m_data += xfer; + m->m_len -= xfer; + } + return (xfer); +} + +/* + * Shift to the next mbuf in the list list and update the nd fields. + * Return true if successful, false otherwise. + */ +bool +nfsm_shiftnext(struct nfsrv_descript *nd, int *leftp) +{ + + nd->nd_md = nd->nd_md->m_next; + if (nd->nd_md == NULL) + return (false); + *leftp = nfsm_set(nd, 0, false); + return (true); } Modified: head/sys/fs/nfs/nfs_var.h ============================================================================== --- head/sys/fs/nfs/nfs_var.h Thu Apr 30 23:41:22 2020 (r360513) +++ head/sys/fs/nfs/nfs_var.h Fri May 1 00:36:14 2020 (r360514) @@ -361,6 +361,8 @@ int nfsv4_sequencelookup(struct nfsmount *, struct nfs void nfsv4_freeslot(struct nfsclsession *, int); struct ucred *nfsrv_getgrpscred(struct ucred *); struct nfsdevice *nfsv4_findmirror(struct nfsmount *); +int nfsm_set(struct nfsrv_descript *, u_int, bool); +bool nfsm_shiftnext(struct nfsrv_descript *, int *); /* nfs_clcomsubs.c */ void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int); From owner-svn-src-head@freebsd.org Fri May 1 01:26:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82FBF2CD76B; Fri, 1 May 2020 01:26:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49CvjX3BmHz4J56; Fri, 1 May 2020 01:26:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66037225; Fri, 1 May 2020 01:26:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0411QefJ047337; Fri, 1 May 2020 01:26:40 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0411QaEF047318; Fri, 1 May 2020 01:26:36 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202005010126.0411QaEF047318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 1 May 2020 01:26:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360517 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/dispatcher components/executer include X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/dispatcher components/executer include X-SVN-Commit-Revision: 360517 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 01:26:40 -0000 Author: jkim Date: Fri May 1 01:26:36 2020 New Revision: 360517 URL: https://svnweb.freebsd.org/changeset/base/360517 Log: MFV: r360512 Merge ACPICA 20200430. Modified: head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/acgetline.c head/sys/contrib/dev/acpica/common/dmtbdump2.c head/sys/contrib/dev/acpica/compiler/aslcompiler.l head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslpredef.c head/sys/contrib/dev/acpica/compiler/aslxref.c head/sys/contrib/dev/acpica/compiler/dtutils.c head/sys/contrib/dev/acpica/components/debugger/dbhistry.c head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c head/sys/contrib/dev/acpica/components/executer/exfield.c head/sys/contrib/dev/acpica/include/acglobal.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acpredef.h Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/changes.txt Fri May 1 01:26:36 2020 (r360517) @@ -1,4 +1,61 @@ ---------------------------------------- + + +30 April 2020. Summary of changes for version 20200430: + + +1) ACPICA kernel-resident subsystem: + +Cleaned up the coding style of a couple of global variables +(AcpiGbl_NextCmdNum and AcpiProtocolLengths) caught by static analyzers. +AcpiProtocolLengths was made static, and the definition of +AcpiGbl_NextCmdNum was moved to acglobal.h. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL DataTable Compiler: Fixed a segfault on errors that aren't directly +associated with a field. + +Disassembler: has been made more resilient so that it will continue to +parse AML even if the AML generates ACPI namespace errors. This enables +iASL to disassemble some AML that may have been compiled using older +versions of iASL that no longer compile with newer versions of iASL. + +iASL: Fixed the required parameters for _NIH and _NIG. Previously, there +was a mixup where _NIG required one parameter and _NIH required zero +parameters. This change swaps these parameter requirements. Now it is +required that _NIH must be called with one parameter and _NIG requires +zero parameters. + +iASL: Allow use of undefined externals as long as they are protected by +an if (CondRefOf (...)) block when compiling multiple definition blocks. + +iASL: Fixed the type override behavior of named objects that are declared +as External. External declarations will no longer override the type of +the actual definition if it already exists. + +AcpiNames: Added setargv.obj to the MSVC 2017 link sequence to enable +command line wildcard support on Windows. Note: the AcpiNames utility is +essentially redundant with the AcpiExec utility (using the "namespace" +command) and is therefore deprecated. It will be removed in future +releases of ACPICA. + +Disassembler: ignore AE_ALREADY_EXISTS status when parsing create* +operators. The disassembler is intended to emit existing ASL code as-is. +Therefore, error messages emitted during disassembly should be ignored or +handled in a way such that the disassembler can continue to parse the +AML. This change ignores AE_ALREADY_EXISTS errors during the deferred Op +parsing for create operators in order to complete parsing ASL termlists. + +iASL DataTable Compiler: IVRS table: fix potentially uninitialized +variable warning. Some compilers catch potential uninitialized variables. +This is done by examining branches of if/else statements. This change +replaces an "else if" with an "else" to fix the uninitialized variable +warning. + + +---------------------------------------- 26 March 2020. Summary of changes for version 20200326: @@ -674,7 +731,7 @@ temporary. iASL: Emit error for creation of a zero-length operation region. Such a region is rather pointless. If encountered, a runtime error is also -implemented in the interpeter. +implemented in the interpreter. Debugger: Fix a possible fault with the "test objects" command. Modified: head/sys/contrib/dev/acpica/common/acgetline.c ============================================================================== --- head/sys/contrib/dev/acpica/common/acgetline.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/common/acgetline.c Fri May 1 01:26:36 2020 (r360517) @@ -189,8 +189,6 @@ AcpiAcClearLine ( #define _ASCII_LEFT_ARROW 'D' #define _ASCII_NEWLINE '\n' -extern UINT32 AcpiGbl_NextCmdNum; - /* Erase a single character on the input command line */ #define ACPI_CLEAR_CHAR() \ Modified: head/sys/contrib/dev/acpica/common/dmtbdump2.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump2.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/common/dmtbdump2.c Fri May 1 01:26:36 2020 (r360517) @@ -528,8 +528,10 @@ AcpiDmDumpIvrs ( DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, sizeof (ACPI_IVRS_HARDWARE1)); } - else if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2) + else { + /* ACPI_IVRS_TYPE_HARDWARE2 subtable type */ + EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2); DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, sizeof (ACPI_IVRS_HARDWARE2)); Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.l ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.l Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.l Fri May 1 01:26:36 2020 (r360517) @@ -819,7 +819,7 @@ NamePathTail [.]{NameSeg} } /* - * The eror code is contained inside the + * The error code is contained inside the * {ErrorCode} pattern. Extract it and log it * as the expected error code. */ Modified: head/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslload.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/compiler/aslload.c Fri May 1 01:26:36 2020 (r360517) @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: dswload - Dispatcher namespace load callbacks + * Module Name: aslload - compiler namespace load callbacks * *****************************************************************************/ @@ -201,7 +201,6 @@ LdAnalyzeExternals ( ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op, ACPI_OBJECT_TYPE ExternalOpType, - ACPI_OBJECT_TYPE ObjectType, ACPI_WALK_STATE *WalkState); @@ -515,7 +514,6 @@ LdNamespace1Begin ( ACPI_PARSE_OBJECT *MethodOp; ACPI_STATUS Status; ACPI_OBJECT_TYPE ObjectType; - ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY; char *Path; UINT32 Flags = ACPI_NS_NO_UPSEARCH; ACPI_PARSE_OBJECT *Arg; @@ -689,8 +687,7 @@ LdNamespace1Begin ( * * first child is name, next child is ObjectType */ - ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer; - ObjectType = ACPI_TYPE_ANY; + ObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer; /* * We will mark every new node along the path as "External". This @@ -709,7 +706,7 @@ LdNamespace1Begin ( * Store (\_SB_.PCI0.ABCD, Local0) * } */ - Flags |= ACPI_NS_EXTERNAL; + Flags |= ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE; break; case PARSEOP_DEFAULT_ARG: @@ -913,8 +910,7 @@ LdNamespace1Begin ( else if ((Node->Flags & ANOBJ_IS_EXTERNAL) || (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) { - Status = LdAnalyzeExternals (Node, Op, ActualObjectType, - ObjectType, WalkState); + Status = LdAnalyzeExternals (Node, Op, ObjectType, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_ERROR) @@ -929,6 +925,19 @@ LdNamespace1Begin ( } return_ACPI_STATUS (Status); } + + if (!(Node->Flags & ANOBJ_IS_EXTERNAL) && + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) + { + /* + * If we get to here, it means that an actual definition of + * the object declared external exists. Meaning that Op + * loading this this Op should have no change to the ACPI + * namespace. By going to FinishNode, we skip the + * assignment of Node->Op = Op. + */ + goto FinishNode; + } } else { @@ -980,31 +989,16 @@ LdNamespace1Begin ( } } -FinishNode: - /* - * Point the parse node to the new namespace node, and point - * the Node back to the original Parse node - */ - Op->Asl.Node = Node; + /* Point the Node back to the original Parse node */ + Node->Op = Op; - /* - * Set the actual data type if appropriate (EXTERNAL term only) - * As of 11/19/2019, ASL External() does not support parameter - * counts. When an External method is loaded, the parameter count is - * recorded in the external's arg count parameter. The parameter count may - * or may not be known in the declaration. If the value of this node turns - * out to be ASL_EXTERNAL_METHOD_UNKNOWN_PARAMS, it indicates that - * we do not know the parameter count and that we must look at the usage of - * the External method call to get this information. - */ - if (ActualObjectType != ACPI_TYPE_ANY) - { - Node->Type = (UINT8) ActualObjectType; - Node->Value = (UINT32) - Op->Asl.Child->Asl.Next->Asl.Next->Asl.Value.Integer; - } +FinishNode: + /* Point the parse node to the new namespace node */ + + Op->Asl.Node = Node; + if (Op->Asl.ParseOpcode == PARSEOP_METHOD) { /* @@ -1013,6 +1007,13 @@ FinishNode: */ Node->Value = (UINT32) Op->Asl.Extra; } + else if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL && + Node->Type == ACPI_TYPE_METHOD && + (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + Node->Value = + (UINT32) Op->Asl.Child->Asl.Next->Asl.Next->Asl.Value.Integer; + } return_ACPI_STATUS (Status); } @@ -1020,7 +1021,7 @@ FinishNode: /******************************************************************************* * - * FUNCTION: LdAnalyzeExternals + * FUNCTION: LdMatchExternType * * PARAMETERS: Type1 * Type2 @@ -1037,7 +1038,7 @@ FinishNode: ******************************************************************************/ static BOOLEAN -LdTypesMatchExternType ( +LdMatchExternType ( ACPI_OBJECT_TYPE Type1, ACPI_OBJECT_TYPE Type2) { @@ -1093,7 +1094,6 @@ LdTypesMatchExternType ( * PARAMETERS: Node - Node that represents the named object * Op - Named object declaring this named object * ExternalOpType - Type of ExternalOp - * ObjectType - Type of Declared object * WalkState - Current WalkState * * RETURN: Status @@ -1111,7 +1111,6 @@ LdAnalyzeExternals ( ACPI_NAMESPACE_NODE *Node, ACPI_PARSE_OBJECT *Op, ACPI_OBJECT_TYPE ExternalOpType, - ACPI_OBJECT_TYPE ObjectType, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; @@ -1135,12 +1134,12 @@ LdAnalyzeExternals ( else { ActualExternalOpType = Node->Type; - ActualOpType = ObjectType; + ActualOpType = ExternalOpType; } if ((ActualOpType != ACPI_TYPE_ANY) && (ActualExternalOpType != ACPI_TYPE_ANY) && - !LdTypesMatchExternType (ActualExternalOpType, ActualOpType)) + !LdMatchExternType (ActualExternalOpType, ActualOpType)) { if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL && Node->Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) @@ -1168,6 +1167,8 @@ LdAnalyzeExternals ( } } + /* Set the object type of the external */ + if ((Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) { @@ -1176,13 +1177,13 @@ LdAnalyzeExternals ( * previously declared External */ Node->Flags &= ~ANOBJ_IS_EXTERNAL; - Node->Type = (UINT8) ObjectType; + Node->Type = (UINT8) ExternalOpType; /* Just retyped a node, probably will need to open a scope */ - if (AcpiNsOpensScope (ObjectType)) + if (AcpiNsOpensScope (ExternalOpType)) { - Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); + Status = AcpiDsScopeStackPush (Node, ExternalOpType, WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -1203,7 +1204,7 @@ LdAnalyzeExternals ( } else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && - (ObjectType == ACPI_TYPE_ANY)) + (ExternalOpType == ACPI_TYPE_ANY)) { /* Allow update of externals of unknown type. */ Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c Fri May 1 01:26:36 2020 (r360517) @@ -380,6 +380,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_TYPE_MISMATCH_FOUND_HERE */ "Actual object declaration:", /* ASL_MSG_DUPLICATE_EXTERN_MISMATCH */ "Type mismatch between multiple external declarations detected", /* ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:", +/* ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL */"CondRefOf parameter requires External() declaration", }; /* Table compiler */ Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Fri May 1 01:26:36 2020 (r360517) @@ -382,6 +382,7 @@ typedef enum ASL_MSG_TYPE_MISMATCH_FOUND_HERE, ASL_MSG_DUPLICATE_EXTERN_MISMATCH, ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, + ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL, /* These messages are used by the Data Table compiler only */ Modified: head/sys/contrib/dev/acpica/compiler/aslpredef.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslpredef.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/compiler/aslpredef.c Fri May 1 01:26:36 2020 (r360517) @@ -674,7 +674,7 @@ ApCheckForSpecialName ( /* * Was not actually emitted by the compiler. This is a special case, * however. If the ASL code being compiled was the result of a - * dissasembly, it may possibly contain valid compiler-emitted names + * disassembly, it may possibly contain valid compiler-emitted names * of the form "_T_x". We don't want to issue an error or even a * warning and force the user to manually change the names. So, we * will issue a remark instead. Modified: head/sys/contrib/dev/acpica/compiler/aslxref.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslxref.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/compiler/aslxref.c Fri May 1 01:26:36 2020 (r360517) @@ -199,7 +199,17 @@ XfCheckFieldRange ( UINT32 FieldBitLength, UINT32 AccessBitWidth); +static BOOLEAN +XfFindCondRefOfName ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); +static BOOLEAN +XfRefIsGuardedByIfCondRefOf ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op); + + /******************************************************************************* * * FUNCTION: XfCrossReferenceNamespace @@ -582,17 +592,6 @@ XfNamespaceLocateBegin ( } /* - * One special case: CondRefOf operator - we don't care if the name exists - * or not at this point, just ignore it, the point of the operator is to - * determine if the name exists at runtime. - */ - if ((Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) - { - return_ACPI_STATUS (AE_OK); - } - - /* * We must enable the "search-to-root" for single NameSegs, but * we have to be very careful about opening up scopes */ @@ -600,7 +599,8 @@ XfNamespaceLocateBegin ( if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) || - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) || + (Op->Asl.ParseOpcode == PARSEOP_CONDREFOF)) { /* * These are name references, do not push the scope stack @@ -665,8 +665,23 @@ XfNamespaceLocateBegin ( * We didn't find the name reference by path -- we can qualify this * a little better before we print an error message */ - if (strlen (Path) == ACPI_NAMESEG_SIZE) + + if ((Op->Asl.Parent) && + (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) { + /* + * One special case: CondRefOf operator - if the name doesn't + * exist at this point, it means that there's no actual or + * external declaration. If the name is not found, just ignore + * it, the point of the operator is to determine if the name + * exists at runtime. We wanted to see if this named object + * exists to facilitate analysis to allow protected usage of + * undeclared externals. + */ + return_ACPI_STATUS (AE_OK); + } + else if (strlen (Path) == ACPI_NAMESEG_SIZE) + { /* A simple, one-segment ACPI name */ if (XfObjectExists (Path)) @@ -1190,6 +1205,7 @@ XfNamespaceLocateBegin ( /* * 5) Check for external resolution + * * By this point, everything should be loaded in the namespace. If a * namespace lookup results in a namespace node that is an external, it * means that this named object was not defined in the input ASL. This @@ -1197,11 +1213,38 @@ XfNamespaceLocateBegin ( * use the external keyword to suppress compiler errors about undefined * objects. Note: this only applies when compiling multiple definition * blocks. + * + * Do not check for external resolution in the following cases: + * + * case 1) External (ABCD) + * + * This declares ABCD as an external so there is no requirement for + * ABCD to be loaded in the namespace when analyzing the actual + * External() statement. + * + * case 2) CondRefOf (ABCD) + * + * This operator will query the ACPI namespace on the existence of + * ABCD. If ABCD does not exist, this operator will return a 0 + * without incurring AML runtime errors. Therefore, ABCD is allowed + * to not exist when analyzing the CondRefOf operator. + * + * case 3) External (ABCD) + * if (CondRefOf (ABCD)) + * { + * Store (0, ABCD) + * } + * + * In this case, ABCD is accessed only if it exists due to the if + * statement so there is no need to flag the ABCD nested in the + * store operator. */ if (AslGbl_ParseTreeRoot->Asl.Child && AslGbl_ParseTreeRoot->Asl.Child->Asl.Next && - (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL && - Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL) && - (Node->Flags & ANOBJ_IS_EXTERNAL)) + (Node->Flags & ANOBJ_IS_EXTERNAL) && + Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL && + Op->Asl.ParseOpcode != PARSEOP_EXTERNAL && + Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_CONDREFOF && + !XfRefIsGuardedByIfCondRefOf (Node, Op)) { AslError (ASL_ERROR, ASL_MSG_UNDEFINED_EXTERNAL, Op, NULL); } @@ -1216,6 +1259,96 @@ XfNamespaceLocateBegin ( Op->Asl.Node = Node; return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: XfRefIsGuardedByIfCondRefOf + * + * PARAMETERS: Node - Named object reference node + * Op - Named object reference parse node + * + * RETURN: BOOLEAN + * + * DESCRIPTION: returns true if Op checked inside if (CondRefOf (...)) + * refers to Node. + * + ******************************************************************************/ + +static BOOLEAN +XfRefIsGuardedByIfCondRefOf ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *Parent = Op->Asl.Parent; + + + while (Parent) + { + if (Parent->Asl.ParseOpcode == PARSEOP_IF && + XfFindCondRefOfName (Node, Parent->Asl.Child)) + { + return (TRUE); + } + + Parent = Parent->Asl.Parent; + } + + return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION: XfRefIsGuardedByIfCondRefOf + * + * PARAMETERS: Node - Named object reference node + * Op - Named object reference parse node + * + * RETURN: BOOLEAN + * + * DESCRIPTION: returns true if Op checked inside if (CondRefOf (...)) + * refers to Node. + * + ******************************************************************************/ + +static BOOLEAN +XfFindCondRefOfName ( + ACPI_NAMESPACE_NODE *Node, + ACPI_PARSE_OBJECT *Op) +{ + BOOLEAN CondRefOfFound = FALSE; + + + if (!Op) + { + return (FALSE); + } + + switch (Op->Asl.ParseOpcode) + { + case PARSEOP_CONDREFOF: + + return (Op->Asl.Child->Common.Node == Node); + break; + + case PARSEOP_LAND: + + CondRefOfFound = XfFindCondRefOfName (Node, Op->Asl.Child); + if (CondRefOfFound) + { + return (TRUE); + } + + return (XfFindCondRefOfName (Node, Op->Asl.Child->Asl.Next)); + break; + + default: + + return (FALSE); + break; + } } Modified: head/sys/contrib/dev/acpica/compiler/dtutils.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/dtutils.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/compiler/dtutils.c Fri May 1 01:26:36 2020 (r360517) @@ -186,11 +186,20 @@ DtError ( DT_FIELD *FieldObject, char *ExtraMessage) { + UINT32 Line = 0; + + /* Field object could be NULL */ + + if (FieldObject) + { + Line = FieldObject->Line; + } + /* Check if user wants to ignore this exception */ if (AslIsExceptionIgnored (AslGbl_Files[ASL_FILE_INPUT].Filename, - FieldObject->Line, Level, MessageId)) + Line, Level, MessageId)) { return; } Modified: head/sys/contrib/dev/acpica/components/debugger/dbhistry.c ============================================================================== --- head/sys/contrib/dev/acpica/components/debugger/dbhistry.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/components/debugger/dbhistry.c Fri May 1 01:26:36 2020 (r360517) @@ -175,7 +175,6 @@ static HISTORY_INFO AcpiGbl_HistoryBuffer[HIST static UINT16 AcpiGbl_LoHistory = 0; static UINT16 AcpiGbl_NumHistory = 0; static UINT16 AcpiGbl_NextHistoryIndex = 0; -UINT32 AcpiGbl_NextCmdNum = 1; /******************************************************************************* Modified: head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c ============================================================================== --- head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c Fri May 1 01:26:36 2020 (r360517) @@ -400,6 +400,10 @@ AcpiDmIsUuidBuffer ( /* Buffer size is the buffer argument */ SizeOp = Op->Common.Value.Arg; + if (!SizeOp) + { + return (FALSE); + } /* Next, the initializer byte list to examine */ @@ -520,6 +524,10 @@ AcpiDmIsUnicodeBuffer ( /* Buffer size is the buffer argument */ SizeOp = Op->Common.Value.Arg; + if (!SizeOp) + { + return (FALSE); + } /* Next, the initializer byte list to examine */ @@ -596,6 +604,10 @@ AcpiDmIsStringBuffer ( /* Buffer size is the buffer argument */ SizeOp = Op->Common.Value.Arg; + if (!SizeOp) + { + return (FALSE); + } /* Next, the initializer byte list to examine */ @@ -675,13 +687,18 @@ AcpiDmIsPldBuffer ( UINT64 InitializerSize; + if (!Op) + { + return (FALSE); + } + /* * Get the BufferSize argument - Buffer(BufferSize) * If the buffer was generated by the ToPld macro, it must * be a BYTE constant. */ SizeOp = Op->Common.Value.Arg; - if (SizeOp->Common.AmlOpcode != AML_BYTE_OP) + if (!SizeOp || SizeOp->Common.AmlOpcode != AML_BYTE_OP) { return (FALSE); } Modified: head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c ============================================================================== --- head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c Fri May 1 01:26:36 2020 (r360517) @@ -341,8 +341,13 @@ AcpiDsCreateBufferField ( Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); - if (ACPI_FAILURE (Status)) + if ((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) && + Status == AE_ALREADY_EXISTS) { + Status = AE_OK; + } + else if (ACPI_FAILURE (Status)) + { ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); @@ -682,12 +687,21 @@ AcpiDsCreateField ( Info.RegionNode = RegionNode; Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); - if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM && - !(RegionNode->Object->Field.InternalPccBuffer - = ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length))) + if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (AE_NO_MEMORY); + return_ACPI_STATUS (Status); } + + if (Info.RegionNode->Object->Region.SpaceId == ACPI_ADR_SPACE_PLATFORM_COMM) + { + RegionNode->Object->Field.InternalPccBuffer = + ACPI_ALLOCATE_ZEROED(Info.RegionNode->Object->Region.Length); + if (!RegionNode->Object->Field.InternalPccBuffer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + } + return_ACPI_STATUS (Status); } Modified: head/sys/contrib/dev/acpica/components/executer/exfield.c ============================================================================== --- head/sys/contrib/dev/acpica/components/executer/exfield.c Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/components/executer/exfield.c Fri May 1 01:26:36 2020 (r360517) @@ -167,7 +167,7 @@ #define ACPI_INVALID_PROTOCOL_ID 0x80 #define ACPI_MAX_PROTOCOL_ID 0x0F -const UINT8 AcpiProtocolLengths[] = +static const UINT8 AcpiProtocolLengths[] = { ACPI_INVALID_PROTOCOL_ID, /* 0 - reserved */ ACPI_INVALID_PROTOCOL_ID, /* 1 - reserved */ Modified: head/sys/contrib/dev/acpica/include/acglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acglobal.h Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/include/acglobal.h Fri May 1 01:26:36 2020 (r360517) @@ -436,6 +436,7 @@ ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_Extern #ifdef ACPI_DEBUGGER ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NextCmdNum, 1); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoIniMethods); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport); Modified: head/sys/contrib/dev/acpica/include/acpixf.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acpixf.h Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/include/acpixf.h Fri May 1 01:26:36 2020 (r360517) @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20200326 +#define ACPI_CA_VERSION 0x20200430 #include #include Modified: head/sys/contrib/dev/acpica/include/acpredef.h ============================================================================== --- head/sys/contrib/dev/acpica/include/acpredef.h Fri May 1 00:41:41 2020 (r360516) +++ head/sys/contrib/dev/acpica/include/acpredef.h Fri May 1 01:26:36 2020 (r360517) @@ -769,10 +769,10 @@ const ACPI_PREDEFINED_INFO AcpiGbl_Predefined {{"_NIC", METHOD_0ARGS, /* ACPI 6.3 */ METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - {{"_NIG", METHOD_1ARGS (ACPI_TYPE_BUFFER), /* ACPI 6.3 */ + {{"_NIG", METHOD_0ARGS, /* ACPI 6.3 */ METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, - {{"_NIH", METHOD_0ARGS, /* ACPI 6.3 */ + {{"_NIH", METHOD_1ARGS (ACPI_TYPE_BUFFER), /* ACPI 6.3 */ METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, {{"_NTT", METHOD_0ARGS, From owner-svn-src-head@freebsd.org Fri May 1 01:31: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 BDAD62CE216; Fri, 1 May 2020 01:31:19 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Cvpv4dHBz4JpN; Fri, 1 May 2020 01:31:19 +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 99CEC384; Fri, 1 May 2020 01:31:19 +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 0411VJiZ048535; Fri, 1 May 2020 01:31:19 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0411VJAH048534; Fri, 1 May 2020 01:31:19 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202005010131.0411VJAH048534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 1 May 2020 01:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360519 - head/usr.sbin/binmiscctl X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/usr.sbin/binmiscctl X-SVN-Commit-Revision: 360519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 01:31:19 -0000 Author: mhorne Date: Fri May 1 01:31:19 2020 New Revision: 360519 URL: https://svnweb.freebsd.org/changeset/base/360519 Log: Add RISC-V interpreter example Now that RISC-V support has landed in qemu-user-static, add to the list of examples in the binmiscctl(8) manpage. Reviewed by: kevans MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D24646 Modified: head/usr.sbin/binmiscctl/binmiscctl.8 Modified: head/usr.sbin/binmiscctl/binmiscctl.8 ============================================================================== --- head/usr.sbin/binmiscctl/binmiscctl.8 Fri May 1 01:30:11 2020 (r360518) +++ head/usr.sbin/binmiscctl/binmiscctl.8 Fri May 1 01:31:19 2020 (r360519) @@ -27,7 +27,7 @@ .\" .\" Support for miscellaneous binary image activators .\" -.Dd February 10, 2020 +.Dd April 30, 2020 .Dt BINMISCCTL 8 .Os .Sh NAME @@ -269,6 +269,17 @@ Add QEMU bsd-user program as an image activator for Po \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex15" \e --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e + --size 20 --set-enabled +.Ed +.Pp +Add QEMU bsd-user program as an image activator for 64-bit RISC-V binaries: +.Bd -literal -offset indent +# binmiscctl add riscv64 \e + --interpreter "/usr/local/bin/qemu-riscv64-static" \e + --magic "\ex7f\ex45\ex4c\ex46\ex02\ex01\ex01\ex00\ex00\ex00\e + \ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\exf3\ex00" \e + --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e + \exff\exff\exff\exff\exff\exff\exfe\exff\exff\exff" \e --size 20 --set-enabled .Ed .Ss "Create and use an ARMv6 chroot on an AMD64 host" From owner-svn-src-head@freebsd.org Fri May 1 10:02: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 864452D0D47; Fri, 1 May 2020 10:02:41 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49D78x2zrkz4KY5; Fri, 1 May 2020 10:02:41 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61A0967F9; Fri, 1 May 2020 10:02:41 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041A2fvo073356; Fri, 1 May 2020 10:02:41 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041A2cKX073344; Fri, 1 May 2020 10:02:38 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <202005011002.041A2cKX073344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Fri, 1 May 2020 10:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360527 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 360527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 10:02:41 -0000 Author: bcr (doc committer) Date: Fri May 1 10:02:38 2020 New Revision: 360527 URL: https://svnweb.freebsd.org/changeset/base/360527 Log: Fix a number of the following issues in man4: - Inconsistencies in .Dd like abbreviated month names, "th" after numbers, or leading zeros - No line breaks after a sentence stop - Whitespace at the end of the line - Use macros for BSD OS names instead of hardcoded names - CAVEATS instead of CAVEAT in section name No actual content change in terms of additions were made, so no bump of the .Dd for these man pages. All of these issues were found and fixed by Gordon Bergling. Submitted by: gbergling_gmail.com Approved by: bcr Differential Revision: https://reviews.freebsd.org/D24648 Modified: head/share/man/man4/acpi_wmi.4 head/share/man/man4/bhndb.4 head/share/man/man4/bnxt.4 head/share/man/man4/bridge.4 head/share/man/man4/bwi.4 head/share/man/man4/bxe.4 head/share/man/man4/cyapa.4 head/share/man/man4/hv_vss.4 head/share/man/man4/ig4.4 head/share/man/man4/pchtherm.4 head/share/man/man4/ppbus.4 Modified: head/share/man/man4/acpi_wmi.4 ============================================================================== --- head/share/man/man4/acpi_wmi.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/acpi_wmi.4 Fri May 1 10:02:38 2020 (r360527) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 5, 2019 +.Dd September 5, 2019 .Dt ACPI_WMI 4 .Os .Sh NAME Modified: head/share/man/man4/bhndb.4 ============================================================================== --- head/share/man/man4/bhndb.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/bhndb.4 Fri May 1 10:02:38 2020 (r360527) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 16th, 2017 +.Dd October 16, 2017 .Dt BHNDB 4 .Os .Sh NAME Modified: head/share/man/man4/bnxt.4 ============================================================================== --- head/share/man/man4/bnxt.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/bnxt.4 Fri May 1 10:02:38 2020 (r360527) @@ -208,10 +208,12 @@ reasons to ignore Ethernet frames. .It Va dev.bnxt.X.hwstats.rxq0.tpa_* statistics related to HW LRO. .It Va dev.bnxt.X.hw_lro.* -Enable / Disable HW LRO feature. Defaults to disable. +Enable / Disable HW LRO feature. +Defaults to disable. Enabling HW LRO could cause issues when forwarding is enabled on host. .It Va dev.bnxt.X.fc -Enable / Disable Flow Control feature. Defaults to Enable +Enable / Disable Flow Control feature. +Defaults to Enable .El .Sh DIAGNOSTICS .Bl -diag @@ -245,8 +247,8 @@ device driver first appeared in The .Nm driver was written by -.An Jack Vogel Aq Mt jfvogel@gmail.com -and +.An Jack Vogel Aq Mt jfvogel@gmail.com +and .An Stephen Hurd Aq Mt shurd@freebsd.org , and is currently maintained by .An Broadcom Limited Aq Mt freebsd.pdl@broadcom.com . Modified: head/share/man/man4/bridge.4 ============================================================================== --- head/share/man/man4/bridge.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/bridge.4 Fri May 1 10:02:38 2020 (r360527) @@ -35,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 01, 2020 +.Dd February 1, 2020 .Dt IF_BRIDGE 4 .Os .Sh NAME Modified: head/share/man/man4/bwi.4 ============================================================================== --- head/share/man/man4/bwi.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/bwi.4 Fri May 1 10:02:38 2020 (r360527) @@ -140,7 +140,9 @@ driver first appeared in .An -nosplit The .Nm -driver was written for DragonFly BSD by +driver was written for +.Dx +by .An Sepherosa Ziehau and subsequently ported to .Fx . Modified: head/share/man/man4/bxe.4 ============================================================================== --- head/share/man/man4/bxe.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/bxe.4 Fri May 1 10:02:38 2020 (r360527) @@ -164,7 +164,7 @@ Enable/Disable 4-tuple RSS for UDP: 0=DISABLED, 1=ENAB .Pp Special care must be taken when modifying the number of queues and receive buffers. -FreeBSD imposes a limit on the maximum number of +.Fx imposes a limit on the maximum number of .Xr mbuf 9 allocations. If buffer allocations fail, the interface initialization will fail Modified: head/share/man/man4/cyapa.4 ============================================================================== --- head/share/man/man4/cyapa.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/cyapa.4 Fri May 1 10:02:38 2020 (r360527) @@ -210,7 +210,9 @@ file: .An -nosplit The original .Nm -driver was written for DragonFly BSD by +driver was written for +.Dx +by .An Matthew Dillon . .Pp It has been ported, modified, and enhanced for Modified: head/share/man/man4/hv_vss.4 ============================================================================== --- head/share/man/man4/hv_vss.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/hv_vss.4 Fri May 1 10:02:38 2020 (r360527) @@ -52,11 +52,14 @@ struct hv_vss_opt_msg { .Ed .Sh DESCRIPTION The freeze or thaw functionality of application is important to guarantee -the application consistent backup. On windows platform, VSS is defined to do -live backup. But for VM guest running on Hyper-V, the corresponding VSS is -not defined yet. For example, a running database server instance, it knows when the -applications' freeze/thaw should start or finish. But it is not aware of -the freeze/thaw notification from Hyper-V host. The +the application consistent backup. +On windows platform, VSS is defined to do live backup. +But for VM guest running on Hyper-V, the corresponding VSS is +not defined yet. +For example, a running database server instance, it knows when the +applications' freeze/thaw should start or finish. +But it is not aware of the freeze/thaw notification from Hyper-V host. +The .Nm is designed to notify application freeze/thaw request. Thus, it plays a role of broker to forward the freeze/thaw command from Hyper-V host @@ -67,23 +70,25 @@ VM, and sends the result back to Hyper-V host. Generally, .Xr hv_vss_daemon 8 takes the responsibility to freeze/thaw UFS file system, -and it is automatically launched after system boots. When Hyper-V host wants to -take a snapshot of the +and it is automatically launched after system boots. +When Hyper-V host wants to take a snapshot of the .Fx VM, it will first send VSS capability check to .Fx -VM. The +VM. +The .Nm received the request and forward the request to userland application if it is -registered. Only after +registered. +Only after .Nm received the VSS_SUCCESS response from application, the .Xr hv_vss_daemon 8 -will be informed to check whether file system freeze/thaw is supported. Any error -occurs during this period, +will be informed to check whether file system freeze/thaw is supported. +Any error occurs during this period, .Nm -will inform Hyper-V host that VSS is not supported. In addition, there is a default -timeout limit before sending response to Hyper-V host. +will inform Hyper-V host that VSS is not supported. +In addition, there is a default timeout limit before sending response to Hyper-V host. If the total response time from application and .Xr hv_vss_daemon 8 exceeds this value, timeout @@ -93,20 +98,20 @@ After Hyper-V host confirmed the .Fx VM supports VSS, it will send freeze request to VM, and .Nm -will first forward it to application. After application finished freezing, it should -inform +will first forward it to application. +After application finished freezing, it should inform .Nm and file system level freezing will be triggered by -.Xr hv_vss_daemon 8 . After all freezing -on both application and +.Xr hv_vss_daemon 8 . +After all freezing on both application and .Xr hv_vss_daemon 8 were finished, the .Nm -will inform Hyper-V host that freezing is done. Of course, there is a timeout limit as -same as VSS capability is set to make sure freezing on +will inform Hyper-V host that freezing is done. +Of course, there is a timeout limit as same as VSS capability is set to make sure freezing on .Fx -VM is not hang. If there is any error occurs or timeout happened, the freezing is failed -on Hyper-V side. +VM is not hang. +If there is any error occurs or timeout happened, the freezing is failed on Hyper-V side. .Pp Hyper-V host will send thaw request after taking the snapshot, typically, this period is very short in order not to block the running application. @@ -114,17 +119,20 @@ very short in order not to block the running applicati firstly thaw the file system by notifying .Xr hv_vss_daemon 8 , then notifies user registered -application. There is also a timeout check before sending response to Hyper-V host. +application. +There is also a timeout check before sending response to Hyper-V host. .Pp All the default timeout limit used in VSS capability check, freeze or thaw is the same. It is 15 seconds currently. .Sh NOTES .Nm -only support UFS currently. If any of file system partition is non UFS, the VSS capability -check will fail. If application does not register VSS, +only support UFS currently. +If any of file system partition is non UFS, the VSS capability check will fail. +If application does not register VSS, .Nm -only support backup for file system level consistent. The device should be closed before it -was opened again. If you want to simultaneously open "/dev/hv_appvss_dev" two or more times, +only support backup for file system level consistent. +The device should be closed before it was opened again. +If you want to simultaneously open "/dev/hv_appvss_dev" two or more times, an error (-1) will be returned, and errno was set. .Pp If Modified: head/share/man/man4/ig4.4 ============================================================================== --- head/share/man/man4/ig4.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/ig4.4 Fri May 1 10:02:38 2020 (r360527) @@ -71,7 +71,9 @@ device with the same unit number. .An -nosplit The .Nm -driver was written for DragonFly BSD by +driver was written for +.Dx +by .An Matthew Dillon and subsequently ported to .Fx Modified: head/share/man/man4/pchtherm.4 ============================================================================== --- head/share/man/man4/pchtherm.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/pchtherm.4 Fri May 1 10:02:38 2020 (r360527) @@ -35,7 +35,7 @@ .Sh DESCRIPTION The .Nm -driver provides access to sensor data and configuration +driver provides access to sensor data and configuration installed in Intel PCH chipset. .Nm configuration register. @@ -60,7 +60,7 @@ dev.pchtherm.0.%pnpinfo: vendor=0x8086 device=0x9d31 s dev.pchtherm.0.%location: slot=20 function=2 dbsf=pci0:0:20:2 dev.pchtherm.0.%driver: pchtherm dev.pchtherm.0.%desc: Skylake PCH Thermal Subsystem -dev.pchtherm.%parent: +dev.pchtherm.%parent: .Ed .Bl -tag -width ".Va dev.pchtherm.%d.pch_hot_level" .It Va dev.pchtherm.%d.temperature @@ -99,7 +99,7 @@ This value is not appear when this feature is disabled .Pp Please check the PCH datasheets for more details. .Pp -.Sh CAVEAT +.Sh CAVEATS All values are read-only. And it do not support event interrupt for now. .Sh SEE ALSO Modified: head/share/man/man4/ppbus.4 ============================================================================== --- head/share/man/man4/ppbus.4 Fri May 1 09:50:36 2020 (r360526) +++ head/share/man/man4/ppbus.4 Fri May 1 10:02:38 2020 (r360527) @@ -95,7 +95,7 @@ parallel port model. Consequently, for the i386 implementation of ppbus, most of the services provided by ppc are macros for inb() and outb() calls. -But, for an other architecture, accesses to one of our logical +But, for another architecture, accesses to one of our logical registers (data, status, control...) may require more than one I/O access. .Ss Description The parallel port may operate in the following modes: From owner-svn-src-head@freebsd.org Fri May 1 10:14: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 965252D160B; Fri, 1 May 2020 10:14:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49D7Qt3WZPz4LK9; Fri, 1 May 2020 10:14:46 +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 741156A05; Fri, 1 May 2020 10:14:46 +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 041AEkUW079418; Fri, 1 May 2020 10:14:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041AEkHe079417; Fri, 1 May 2020 10:14:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202005011014.041AEkHe079417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 May 2020 10:14:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360528 - 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: 360528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 10:14:46 -0000 Author: hselasky Date: Fri May 1 10:14:45 2020 New Revision: 360528 URL: https://svnweb.freebsd.org/changeset/base/360528 Log: Implement kstrtou64() in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) 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 Fri May 1 10:02:38 2020 (r360527) +++ head/sys/compat/linuxkpi/common/include/linux/kernel.h Fri May 1 10:14:45 2020 (r360528) @@ -390,6 +390,21 @@ kstrtou32(const char *cp, unsigned int base, u32 *res) } static inline int +kstrtou64(const char *cp, unsigned int base, u64 *res) +{ + char *end; + + *res = strtouq(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + return (0); +} + +static inline int kstrtobool(const char *s, bool *res) { int len; From owner-svn-src-head@freebsd.org Fri May 1 10:18: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 4F0832D1887; Fri, 1 May 2020 10:18:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49D7Vm1Md4z4Lc1; Fri, 1 May 2020 10:18:08 +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 2A1A36A1A; Fri, 1 May 2020 10:18:08 +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 041AI8xn079669; Fri, 1 May 2020 10:18:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041AI8K1079668; Fri, 1 May 2020 10:18:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202005011018.041AI8K1079668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 May 2020 10:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360529 - 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: 360529 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 10:18:08 -0000 Author: hselasky Date: Fri May 1 10:18:07 2020 New Revision: 360529 URL: https://svnweb.freebsd.org/changeset/base/360529 Log: Implement more lockdep macros in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/lockdep.h Modified: head/sys/compat/linuxkpi/common/include/linux/lockdep.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/lockdep.h Fri May 1 10:14:45 2020 (r360528) +++ head/sys/compat/linuxkpi/common/include/linux/lockdep.h Fri May 1 10:18:07 2020 (r360529) @@ -36,6 +36,7 @@ struct lock_class_key { }; #define lockdep_set_class(lock, key) +#define lockdep_set_subclass(lock, sub) #define lockdep_set_class_and_name(lock, key, name) #define lockdep_set_current_reclaim_state(g) do { } while (0) #define lockdep_clear_current_reclaim_state() do { } while (0) @@ -60,6 +61,7 @@ lockdep_is_held(void *__m) __lock = __m; return (LOCK_CLASS(__lock)->lc_owner(__lock, &__td) != 0); } +#define lockdep_is_held_type(_m, _t) lockdep_is_held(_m) #else #define lockdep_assert_held(m) do { } while (0) @@ -67,6 +69,7 @@ lockdep_is_held(void *__m) #define lockdep_assert_held_once(m) do { } while (0) #define lockdep_is_held(m) 1 +#define lockdep_is_held_type(_m, _t) 1 #endif #define might_lock(m) do { } while (0) @@ -75,5 +78,8 @@ lockdep_is_held(void *__m) #define lock_acquire(...) do { } while (0) #define lock_release(...) do { } while (0) #define lock_acquire_shared_recursive(...) do { } while (0) + +#define mutex_acquire(...) do { } while (0) +#define mutex_release(...) do { } while (0) #endif /* _LINUX_LOCKDEP_H_ */ From owner-svn-src-head@freebsd.org Fri May 1 10:25: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 BD3262D1E58; Fri, 1 May 2020 10:25:07 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49D7fq4dh8z4MJ1; Fri, 1 May 2020 10:25:07 +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 9A5996BE8; Fri, 1 May 2020 10:25:07 +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 041AP74T085494; Fri, 1 May 2020 10:25:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041AP7Di085493; Fri, 1 May 2020 10:25:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202005011025.041AP7Di085493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 May 2020 10:25:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360530 - 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: 360530 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 10:25:07 -0000 Author: hselasky Date: Fri May 1 10:25:07 2020 New Revision: 360530 URL: https://svnweb.freebsd.org/changeset/base/360530 Log: Implement DIV64_U64_ROUND_UP() in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/math64.h Modified: head/sys/compat/linuxkpi/common/include/linux/math64.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/math64.h Fri May 1 10:18:07 2020 (r360529) +++ head/sys/compat/linuxkpi/common/include/linux/math64.h Fri May 1 10:25:07 2020 (r360530) @@ -91,4 +91,13 @@ mul_u32_u32(uint32_t a, uint32_t b) return ((uint64_t)a * b); } +static inline uint64_t +div64_u64_round_up(uint64_t dividend, uint64_t divisor) +{ + return ((dividend + divisor - 1) / divisor); +} + +#define DIV64_U64_ROUND_UP(...) \ + div64_u64_round_up(__VA_ARGS__) + #endif /* _LINUX_MATH64_H */ From owner-svn-src-head@freebsd.org Fri May 1 10:28: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 9D1092D1F0E; Fri, 1 May 2020 10:28:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49D7kY3jb2z4MRc; Fri, 1 May 2020 10:28:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 760766BE9; Fri, 1 May 2020 10:28:21 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041ASLJi085782; Fri, 1 May 2020 10:28:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041ASLXs085781; Fri, 1 May 2020 10:28:21 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202005011028.041ASLXs085781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 May 2020 10:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360531 - 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: 360531 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 10:28:21 -0000 Author: hselasky Date: Fri May 1 10:28:21 2020 New Revision: 360531 URL: https://svnweb.freebsd.org/changeset/base/360531 Log: Implement mutex_lock_killable() in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/mutex.h Fri May 1 10:25:07 2020 (r360530) +++ head/sys/compat/linuxkpi/common/include/linux/mutex.h Fri May 1 10:28:21 2020 (r360531) @@ -66,6 +66,18 @@ typedef struct mutex { linux_mutex_lock_interruptible(_m); \ }) +/* + * Reuse the interruptable method since the SX + * lock handles both signals and interrupts: + */ +#define mutex_lock_killable(_m) ({ \ + MUTEX_SKIP() ? 0 : \ + linux_mutex_lock_interruptible(_m); \ +}) + +#define mutex_lock_killable_nested(_m, _sub) \ + mutex_lock_killable(_m) + #define mutex_unlock(_m) do { \ if (MUTEX_SKIP()) \ break; \ From owner-svn-src-head@freebsd.org Fri May 1 10: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 8DC532D218A; Fri, 1 May 2020 10:32:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49D7qb3FnHz4MwN; Fri, 1 May 2020 10:32:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AF606DC0; Fri, 1 May 2020 10:32:43 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041AWhVE091842; Fri, 1 May 2020 10:32:43 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041AWhcK091841; Fri, 1 May 2020 10:32:43 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202005011032.041AWhcK091841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 May 2020 10:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360532 - 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: 360532 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 10:32:43 -0000 Author: hselasky Date: Fri May 1 10:32:42 2020 New Revision: 360532 URL: https://svnweb.freebsd.org/changeset/base/360532 Log: Implement more PCI-express bandwidth functions in the LinuxKPI. Submitted by: ashafer_badland.io (Austin Shafer) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/pci.h Fri May 1 10:28:21 2020 (r360531) +++ head/sys/compat/linuxkpi/common/include/linux/pci.h Fri May 1 10:32:42 2020 (r360532) @@ -954,6 +954,47 @@ pcie_get_width_cap(struct pci_dev *dev) return (PCIE_LNK_WIDTH_UNKNOWN); } +static inline int +pcie_get_mps(struct pci_dev *dev) +{ + return (pci_get_max_payload(dev->dev.bsddev)); +} + +static inline uint32_t +PCIE_SPEED2MBS_ENC(enum pci_bus_speed spd) +{ + + switch(spd) { + case PCIE_SPEED_16_0GT: + return (16000 * 128 / 130); + case PCIE_SPEED_8_0GT: + return (8000 * 128 / 130); + case PCIE_SPEED_5_0GT: + return (5000 * 8 / 10); + case PCIE_SPEED_2_5GT: + return (2500 * 8 / 10); + default: + return (0); + } +} + +static inline uint32_t +pcie_bandwidth_available(struct pci_dev *pdev, + struct pci_dev **limiting, + enum pci_bus_speed *speed, + enum pcie_link_width *width) +{ + enum pci_bus_speed nspeed = pcie_get_speed_cap(pdev); + enum pcie_link_width nwidth = pcie_get_width_cap(pdev); + + if (speed) + *speed = nspeed; + if (width) + *width = nwidth; + + return (nwidth * PCIE_SPEED2MBS_ENC(nspeed)); +} + /* * The following functions can be used to attach/detach the LinuxKPI's * PCI device runtime. The pci_driver and pci_device_id pointer is From owner-svn-src-head@freebsd.org Fri May 1 11:36:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C83FE2D3091; Fri, 1 May 2020 11:36:40 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49D9FN3mpBz4QM3; Fri, 1 May 2020 11:36:40 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7CA4B7952; Fri, 1 May 2020 11:36:40 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041BaeJp028670; Fri, 1 May 2020 11:36:40 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041Baeio028668; Fri, 1 May 2020 11:36:40 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <202005011136.041Baeio028668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Fri, 1 May 2020 11:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360533 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 360533 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 11:36:40 -0000 Author: bcr (doc committer) Date: Fri May 1 11:36:39 2020 New Revision: 360533 URL: https://svnweb.freebsd.org/changeset/base/360533 Log: Fix typo in r360492: appeard -> appeared Reported by: trasz (via IRC) Modified: head/share/man/man9/disk.9 head/share/man/man9/epoch.9 Modified: head/share/man/man9/disk.9 ============================================================================== --- head/share/man/man9/disk.9 Fri May 1 10:32:42 2020 (r360532) +++ head/share/man/man9/disk.9 Fri May 1 11:36:39 2020 (r360533) @@ -244,7 +244,7 @@ structure for this disk device. .Sh HISTORY The .Nm kernel disk storage API -first appeard in +first appeared in .Fx 4.9 . .Sh SEE ALSO .Xr GEOM 4 , Modified: head/share/man/man9/epoch.9 ============================================================================== --- head/share/man/man9/epoch.9 Fri May 1 10:32:42 2020 (r360532) +++ head/share/man/man9/epoch.9 Fri May 1 11:36:39 2020 (r360533) @@ -284,7 +284,7 @@ kernel programming interface is under development and .Sh HISTORY The .Nm -framework first appeard in +framework first appeared in .Fx 11.0 . .Sh SEE ALSO .Xr locking 9 , From owner-svn-src-head@freebsd.org Fri May 1 14:30: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 D68632D701A; Fri, 1 May 2020 14:30:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DF6W5KBwz4cd4; Fri, 1 May 2020 14:30:59 +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 B1DFC9979; Fri, 1 May 2020 14:30:59 +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 041EUx3N035155; Fri, 1 May 2020 14:30:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041EUx7b035154; Fri, 1 May 2020 14:30:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202005011430.041EUx7b035154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 1 May 2020 14:30:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360535 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360535 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 14:30:59 -0000 Author: emaste Date: Fri May 1 14:30:59 2020 New Revision: 360535 URL: https://svnweb.freebsd.org/changeset/base/360535 Log: correct procctl(PROC_PROTMAX_STATUS _NOFORCE return Previously procctl(PROC_PROTMAX_STATUS, ... used the PROC_ASLR_NOFORCE macro for the "system-wide configured policy" status, instead of PROC_PROTMAX_NOFORCE. They both have a value of 3, so no functional change. Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_procctl.c Modified: head/sys/kern/kern_procctl.c ============================================================================== --- head/sys/kern/kern_procctl.c Fri May 1 13:47:13 2020 (r360534) +++ head/sys/kern/kern_procctl.c Fri May 1 14:30:59 2020 (r360535) @@ -449,7 +449,7 @@ protmax_status(struct thread *td, struct proc *p, int switch (p->p_flag2 & (P2_PROTMAX_ENABLE | P2_PROTMAX_DISABLE)) { case 0: - d = PROC_ASLR_NOFORCE; + d = PROC_PROTMAX_NOFORCE; break; case P2_PROTMAX_ENABLE: d = PROC_PROTMAX_FORCE_ENABLE; From owner-svn-src-head@freebsd.org Fri May 1 15:12: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 7E0842D8082; Fri, 1 May 2020 15:12:37 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DG2Y2cHlz3Bnv; Fri, 1 May 2020 15:12:36 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f50.google.com with SMTP id j26so2822277ots.0; Fri, 01 May 2020 08:12:36 -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=xqcrio596Dq9xJH/TthPNYrXc0UPcTq1R/08/+FgMZ4=; b=ksZs0UaLwe9gW2Layt7OtjEnj/z5GuhgPF2PrsJJK920hOrXqaHEThX5Pjn6DYa3/l 97ikCUyN8TH2wLoGDh99kkBhJk1FN6OKawNGmFyaXdW7e+NBVAGj5vO3qjGi8b3fF3XF 0TPArGVj93NvqGL2kNg/VqhMUDzNdxBG4yjrip3qkoEAqvBy0kjF4TUhdR+IcwAhMLHz oUlOoUyuNN6m/NeIaOU7X6NIv+r07QQOAewUBRoxYTuHLWU/hdPdOcobMFy5Cdd+Auyd lHAPRcjfYD89BJmXtS0xu59NP2NUbqwsgDhZnCO6wLUlgfiaE2j8myzIWgMKgxJAC6hz spkQ== X-Gm-Message-State: AGi0PuZPttYEtwhm/KQV0HZS8ksmvz1EgkQY8j9T4SXi3Ze7Hi8qZpZu Puqpf1UmQQX6Kv4Qd0CYfcyydWAd X-Google-Smtp-Source: APiQypIC7D1/47Yha7Enfud5Q4UKLyCuRKUlyw7ovFkX8X+9OFJQLXiEuAD1rQHua8mWYQJ4riHCow== X-Received: by 2002:a9d:22e4:: with SMTP id y91mr3900046ota.336.1588345955464; Fri, 01 May 2020 08:12:35 -0700 (PDT) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com. [209.85.167.173]) by smtp.gmail.com with ESMTPSA id i196sm6310oib.8.2020.05.01.08.12.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 May 2020 08:12:35 -0700 (PDT) Received: by mail-oi1-f173.google.com with SMTP id o24so47089oic.0; Fri, 01 May 2020 08:12:35 -0700 (PDT) X-Received: by 2002:a05:6808:28b:: with SMTP id z11mr2729oic.135.1588345954875; Fri, 01 May 2020 08:12:34 -0700 (PDT) MIME-Version: 1.0 References: <202005010126.0411QaEF047318@repo.freebsd.org> In-Reply-To: <202005010126.0411QaEF047318@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 1 May 2020 08:12:24 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r360517 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/dispatcher components/executer include To: Jung-uk Kim Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 49DG2Y2cHlz3Bnv X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 15:12:37 -0000 Thanks, this looks like a big improvement! On Thu, Apr 30, 2020 at 18:26 Jung-uk Kim wrote: > Author: jkim > Date: Fri May 1 01:26:36 2020 > New Revision: 360517 > URL: https://svnweb.freebsd.org/changeset/base/360517 > > Log: > MFV: r360512 > > Merge ACPICA 20200430. > > --- head/sys/contrib/dev/acpica/changes.txt Fri May 1 00:41:41 2020 > (r360516) > +++ head/sys/contrib/dev/acpica/changes.txt Fri May 1 01:26:36 2020 > (r360517) > @@ -1,4 +1,61 @@ > ---------------------------------------- > + > + > +30 April 2020. Summary of changes for version 20200430: > ... > +2) iASL Compiler/Disassembler and ACPICA tools: > + > +iASL DataTable Compiler: Fixed a segfault on errors that aren't directly > +associated with a field. > + > +Disassembler: has been made more resilient so that it will continue to > +parse AML even if the AML generates ACPI namespace errors. This enables > +iASL to disassemble some AML that may have been compiled using older > +versions of iASL that no longer compile with newer versions of iASL. > + > +iASL: Fixed the required parameters for _NIH and _NIG. Previously, there > +was a mixup where _NIG required one parameter and _NIH required zero > +parameters. This change swaps these parameter requirements. Now it is > +required that _NIH must be called with one parameter and _NIG requires > +zero parameters. > + > +iASL: Allow use of undefined externals as long as they are protected by > +an if (CondRefOf (...)) block when compiling multiple definition blocks. > + > +iASL: Fixed the type override behavior of named objects that are declared > +as External. External declarations will no longer override the type of > +the actual definition if it already exists. > + > +AcpiNames: Added setargv.obj to the MSVC 2017 link sequence to enable > +command line wildcard support on Windows. Note: the AcpiNames utility is > +essentially redundant with the AcpiExec utility (using the "namespace" > +command) and is therefore deprecated. It will be removed in future > +releases of ACPICA. > + > +Disassembler: ignore AE_ALREADY_EXISTS status when parsing create* > +operators. The disassembler is intended to emit existing ASL code as-is. > +Therefore, error messages emitted during disassembly should be ignored or > +handled in a way such that the disassembler can continue to parse the > +AML. This change ignores AE_ALREADY_EXISTS errors during the deferred Op > +parsing for create operators in order to complete parsing ASL termlists. All of the above should improve acpidump disassembler utility significantly. Best, Conrad From owner-svn-src-head@freebsd.org Fri May 1 16: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 8E6E12DA07F; Fri, 1 May 2020 16:47:54 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DJ8V3HG8z3JRj; Fri, 1 May 2020 16:47:54 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B4BFB3F3; Fri, 1 May 2020 16:47:54 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041GlscG020887; Fri, 1 May 2020 16:47:54 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041GlsY9020886; Fri, 1 May 2020 16:47:54 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202005011647.041GlsY9020886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 1 May 2020 16:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360536 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 360536 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 16:47:54 -0000 Author: bdragon Date: Fri May 1 16:47:54 2020 New Revision: 360536 URL: https://svnweb.freebsd.org/changeset/base/360536 Log: Remove sparc relocation support from reloc_elf.c. It got missed in the sparc64 removal. Modified: head/stand/common/reloc_elf.c Modified: head/stand/common/reloc_elf.c ============================================================================== --- head/stand/common/reloc_elf.c Fri May 1 14:30:59 2020 (r360535) +++ head/stand/common/reloc_elf.c Fri May 1 16:47:54 2020 (r360536) @@ -52,32 +52,7 @@ int __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len) { -#ifdef __sparc__ - Elf_Size w; - const Elf_Rela *a; - - switch (reltype) { - case ELF_RELOC_RELA: - a = reldata; - if (relbase + a->r_offset >= dataaddr && - relbase + a->r_offset < dataaddr + len) { - switch (ELF_R_TYPE(a->r_info)) { - case R_SPARC_RELATIVE: - w = relbase + a->r_addend; - bcopy(&w, (u_char *)data + (relbase + - a->r_offset - dataaddr), sizeof(w)); - break; - default: - printf("\nunhandled relocation type %u\n", - (u_int)ELF_R_TYPE(a->r_info)); - return (EFTYPE); - } - } - break; - } - - return (0); -#elif (defined(__i386__) || defined(__amd64__)) && __ELF_WORD_SIZE == 64 +#if (defined(__i386__) || defined(__amd64__)) && __ELF_WORD_SIZE == 64 Elf64_Addr *where, val; Elf_Addr addend, addr; Elf_Size rtype, symidx; From owner-svn-src-head@freebsd.org Fri May 1 16:56: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 4FAE62DA324; Fri, 1 May 2020 16:56:37 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DJLY1GL7z3K00; Fri, 1 May 2020 16:56:37 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 21115B5E2; Fri, 1 May 2020 16:56:37 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041Gua1k027265; Fri, 1 May 2020 16:56:36 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041Gua1w027264; Fri, 1 May 2020 16:56:36 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202005011656.041Gua1w027264@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Fri, 1 May 2020 16:56:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360537 - head/stand/powerpc/boot1.chrp X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: head/stand/powerpc/boot1.chrp X-SVN-Commit-Revision: 360537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 16:56:37 -0000 Author: bdragon Date: Fri May 1 16:56:36 2020 New Revision: 360537 URL: https://svnweb.freebsd.org/changeset/base/360537 Log: [PowerPC] Set fixed boot1.elf load address Due to the way claiming works, we need to ensure on AIM OFW machines that we don't have overlapping ranges on any step of the load. Load boot1.elf at 0x38000 so it will not overlap with anything even if the entire PReP partition gets loaded by OFW. Tested on an iBook G4, a PowerBook G4, a PowerMac G5, and qemu pseries. (qemu pseries is broken without this patch due to the high address used by lld10.) Reviewed by: adalava Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D24623 Modified: head/stand/powerpc/boot1.chrp/Makefile Modified: head/stand/powerpc/boot1.chrp/Makefile ============================================================================== --- head/stand/powerpc/boot1.chrp/Makefile Fri May 1 16:47:54 2020 (r360536) +++ head/stand/powerpc/boot1.chrp/Makefile Fri May 1 16:56:36 2020 (r360537) @@ -10,7 +10,20 @@ FILES= boot1.hfs SRCS= boot1.c ashldi3.c syncicache.c CFLAGS+=-I${LDRSRC} -LDFLAGS=-nostdlib -static -Wl,-N +# Load boot1.elf below kernel. +# +# Due to limitiations in the way we load stuff, we have to avoid reusing +# memory until the kernel MMU code has taken over. +# +# 0x38000 is high enough to not interfere with the trap area, but low +# enough that it doesn't bump into the kernel area starting at 0x100000, +# even if the entire partition gets used as the load size by a buggy OFW. +# +# In theory 0xf0000 would work too under the current 64k size limit for +# boot1.elf defined in the HFS template, but sometimes boot1.elf is written +# directly to the PReP partition. +# +LDFLAGS=-nostdlib -static -Wl,-N -Wl,-Ttext=0x38000 .PATH: ${SYSDIR}/libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR} From owner-svn-src-head@freebsd.org Fri May 1 17:16: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 1C7A12DAAE1; Fri, 1 May 2020 17:16:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DJp171MKz3LjP; Fri, 1 May 2020 17:16:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB5DDB9C4; Fri, 1 May 2020 17:16:57 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041HGvHH040094; Fri, 1 May 2020 17:16:57 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041HGvY9040093; Fri, 1 May 2020 17:16:57 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005011716.041HGvY9040093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 17:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360538 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 360538 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 17:16:58 -0000 Author: imp Date: Fri May 1 17:16:57 2020 New Revision: 360538 URL: https://svnweb.freebsd.org/changeset/base/360538 Log: When we have an invalid build option, don't rm -rf the current directory. Add a quick sanity check to objdir before using it. It must start with /. If there was a make error getting it, report that and continue with the next target. If there was anything else, bail out. Modified: head/tools/boot/universe.sh Modified: head/tools/boot/universe.sh ============================================================================== --- head/tools/boot/universe.sh Fri May 1 16:56:36 2020 (r360537) +++ head/tools/boot/universe.sh Fri May 1 17:16:57 2020 (r360538) @@ -19,6 +19,12 @@ # Output is put into _.boot.$TARGET_ARCH.log in sys.boot. # +die() +{ + echo $* + exit 1 +} + dobuild() { local ta=$1 @@ -27,6 +33,12 @@ dobuild() echo -n "Building $ta ${opt} ... " objdir=$(make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make -V .OBJDIR" | tail -1) + case ${objdir} in + /*) ;; + make*) echo Error message from make: $objdir + continue ;; + *) die Crazy object dir: $objdir ;; + esac rm -rf ${objdir} if ! make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make clean cleandepend cleandir obj depend" \ > $lf 2>&1; then @@ -116,4 +128,3 @@ for i in \ ta=${i##*/} dobuild $ta _.boot.${ta}.debug.log "LOADER_DEBUG=yes" done - From owner-svn-src-head@freebsd.org Fri May 1 17:17: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 7E2102DAB03; Fri, 1 May 2020 17:17:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DJp62Hkjz3LlF; Fri, 1 May 2020 17:17:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E1BFB9C5; Fri, 1 May 2020 17:17:02 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041HH2Sx040153; Fri, 1 May 2020 17:17:02 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041HH21A040152; Fri, 1 May 2020 17:17:02 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005011717.041HH21A040152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 17:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360539 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 360539 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 17:17:02 -0000 Author: imp Date: Fri May 1 17:17:01 2020 New Revision: 360539 URL: https://svnweb.freebsd.org/changeset/base/360539 Log: Catch up to arm/arm and sparc64 removal. Modified: head/tools/boot/universe.sh Modified: head/tools/boot/universe.sh ============================================================================== --- head/tools/boot/universe.sh Fri May 1 17:16:57 2020 (r360538) +++ head/tools/boot/universe.sh Fri May 1 17:17:01 2020 (r360539) @@ -77,12 +77,11 @@ done # Default build for a goodly selection of architectures for i in \ amd64/amd64 \ - arm/arm arm/armv7 \ + arm/armv7 \ arm64/aarch64 \ i386/i386 \ mips/mips mips/mips64 \ powerpc/powerpc powerpc/powerpc64 \ - sparc64/sparc64 \ ; do ta=${i##*/} dobuild $ta _.boot.${ta}.log "" @@ -91,12 +90,11 @@ done # Default build for a goodly selection of architectures with Lua for i in \ amd64/amd64 \ - arm/arm arm/armv7 \ + arm/armv7 \ arm64/aarch64 \ i386/i386 \ mips/mips mips/mips64 \ powerpc/powerpc powerpc/powerpc64 \ - sparc64/sparc64 \ ; do ta=${i##*/} dobuild $ta _.boot.${ta}.lua.log "MK_LOADEDER_LUA=yes MK_FORTH=no" @@ -106,7 +104,6 @@ done for i in \ amd64/amd64 \ i386/i386 \ - sparc64/sparc64 \ ; do ta=${i##*/} dobuild $ta _.boot.${ta}.no_zfs.log "MK_ZFS=no" @@ -119,12 +116,4 @@ for i in \ ; do ta=${i##*/} dobuild $ta _.boot.${ta}.firewire.log "MK_LOADER_FIREWIRE=yes" -done - -# Build with LOADER_DEBUG, only sparc64 does this. -for i in \ - sparc64/sparc64 \ - ; do - ta=${i##*/} - dobuild $ta _.boot.${ta}.debug.log "LOADER_DEBUG=yes" done From owner-svn-src-head@freebsd.org Fri May 1 17:50: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 531422DBC0E; Fri, 1 May 2020 17:50:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DKXZ1VQpz3PKw; Fri, 1 May 2020 17:50:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A4DEC118; Fri, 1 May 2020 17:50:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041HoMsr058950; Fri, 1 May 2020 17:50:22 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041HoMaV058949; Fri, 1 May 2020 17:50:22 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005011750.041HoMaV058949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 17:50:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360540 - head/stand/libofw X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libofw X-SVN-Commit-Revision: 360540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 17:50:22 -0000 Author: imp Date: Fri May 1 17:50:21 2020 New Revision: 360540 URL: https://svnweb.freebsd.org/changeset/base/360540 Log: Remove more stray sparc64 ifdefs. Also, dmabuf appears to only be set for sparc64 case, but there was a comment at its only use that says it was broken for some apple adapters. #ifdef it all of that out now that nothing sets it. Modified: head/stand/libofw/ofw_net.c Modified: head/stand/libofw/ofw_net.c ============================================================================== --- head/stand/libofw/ofw_net.c Fri May 1 17:17:01 2020 (r360539) +++ head/stand/libofw/ofw_net.c Fri May 1 17:50:21 2020 (r360540) @@ -73,7 +73,9 @@ struct netif_driver ofwnet = { static ihandle_t netinstance; +#ifdef BROKEN static void *dmabuf; +#endif static int ofwn_match(struct netif *nif, void *machdep_hint) @@ -110,10 +112,12 @@ ofwn_put(struct iodesc *desc, void *pkt, size_t len) #endif } +#ifdef BROKEN if (dmabuf) { bcopy(pkt, dmabuf, sendlen); pkt = dmabuf; } +#endif rv = OF_write(netinstance, pkt, len); @@ -203,11 +207,7 @@ ofwn_init(struct iodesc *desc, void *machdep_hint) if ((ch = strchr(path, ':')) != NULL) *ch = '\0'; netdev = OF_finddevice(path); -#ifdef __sparc64__ - if (OF_getprop(netdev, "mac-address", desc->myea, 6) == -1) -#else if (OF_getprop(netdev, "local-mac-address", desc->myea, 6) == -1) -#endif goto punt; printf("boot: ethernet address: %s\n", ether_sprintf(desc->myea)); @@ -220,20 +220,6 @@ ofwn_init(struct iodesc *desc, void *machdep_hint) #if defined(NETIF_DEBUG) printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance); #endif - -#ifndef __sparc64__ - dmabuf = NULL; - if (OF_call_method("dma-alloc", netinstance, 1, 1, (64 * 1024), &dmabuf) - < 0) { - printf("Failed to allocate DMA buffer (got %p).\n", dmabuf); - goto punt; - } - -#if defined(NETIF_DEBUG) - printf("ofwn_init: allocated DMA buffer: %p\n", dmabuf); -#endif -#endif - return; punt: From owner-svn-src-head@freebsd.org Fri May 1 17:50: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 39E252DBC2D; Fri, 1 May 2020 17:50:27 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DKXf5Tj5z3PMw; Fri, 1 May 2020 17:50:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F194C119; Fri, 1 May 2020 17:50:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041HoQvu059004; Fri, 1 May 2020 17:50:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041HoQeK059003; Fri, 1 May 2020 17:50:26 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005011750.041HoQeK059003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 17:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360541 - head/tools/boot X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/tools/boot X-SVN-Commit-Revision: 360541 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 17:50:28 -0000 Author: imp Date: Fri May 1 17:50:26 2020 New Revision: 360541 URL: https://svnweb.freebsd.org/changeset/base/360541 Log: Spell LOADER correctly so we test lua build. Modified: head/tools/boot/universe.sh Modified: head/tools/boot/universe.sh ============================================================================== --- head/tools/boot/universe.sh Fri May 1 17:50:21 2020 (r360540) +++ head/tools/boot/universe.sh Fri May 1 17:50:26 2020 (r360541) @@ -97,7 +97,7 @@ for i in \ powerpc/powerpc powerpc/powerpc64 \ ; do ta=${i##*/} - dobuild $ta _.boot.${ta}.lua.log "MK_LOADEDER_LUA=yes MK_FORTH=no" + dobuild $ta _.boot.${ta}.lua.log "MK_LOADER_LUA=yes MK_FORTH=no" done # Build w/o ZFS From owner-svn-src-head@freebsd.org Fri May 1 18:36: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 6E02D2DCFD1; Fri, 1 May 2020 18:36:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DLZ92LZLz3yTr; Fri, 1 May 2020 18:36:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 479A6CA71; Fri, 1 May 2020 18:36:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041IanC0090690; Fri, 1 May 2020 18:36:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041Ianpm090689; Fri, 1 May 2020 18:36:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005011836.041Ianpm090689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 18:36:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360543 - head/stand/libofw X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/stand/libofw X-SVN-Commit-Revision: 360543 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 18:36:49 -0000 Author: imp Date: Fri May 1 18:36:48 2020 New Revision: 360543 URL: https://svnweb.freebsd.org/changeset/base/360543 Log: Redo r360540 to retain the ifndef sparc code, not delete it. Also undo the BROKEN stuff, since it was based on the same misreading. Noticed by: Jens Schweikhardt Modified: head/stand/libofw/ofw_net.c Modified: head/stand/libofw/ofw_net.c ============================================================================== --- head/stand/libofw/ofw_net.c Fri May 1 18:27:14 2020 (r360542) +++ head/stand/libofw/ofw_net.c Fri May 1 18:36:48 2020 (r360543) @@ -73,9 +73,7 @@ struct netif_driver ofwnet = { static ihandle_t netinstance; -#ifdef BROKEN static void *dmabuf; -#endif static int ofwn_match(struct netif *nif, void *machdep_hint) @@ -112,12 +110,10 @@ ofwn_put(struct iodesc *desc, void *pkt, size_t len) #endif } -#ifdef BROKEN if (dmabuf) { bcopy(pkt, dmabuf, sendlen); pkt = dmabuf; } -#endif rv = OF_write(netinstance, pkt, len); @@ -220,6 +216,16 @@ ofwn_init(struct iodesc *desc, void *machdep_hint) #if defined(NETIF_DEBUG) printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance); #endif + dmabuf = NULL; + if (OF_call_method("dma-alloc", netinstance, 1, 1, (64 * 1024), &dmabuf) + < 0) { + printf("Failed to allocate DMA buffer (got %p).\n", dmabuf); + goto punt; + } +#if defined(NETIF_DEBUG) + printf("ofwn_init: allocated DMA buffer: %p\n", dmabuf); +#endif + return; punt: From owner-svn-src-head@freebsd.org Fri May 1 20:29: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 02FC52DEF2E; Fri, 1 May 2020 20:29:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DP4V63WVz44nh; Fri, 1 May 2020 20:29:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB13EDF9A; Fri, 1 May 2020 20:29:46 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041KTkKe059134; Fri, 1 May 2020 20:29:46 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041KTkVo059133; Fri, 1 May 2020 20:29:46 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005012029.041KTkVo059133@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 20:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360546 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 360546 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 20:29:47 -0000 Author: imp Date: Fri May 1 20:29:46 2020 New Revision: 360546 URL: https://svnweb.freebsd.org/changeset/base/360546 Log: Various improvements to this man page: o Be consistent about device-id and namespace-id o Use consistent arg markup for these o document you can use disk names too o document nsid command better o document the idenntify command o add a couple of examples. Differential Revision: https://reviews.freebsd.org/D24638 Modified: head/sbin/nvmecontrol/nvmecontrol.8 Modified: head/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.8 Fri May 1 20:20:23 2020 (r360545) +++ head/sbin/nvmecontrol/nvmecontrol.8 Fri May 1 20:29:46 2020 (r360546) @@ -1,4 +1,5 @@ .\" +.\" Copyright (c) 2020 Warner Losh .\" Copyright (c) 2018-2019 Alexander Motin .\" Copyright (c) 2012 Intel Corporation .\" All rights reserved. @@ -34,7 +35,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 5, 2019 +.Dd April 30, 2020 .Dt NVMECONTROL 8 .Os .Sh NAME @@ -47,8 +48,8 @@ .Ic identify .Op Fl v .Op Fl x -.Aq device id -.Aq namespace id +.Op Fl n Ar nsid +.Aq Ar device-id | Ar namespace-id .Nm .Ic perftest .Aq Fl n Ar num_threads @@ -56,10 +57,10 @@ .Op Fl p .Aq Fl s Ar size_in_bytes .Aq Fl t Ar time_in_sec -.Aq namespace id +.Aq Ar namespace-id .Nm .Ic reset -.Aq controller id +.Aq Ar device-id .Nm .Ic logpage .Aq Fl p Ar page_id @@ -69,26 +70,25 @@ .Op Fl f Ar LSP .Op Fl i Ar LSI .Op Fl r -.Aq device id -.Aq namespace id +.Aq Ar device-id | Ar namespace-id .Nm .Ic ns active -.Aq device id +.Aq Ar device-id .Nm .Ic ns allocated -.Aq device id +.Aq Ar device-id .Nm .Ic ns attach .Aq Fl n Ar nsid .Aq Fl c Ar cntid -.Aq device id +.Aq Ar device-id .Nm .Ic ns attached .Aq Fl n Ar nsid -.Aq device id +.Aq Ar device-id .Nm .Ic ns controllers -.Aq device id +.Aq Ar device-id .Nm .Ic ns create .Aq Fl s Ar nsze @@ -100,33 +100,32 @@ .Op Fl l Ar pil .Op Fl L Ar flbas .Op Fl d Ar dps -.Aq device id +.Aq Ar device-id .Nm .Ic ns delete .Aq Fl n Ar nsid -.Aq device id +.Aq Ar device-id .Nm .Ic ns detach .Aq Fl n Ar nsid .Aq Fl c Ar cntid -.Aq device id +.Aq Ar device-id .Nm .Ic ns identify .Op Fl v .Op Fl x .Aq Fl n Ar nsid -.Aq device id +.Aq Ar device-id .Nm .Ic nsid -.Aq device id -.Aq namespace id +.Aq Ar device-id | Ar namespace-id .Nm .Ic resv acquire .Aq Fl c Ar crkey .Op Fl p Ar prkey .Aq Fl t Ar rtype .Aq Fl a Ar racqa -.Aq namespace id +.Aq Ar namespace-id .Nm .Ic resv register .Op Fl c Ar crkey @@ -134,25 +133,25 @@ .Aq Fl r Ar rrega .Op Fl i Ar iekey .Op Fl p Ar cptpl -.Aq namespace id +.Aq Ar namespace-id .Nm .Ic resv release .Aq Fl c Ar crkey .Aq Fl t Ar rtype .Aq Fl a Ar rrela -.Aq namespace id +.Aq Ar namespace-id .Nm .Ic resv report .Op Fl e .Op Fl v .Op Fl x -.Aq namespace id +.Aq Ar namespace-id .Nm .Ic firmware .Op Fl s Ar slot .Op Fl f Ar path_to_firmware .Op Fl a -.Aq device id +.Aq Ar device-id .Nm .Ic format .Op Fl f Ar fmt @@ -161,8 +160,7 @@ .Op Fl l Ar pil .Op Fl E .Op Fl C -.Aq device id -.Aq namespace id +.Aq Ar device-id | Ar namespace-id .Nm .Ic sanitize .Aq Fl a Ar sanact @@ -172,7 +170,7 @@ .Op Fl r .Op Fl I .Op Fl U -.Aq device id +.Aq Ar device-id .Nm .Ic power .Op Fl l @@ -181,25 +179,57 @@ .Nm .Ic wdc cap-diag .Op Fl o path_template -.Aq device id +.Aq Ar device-id .Nm .Ic wdc drive-log .Op Fl o path_template -.Aq device id +.Aq Ar device-id .Nm .Ic wdc get-crash-dump .Op Fl o path_template -.Aq device id +.Aq Ar device-id .\" .Nm .\" .Ic wdc purge -.\" .Aq device id +.\" .Aq device-id .\" .Nm .\" .Ic wdc purge-monitor -.\" .Aq device id +.\" .Aq device-id .Sh DESCRIPTION NVM Express (NVMe) is a storage protocol standard, for SSDs and other high-speed storage devices over PCI Express. .Pp +.Ss identify +The identify commands reports information from the drive's +.Dv IDENTIFY_CONTROLLER +if a +.Ar device-id +is specified. +It reports +.Dv IDENTIFY_NAMESPACE +data if a +.Ar namespace-id +is specified. +When used with disk names, the +.Dv IDENTIFY_NAMESPACE +data is reported, unless the namespace +.Ar nsid +is overridden with the +.Fl n +flag. +Then that namespace's data is reported, if it exists. +The command accepts the following parameters: +.Bl -tag -width 6n +.It Fl n +The namespace +.Aq nsid +to use instead of the namespace associated with the device. +A +.Ar nsid +of +.Dq 0 +is used to retrieve the +.Dv IDENTIFY_CONTROLLER +data associated with that drive. .Ss logpage The logpage command knows how to print log pages of various types. It also knows about vendor specific log pages from hgst/wdc and intel. @@ -250,6 +280,12 @@ will set Retain Asynchronous Event. Various namespace management commands. If namespace management is supported by device, allow list, create and delete namespaces, list, attach and detach controllers to namespaces. +.Ss nsid +Reports the namespace id and controller device associated with the +.Aq Ar namespace-id +or +.Aq Ar device-id +argument. .Ss resv acquire Acquire or preempt namespace reservation, using specified parameters: .Bl -tag -width 6n @@ -430,19 +466,54 @@ the drive's serial number and the type of dump it is f by .bin. These logs must be sent to the vendor for analysis. This tool only provides a way to extract them. +.Sh DEVICE NAMES +Where +.Aq Ar namespace-id +is required, you can use either the +.Pa nvmeXnsY +device, or the disk device such as +.Pa ndaZ +or +.Pa nvdZ . +The leading +.Pa /dev/ +is omitted. +Where +.Aq Ar device-id +is required, you can use either the +.Pa nvmeX +device, or the disk device such as +.Pa nda Z +or +.Pa nvdZ . +For commands that take an optional +.Aq nsid +you can use it to get information on other namespaces, or to query the +drive itself. +A +.Aq nsid +of +.Dq 0 +means query the drive itself. .Sh EXAMPLES .Dl nvmecontrol devlist .Pp Display a list of NVMe controllers and namespaces along with their device nodes. .Pp .Dl nvmecontrol identify nvme0 +.Dl nvmecontrol identify -n 0 nvd0 .Pp -Display a human-readable summary of the nvme0 IDENTIFY_CONTROLLER data. +Display a human-readable summary of the nvme0 +.Dv IDENTIFY_CONTROLLER +data. +In this example, nvd0 is connected to nvme0. .Pp .Dl nvmecontrol identify -x -v nvme0ns1 +.Dl nvmecontrol identify -x -v -n 1 nvme0 .Pp -Display an hexadecimal dump of the nvme0 IDENTIFY_NAMESPACE data for namespace -1. +Display an hexadecimal dump of the nvme0 +.Dv IDENTIFY_NAMESPACE +data for namespace 1. .Pp .Dl nvmecontrol perftest -n 32 -o read -s 512 -t 30 nvme0ns1 .Pp @@ -451,8 +522,10 @@ Each thread will issue a single 512 byte read command. Results are printed to stdout when 30 seconds expires. .Pp .Dl nvmecontrol reset nvme0 +.Dl nvmecontrol reset nda4 .Pp Perform a controller-level reset of the nvme0 controller. +In this example, nda4 is wired to nvme0. .Pp .Dl nvmecontrol logpage -p 1 nvme0 .Pp @@ -500,6 +573,24 @@ Set the current power mode. .Dl nvmecontrol power nvme0 .Pp Get the current power mode. +.Pp +.Dl nvmecontrol identify -n 0 nda0 +.Pp +Identify the drive data associated with the +.Pa nda0 +device. +The corresponding +.Pa nvmeX +devices is used automatically. +.Pp +.Dl nvmecontrol identify nda0 +.Pp +Get the namespace parameters associated with the +.Pa nda0 +device. +The corresponding +.Pa nvmeXnsY +device is used automatically. .Sh DYNAMIC LOADING The directories .Pa /lib/nvmecontrol From owner-svn-src-head@freebsd.org Fri May 1 20:29:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1A842DEF4E; Fri, 1 May 2020 20:29:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DP4c74gdz44rW; Fri, 1 May 2020 20:29:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A26CDF9B; Fri, 1 May 2020 20:29:52 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041KTqtr059189; Fri, 1 May 2020 20:29:52 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041KTqYo059187; Fri, 1 May 2020 20:29:52 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005012029.041KTqYo059187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 20:29:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360547 - head/sbin/nvmecontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/nvmecontrol X-SVN-Commit-Revision: 360547 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 20:29:53 -0000 Author: imp Date: Fri May 1 20:29:51 2020 New Revision: 360547 URL: https://svnweb.freebsd.org/changeset/base/360547 Log: Document the passthru commands. Reviewed by: bcr@ (earlier version) Differential Revision: https://reviews.freebsd.org/D24639 Modified: head/sbin/nvmecontrol/nvmecontrol.8 head/sbin/nvmecontrol/passthru.c Modified: head/sbin/nvmecontrol/nvmecontrol.8 ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.8 Fri May 1 20:29:46 2020 (r360546) +++ head/sbin/nvmecontrol/nvmecontrol.8 Fri May 1 20:29:51 2020 (r360547) @@ -194,6 +194,14 @@ .\" .Nm .\" .Ic wdc purge-monitor .\" .Aq device-id +.Nm +.Ic admin-passthru +.Op args +.Aq Ar device-id +.Nm +.Ic io-passthru +.Op args +.Aq Ar namespace-id .Sh DESCRIPTION NVM Express (NVMe) is a storage protocol standard, for SSDs and other high-speed storage devices over PCI Express. @@ -466,6 +474,68 @@ the drive's serial number and the type of dump it is f by .bin. These logs must be sent to the vendor for analysis. This tool only provides a way to extract them. +.Ss passthru +The +.Dq admin-passthru +and +.Dq io-passthru +commands send NVMe commands to +either the administrative or the data part of the device. +These commands are expected to be compatible with nvme-cli. +Please see +.St The NVMe Standard +for details. +.Bl -tag -width 16n +.It Fl o -opcode Ar opcode +Opcode to send. +.It Fl 2 -cdw2 Ar value +32-bit value for CDW2. +.It Fl 3 -cdw3 Ar value +32-bit value for CDW3. +.It Fl 4 -cdw10 Ar value +32-bit value for CDW10. +.It Fl 5 -cdw11 Ar value +32-bit value for CDW11. +.It Fl 6 -cdw12 Ar value +32-bit value for CDW12. +.It Fl 7 -cdw13 Ar value +32-bit value for CDW13. +.It Fl 8 -cdw14 Ar value +32-bit value for CDW14. +.It Fl 9 -cdw15 Ar value +32-bit value for CDW15. +.It Fl l -data-len +Length of the data for I/O (bytes). +.It Fl m -metadata-len +Length of the metadata segment for command (bytes). +This is ignored and not implemented in +.Xr nvme 4 . +.It Fl f -flags +Nvme command flags. +.It Fl n -namespace-id +Namespace ID for command (Ignored). +.It Fl p -prefill +Value to prefill payload with. +.It Fl b -raw-binary +Output in binary format (otherwise a hex dump is produced). +.It Fl d -dry-run +Do not actually execute the command, but perform sanity checks on it. +.It Fl r -read +Command reads data from the device. +.It Fl s -show-command +Show all the command values on stdout. +.It Fl w -write +Command writes data to the device. +.El +Send arbitrary commands to the device. +Can be used to extract vendor specific logs. +Transfers to/from the device possible, but limited to +.Dv MAXPHYS +bytes. +Commands either read data or write it, but not both. +Commands needing metadata are not supported by the +.Xr nvme 4 +drive. .Sh DEVICE NAMES Where .Aq Ar namespace-id Modified: head/sbin/nvmecontrol/passthru.c ============================================================================== --- head/sbin/nvmecontrol/passthru.c Fri May 1 20:29:46 2020 (r360546) +++ head/sbin/nvmecontrol/passthru.c Fri May 1 20:29:51 2020 (r360547) @@ -292,7 +292,7 @@ static struct cmd io_pass_cmd = { .ctx_size = sizeof(struct options), .opts = opts, .args = args, - .descr = "Send a pass through Admin command to the specified device", + .descr = "Send a pass through I/O command to the specified device", }; CMD_COMMAND(admin_pass_cmd); From owner-svn-src-head@freebsd.org Fri May 1 21:24: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 DF7C92B00D1; Fri, 1 May 2020 21:24:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DQHM5YbPz47xP; Fri, 1 May 2020 21:24:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9C36EAF1; Fri, 1 May 2020 21:24:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041LOF1e096160; Fri, 1 May 2020 21:24:15 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041LOF5c096159; Fri, 1 May 2020 21:24:15 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005012124.041LOF5c096159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 21:24:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360549 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 360549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 21:24:15 -0000 Author: imp Date: Fri May 1 21:24:15 2020 New Revision: 360549 URL: https://svnweb.freebsd.org/changeset/base/360549 Log: Rename ns notification function... This function is called whenever the namespace is added, deleted or changes. Update the name to reflect that. No functional change. Modified: head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Fri May 1 21:22:26 2020 (r360548) +++ head/sys/dev/nvme/nvme_sim.c Fri May 1 21:24:15 2020 (r360549) @@ -315,7 +315,7 @@ err1: } static void * -nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg) +nvme_sim_ns_change(struct nvme_namespace *ns, void *sc_arg) { struct nvme_sim_softc *sc = sc_arg; union ccb *ccb; @@ -339,7 +339,7 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar } xpt_rescan(ccb); - return (ns); + return (sc_arg); } static void @@ -362,7 +362,7 @@ nvme_sim_init(void) if (nvme_use_nvd) return; - consumer_cookie = nvme_register_consumer(nvme_sim_new_ns, + consumer_cookie = nvme_register_consumer(nvme_sim_ns_change, nvme_sim_new_controller, NULL, nvme_sim_controller_fail); } From owner-svn-src-head@freebsd.org Fri May 1 21:24: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 872332B00FE; Fri, 1 May 2020 21:24:22 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DQHT2X3cz4813; Fri, 1 May 2020 21:24:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76A23EAF2; Fri, 1 May 2020 21:24:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 041LOK7w096214; Fri, 1 May 2020 21:24:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041LOKec096213; Fri, 1 May 2020 21:24:20 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202005012124.041LOKec096213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 1 May 2020 21:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360550 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 360550 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 21:24:24 -0000 Author: imp Date: Fri May 1 21:24:19 2020 New Revision: 360550 URL: https://svnweb.freebsd.org/changeset/base/360550 Log: Add KASSERT to ensure sane nsid. All callers are currently filtering bad nsid to this function, however, we'll have undefined behavior if that's not true. Add the KASSERT to prevent that. Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Fri May 1 21:24:15 2020 (r360549) +++ head/sys/dev/nvme/nvme.c Fri May 1 21:24:19 2020 (r360550) @@ -285,13 +285,18 @@ void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid) { struct nvme_consumer *cons; - struct nvme_namespace *ns = &ctrlr->ns[nsid - 1]; + struct nvme_namespace *ns; void *ctrlr_cookie; uint32_t i; + KASSERT(nsid <= NVME_MAX_NAMESPACES, + ("%s: Namespace notification to nsid %d exceeds range\n", + device_get_nameunit(ctrlr->dev), nsid)); + if (!ctrlr->is_initialized) return; + ns = &ctrlr->ns[nsid - 1]; for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL && From owner-svn-src-head@freebsd.org Fri May 1 21:52: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 201722B0CCB; Fri, 1 May 2020 21:52:30 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DQvy03Mbz49QR; Fri, 1 May 2020 21:52:30 +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 F1609F0B9; Fri, 1 May 2020 21:52:29 +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 041LqTBZ014391; Fri, 1 May 2020 21:52:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041LqTNM014390; Fri, 1 May 2020 21:52:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202005012152.041LqTNM014390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 1 May 2020 21:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360551 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 360551 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 21:52:30 -0000 Author: mhorne Date: Fri May 1 21:52:29 2020 New Revision: 360551 URL: https://svnweb.freebsd.org/changeset/base/360551 Log: Make mpentry independent of _start APs enter the kernel at the same point as the BSP, the _start routine. They then jump to mpentry, but not before storing the kernel's physical load address in the s9 register. Extract this calculation into its own routine, so that APs can be instructed to enter directly from mpentry. Differential Revision: https://reviews.freebsd.org/D24495 Modified: head/sys/riscv/riscv/locore.S Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Fri May 1 21:24:19 2020 (r360550) +++ head/sys/riscv/riscv/locore.S Fri May 1 21:52:29 2020 (r360551) @@ -59,13 +59,6 @@ _start: lla gp, __global_pointer$ .option pop - /* Get the physical address kernel loaded to */ - lla t0, virt_map - ld t1, 0(t0) - sub t1, t1, t0 - li t2, KERNBASE - sub s9, t2, t1 /* s9 = physmem base */ - /* * a0 = hart id * a1 = dtbp @@ -87,6 +80,9 @@ _start: * Page tables */ 1: + /* Get the kernel's load address */ + jal get_physmem + /* Add L1 entry for kernel */ lla s1, pagetable_l1 lla s2, pagetable_l2 /* Link to next level PN */ @@ -224,6 +220,17 @@ va: call _C_LABEL(initriscv) /* Off we go */ call _C_LABEL(mi_startup) +/* + * Get the physical address the kernel is loaded to. Returned in s9. + */ +get_physmem: + lla t0, virt_map /* physical address of virt_map */ + ld t1, 0(t0) /* virtual address of virt_map */ + sub t1, t1, t0 /* calculate phys->virt delta */ + li t2, KERNBASE + sub s9, t2, t1 /* s9 = physmem base */ + ret + .align 4 initstack: .space (PAGE_SIZE * KSTACK_PAGES) @@ -302,6 +309,9 @@ ENTRY(mpentry) /* Setup stack pointer */ lla t0, bootstack ld sp, 0(t0) + + /* Get the kernel's load address */ + jal get_physmem /* Setup supervisor trap vector */ lla t0, mpva From owner-svn-src-head@freebsd.org Fri May 1 21:55: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 EA6172B0D89; Fri, 1 May 2020 21:55:51 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DQzq5vpRz49bd; Fri, 1 May 2020 21:55:51 +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 C16F6F0CA; Fri, 1 May 2020 21:55:51 +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 041LtpJQ014632; Fri, 1 May 2020 21:55:51 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041LtpFL014631; Fri, 1 May 2020 21:55:51 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202005012155.041LtpFL014631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 1 May 2020 21:55:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360552 - in head/sys/riscv: include riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys/riscv: include riscv X-SVN-Commit-Revision: 360552 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 21:55:52 -0000 Author: mhorne Date: Fri May 1 21:55:51 2020 New Revision: 360552 URL: https://svnweb.freebsd.org/changeset/base/360552 Log: Add support for HSM SBI extension The Hardware State Management (HSM) extension provides a set of SBI calls that allow the supervisor software to start and stop hart execution. The HSM extension has been implemented in OpenSBI and is present in the v0.7 release. [1] https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc Reviewed by: br Differential Revision: https://reviews.freebsd.org/D24496 Modified: head/sys/riscv/include/sbi.h head/sys/riscv/riscv/sbi.c Modified: head/sys/riscv/include/sbi.h ============================================================================== --- head/sys/riscv/include/sbi.h Fri May 1 21:52:29 2020 (r360551) +++ head/sys/riscv/include/sbi.h Fri May 1 21:55:51 2020 (r360552) @@ -55,6 +55,7 @@ #define SBI_ERR_INVALID_PARAM -3 #define SBI_ERR_DENIED -4 #define SBI_ERR_INVALID_ADDRESS -5 +#define SBI_ERR_ALREADY_AVAILABLE -6 /* SBI Base Extension */ #define SBI_EXT_ID_BASE 0x10 @@ -66,6 +67,16 @@ #define SBI_BASE_GET_MARCHID 5 #define SBI_BASE_GET_MIMPID 6 +/* Hart State Management (HSM) Extension */ +#define SBI_EXT_ID_HSM 0x48534D +#define SBI_HSM_HART_START 0 +#define SBI_HSM_HART_STOP 1 +#define SBI_HSM_HART_STATUS 2 +#define SBI_HSM_STATUS_STARTED 0 +#define SBI_HSM_STATUS_STOPPED 1 +#define SBI_HSM_STATUS_START_PENDING 2 +#define SBI_HSM_STATUS_STOP_PENDING 3 + /* Legacy Extensions */ #define SBI_SET_TIMER 0 #define SBI_CONSOLE_PUTCHAR 1 @@ -127,6 +138,30 @@ sbi_probe_extension(long id) { return (SBI_CALL1(SBI_EXT_ID_BASE, SBI_BASE_PROBE_EXTENSION, id).value); } + +/* Hart State Management extension functions. */ + +/* + * Start execution on the specified hart at physical address start_addr. The + * register a0 will contain the hart's ID, and a1 will contain the value of + * priv. + */ +int sbi_hsm_hart_start(u_long hart, u_long start_addr, u_long priv); + +/* + * Stop execution on the current hart. Interrupts should be disabled, or this + * function may return. + */ +void sbi_hsm_hart_stop(void); + +/* + * Get the execution status of the specified hart. The status will be one of: + * - SBI_HSM_STATUS_STARTED + * - SBI_HSM_STATUS_STOPPED + * - SBI_HSM_STATUS_START_PENDING + * - SBI_HSM_STATUS_STOP_PENDING + */ +int sbi_hsm_hart_status(u_long hart); /* Legacy extension functions. */ static __inline void Modified: head/sys/riscv/riscv/sbi.c ============================================================================== --- head/sys/riscv/riscv/sbi.c Fri May 1 21:52:29 2020 (r360551) +++ head/sys/riscv/riscv/sbi.c Fri May 1 21:55:51 2020 (r360552) @@ -113,6 +113,31 @@ sbi_print_version(void) printf("SBI Specification Version: %u.%u\n", major, minor); } +int +sbi_hsm_hart_start(u_long hart, u_long start_addr, u_long priv) +{ + struct sbi_ret ret; + + ret = SBI_CALL3(SBI_EXT_ID_HSM, SBI_HSM_HART_START, hart, start_addr, priv); + return (ret.error != 0 ? (int)ret.error : 0); +} + +void +sbi_hsm_hart_stop(void) +{ + (void)SBI_CALL0(SBI_EXT_ID_HSM, SBI_HSM_HART_STOP); +} + +int +sbi_hsm_hart_status(u_long hart) +{ + struct sbi_ret ret; + + ret = SBI_CALL1(SBI_EXT_ID_HSM, SBI_HSM_HART_STATUS, hart); + + return (ret.error != 0 ? (int)ret.error : (int)ret.value); +} + void sbi_init(void) { From owner-svn-src-head@freebsd.org Fri May 1 21:58: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 1B7202B0E36; Fri, 1 May 2020 21:58:20 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DR2h0033z49nR; Fri, 1 May 2020 21:58:19 +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 EABD8F0D6; Fri, 1 May 2020 21:58:19 +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 041LwJAs014783; Fri, 1 May 2020 21:58:19 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041LwJmo014782; Fri, 1 May 2020 21:58:19 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202005012158.041LwJmo014782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 1 May 2020 21:58:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360553 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 360553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 21:58:20 -0000 Author: mhorne Date: Fri May 1 21:58:19 2020 New Revision: 360553 URL: https://svnweb.freebsd.org/changeset/base/360553 Log: Use the HSM SBI extension to start APs The addition of the HSM SBI extension to OpenSBI introduces a new breaking change: secondary harts will remain parked in the firmware, until they are brought up explicitly via sbi_hsm_hart_start(). Add the call to do this, sending the secondary harts to mpentry. If the HSM extension is not present, secondary harts are assumed to be released by the firmware, as is the case for OpenSBI =< v0.6 and BBL. In the case that the HSM call fails we exclude the CPU, notify the user, and allow the system to proceed with booting. Reviewed by: markj (older version) Differential Revision: https://reviews.freebsd.org/D24497 Modified: head/sys/riscv/riscv/mp_machdep.c Modified: head/sys/riscv/riscv/mp_machdep.c ============================================================================== --- head/sys/riscv/riscv/mp_machdep.c Fri May 1 21:55:51 2020 (r360552) +++ head/sys/riscv/riscv/mp_machdep.c Fri May 1 21:58:19 2020 (r360553) @@ -97,6 +97,7 @@ static uint32_t cpu_reg[MAXCPU][2]; #endif static device_t cpu_list[MAXCPU]; +void mpentry(u_long hartid); void init_secondary(uint64_t); static struct mtx ap_boot_mtx; @@ -297,7 +298,7 @@ smp_after_idle_runnable(void *arg __unused) struct pcpu *pc; int cpu; - for (cpu = 1; cpu < mp_ncpus; cpu++) { + for (cpu = 1; cpu <= mp_maxid; cpu++) { if (bootstacks[cpu] != NULL) { pc = pcpu_find(cpu); while (atomic_load_ptr(&pc->pc_curpcb) == NULL) @@ -399,9 +400,11 @@ static boolean_t cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg) { struct pcpu *pcpup; + vm_paddr_t start_addr; uint64_t hart; u_int cpuid; int naps; + int error; /* Check if this hart supports MMU. */ if (OF_getproplen(node, "mmu-type") < 0) @@ -440,6 +443,23 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size /* Check if we are able to start this cpu */ if (cpuid > mp_maxid) return (0); + + /* + * Depending on the SBI implementation, APs are waiting either in + * locore.S or to be activated explicitly, via SBI call. + */ + if (sbi_probe_extension(SBI_EXT_ID_HSM) != 0) { + start_addr = pmap_kextract((vm_offset_t)mpentry); + error = sbi_hsm_hart_start(hart, start_addr, 0); + if (error != 0) { + mp_ncpus--; + + /* Send a warning to the user and continue. */ + printf("AP %u (hart %lu) failed to start, error %d\n", + cpuid, hart, error); + return (0); + } + } pcpup = &__pcpu[cpuid]; pcpu_init(pcpup, cpuid, sizeof(struct pcpu)); From owner-svn-src-head@freebsd.org Fri May 1 21:59: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 AD7182B0F0B; Fri, 1 May 2020 21:59:47 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DR4M49zNz4B0c; Fri, 1 May 2020 21:59:47 +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 8A5FCF0E8; Fri, 1 May 2020 21:59:47 +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 041LxlH8014890; Fri, 1 May 2020 21:59:47 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 041Lxlwc014889; Fri, 1 May 2020 21:59:47 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202005012159.041Lxlwc014889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 1 May 2020 21:59:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360554 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 360554 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2020 21:59:47 -0000 Author: mhorne Date: Fri May 1 21:59:47 2020 New Revision: 360554 URL: https://svnweb.freebsd.org/changeset/base/360554 Log: Use the HSM SBI extension to halt CPUs Differential Revision: https://reviews.freebsd.org/D24498 Modified: head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Fri May 1 21:58:19 2020 (r360553) +++ head/sys/riscv/riscv/machdep.c Fri May 1 21:59:47 2020 (r360554) @@ -473,9 +473,16 @@ void cpu_halt(void) { + /* + * Try to power down using the HSM SBI extension and fall back to a + * simple wfi loop. + */ intr_disable(); + if (sbi_probe_extension(SBI_EXT_ID_HSM) != 0) + sbi_hsm_hart_stop(); for (;;) __asm __volatile("wfi"); + /* NOTREACHED */ } /* From owner-svn-src-head@freebsd.org Sat May 2 00:07: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 94EF42B3E03; Sat, 2 May 2020 00:07:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DTv93YJVz4HMN; Sat, 2 May 2020 00:07:01 +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 564201897D; Sat, 2 May 2020 00:07:01 +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 042071Ob094552; Sat, 2 May 2020 00:07:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04206xTZ094527; Sat, 2 May 2020 00:06:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005020006.04206xTZ094527@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 2 May 2020 00:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360557 - in head: lib/libipsec sbin/setkey sys/netipsec usr.bin/netstat X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: lib/libipsec sbin/setkey sys/netipsec usr.bin/netstat X-SVN-Commit-Revision: 360557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 00:07:01 -0000 Author: jhb Date: Sat May 2 00:06:58 2020 New Revision: 360557 URL: https://svnweb.freebsd.org/changeset/base/360557 Log: Remove support for IPsec algorithms deprecated in r348205 and r360202. Examples of depecrated algorithms in manual pages and sample configs are updated where relevant. I removed the one example of combining ESP and AH (vs using a cipher and auth in ESP) as RFC 8221 says this combination is NOT RECOMMENDED. Specifically, this removes support for the following ciphers: - des-cbc - 3des-cbc - blowfish-cbc - cast128-cbc - des-deriv - des-32iv - camellia-cbc This also removes support for the following authentication algorithms: - hmac-md5 - keyed-md5 - keyed-sha1 - hmac-ripemd160 Reviewed by: cem, gnn (older verisons) Relnotes: yes Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24342 Modified: head/lib/libipsec/pfkey_dump.c head/sbin/setkey/sample.cf head/sbin/setkey/setkey.8 head/sbin/setkey/test-pfkey.c head/sbin/setkey/token.l head/sys/netipsec/ipsec.c head/sys/netipsec/ipsec.h head/sys/netipsec/key.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c head/usr.bin/netstat/ipsec.c Modified: head/lib/libipsec/pfkey_dump.c ============================================================================== --- head/lib/libipsec/pfkey_dump.c Fri May 1 23:07:23 2020 (r360556) +++ head/lib/libipsec/pfkey_dump.c Sat May 2 00:06:58 2020 (r360557) @@ -57,22 +57,10 @@ __FBSDID("$FreeBSD$"); #include "libpfkey.h" /* cope with old kame headers - ugly */ -#ifndef SADB_X_AALG_MD5 -#define SADB_X_AALG_MD5 SADB_AALG_MD5 -#endif -#ifndef SADB_X_AALG_SHA -#define SADB_X_AALG_SHA SADB_AALG_SHA -#endif #ifndef SADB_X_AALG_NULL #define SADB_X_AALG_NULL SADB_AALG_NULL #endif -#ifndef SADB_X_EALG_BLOWFISHCBC -#define SADB_X_EALG_BLOWFISHCBC SADB_EALG_BLOWFISHCBC -#endif -#ifndef SADB_X_EALG_CAST128CBC -#define SADB_X_EALG_CAST128CBC SADB_EALG_CAST128CBC -#endif #ifndef SADB_X_EALG_RC5CBC #ifdef SADB_EALG_RC5CBC #define SADB_X_EALG_RC5CBC SADB_EALG_RC5CBC @@ -147,10 +135,7 @@ static char *str_state[] = { static struct val2str str_alg_auth[] = { { SADB_AALG_NONE, "none", }, - { SADB_AALG_MD5HMAC, "hmac-md5", }, { SADB_AALG_SHA1HMAC, "hmac-sha1", }, - { SADB_X_AALG_MD5, "md5", }, - { SADB_X_AALG_SHA, "sha", }, { SADB_X_AALG_NULL, "null", }, { SADB_X_AALG_TCP_MD5, "tcp-md5", }, #ifdef SADB_X_AALG_SHA2_256 @@ -162,9 +147,6 @@ static struct val2str str_alg_auth[] = { #ifdef SADB_X_AALG_SHA2_512 { SADB_X_AALG_SHA2_512, "hmac-sha2-512", }, #endif -#ifdef SADB_X_AALG_RIPEMD160HMAC - { SADB_X_AALG_RIPEMD160HMAC, "hmac-ripemd160", }, -#endif #ifdef SADB_X_AALG_AES_XCBC_MAC { SADB_X_AALG_AES_XCBC_MAC, "aes-xcbc-mac", }, #endif @@ -173,14 +155,10 @@ static struct val2str str_alg_auth[] = { static struct val2str str_alg_enc[] = { { SADB_EALG_NONE, "none", }, - { SADB_EALG_DESCBC, "des-cbc", }, - { SADB_EALG_3DESCBC, "3des-cbc", }, { SADB_EALG_NULL, "null", }, #ifdef SADB_X_EALG_RC5CBC { SADB_X_EALG_RC5CBC, "rc5-cbc", }, #endif - { SADB_X_EALG_CAST128CBC, "cast128-cbc", }, - { SADB_X_EALG_BLOWFISHCBC, "blowfish-cbc", }, #ifdef SADB_X_EALG_RIJNDAELCBC { SADB_X_EALG_RIJNDAELCBC, "rijndael-cbc", }, #endif @@ -192,9 +170,6 @@ static struct val2str str_alg_enc[] = { #endif #ifdef SADB_X_EALG_AESGCM16 { SADB_X_EALG_AESGCM16, "aes-gcm-16", }, -#endif -#ifdef SADB_X_EALG_CAMELLIACBC - { SADB_X_EALG_CAMELLIACBC, "camellia-cbc", }, #endif { -1, NULL, }, }; Modified: head/sbin/setkey/sample.cf ============================================================================== --- head/sbin/setkey/sample.cf Fri May 1 23:07:23 2020 (r360556) +++ head/sbin/setkey/sample.cf Sat May 2 00:06:58 2020 (r360557) @@ -34,9 +34,9 @@ # parameters when you configure by manual keying. # ESP transport mode is recommended for TCP port number 110 between -# Host-A and Host-B. Encryption algorithm is blowfish-cbc whose key -# is "kamekame", and authentication algorithm is hmac-sha1 whose key -# is "this is the test key". +# Host-A and Host-B. Encryption algorithm is aes-cbc whose key +# is "kamekamekamekamekamekamekamekame", and authentication algorithm is +# hmac-sha2-512 whose key is "this is the test key". # # ============ ESP ============ # | | @@ -50,17 +50,17 @@ spdadd fec0::11[110] fec0::10[any] tcp -P in ipsec esp/transport//use ; add fec0::10 fec0::11 esp 0x10001 -m transport - -E blowfish-cbc "kamekame" - -A hmac-sha1 "this is the test key" ; + -E aes-cbc "kamekamekamekamekamekamekamekame" + -A hmac-sha2-512 "this is the test key" ; add fec0::11 fec0::10 esp 0x10002 -m transport - -E blowfish-cbc "kamekame" - -A hmac-sha1 "this is the test key" ; + -E aes-cbc "kamekamekamekamekamekamekamekame" + -A hmac-sha2-512 "this is the test key" ; # "[any]" is wildcard of port number. Note that "[0]" is the number of # zero in port number. -# Security protocol is old AH tunnel mode, i.e. RFC1826, with keyed-md5 +# Security protocol is old AH tunnel mode, i.e. RFC1826, with hmac-sha2-256 # whose key is "this is the test" as authentication algorithm. # That protocol takes place between Gateway-A and Gateway-B. # @@ -76,10 +76,10 @@ spdadd 10.0.2.0/24 10.0.1.0/24 any -P in ipsec ah/tunnel/172.16.0.2-172.16.0.1/require ; add 172.16.0.1 172.16.0.2 ah-old 0x10003 -m any - -A keyed-md5 "this is the test" ; + -A hmac-sha2-256 "this is the test" ; add 172.16.0.2 172.16.0.1 ah-old 0x10004 -m any - -A keyed-md5 "this is the test" ; + -A hmac-sha2-256 "this is the test" ; # If port number field is omitted such above then "[any]" is employed. # -m specifies the mode of SA to be used. "-m any" means wildcard of @@ -93,15 +93,15 @@ spdadd 10.0.1.0/24 10.0.2.0/24 any -P in ipsec ah/tunnel/172.16.0.1-172.16.0.2/require ; add 172.16.0.1 172.16.0.2 ah-old 0x10003 -m tunnel - -A keyed-md5 "this is the test" ; + -A hmac-sha2-256 "this is the test" ; add 172.16.0.2 172.16.0.1 ah-old 0x10004 -m tunnel - -A keyed-md5 "this is the test" ; + -A hmac-sha2-256 "this is the test" ; # AH transport mode followed by ESP tunnel mode is required between # Gateway-A and Gateway-B. -# Encryption algorithm is 3des-cbc, and authentication algorithm for ESP -# is hmac-sha1. Authentication algorithm for AH is hmac-md5. +# Encryption algorithm is aes-cbc, and authentication algorithm for ESP +# is hmac-sha2-512. Authentication algorithm for AH is hmac-sha2-256. # # ========== AH ========= # | ======= ESP ===== | @@ -118,25 +118,25 @@ spdadd fec0:0:0:2::/64 fec0:0:0:1::/64 any -P in ipsec ah/transport//require ; add fec0:0:0:1::1 fec0:0:0:2::1 esp 0x10001 -m tunnel - -E 3des-cbc "kamekame12341234kame1234" - -A hmac-sha1 "this is the test key" ; + -E aes-cbc "kamekame12341234kamekame12341234" + -A hmac-sha2-512 "this is the test key" ; add fec0:0:0:1::1 fec0:0:0:2::1 ah 0x10001 -m transport - -A hmac-md5 "this is the test" ; + -A hmac-sha2-256 "this is the test" ; add fec0:0:0:2::1 fec0:0:0:1::1 esp 0x10001 -m tunnel - -E 3des-cbc "kamekame12341234kame1234" - -A hmac-sha1 "this is the test key" ; + -E aes-cbc "kamekame12341234kamekame12341234" + -A hmac-sha2-512 "this is the test key" ; add fec0:0:0:2::1 fec0:0:0:1::1 ah 0x10001 -m transport - -A hmac-md5 "this is the test" ; + -A hmac-sha2-256 "this is the test" ; # ESP tunnel mode is required between Host-A and Gateway-A. -# Encryption algorithm is cast128-cbc, and authentication algorithm -# for ESP is hmac-sha1. +# Encryption algorithm is aes-cbc, and authentication algorithm +# for ESP is hmac-sha2-256. # ESP transport mode is recommended between Host-A and Host-B. -# Encryption algorithm is rc5-cbc, and authentication algorithm -# for ESP is hmac-md5. +# Encryption algorithm is aes-ctr, and authentication algorithm +# for ESP is hmac-sha2-512. # # ================== ESP ================= # | ======= ESP ======= | @@ -153,18 +153,18 @@ spdadd fec0:0:0:2::1[80] fec0:0:0:1::1[any] tcp -P in esp/tunnel/fec0:0:0:2::1-fec0:0:0:1::1/require ; add fec0:0:0:1::1 fec0:0:0:2::2 esp 0x10001 -m transport - -E cast128-cbc "12341234" - -A hmac-sha1 "this is the test key" ; + -E aes-cbc "kamekame12341234kamekame12341234" + -A hmac-sha2-256 "this is the test key" ; add fec0:0:0:1::1 fec0:0:0:2::1 esp 0x10002 - -E rc5-cbc "kamekame" - -A hmac-md5 "this is the test" ; + -E aes-ctr "kamekame12341234kamekame12341234f00f" + -A hmac-sha2-512 "this is the test" ; add fec0:0:0:2::2 fec0:0:0:1::1 esp 0x10003 -m transport - -E cast128-cbc "12341234" - -A hmac-sha1 "this is the test key" ; + -E aes-cbc "kamekame12341234kamekame12341234" + -A hmac-sha2-256 "this is the test key" ; add fec0:0:0:2::1 fec0:0:0:1::1 esp 0x10004 - -E rc5-cbc "kamekame" - -A hmac-md5 "this is the test" ; + -E aes-ctr "kamekame12341234kamekame12341234f00f" + -A hmac-sha2-512 "this is the test" ; # By "get" command, you can get a entry of either SP or SA. get fec0:0:0:1::1 fec0:0:0:2::2 ah 0x10004 ; @@ -189,29 +189,14 @@ flush ah ; # XXX add ::1 ::1 esp 10001 -m transport -E null ; -add ::1 ::1 esp 10002 -m transport -E des-deriv "12341234" ; -add ::1 ::1 esp-old 10003 -m transport -E des-32iv "12341234" ; add ::1 ::1 esp 10004 -m transport -E null -A null ; -add ::1 ::1 esp 10005 -m transport -E null -A hmac-md5 "1234123412341234" ; add ::1 ::1 esp 10006 -m tunnel -E null -A hmac-sha1 "12341234123412341234" ; -add ::1 ::1 esp 10007 -m transport -E null -A keyed-md5 "1234123412341234" ; -add ::1 ::1 esp 10008 -m any -E null -A keyed-sha1 "12341234123412341234" ; -add ::1 ::1 esp 10009 -m transport -E des-cbc "testtest" ; -add ::1 ::1 esp 10010 -m transport -E 3des-cbc "testtest12341234testtest" ; -add ::1 ::1 esp 10011 -m tunnel -E cast128-cbc "testtest1234" ; -add ::1 ::1 esp 10012 -m tunnel -E blowfish-cbc "testtest1234" ; -add ::1 ::1 esp 10013 -m tunnel -E rc5-cbc "testtest1234" ; -add ::1 ::1 esp 10014 -m any -E rc5-cbc "testtest1234" ; add ::1 ::1 esp 10015 -m transport -f zero-pad -E null ; add ::1 ::1 esp 10016 -m tunnel -f random-pad -r 8 -lh 100 -ls 80 -E null ; add ::1 ::1 esp 10017 -m transport -f seq-pad -f nocyclic-seq -E null ; add ::1 ::1 esp 10018 -m transport -E null ; #add ::1 ::1 ah 20000 -m transport -A null ; -add ::1 ::1 ah 20001 -m any -A hmac-md5 "1234123412341234"; add ::1 ::1 ah 20002 -m tunnel -A hmac-sha1 "12341234123412341234"; -add ::1 ::1 ah 20003 -m transport -A keyed-md5 "1234123412341234"; -add ::1 ::1 ah-old 20004 -m transport -A keyed-md5 "1234123412341234"; -add ::1 ::1 ah 20005 -m transport -A keyed-sha1 "12341234123412341234"; #add ::1 ::1 ipcomp 30000 -C oui ; add ::1 ::1 ipcomp 30001 -C deflate ; #add ::1 ::1 ipcomp 30002 -C lzs ; Modified: head/sbin/setkey/setkey.8 ============================================================================== --- head/sbin/setkey/setkey.8 Fri May 1 23:07:23 2020 (r360556) +++ head/sbin/setkey/setkey.8 Sat May 2 00:06:58 2020 (r360557) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 9, 2017 +.Dd May 01, 2020 .Dt SETKEY 8 .Os .\" @@ -588,14 +588,8 @@ of the parameter: .Bd -literal -offset indent algorithm keylen (bits) comment -hmac-md5 128 ah: rfc2403 - 128 ah-old: rfc2085 hmac-sha1 160 ah: rfc2404 160 ah-old: 128bit ICV (no document) -keyed-md5 128 ah: 96bit ICV (no document) - 128 ah-old: rfc1828 -keyed-sha1 160 ah: 96bit ICV (no document) - 160 ah-old: 128bit ICV (no document) null 0 to 2048 for debugging hmac-sha2-256 256 ah: 128bit ICV (RFC4868) 256 ah-old: 128bit ICV (no document) @@ -603,8 +597,6 @@ hmac-sha2-384 384 ah: 192bit ICV (RFC4868) 384 ah-old: 128bit ICV (no document) hmac-sha2-512 512 ah: 256bit ICV (RFC4868) 512 ah-old: 128bit ICV (no document) -hmac-ripemd160 160 ah: 96bit ICV (RFC2857) - ah-old: 128bit ICV (no document) aes-xcbc-mac 128 ah: 96bit ICV (RFC3566) 128 ah-old: 128bit ICV (no document) tcp-md5 8 to 640 tcp: rfc2385 @@ -619,16 +611,10 @@ of the parameter: .Bd -literal -offset indent algorithm keylen (bits) comment -des-cbc 64 esp-old: rfc1829, esp: rfc2405 -3des-cbc 192 rfc2451 null 0 to 2048 rfc2410 -blowfish-cbc 40 to 448 rfc2451 -cast128-cbc 40 to 128 rfc2451 -des-deriv 64 ipsec-ciph-des-derived-01 rijndael-cbc 128/192/256 rfc3602 aes-ctr 160/224/288 draft-ietf-ipsec-ciph-aes-ctr-03 aes-gcm-16 160/224/288 rfc4106 -camellia-cbc 128/192/256 rfc4312 .Ed .Pp Note that the first 128/192/256 bits of a key for @@ -653,24 +639,17 @@ deflate rfc2394 .\" .Sh EXAMPLES Add an ESP SA between two IPv6 addresses using the -des-cbc encryption algorithm. +AES-GCM encryption algorithm. .Bd -literal -offset indent add 3ffe:501:4819::1 3ffe:501:481d::1 esp 123457 - -E des-cbc 0x3ffe05014819ffff ; + -E aes-gcm-16 0x3ffe050148193ffe050148193ffe050148193ffe ; .Pp .Ed .\" Add an authentication SA between two FQDN specified hosts: .Bd -literal -offset indent add -6 myhost.example.com yourhost.example.com ah 123456 - -A hmac-sha1 "AH SA configuration!" ; -.Pp -.Ed -Use both ESP and AH between two numerically specified hosts: -.Bd -literal -offset indent -add 10.0.11.41 10.0.11.33 esp 0x10001 - -E des-cbc 0x3ffe05014819ffff - -A hmac-md5 "authentication!!" ; + -A hmac-sha2-256 "AH SA configuration!" ; .Pp .Ed Get the SA information associated with first example above: Modified: head/sbin/setkey/test-pfkey.c ============================================================================== --- head/sbin/setkey/test-pfkey.c Fri May 1 23:07:23 2020 (r360556) +++ head/sbin/setkey/test-pfkey.c Sat May 2 00:06:58 2020 (r360557) @@ -319,15 +319,15 @@ key_setsadbprop() m_prop.sadb_prop_reserved[1] = 0; m_prop.sadb_prop_reserved[2] = 0; - /* the 1st is ESP DES-CBC HMAC-MD5 */ + /* the 1st is ESP AES-GCM-16 */ m_comb = (struct sadb_comb *)buf; - m_comb->sadb_comb_auth = SADB_AALG_MD5HMAC; - m_comb->sadb_comb_encrypt = SADB_EALG_DESCBC; + m_comb->sadb_comb_auth = SADB_AALG_NONE; + m_comb->sadb_comb_encrypt = SADB_X_EALG_AESGCM16; m_comb->sadb_comb_flags = 0; - m_comb->sadb_comb_auth_minbits = 8; - m_comb->sadb_comb_auth_maxbits = 96; - m_comb->sadb_comb_encrypt_minbits = 64; - m_comb->sadb_comb_encrypt_maxbits = 64; + m_comb->sadb_comb_auth_minbits = 0; + m_comb->sadb_comb_auth_maxbits = 0; + m_comb->sadb_comb_encrypt_minbits = 128; + m_comb->sadb_comb_encrypt_maxbits = 256; m_comb->sadb_comb_reserved = 0; m_comb->sadb_comb_soft_allocations = 0; m_comb->sadb_comb_hard_allocations = 0; @@ -338,15 +338,15 @@ key_setsadbprop() m_comb->sadb_comb_soft_usetime = 0; m_comb->sadb_comb_hard_usetime = 0; - /* the 2st is ESP 3DES-CBC and AH HMAC-SHA1 */ + /* the 2nd is ESP AES-CBC and AH HMAC-SHA2-256 */ m_comb = (struct sadb_comb *)(buf + sizeof(*m_comb)); - m_comb->sadb_comb_auth = SADB_AALG_SHA1HMAC; - m_comb->sadb_comb_encrypt = SADB_EALG_3DESCBC; + m_comb->sadb_comb_auth = SADB_X_AALG_SHA2_256; + m_comb->sadb_comb_encrypt = SADB_X_EALG_RIJNDAELCBC; m_comb->sadb_comb_flags = 0; - m_comb->sadb_comb_auth_minbits = 8; - m_comb->sadb_comb_auth_maxbits = 96; - m_comb->sadb_comb_encrypt_minbits = 64; - m_comb->sadb_comb_encrypt_maxbits = 64; + m_comb->sadb_comb_auth_minbits = 256; + m_comb->sadb_comb_auth_maxbits = 256; + m_comb->sadb_comb_encrypt_minbits = 128; + m_comb->sadb_comb_encrypt_maxbits = 256; m_comb->sadb_comb_reserved = 0; m_comb->sadb_comb_soft_allocations = 0; m_comb->sadb_comb_hard_allocations = 0; @@ -457,8 +457,8 @@ key_setsadbsa() m_sa.sadb_sa_spi = htonl(0x12345678); m_sa.sadb_sa_replay = 4; m_sa.sadb_sa_state = 0; - m_sa.sadb_sa_auth = SADB_AALG_MD5HMAC; - m_sa.sadb_sa_encrypt = SADB_EALG_DESCBC; + m_sa.sadb_sa_auth = SADB_AALG_NONE; + m_sa.sadb_sa_encrypt = SADB_X_EALG_AESGCM16; m_sa.sadb_sa_flags = 0; memcpy(m_buf + m_len, &m_sa, sizeof(struct sadb_sa)); Modified: head/sbin/setkey/token.l ============================================================================== --- head/sbin/setkey/token.l Fri May 1 23:07:23 2020 (r360556) +++ head/sbin/setkey/token.l Sat May 2 00:06:58 2020 (r360557) @@ -147,31 +147,20 @@ tcp { yylval.num = 0; return(PR_TCP); } /* authentication alogorithm */ {hyphen}A { BEGIN S_AUTHALG; return(F_AUTH); } -hmac-md5 { yylval.num = SADB_AALG_MD5HMAC; BEGIN INITIAL; return(ALG_AUTH); } hmac-sha1 { yylval.num = SADB_AALG_SHA1HMAC; BEGIN INITIAL; return(ALG_AUTH); } -keyed-md5 { yylval.num = SADB_X_AALG_MD5; BEGIN INITIAL; return(ALG_AUTH); } -keyed-sha1 { yylval.num = SADB_X_AALG_SHA; BEGIN INITIAL; return(ALG_AUTH); } hmac-sha2-256 { yylval.num = SADB_X_AALG_SHA2_256; BEGIN INITIAL; return(ALG_AUTH); } hmac-sha2-384 { yylval.num = SADB_X_AALG_SHA2_384; BEGIN INITIAL; return(ALG_AUTH); } hmac-sha2-512 { yylval.num = SADB_X_AALG_SHA2_512; BEGIN INITIAL; return(ALG_AUTH); } -hmac-ripemd160 { yylval.num = SADB_X_AALG_RIPEMD160HMAC; BEGIN INITIAL; return(ALG_AUTH); } aes-xcbc-mac { yylval.num = SADB_X_AALG_AES_XCBC_MAC; BEGIN INITIAL; return(ALG_AUTH); } tcp-md5 { yylval.num = SADB_X_AALG_TCP_MD5; BEGIN INITIAL; return(ALG_AUTH); } null { yylval.num = SADB_X_AALG_NULL; BEGIN INITIAL; return(ALG_AUTH_NOKEY); } /* encryption alogorithm */ {hyphen}E { BEGIN S_ENCALG; return(F_ENC); } -des-cbc { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC); } -3des-cbc { yylval.num = SADB_EALG_3DESCBC; BEGIN INITIAL; return(ALG_ENC); } null { yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC); } simple { yylval.num = SADB_EALG_NULL; BEGIN INITIAL; return(ALG_ENC_OLD); } -blowfish-cbc { yylval.num = SADB_X_EALG_BLOWFISHCBC; BEGIN INITIAL; return(ALG_ENC); } -cast128-cbc { yylval.num = SADB_X_EALG_CAST128CBC; BEGIN INITIAL; return(ALG_ENC); } -des-deriv { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DESDERIV); } -des-32iv { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DES32IV); } rijndael-cbc { yylval.num = SADB_X_EALG_RIJNDAELCBC; BEGIN INITIAL; return(ALG_ENC); } aes-ctr { yylval.num = SADB_X_EALG_AESCTR; BEGIN INITIAL; return(ALG_ENC_SALT); } -camellia-cbc { yylval.num = SADB_X_EALG_CAMELLIACBC; BEGIN INITIAL; return(ALG_ENC); } aes-gcm-16 { yylval.num = SADB_X_EALG_AESGCM16; BEGIN INITIAL; return(ALG_ENC_SALT); } /* compression algorithms */ Modified: head/sys/netipsec/ipsec.c ============================================================================== --- head/sys/netipsec/ipsec.c Fri May 1 23:07:23 2020 (r360556) +++ head/sys/netipsec/ipsec.c Sat May 2 00:06:58 2020 (r360557) @@ -217,11 +217,6 @@ SYSCTL_INT(_net_inet_ipsec, OID_AUTO, filtertunnel, SYSCTL_VNET_PCPUSTAT(_net_inet_ipsec, OID_AUTO, ipsecstats, struct ipsecstat, ipsec4stat, "IPsec IPv4 statistics."); -struct timeval ipsec_warn_interval = { .tv_sec = 1, .tv_usec = 0 }; -SYSCTL_TIMEVAL_SEC(_net_inet_ipsec, OID_AUTO, crypto_warn_interval, CTLFLAG_RW, - &ipsec_warn_interval, - "Delay in seconds between warnings of deprecated IPsec crypto algorithms."); - #ifdef REGRESSION /* * When set to 1, IPsec will send packets with the same sequence number. Modified: head/sys/netipsec/ipsec.h ============================================================================== --- head/sys/netipsec/ipsec.h Fri May 1 23:07:23 2020 (r360556) +++ head/sys/netipsec/ipsec.h Sat May 2 00:06:58 2020 (r360557) @@ -287,8 +287,6 @@ VNET_DECLARE(int, crypto_support); VNET_DECLARE(int, async_crypto); VNET_DECLARE(int, natt_cksum_policy); -extern struct timeval ipsec_warn_interval; - #define IPSECSTAT_INC(name) \ VNET_PCPUSTAT_ADD(struct ipsecstat, ipsec4stat, name, 1) #define V_ip4_esp_trans_deflev VNET(ip4_esp_trans_deflev) Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Fri May 1 23:07:23 2020 (r360556) +++ head/sys/netipsec/key.c Sat May 2 00:06:58 2020 (r360557) @@ -583,13 +583,8 @@ static struct supported_ealgs { int sadb_alg; const struct enc_xform *xform; } supported_ealgs[] = { - { SADB_EALG_DESCBC, &enc_xform_des }, - { SADB_EALG_3DESCBC, &enc_xform_3des }, { SADB_X_EALG_AES, &enc_xform_rijndael128 }, - { SADB_X_EALG_BLOWFISHCBC, &enc_xform_blf }, - { SADB_X_EALG_CAST128CBC, &enc_xform_cast5 }, { SADB_EALG_NULL, &enc_xform_null }, - { SADB_X_EALG_CAMELLIACBC, &enc_xform_camellia }, { SADB_X_EALG_AESCTR, &enc_xform_aes_icm }, { SADB_X_EALG_AESGCM16, &enc_xform_aes_nist_gcm }, { SADB_X_EALG_AESGMAC, &enc_xform_aes_nist_gmac }, @@ -600,11 +595,7 @@ static struct supported_aalgs { const struct auth_hash *xform; } supported_aalgs[] = { { SADB_X_AALG_NULL, &auth_hash_null }, - { SADB_AALG_MD5HMAC, &auth_hash_hmac_md5 }, { SADB_AALG_SHA1HMAC, &auth_hash_hmac_sha1 }, - { SADB_X_AALG_RIPEMD160HMAC, &auth_hash_hmac_ripemd_160 }, - { SADB_X_AALG_MD5, &auth_hash_key_md5 }, - { SADB_X_AALG_SHA, &auth_hash_key_sha1 }, { SADB_X_AALG_SHA2_256, &auth_hash_hmac_sha2_256 }, { SADB_X_AALG_SHA2_384, &auth_hash_hmac_sha2_384 }, { SADB_X_AALG_SHA2_512, &auth_hash_hmac_sha2_512 }, @@ -6381,8 +6372,6 @@ key_getsizes_ah(const struct auth_hash *ah, int alg, u * key size is restricted. Enforce this here. */ switch (alg) { - case SADB_X_AALG_MD5: *min = *max = 16; break; - case SADB_X_AALG_SHA: *min = *max = 20; break; case SADB_X_AALG_NULL: *min = 1; *max = 256; break; case SADB_X_AALG_SHA2_256: *min = *max = 32; break; case SADB_X_AALG_SHA2_384: *min = *max = 48; break; @@ -6413,7 +6402,6 @@ key_getcomb_ah() #if 1 /* we prefer HMAC algorithms, not old algorithms */ if (i != SADB_AALG_SHA1HMAC && - i != SADB_AALG_MD5HMAC && i != SADB_X_AALG_SHA2_256 && i != SADB_X_AALG_SHA2_384 && i != SADB_X_AALG_SHA2_512) Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Fri May 1 23:07:23 2020 (r360556) +++ head/sys/netipsec/xform_ah.c Sat May 2 00:06:58 2020 (r360557) @@ -108,7 +108,6 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_ah, IPSECCTL_STATS, sta #endif static unsigned char ipseczeroes[256]; /* larger than an ip6 extension hdr */ -static struct timeval md5warn, ripewarn, kpdkmd5warn, kpdksha1warn; static int ah_input_cb(struct cryptop*); static int ah_output_cb(struct cryptop*); @@ -185,25 +184,6 @@ ah_init0(struct secasvar *sav, struct xformsw *xsp, return EINVAL; } - switch (sav->alg_auth) { - case SADB_AALG_MD5HMAC: - if (ratecheck(&md5warn, &ipsec_warn_interval)) - gone_in(13, "MD5-HMAC authenticator for IPsec"); - break; - case SADB_X_AALG_RIPEMD160HMAC: - if (ratecheck(&ripewarn, &ipsec_warn_interval)) - gone_in(13, "RIPEMD160-HMAC authenticator for IPsec"); - break; - case SADB_X_AALG_MD5: - if (ratecheck(&kpdkmd5warn, &ipsec_warn_interval)) - gone_in(13, "Keyed-MD5 authenticator for IPsec"); - break; - case SADB_X_AALG_SHA: - if (ratecheck(&kpdksha1warn, &ipsec_warn_interval)) - gone_in(13, "Keyed-SHA1 authenticator for IPsec"); - break; - } - /* * Verify the replay state block allocation is consistent with * the protocol type. We check here so we can make assumptions @@ -317,11 +297,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int sk ip->ip_tos = 0; ip->ip_ttl = 0; ip->ip_sum = 0; - - if (alg == CRYPTO_MD5_KPDK || alg == CRYPTO_SHA1_KPDK) - ip->ip_off &= htons(IP_DF); - else - ip->ip_off = htons(0); + ip->ip_off = htons(0); ptr = mtod(m, unsigned char *); Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Fri May 1 23:07:23 2020 (r360556) +++ head/sys/netipsec/xform_esp.c Sat May 2 00:06:58 2020 (r360557) @@ -94,8 +94,6 @@ SYSCTL_VNET_PCPUSTAT(_net_inet_esp, IPSECCTL_STATS, st struct espstat, espstat, "ESP statistics (struct espstat, netipsec/esp_var.h"); -static struct timeval deswarn, blfwarn, castwarn, camelliawarn, tdeswarn; - static int esp_input_cb(struct cryptop *op); static int esp_output_cb(struct cryptop *crp); @@ -157,29 +155,6 @@ esp_init(struct secasvar *sav, struct xformsw *xsp) DPRINTF(("%s: 4-byte IV not supported with protocol\n", __func__)); return EINVAL; - } - - switch (sav->alg_enc) { - case SADB_EALG_DESCBC: - if (ratecheck(&deswarn, &ipsec_warn_interval)) - gone_in(13, "DES cipher for IPsec"); - break; - case SADB_EALG_3DESCBC: - if (ratecheck(&tdeswarn, &ipsec_warn_interval)) - gone_in(13, "3DES cipher for IPsec"); - break; - case SADB_X_EALG_BLOWFISHCBC: - if (ratecheck(&blfwarn, &ipsec_warn_interval)) - gone_in(13, "Blowfish cipher for IPsec"); - break; - case SADB_X_EALG_CAST128CBC: - if (ratecheck(&castwarn, &ipsec_warn_interval)) - gone_in(13, "CAST cipher for IPsec"); - break; - case SADB_X_EALG_CAMELLIACBC: - if (ratecheck(&camelliawarn, &ipsec_warn_interval)) - gone_in(13, "Camellia cipher for IPsec"); - break; } /* subtract off the salt, RFC4106, 8.1 and RFC3686, 5.1 */ Modified: head/usr.bin/netstat/ipsec.c ============================================================================== --- head/usr.bin/netstat/ipsec.c Fri May 1 23:07:23 2020 (r360556) +++ head/usr.bin/netstat/ipsec.c Sat May 2 00:06:58 2020 (r360557) @@ -123,15 +123,11 @@ struct val2str { static struct val2str ipsec_ahnames[] = { { SADB_AALG_NONE, "none", }, - { SADB_AALG_MD5HMAC, "hmac-md5", }, { SADB_AALG_SHA1HMAC, "hmac-sha1", }, - { SADB_X_AALG_MD5, "keyed-md5", }, - { SADB_X_AALG_SHA, "keyed-sha1", }, { SADB_X_AALG_NULL, "null", }, { SADB_X_AALG_SHA2_256, "hmac-sha2-256", }, { SADB_X_AALG_SHA2_384, "hmac-sha2-384", }, { SADB_X_AALG_SHA2_512, "hmac-sha2-512", }, - { SADB_X_AALG_RIPEMD160HMAC, "hmac-ripemd160", }, { SADB_X_AALG_AES_XCBC_MAC, "aes-xcbc-mac", }, { SADB_X_AALG_TCP_MD5, "tcp-md5", }, { SADB_X_AALG_AES128GMAC, "aes-gmac-128", }, @@ -142,13 +138,8 @@ static struct val2str ipsec_ahnames[] = { static struct val2str ipsec_espnames[] = { { SADB_EALG_NONE, "none", }, - { SADB_EALG_DESCBC, "des-cbc", }, - { SADB_EALG_3DESCBC, "3des-cbc", }, { SADB_EALG_NULL, "null", }, - { SADB_X_EALG_CAST128CBC, "cast128-cbc", }, - { SADB_X_EALG_BLOWFISHCBC, "blowfish-cbc", }, { SADB_X_EALG_RIJNDAELCBC, "rijndael-cbc", }, - { SADB_X_EALG_CAMELLIACBC, "camellia-cbc", }, { SADB_X_EALG_AESCTR, "aes-ctr", }, { SADB_X_EALG_AESGCM16, "aes-gcm-16", }, { SADB_X_EALG_AESGMAC, "aes-gmac", }, From owner-svn-src-head@freebsd.org Sat May 2 00:08: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 B27D42B3EEF; Sat, 2 May 2020 00:08: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DTx844Tcz4HWG; Sat, 2 May 2020 00:08: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 8718F18991; Sat, 2 May 2020 00:08:44 +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 04208iUI094667; Sat, 2 May 2020 00:08:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04208i0C094664; Sat, 2 May 2020 00:08:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005020008.04208i0C094664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 2 May 2020 00:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360558 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 360558 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 00:08:44 -0000 Author: jhb Date: Sat May 2 00:08:44 2020 New Revision: 360558 URL: https://svnweb.freebsd.org/changeset/base/360558 Log: Document removal of deprecated IPsec algorithms. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Sat May 2 00:06:58 2020 (r360557) +++ head/RELNOTES Sat May 2 00:08:44 2020 (r360558) @@ -10,6 +10,11 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r360557: + Remove support for DES, Triple DES, Blowfish, Cast, and + Camellia ciphers from IPsec(4). Remove support for MD5-HMAC, + Keyed MD5, Keyed SHA1, and RIPEMD160-HMAC from IPsec(4). + r359945: Remove support for Triple DES, Blowfish, and MD5 HMAC from geli(4). From owner-svn-src-head@freebsd.org Sat May 2 00:10:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DFBE2B3FB1; Sat, 2 May 2020 00:10:26 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DTz60wtlz4Hf8; Sat, 2 May 2020 00:10:26 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B1A418997; Sat, 2 May 2020 00:10:26 +0000 (UTC) (envelope-from chs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0420APo6094824; Sat, 2 May 2020 00:10:25 GMT (envelope-from chs@FreeBSD.org) Received: (from chs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0420APw7094823; Sat, 2 May 2020 00:10:25 GMT (envelope-from chs@FreeBSD.org) Message-Id: <202005020010.0420APw7094823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chs set sender to chs@FreeBSD.org using -f From: Chuck Silvers Date: Sat, 2 May 2020 00:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360559 - head/sbin/dumpfs X-SVN-Group: head X-SVN-Commit-Author: chs X-SVN-Commit-Paths: head/sbin/dumpfs X-SVN-Commit-Revision: 360559 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 00:10:26 -0000 Author: chs Date: Sat May 2 00:10:25 2020 New Revision: 360559 URL: https://svnweb.freebsd.org/changeset/base/360559 Log: Print the fs last-mounted time too. Reviewed by: mckusick Approved by: mckusick (mentor) Sponsored by: Netflix Modified: head/sbin/dumpfs/dumpfs.c Modified: head/sbin/dumpfs/dumpfs.c ============================================================================== --- head/sbin/dumpfs/dumpfs.c Sat May 2 00:08:44 2020 (r360558) +++ head/sbin/dumpfs/dumpfs.c Sat May 2 00:10:25 2020 (r360559) @@ -156,7 +156,7 @@ dumpfsid(void) static int dumpfs(const char *name) { - time_t fstime; + time_t fstime, fsmtime; int64_t fssize; int32_t fsflags; int i; @@ -165,8 +165,10 @@ dumpfs(const char *name) case 2: fssize = afs.fs_size; fstime = afs.fs_time; - printf("magic\t%x (UFS2)\ttime\t%s", - afs.fs_magic, ctime(&fstime)); + fsmtime = afs.fs_mtime; + printf("magic\t%x (UFS2)\n", afs.fs_magic); + printf("last mounted time\t%s", ctime(&fsmtime)); + printf("last modified time\t%s", ctime(&fstime)); printf("superblock location\t%jd\tid\t[ %08x %08x ]\n", (intmax_t)afs.fs_sblockloc, afs.fs_id[0], afs.fs_id[1]); printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n", From owner-svn-src-head@freebsd.org Sat May 2 00:23: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 1DBA62B49E8; Sat, 2 May 2020 00:23:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DVGY026Nz4Jvt; Sat, 2 May 2020 00:23:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-164.local (unknown [IPv6:2601:648:8203:2990:10da:1785:4af1:96fa]) (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 981139E1F; Sat, 2 May 2020 00:23:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r360557 - in head: lib/libipsec sbin/setkey sys/netipsec usr.bin/netstat From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202005020006.04206xTZ094527@repo.freebsd.org> 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: <6cb8b3f0-10ca-4fca-faff-a3b5983e214c@FreeBSD.org> Date: Fri, 1 May 2020 17:23:46 -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: <202005020006.04206xTZ094527@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 00:23:49 -0000 On 5/1/20 5:06 PM, John Baldwin wrote: > Author: jhb > Date: Sat May 2 00:06:58 2020 > New Revision: 360557 > URL: https://svnweb.freebsd.org/changeset/base/360557 > > Log: > Remove support for IPsec algorithms deprecated in r348205 and r360202. > > Examples of depecrated algorithms in manual pages and sample configs > are updated where relevant. I removed the one example of combining > ESP and AH (vs using a cipher and auth in ESP) as RFC 8221 says this > combination is NOT RECOMMENDED. > > Specifically, this removes support for the following ciphers: > - des-cbc > - 3des-cbc > - blowfish-cbc > - cast128-cbc > - des-deriv > - des-32iv > - camellia-cbc > > This also removes support for the following authentication algorithms: > - hmac-md5 > - keyed-md5 > - keyed-sha1 > - hmac-ripemd160 > > Reviewed by: cem, gnn (older verisons) > Relnotes: yes > Sponsored by: Chelsio Communications > Differential Revision: https://reviews.freebsd.org/D24342 Oops, forgot: PR: 245834 (exp-run) -- John Baldwin From owner-svn-src-head@freebsd.org Sat May 2 01: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 7AA932B5E4E; Sat, 2 May 2020 01:00:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DW4t2hBzz4M4C; Sat, 2 May 2020 01:00:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 574C6192D6; Sat, 2 May 2020 01:00:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04210UFk026242; Sat, 2 May 2020 01:00:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04210Tgm026239; Sat, 2 May 2020 01:00:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005020100.04210Tgm026239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 2 May 2020 01:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360560 - head/sys/netipsec X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/netipsec X-SVN-Commit-Revision: 360560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 01:00:30 -0000 Author: jhb Date: Sat May 2 01:00:29 2020 New Revision: 360560 URL: https://svnweb.freebsd.org/changeset/base/360560 Log: Don't pass bogus keys down for NULL algorithms. The changes in r359374 added various sanity checks in sessions and requests created by crypto consumers in part to permit backend drivers to make assumptions instead of duplicating checks for various edge cases. One of the new checks was to reject sessions which provide a pointer to a key while claiming the key is zero bits long. IPsec ESP tripped over this as it passes along whatever key is provided for NULL, including a pointer to a zero-length key when an empty string ("") is used with setkey(8). One option would be to teach the IPsec key layer to not allocate keys of zero length, but I went with a simpler fix of just not passing any keys down and always using a key length of zero for NULL algorithms. PR: 245832 Reported by: CI Modified: head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Sat May 2 00:10:25 2020 (r360559) +++ head/sys/netipsec/xform_ah.c Sat May 2 01:00:29 2020 (r360560) @@ -215,8 +215,10 @@ ah_init0(struct secasvar *sav, struct xformsw *xsp, /* Initialize crypto session. */ csp->csp_auth_alg = sav->tdb_authalgxform->type; - csp->csp_auth_klen = _KEYBITS(sav->key_auth) / 8; - csp->csp_auth_key = sav->key_auth->key_data; + if (csp->csp_auth_alg != CRYPTO_NULL_HMAC) { + csp->csp_auth_klen = _KEYBITS(sav->key_auth) / 8; + csp->csp_auth_key = sav->key_auth->key_data; + }; csp->csp_auth_mlen = AUTHSIZE(sav); return 0; Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Sat May 2 00:10:25 2020 (r360559) +++ head/sys/netipsec/xform_esp.c Sat May 2 01:00:29 2020 (r360560) @@ -220,9 +220,11 @@ esp_init(struct secasvar *sav, struct xformsw *xsp) /* Initialize crypto session. */ csp.csp_cipher_alg = sav->tdb_encalgxform->type; - csp.csp_cipher_key = sav->key_enc->key_data; - csp.csp_cipher_klen = _KEYBITS(sav->key_enc) / 8 - - SAV_ISCTRORGCM(sav) * 4; + if (csp.csp_cipher_alg != CRYPTO_NULL_CBC) { + csp.csp_cipher_key = sav->key_enc->key_data; + csp.csp_cipher_klen = _KEYBITS(sav->key_enc) / 8 - + SAV_ISCTRORGCM(sav) * 4; + }; csp.csp_ivlen = txform->ivsize; error = crypto_newsession(&sav->tdb_cryptoid, &csp, V_crypto_support); From owner-svn-src-head@freebsd.org Sat May 2 09:16: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 AB3C92C9876; Sat, 2 May 2020 09:16:35 +0000 (UTC) (envelope-from rene@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) server-signature RSA-PSS (4096 bits) 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 49Dk5H42Mjz3y0H; Sat, 2 May 2020 09:16:35 +0000 (UTC) (envelope-from rene@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1185) id 6440C5D4F; Sat, 2 May 2020 09:16:35 +0000 (UTC) Date: Sat, 2 May 2020 09:16:35 +0000 From: Rene Ladan To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r360540 - head/stand/libofw Message-ID: <20200502091635.GA16751@freefall.freebsd.org> References: <202005011750.041HoMaV058949@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202005011750.041HoMaV058949@repo.freebsd.org> X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 09:16:35 -0000 On Fri, May 01, 2020 at 05:50:22PM +0000, Warner Losh wrote: > Author: imp > Date: Fri May 1 17:50:21 2020 > New Revision: 360540 > URL: https://svnweb.freebsd.org/changeset/base/360540 > > Log: > Remove more stray sparc64 ifdefs. > > Also, dmabuf appears to only be set for sparc64 case, but there was a > comment at its only use that says it was broken for some apple > adapters. #ifdef it all of that out now that nothing sets it. > > Modified: > head/stand/libofw/ofw_net.c > > Modified: head/stand/libofw/ofw_net.c > ============================================================================== > --- head/stand/libofw/ofw_net.c Fri May 1 17:17:01 2020 (r360539) > +++ head/stand/libofw/ofw_net.c Fri May 1 17:50:21 2020 (r360540) [...] > @@ -220,20 +220,6 @@ ofwn_init(struct iodesc *desc, void *machdep_hint) > #if defined(NETIF_DEBUG) > printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance); > #endif > - > -#ifndef __sparc64__ ^ Shouldn't this code always be present? > - dmabuf = NULL; > - if (OF_call_method("dma-alloc", netinstance, 1, 1, (64 * 1024), &dmabuf) > - < 0) { > - printf("Failed to allocate DMA buffer (got %p).\n", dmabuf); > - goto punt; > - } > - > -#if defined(NETIF_DEBUG) > - printf("ofwn_init: allocated DMA buffer: %p\n", dmabuf); > -#endif > -#endif > - René From owner-svn-src-head@freebsd.org Sat May 2 09:17: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 E9D9D2C990A; Sat, 2 May 2020 09:17:57 +0000 (UTC) (envelope-from rene@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) server-signature RSA-PSS (4096 bits) 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 49Dk6s5xnjz3y6g; Sat, 2 May 2020 09:17:57 +0000 (UTC) (envelope-from rene@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1185) id A60C35D6F; Sat, 2 May 2020 09:17:57 +0000 (UTC) Date: Sat, 2 May 2020 09:17:57 +0000 From: Rene Ladan To: Warner Losh Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r360540 - head/stand/libofw Message-ID: <20200502091757.GB16751@freefall.freebsd.org> References: <202005011750.041HoMaV058949@repo.freebsd.org> <20200502091635.GA16751@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200502091635.GA16751@freefall.freebsd.org> X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 09:17:58 -0000 On Sat, May 02, 2020 at 09:16:35AM +0000, Rene Ladan wrote: > On Fri, May 01, 2020 at 05:50:22PM +0000, Warner Losh wrote: > > Author: imp > > Date: Fri May 1 17:50:21 2020 > > New Revision: 360540 > > URL: https://svnweb.freebsd.org/changeset/base/360540 > > > > Log: > > Remove more stray sparc64 ifdefs. > > > > Also, dmabuf appears to only be set for sparc64 case, but there was a > > comment at its only use that says it was broken for some apple > > adapters. #ifdef it all of that out now that nothing sets it. > > > > Modified: > > head/stand/libofw/ofw_net.c > > > > Modified: head/stand/libofw/ofw_net.c > > ============================================================================== > > --- head/stand/libofw/ofw_net.c Fri May 1 17:17:01 2020 (r360539) > > +++ head/stand/libofw/ofw_net.c Fri May 1 17:50:21 2020 (r360540) > [...] > > @@ -220,20 +220,6 @@ ofwn_init(struct iodesc *desc, void *machdep_hint) > > #if defined(NETIF_DEBUG) > > printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance); > > #endif > > - > > -#ifndef __sparc64__ > ^ > Shouldn't this code always be present? Ah yes, but already fixed :) René From owner-svn-src-head@freebsd.org Sat May 2 14:20: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 EAE4B2D0F62; Sat, 2 May 2020 14:20:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Drr05y0yz4FYW; Sat, 2 May 2020 14:20:32 +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 C75A322F09; Sat, 2 May 2020 14:20:32 +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 042EKWIx029504; Sat, 2 May 2020 14:20:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042EKW3d029502; Sat, 2 May 2020 14:20:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005021420.042EKW3d029502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 2 May 2020 14:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360562 - in head: sys/opencrypto tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: sys/opencrypto tests/sys/opencrypto X-SVN-Commit-Revision: 360562 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 14:20:33 -0000 Author: jhb Date: Sat May 2 14:20:32 2020 New Revision: 360562 URL: https://svnweb.freebsd.org/changeset/base/360562 Log: Remove support for the algorithms deprecated in r348876. This removes support for the following algorithms: - ARC4 - Blowfish - CAST128 - DES - 3DES - MD5-HMAC - Skipjack Since /dev/crypto no longer supports 3DES, stop testing the 3DES KAT vectors in cryptotest.py. Reviewed by: cem (previous version) Relnotes: yes Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24346 Modified: head/sys/opencrypto/cryptodev.c head/tests/sys/opencrypto/cryptotest.py Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Sat May 2 13:42:03 2020 (r360561) +++ head/sys/opencrypto/cryptodev.c Sat May 2 14:20:32 2020 (r360562) @@ -291,11 +291,6 @@ struct fcrypt { struct mtx lock; }; -static struct timeval warninterval = { .tv_sec = 60, .tv_usec = 0 }; -SYSCTL_TIMEVAL_SEC(_kern, OID_AUTO, cryptodev_warn_interval, CTLFLAG_RW, - &warninterval, - "Delay in seconds between warnings of deprecated /dev/crypto algorithms"); - static int cryptof_ioctl(struct file *, u_long, void *, struct ucred *, struct thread *); static int cryptof_stat(struct file *, struct stat *, @@ -408,21 +403,9 @@ cryptof_ioctl( switch (sop->cipher) { case 0: break; - case CRYPTO_DES_CBC: - txform = &enc_xform_des; - break; case CRYPTO_3DES_CBC: txform = &enc_xform_3des; break; - case CRYPTO_BLF_CBC: - txform = &enc_xform_blf; - break; - case CRYPTO_CAST_CBC: - txform = &enc_xform_cast5; - break; - case CRYPTO_SKIPJACK_CBC: - txform = &enc_xform_skipjack; - break; case CRYPTO_AES_CBC: txform = &enc_xform_rijndael128; break; @@ -432,9 +415,6 @@ cryptof_ioctl( case CRYPTO_NULL_CBC: txform = &enc_xform_null; break; - case CRYPTO_ARC4: - txform = &enc_xform_arc4; - break; case CRYPTO_CAMELLIA_CBC: txform = &enc_xform_camellia; break; @@ -460,9 +440,6 @@ cryptof_ioctl( switch (sop->mac) { case 0: break; - case CRYPTO_MD5_HMAC: - thash = &auth_hash_hmac_md5; - break; case CRYPTO_POLY1305: thash = &auth_hash_poly1305; break; @@ -847,49 +824,6 @@ cod_free(struct cryptop_data *cod) free(cod, M_XDATA); } -static void -cryptodev_warn(struct csession *cse) -{ - static struct timeval arc4warn, blfwarn, castwarn, deswarn, md5warn; - static struct timeval skipwarn, tdeswarn; - const struct crypto_session_params *csp; - - csp = crypto_get_params(cse->cses); - switch (csp->csp_cipher_alg) { - case CRYPTO_DES_CBC: - if (ratecheck(&deswarn, &warninterval)) - gone_in(13, "DES cipher via /dev/crypto"); - break; - case CRYPTO_3DES_CBC: - if (ratecheck(&tdeswarn, &warninterval)) - gone_in(13, "3DES cipher via /dev/crypto"); - break; - case CRYPTO_BLF_CBC: - if (ratecheck(&blfwarn, &warninterval)) - gone_in(13, "Blowfish cipher via /dev/crypto"); - break; - case CRYPTO_CAST_CBC: - if (ratecheck(&castwarn, &warninterval)) - gone_in(13, "CAST128 cipher via /dev/crypto"); - break; - case CRYPTO_SKIPJACK_CBC: - if (ratecheck(&skipwarn, &warninterval)) - gone_in(13, "Skipjack cipher via /dev/crypto"); - break; - case CRYPTO_ARC4: - if (ratecheck(&arc4warn, &warninterval)) - gone_in(13, "ARC4 cipher via /dev/crypto"); - break; - } - - switch (csp->csp_auth_alg) { - case CRYPTO_MD5_HMAC: - if (ratecheck(&md5warn, &warninterval)) - gone_in(13, "MD5-HMAC authenticator via /dev/crypto"); - break; - } -} - static int cryptodev_op( struct csession *cse, @@ -1040,7 +974,6 @@ cryptodev_op( goto bail; } } - cryptodev_warn(cse); again: /* * Let the dispatch run unlocked, then, interlock against the @@ -1231,7 +1164,6 @@ cryptodev_aead( SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); goto bail; } - cryptodev_warn(cse); again: /* * Let the dispatch run unlocked, then, interlock against the Modified: head/tests/sys/opencrypto/cryptotest.py ============================================================================== --- head/tests/sys/opencrypto/cryptotest.py Sat May 2 13:42:03 2020 (r360561) +++ head/tests/sys/opencrypto/cryptotest.py Sat May 2 14:20:32 2020 (r360562) @@ -51,7 +51,6 @@ def katg(base, glob): return iglob(os.path.join(katdir, base, glob)) aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0' ] -desmodules = [ 'cryptosoft0', ] shamodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0' ] def GenTestCase(cname): @@ -331,46 +330,6 @@ def GenTestCase(cname): " Actual: " + repr(binascii.hexlify(r)) + \ " Expected: " + repr(data) + \ " on " + cname) - - ############### - ##### DES ##### - ############### - @unittest.skipIf(cname not in desmodules, 'skipping DES on %s' % (cname)) - def test_tdes(self): - for i in katg('KAT_TDES', 'TCBC[a-z]*.rsp'): - self.runTDES(i) - - def runTDES(self, fname): - columns = [ 'COUNT', 'KEYs', 'IV', 'PLAINTEXT', 'CIPHERTEXT', ] - with cryptodev.KATParser(fname, columns) as parser: - self.runTDESWithParser(parser) - - def runTDESWithParser(self, parser): - curfun = None - for mode, lines in next(parser): - if mode == 'ENCRYPT': - swapptct = False - curfun = Crypto.encrypt - elif mode == 'DECRYPT': - swapptct = True - curfun = Crypto.decrypt - else: - raise RuntimeError('unknown mode: %r' % repr(mode)) - - for data in lines: - curcnt = int(data['COUNT']) - key = data['KEYs'] * 3 - cipherkey = binascii.unhexlify(key) - iv = binascii.unhexlify(data['IV']) - pt = binascii.unhexlify(data['PLAINTEXT']) - ct = binascii.unhexlify(data['CIPHERTEXT']) - - if swapptct: - pt, ct = ct, pt - # run the fun - c = Crypto(cryptodev.CRYPTO_3DES_CBC, cipherkey, crid=crid) - r = curfun(c, pt, iv) - self.assertEqual(r, ct) ############### ##### SHA ##### From owner-svn-src-head@freebsd.org Sat May 2 14:23: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 DF6312D1188; Sat, 2 May 2020 14:23:55 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Drvv5fKjz4FxK; Sat, 2 May 2020 14:23:55 +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 BD3D3230D9; Sat, 2 May 2020 14:23:55 +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 042ENtKU035234; Sat, 2 May 2020 14:23:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042ENtfC035233; Sat, 2 May 2020 14:23:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005021423.042ENtfC035233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 2 May 2020 14:23:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360563 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 360563 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 14:23:55 -0000 Author: jhb Date: Sat May 2 14:23:55 2020 New Revision: 360563 URL: https://svnweb.freebsd.org/changeset/base/360563 Log: Document removal of deprecated algorithms from /dev/crypto. Modified: head/RELNOTES Modified: head/RELNOTES ============================================================================== --- head/RELNOTES Sat May 2 14:20:32 2020 (r360562) +++ head/RELNOTES Sat May 2 14:23:55 2020 (r360563) @@ -10,6 +10,10 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +r360562: + Remove support for ARC4, Blowfish, Cast, DES, Triple DES, + MD5-HMAC, and Skipjack algorithms from /dev/crypto. + r360557: Remove support for DES, Triple DES, Blowfish, Cast, and Camellia ciphers from IPsec(4). Remove support for MD5-HMAC, From owner-svn-src-head@freebsd.org Sat May 2 16:55: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 898192D4689; Sat, 2 May 2020 16:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DwGD3WVDz4P6g; Sat, 2 May 2020 16:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F61824CF9; Sat, 2 May 2020 16:55:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042Gt0Hs027142; Sat, 2 May 2020 16:55:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042Gsx9B027098; Sat, 2 May 2020 16:54:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202005021654.042Gsx9B027098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 2 May 2020 16:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360564 - head/sys/cam/ctl X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam/ctl X-SVN-Commit-Revision: 360564 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 16:55:00 -0000 Author: mav Date: Sat May 2 16:54:59 2020 New Revision: 360564 URL: https://svnweb.freebsd.org/changeset/base/360564 Log: Cleanup LUN addition/removal. - Make ctl_add_lun() synchronous. Asynchronous addition was used by Copan's proprietary code long ago and never for upstream FreeBSD. - Move LUN enable/disable calls from backends to CTL core. - Serialize LUN modification and partially removal to avoid double frees. - Slightly unify backends code. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_backend.c head/sys/cam/ctl/ctl_backend.h head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c head/sys/cam/ctl/ctl_private.h Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat May 2 14:23:55 2020 (r360563) +++ head/sys/cam/ctl/ctl.c Sat May 2 16:54:59 2020 (r360564) @@ -469,10 +469,9 @@ static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, ui struct ctl_ooa_entry *kern_entries); static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td); -static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun, - struct ctl_be_lun *be_lun); +static int ctl_enable_lun(struct ctl_lun *lun); +static int ctl_disable_lun(struct ctl_lun *lun); static int ctl_free_lun(struct ctl_lun *lun); -static void ctl_create_lun(struct ctl_be_lun *be_lun); static int ctl_do_mode_select(union ctl_io *io); static int ctl_pro_preempt(struct ctl_softc *softc, struct ctl_lun *lun, @@ -547,7 +546,6 @@ static int ctl_datamove_remote_xfer(union ctl_io *io, static void ctl_datamove_remote_read(union ctl_io *io); static void ctl_datamove_remote(union ctl_io *io); static void ctl_process_done(union ctl_io *io); -static void ctl_lun_thread(void *arg); static void ctl_thresh_thread(void *arg); static void ctl_work_thread(void *arg); static void ctl_enqueue_incoming(union ctl_io *io); @@ -1945,7 +1943,6 @@ ctl_init(void) "HA link state (0 - offline, 1 - unknown, 2 - online)"); STAILQ_INIT(&softc->lun_list); - STAILQ_INIT(&softc->pending_lun_queue); STAILQ_INIT(&softc->fe_list); STAILQ_INIT(&softc->port_list); STAILQ_INIT(&softc->be_list); @@ -1973,12 +1970,6 @@ ctl_init(void) return (error); } } - error = kproc_kthread_add(ctl_lun_thread, softc, - &softc->ctl_proc, &softc->lun_thread, 0, 0, "ctl", "lun"); - if (error != 0) { - printf("error creating CTL lun thread!\n"); - return (error); - } error = kproc_kthread_add(ctl_thresh_thread, softc, &softc->ctl_proc, &softc->thresh_thread, 0, 0, "ctl", "thresh"); if (error != 0) { @@ -2020,11 +2011,6 @@ ctl_shutdown(void) } mtx_destroy(&thr->queue_lock); } - while (softc->lun_thread != NULL) { - wakeup(&softc->pending_lun_queue); - if (softc->lun_thread != NULL) - pause("CTL thr shutdown", 1); - } while (softc->thresh_thread != NULL) { wakeup(softc->thresh_thread); if (softc->thresh_thread != NULL) @@ -4497,32 +4483,23 @@ hex2bin(const char *str, uint8_t *buf, int buf_size) } /* - * LUN allocation. + * Add LUN. * - * Requirements: - * - caller allocates and zeros LUN storage, or passes in a NULL LUN if he - * wants us to allocate the LUN and he can block. - * - ctl_softc is always set - * - be_lun is set if the LUN has a backend (needed for disk LUNs) - * * Returns 0 for success, non-zero (errno) for failure. */ -static int -ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun, - struct ctl_be_lun *const be_lun) +int +ctl_add_lun(struct ctl_be_lun *be_lun) { + struct ctl_softc *ctl_softc = control_softc; struct ctl_lun *nlun, *lun; struct scsi_vpd_id_descriptor *desc; struct scsi_vpd_id_t10 *t10id; const char *eui, *naa, *scsiname, *uuid, *vendor, *value; - int lun_number, lun_malloced; + int lun_number; int devidlen, idlen1, idlen2 = 0, len; - if (be_lun == NULL) - return (EINVAL); - /* - * We currently only support Direct Access or Processor LUN types. + * We support only Direct Access, CD-ROM or Processor LUN types. */ switch (be_lun->lun_type) { case T_DIRECT: @@ -4532,22 +4509,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_ case T_SEQUENTIAL: case T_CHANGER: default: - be_lun->lun_config_status(be_lun->be_lun, - CTL_LUN_CONFIG_FAILURE); - break; + return (EINVAL); } - if (ctl_lun == NULL) { - lun = malloc(sizeof(*lun), M_CTL, M_WAITOK); - lun_malloced = 1; - } else { - lun_malloced = 0; - lun = ctl_lun; - } + lun = malloc(sizeof(*lun), M_CTL, M_WAITOK | M_ZERO); - memset(lun, 0, sizeof(*lun)); - if (lun_malloced) - lun->flags = CTL_LUN_MALLOCED; - lun->pending_sense = malloc(sizeof(struct scsi_sense_data *) * ctl_max_ports, M_DEVBUF, M_WAITOK | M_ZERO); lun->pending_ua = malloc(sizeof(ctl_ua_type *) * ctl_max_ports, @@ -4658,10 +4623,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_ } fail: free(lun->lun_devid, M_CTL); - if (lun->flags & CTL_LUN_MALLOCED) - free(lun, M_CTL); - be_lun->lun_config_status(be_lun->be_lun, - CTL_LUN_CONFIG_FAILURE); + free(lun, M_CTL); return (ENOSPC); } lun_number = be_lun->req_lun_id; @@ -4687,7 +4649,6 @@ fail: lun->backend = be_lun->be; be_lun->ctl_lun = lun; be_lun->lun_id = lun_number; - atomic_add_int(&be_lun->be->num_luns, 1); if (be_lun->flags & CTL_LUN_FLAG_EJECTED) lun->flags |= CTL_LUN_EJECTED; if (be_lun->flags & CTL_LUN_FLAG_NO_MEDIA) @@ -4743,15 +4704,27 @@ fail: ctl_softc->num_luns++; mtx_unlock(&ctl_softc->ctl_lock); - lun->be_lun->lun_config_status(lun->be_lun->be_lun, CTL_LUN_CONFIG_OK); + /* + * We successfully added the LUN, attempt to enable it. + */ + if (ctl_enable_lun(lun) != 0) { + printf("%s: ctl_enable_lun() failed!\n", __func__); + mtx_lock(&ctl_softc->ctl_lock); + STAILQ_REMOVE(&ctl_softc->lun_list, lun, ctl_lun, links); + ctl_clear_mask(ctl_softc->ctl_lun_mask, lun_number); + ctl_softc->ctl_luns[lun_number] = NULL; + ctl_softc->num_luns--; + mtx_unlock(&ctl_softc->ctl_lock); + free(lun->lun_devid, M_CTL); + free(lun, M_CTL); + return (EIO); + } + return (0); } /* - * Delete a LUN. - * Assumptions: - * - LUN has already been marked invalid and any pending I/O has been taken - * care of. + * Free LUN that has no active requests. */ static int ctl_free_lun(struct ctl_lun *lun) @@ -4778,7 +4751,6 @@ ctl_free_lun(struct ctl_lun *lun) /* * Tell the backend to free resources, if this LUN has a backend. */ - atomic_subtract_int(&lun->be_lun->be->num_luns, 1); lun->be_lun->lun_shutdown(lun->be_lun->be_lun); lun->ie_reportcnt = UINT32_MAX; @@ -4794,57 +4766,24 @@ ctl_free_lun(struct ctl_lun *lun) free(lun->pr_keys, M_DEVBUF); free(lun->write_buffer, M_CTL); free(lun->prevent, M_CTL); - if (lun->flags & CTL_LUN_MALLOCED) - free(lun, M_CTL); + free(lun, M_CTL); return (0); } -static void -ctl_create_lun(struct ctl_be_lun *be_lun) +static int +ctl_enable_lun(struct ctl_lun *lun) { - - /* - * ctl_alloc_lun() should handle all potential failure cases. - */ - ctl_alloc_lun(control_softc, NULL, be_lun); -} - -int -ctl_add_lun(struct ctl_be_lun *be_lun) -{ - struct ctl_softc *softc = control_softc; - - mtx_lock(&softc->ctl_lock); - STAILQ_INSERT_TAIL(&softc->pending_lun_queue, be_lun, links); - mtx_unlock(&softc->ctl_lock); - wakeup(&softc->pending_lun_queue); - - return (0); -} - -int -ctl_enable_lun(struct ctl_be_lun *be_lun) -{ struct ctl_softc *softc; struct ctl_port *port, *nport; - struct ctl_lun *lun; int retval; - lun = (struct ctl_lun *)be_lun->ctl_lun; softc = lun->ctl_softc; mtx_lock(&softc->ctl_lock); mtx_lock(&lun->lun_lock); - if ((lun->flags & CTL_LUN_DISABLED) == 0) { - /* - * eh? Why did we get called if the LUN is already - * enabled? - */ - mtx_unlock(&lun->lun_lock); - mtx_unlock(&softc->ctl_lock); - return (0); - } + KASSERT((lun->flags & CTL_LUN_DISABLED) != 0, + ("%s: LUN not disabled", __func__)); lun->flags &= ~CTL_LUN_DISABLED; mtx_unlock(&lun->lun_lock); @@ -4875,24 +4814,19 @@ ctl_enable_lun(struct ctl_be_lun *be_lun) return (0); } -int -ctl_disable_lun(struct ctl_be_lun *be_lun) +static int +ctl_disable_lun(struct ctl_lun *lun) { struct ctl_softc *softc; struct ctl_port *port; - struct ctl_lun *lun; int retval; - lun = (struct ctl_lun *)be_lun->ctl_lun; softc = lun->ctl_softc; mtx_lock(&softc->ctl_lock); mtx_lock(&lun->lun_lock); - if (lun->flags & CTL_LUN_DISABLED) { - mtx_unlock(&lun->lun_lock); - mtx_unlock(&softc->ctl_lock); - return (0); - } + KASSERT((lun->flags & CTL_LUN_DISABLED) == 0, + ("%s: LUN not enabled", __func__)); lun->flags |= CTL_LUN_DISABLED; mtx_unlock(&lun->lun_lock); @@ -5023,25 +4957,22 @@ ctl_lun_secondary(struct ctl_be_lun *be_lun) return (0); } +/* + * Remove LUN. If there are active requests, wait for completion. + * + * Returns 0 for success, non-zero (errno) for failure. + * Completion is reported to backed via the lun_shutdown() method. + */ int -ctl_invalidate_lun(struct ctl_be_lun *be_lun) +ctl_remove_lun(struct ctl_be_lun *be_lun) { struct ctl_lun *lun; lun = (struct ctl_lun *)be_lun->ctl_lun; - mtx_lock(&lun->lun_lock); + ctl_disable_lun(lun); - /* - * The LUN needs to be disabled before it can be marked invalid. - */ - if ((lun->flags & CTL_LUN_DISABLED) == 0) { - mtx_unlock(&lun->lun_lock); - return (-1); - } - /* - * Mark the LUN invalid. - */ + mtx_lock(&lun->lun_lock); lun->flags |= CTL_LUN_INVALID; /* @@ -13400,35 +13331,6 @@ ctl_work_thread(void *arg) mtx_sleep(thr, &thr->queue_lock, PDROP, "-", 0); } thr->thread = NULL; - kthread_exit(); -} - -static void -ctl_lun_thread(void *arg) -{ - struct ctl_softc *softc = (struct ctl_softc *)arg; - struct ctl_be_lun *be_lun; - - CTL_DEBUG_PRINT(("ctl_lun_thread starting\n")); - thread_lock(curthread); - sched_prio(curthread, PUSER - 1); - thread_unlock(curthread); - - while (!softc->shutdown) { - mtx_lock(&softc->ctl_lock); - be_lun = STAILQ_FIRST(&softc->pending_lun_queue); - if (be_lun != NULL) { - STAILQ_REMOVE_HEAD(&softc->pending_lun_queue, links); - mtx_unlock(&softc->ctl_lock); - ctl_create_lun(be_lun); - continue; - } - - /* Sleep until we have something to do. */ - mtx_sleep(&softc->pending_lun_queue, &softc->ctl_lock, - PDROP, "-", 0); - } - softc->lun_thread = NULL; kthread_exit(); } Modified: head/sys/cam/ctl/ctl_backend.c ============================================================================== --- head/sys/cam/ctl/ctl_backend.c Sat May 2 14:23:55 2020 (r360563) +++ head/sys/cam/ctl/ctl_backend.c Sat May 2 16:54:59 2020 (r360564) @@ -83,7 +83,6 @@ ctl_backend_register(struct ctl_backend_driver *be) #ifdef CS_BE_CONFIG_MOVE_DONE_IS_NOT_USED be->config_move_done = ctl_config_move_done; #endif - be->num_luns = 0; /* Call the backend's initialization routine. */ if (be->init != NULL) { Modified: head/sys/cam/ctl/ctl_backend.h ============================================================================== --- head/sys/cam/ctl/ctl_backend.h Sat May 2 14:23:55 2020 (r360563) +++ head/sys/cam/ctl/ctl_backend.h Sat May 2 16:54:59 2020 (r360564) @@ -80,14 +80,7 @@ typedef enum { MODULE_DEPEND(name, cam, 1, 1, 1) -typedef enum { - CTL_LUN_CONFIG_OK, - CTL_LUN_CONFIG_FAILURE -} ctl_lun_config_status; - typedef void (*be_callback_t)(void *be_lun); -typedef void (*be_lun_config_t)(void *be_lun, - ctl_lun_config_status status); /* * The lun_type field is the SCSI device type of this particular LUN. In @@ -136,16 +129,11 @@ typedef void (*be_lun_config_t)(void *be_lun, * should be padded with ASCII spaces. This field should NOT be NULL * terminated. * - * The lun_shutdown() method is the callback for the ctl_invalidate_lun() + * The lun_shutdown() method is the callback for the ctl_remove_lun() * call. It is called when all outstanding I/O for that LUN has been * completed and CTL has deleted the resources for that LUN. When the CTL * backend gets this call, it can safely free its per-LUN resources. * - * The lun_config_status() method is the callback for the ctl_add_lun() - * call. It is called when the LUN is successfully added, or when LUN - * addition fails. If the LUN is successfully added, the backend may call - * the ctl_enable_lun() method to enable the LUN. - * * The be field is a pointer to the ctl_backend_driver structure, which * contains the backend methods to be called by CTL. * @@ -173,7 +161,6 @@ struct ctl_be_lun { uint8_t serial_num[CTL_SN_LEN]; /* passed to CTL */ uint8_t device_id[CTL_DEVID_LEN];/* passed to CTL */ be_callback_t lun_shutdown; /* passed to CTL */ - be_lun_config_t lun_config_status; /* passed to CTL */ struct ctl_backend_driver *be; /* passed to CTL */ void *ctl_lun; /* used by CTL */ nvlist_t *options; /* passed to CTL */ @@ -212,7 +199,6 @@ struct ctl_backend_driver { #if 0 be_vfunc_t config_write_done; /* passed to backend */ #endif - u_int num_luns; /* used by CTL */ STAILQ_ENTRY(ctl_backend_driver) links; /* used by CTL */ }; @@ -221,22 +207,16 @@ int ctl_backend_deregister(struct ctl_backend_driver * struct ctl_backend_driver *ctl_backend_find(char *backend_name); /* - * To add a LUN, first call ctl_add_lun(). You will get the lun_config_status() - * callback when the LUN addition has either succeeded or failed. - * - * Once you get that callback, you can then call ctl_enable_lun() to enable - * the LUN. + * To add a LUN, call ctl_add_lun(). */ int ctl_add_lun(struct ctl_be_lun *be_lun); -int ctl_enable_lun(struct ctl_be_lun *be_lun); /* - * To delete a LUN, first call ctl_disable_lun(), then - * ctl_invalidate_lun(). You will get the lun_shutdown() callback when all + * To remove a LUN, first call ctl_remove_lun(). + * You will get the lun_shutdown() callback when all * I/O to the LUN has completed and the LUN has been deleted. */ -int ctl_disable_lun(struct ctl_be_lun *be_lun); -int ctl_invalidate_lun(struct ctl_be_lun *be_lun); +int ctl_remove_lun(struct ctl_be_lun *be_lun); /* * To start a LUN (transition from powered off to powered on state) call Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Sat May 2 14:23:55 2020 (r360563) +++ head/sys/cam/ctl/ctl_backend_block.c Sat May 2 16:54:59 2020 (r360564) @@ -80,6 +80,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -121,7 +122,6 @@ SDT_PROVIDER_DEFINE(cbb); typedef enum { CTL_BE_BLOCK_LUN_UNCONFIGURED = 0x01, - CTL_BE_BLOCK_LUN_CONFIG_ERR = 0x02, CTL_BE_BLOCK_LUN_WAITING = 0x04, } ctl_be_block_lun_flags; @@ -153,7 +153,6 @@ typedef uint64_t (*cbb_getattr_t)(struct ctl_be_block_ */ struct ctl_be_block_lun { struct ctl_lun_create_params params; - char lunname[32]; char *dev_path; ctl_be_block_type dev_type; struct vnode *vn; @@ -169,7 +168,7 @@ struct ctl_be_block_lun { struct ctl_be_block_softc *softc; struct devstat *disk_stats; ctl_be_block_lun_flags flags; - STAILQ_ENTRY(ctl_be_block_lun) links; + SLIST_ENTRY(ctl_be_block_lun) links; struct ctl_be_lun cbe_lun; struct taskqueue *io_taskqueue; struct task io_task; @@ -186,10 +185,11 @@ struct ctl_be_block_lun { * Overall softc structure for the block backend module. */ struct ctl_be_block_softc { + struct sx modify_lock; struct mtx lock; uma_zone_t beio_zone; int num_luns; - STAILQ_HEAD(, ctl_be_block_lun) lun_list; + SLIST_HEAD(, ctl_be_block_lun) lun_list; }; static struct ctl_be_block_softc backend_block_softc; @@ -272,8 +272,6 @@ static int ctl_be_block_rm(struct ctl_be_block_softc * static int ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req); static void ctl_be_block_lun_shutdown(void *be_lun); -static void ctl_be_block_lun_config_status(void *be_lun, - ctl_lun_config_status status); static int ctl_be_block_config_write(union ctl_io *io); static int ctl_be_block_config_read(union ctl_io *io); static int ctl_be_block_lun_info(void *be_lun, struct sbuf *sb); @@ -296,7 +294,7 @@ static struct ctl_backend_driver ctl_be_block_driver = .lun_attr = ctl_be_block_lun_attr }; -MALLOC_DEFINE(M_CTLBLK, "ctlblk", "Memory used for CTL block backend"); +MALLOC_DEFINE(M_CTLBLK, "ctlblock", "Memory used for CTL block backend"); CTL_BACKEND_DECLARE(cbb, ctl_be_block_driver); static struct ctl_be_block_io * @@ -1761,13 +1759,10 @@ static int ctl_be_block_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { - struct ctl_be_block_softc *softc; + struct ctl_be_block_softc *softc = &backend_block_softc; int error; - softc = &backend_block_softc; - error = 0; - switch (cmd) { case CTL_LUN_REQ: { struct ctl_lun_req *lun_req; @@ -2230,11 +2225,10 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, STAILQ_INIT(&be_lun->config_read_queue); STAILQ_INIT(&be_lun->config_write_queue); STAILQ_INIT(&be_lun->datamove_queue); - sprintf(be_lun->lunname, "cblk%d", softc->num_luns); - mtx_init(&be_lun->io_lock, "cblk io lock", NULL, MTX_DEF); - mtx_init(&be_lun->queue_lock, "cblk queue lock", NULL, MTX_DEF); + mtx_init(&be_lun->io_lock, "ctlblock io", NULL, MTX_DEF); + mtx_init(&be_lun->queue_lock, "ctlblock queue", NULL, MTX_DEF); cbe_lun->options = nvlist_clone(req->args_nvl); - be_lun->lun_zone = uma_zcreate(be_lun->lunname, CTLBLK_MAX_SEG, + be_lun->lun_zone = uma_zcreate("ctlblock", CTLBLK_MAX_SEG, NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); if (be_lun->lun_zone == NULL) { snprintf(req->error_str, sizeof(req->error_str), @@ -2246,7 +2240,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, cbe_lun->lun_type = params->device_type; else cbe_lun->lun_type = T_DIRECT; - be_lun->flags = CTL_BE_BLOCK_LUN_UNCONFIGURED; + be_lun->flags = 0; cbe_lun->flags = 0; value = dnvlist_get_string(cbe_lun->options, "ha_role", NULL); if (value != NULL) { @@ -2311,7 +2305,6 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, cbe_lun->req_lun_id = 0; cbe_lun->lun_shutdown = ctl_be_block_lun_shutdown; - cbe_lun->lun_config_status = ctl_be_block_lun_config_status; cbe_lun->be = &ctl_be_block_driver; if ((params->flags & CTL_LUN_FLAG_SERIAL_NUM) == 0) { @@ -2344,7 +2337,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, TASK_INIT(&be_lun->io_task, /*priority*/0, ctl_be_block_worker, be_lun); - be_lun->io_taskqueue = taskqueue_create(be_lun->lunname, M_WAITOK, + be_lun->io_taskqueue = taskqueue_create("ctlblocktq", M_WAITOK, taskqueue_thread_enqueue, /*context*/&be_lun->io_taskqueue); if (be_lun->io_taskqueue == NULL) { @@ -2371,27 +2364,15 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, /*num threads*/num_threads, /*priority*/PUSER, /*proc*/control_softc->ctl_proc, - /*thread name*/ - "%s taskq", be_lun->lunname); + /*thread name*/"block"); if (retval != 0) goto bailout_error; be_lun->num_threads = num_threads; - mtx_lock(&softc->lock); - softc->num_luns++; - STAILQ_INSERT_TAIL(&softc->lun_list, be_lun, links); - - mtx_unlock(&softc->lock); - retval = ctl_add_lun(&be_lun->cbe_lun); if (retval != 0) { - mtx_lock(&softc->lock); - STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_block_lun, - links); - softc->num_luns--; - mtx_unlock(&softc->lock); snprintf(req->error_str, sizeof(req->error_str), "ctl_add_lun() returned error %d, see dmesg for " "details", retval); @@ -2399,42 +2380,20 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, goto bailout_error; } - mtx_lock(&softc->lock); - - /* - * Tell the config_status routine that we're waiting so it won't - * clean up the LUN in the event of an error. - */ - be_lun->flags |= CTL_BE_BLOCK_LUN_WAITING; - - while (be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) { - retval = msleep(be_lun, &softc->lock, PCATCH, "ctlblk", 0); - if (retval == EINTR) - break; - } - be_lun->flags &= ~CTL_BE_BLOCK_LUN_WAITING; - - if (be_lun->flags & CTL_BE_BLOCK_LUN_CONFIG_ERR) { - snprintf(req->error_str, sizeof(req->error_str), - "LUN configuration error, see dmesg for details"); - STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_block_lun, - links); - softc->num_luns--; - mtx_unlock(&softc->lock); - goto bailout_error; - } else { - params->req_lun_id = cbe_lun->lun_id; - } - - mtx_unlock(&softc->lock); - - be_lun->disk_stats = devstat_new_entry("cbb", params->req_lun_id, + be_lun->disk_stats = devstat_new_entry("cbb", cbe_lun->lun_id, cbe_lun->blocksize, DEVSTAT_ALL_SUPPORTED, cbe_lun->lun_type | DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_OTHER); + mtx_lock(&softc->lock); + softc->num_luns++; + SLIST_INSERT_HEAD(&softc->lun_list, be_lun, links); + mtx_unlock(&softc->lock); + + params->req_lun_id = cbe_lun->lun_id; + return (retval); bailout_error: @@ -2465,12 +2424,18 @@ ctl_be_block_rm(struct ctl_be_block_softc *softc, stru params = &req->reqdata.rm; + sx_xlock(&softc->modify_lock); mtx_lock(&softc->lock); - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { - if (be_lun->cbe_lun.lun_id == params->lun_id) + SLIST_FOREACH(be_lun, &softc->lun_list, links) { + if (be_lun->cbe_lun.lun_id == params->lun_id) { + SLIST_REMOVE(&softc->lun_list, be_lun, + ctl_be_block_lun, links); + softc->num_luns--; break; + } } mtx_unlock(&softc->lock); + sx_xunlock(&softc->modify_lock); if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), "LUN %u is not managed by the block backend", @@ -2479,14 +2444,6 @@ ctl_be_block_rm(struct ctl_be_block_softc *softc, stru } cbe_lun = &be_lun->cbe_lun; - retval = ctl_disable_lun(cbe_lun); - if (retval != 0) { - snprintf(req->error_str, sizeof(req->error_str), - "error %d returned from ctl_disable_lun() for " - "LUN %d", retval, params->lun_id); - goto bailout_error; - } - if (be_lun->vn != NULL) { cbe_lun->flags |= CTL_LUN_FLAG_NO_MEDIA; ctl_lun_no_media(cbe_lun); @@ -2494,49 +2451,36 @@ ctl_be_block_rm(struct ctl_be_block_softc *softc, stru ctl_be_block_close(be_lun); } - retval = ctl_invalidate_lun(cbe_lun); + mtx_lock(&softc->lock); + be_lun->flags |= CTL_BE_BLOCK_LUN_WAITING; + mtx_unlock(&softc->lock); + + retval = ctl_remove_lun(cbe_lun); if (retval != 0) { snprintf(req->error_str, sizeof(req->error_str), - "error %d returned from ctl_invalidate_lun() for " + "error %d returned from ctl_remove_lun() for " "LUN %d", retval, params->lun_id); + mtx_lock(&softc->lock); + be_lun->flags &= ~CTL_BE_BLOCK_LUN_WAITING; + mtx_unlock(&softc->lock); goto bailout_error; } mtx_lock(&softc->lock); - be_lun->flags |= CTL_BE_BLOCK_LUN_WAITING; while ((be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) == 0) { - retval = msleep(be_lun, &softc->lock, PCATCH, "ctlblk", 0); - if (retval == EINTR) - break; - } + retval = msleep(be_lun, &softc->lock, PCATCH, "ctlblockrm", 0); + if (retval == EINTR) + break; + } be_lun->flags &= ~CTL_BE_BLOCK_LUN_WAITING; - - if ((be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) == 0) { - snprintf(req->error_str, sizeof(req->error_str), - "interrupted waiting for LUN to be freed"); + if (be_lun->flags & CTL_BE_BLOCK_LUN_UNCONFIGURED) { mtx_unlock(&softc->lock); - goto bailout_error; + free(be_lun, M_CTLBLK); + } else { + mtx_unlock(&softc->lock); + return (EINTR); } - STAILQ_REMOVE(&softc->lun_list, be_lun, ctl_be_block_lun, links); - - softc->num_luns--; - mtx_unlock(&softc->lock); - - taskqueue_drain_all(be_lun->io_taskqueue); - taskqueue_free(be_lun->io_taskqueue); - - if (be_lun->disk_stats != NULL) - devstat_remove_entry(be_lun->disk_stats); - - uma_zdestroy(be_lun->lun_zone); - - nvlist_destroy(cbe_lun->options); - free(be_lun->dev_path, M_CTLBLK); - mtx_destroy(&be_lun->queue_lock); - mtx_destroy(&be_lun->io_lock); - free(be_lun, M_CTLBLK); - req->status = CTL_LUN_OK; return (0); @@ -2557,8 +2501,9 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, params = &req->reqdata.modify; + sx_xlock(&softc->modify_lock); mtx_lock(&softc->lock); - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { + SLIST_FOREACH(be_lun, &softc->lun_list, links) { if (be_lun->cbe_lun.lun_id == params->lun_id) break; } @@ -2635,66 +2580,41 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, /* Tell the user the exact size we ended up using */ params->lun_size_bytes = be_lun->size_bytes; + sx_xunlock(&softc->modify_lock); req->status = error ? CTL_LUN_WARNING : CTL_LUN_OK; return (0); bailout_error: + sx_xunlock(&softc->modify_lock); req->status = CTL_LUN_ERROR; return (0); } static void -ctl_be_block_lun_shutdown(void *be_lun) +ctl_be_block_lun_shutdown(void *lun) { - struct ctl_be_block_lun *lun = be_lun; - struct ctl_be_block_softc *softc = lun->softc; + struct ctl_be_block_lun *be_lun = lun; + struct ctl_be_block_softc *softc = be_lun->softc; - mtx_lock(&softc->lock); - lun->flags |= CTL_BE_BLOCK_LUN_UNCONFIGURED; - if (lun->flags & CTL_BE_BLOCK_LUN_WAITING) - wakeup(lun); - mtx_unlock(&softc->lock); -} + taskqueue_drain_all(be_lun->io_taskqueue); + taskqueue_free(be_lun->io_taskqueue); + if (be_lun->disk_stats != NULL) + devstat_remove_entry(be_lun->disk_stats); + uma_zdestroy(be_lun->lun_zone); + nvlist_destroy(be_lun->cbe_lun.options); + free(be_lun->dev_path, M_CTLBLK); + mtx_destroy(&be_lun->queue_lock); + mtx_destroy(&be_lun->io_lock); -static void -ctl_be_block_lun_config_status(void *be_lun, ctl_lun_config_status status) -{ - struct ctl_be_block_lun *lun; - struct ctl_be_block_softc *softc; - - lun = (struct ctl_be_block_lun *)be_lun; - softc = lun->softc; - - if (status == CTL_LUN_CONFIG_OK) { - mtx_lock(&softc->lock); - lun->flags &= ~CTL_BE_BLOCK_LUN_UNCONFIGURED; - if (lun->flags & CTL_BE_BLOCK_LUN_WAITING) - wakeup(lun); - mtx_unlock(&softc->lock); - - /* - * We successfully added the LUN, attempt to enable it. - */ - if (ctl_enable_lun(&lun->cbe_lun) != 0) { - printf("%s: ctl_enable_lun() failed!\n", __func__); - if (ctl_invalidate_lun(&lun->cbe_lun) != 0) { - printf("%s: ctl_invalidate_lun() failed!\n", - __func__); - } - } - - return; - } - - mtx_lock(&softc->lock); - lun->flags &= ~CTL_BE_BLOCK_LUN_UNCONFIGURED; - lun->flags |= CTL_BE_BLOCK_LUN_CONFIG_ERR; - wakeup(lun); + be_lun->flags |= CTL_BE_BLOCK_LUN_UNCONFIGURED; + if (be_lun->flags & CTL_BE_BLOCK_LUN_WAITING) + wakeup(be_lun); + else + free(be_lun, M_CTLBLK); mtx_unlock(&softc->lock); } - static int ctl_be_block_config_write(union ctl_io *io) { @@ -2858,10 +2778,11 @@ ctl_be_block_init(void) { struct ctl_be_block_softc *softc = &backend_block_softc; + sx_init(&softc->modify_lock, "ctlblock modify"); mtx_init(&softc->lock, "ctlblock", NULL, MTX_DEF); softc->beio_zone = uma_zcreate("beio", sizeof(struct ctl_be_block_io), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - STAILQ_INIT(&softc->lun_list); + SLIST_INIT(&softc->lun_list); return (0); } @@ -2870,23 +2791,24 @@ static int ctl_be_block_shutdown(void) { struct ctl_be_block_softc *softc = &backend_block_softc; - struct ctl_be_block_lun *lun, *next_lun; + struct ctl_be_block_lun *lun; mtx_lock(&softc->lock); - STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) { + while ((lun = SLIST_FIRST(&softc->lun_list)) != NULL) { + SLIST_REMOVE_HEAD(&softc->lun_list, links); + softc->num_luns--; /* - * Drop our lock here. Since ctl_invalidate_lun() can call + * Drop our lock here. Since ctl_remove_lun() can call * back into us, this could potentially lead to a recursive * lock of the same mutex, which would cause a hang. */ mtx_unlock(&softc->lock); - ctl_disable_lun(&lun->cbe_lun); - ctl_invalidate_lun(&lun->cbe_lun); + ctl_remove_lun(&lun->cbe_lun); mtx_lock(&softc->lock); } mtx_unlock(&softc->lock); - uma_zdestroy(softc->beio_zone); mtx_destroy(&softc->lock); + sx_destroy(&softc->modify_lock); return (0); } Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Sat May 2 14:23:55 2020 (r360563) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Sat May 2 16:54:59 2020 (r360564) @@ -102,13 +102,11 @@ typedef enum { typedef enum { CTL_BE_RAMDISK_LUN_UNCONFIGURED = 0x01, - CTL_BE_RAMDISK_LUN_CONFIG_ERR = 0x02, CTL_BE_RAMDISK_LUN_WAITING = 0x04 } ctl_be_ramdisk_lun_flags; struct ctl_be_ramdisk_lun { struct ctl_lun_create_params params; - char lunname[32]; int indir; uint8_t **pages; uint8_t *zero_page; @@ -121,7 +119,7 @@ struct ctl_be_ramdisk_lun { uint64_t cap_used; struct ctl_be_ramdisk_softc *softc; ctl_be_ramdisk_lun_flags flags; - STAILQ_ENTRY(ctl_be_ramdisk_lun) links; + SLIST_ENTRY(ctl_be_ramdisk_lun) links; struct ctl_be_lun cbe_lun; struct taskqueue *io_taskqueue; struct task io_task; @@ -130,9 +128,10 @@ struct ctl_be_ramdisk_lun { }; struct ctl_be_ramdisk_softc { + struct sx modify_lock; struct mtx lock; int num_luns; - STAILQ_HEAD(, ctl_be_ramdisk_lun) lun_list; + SLIST_HEAD(, ctl_be_ramdisk_lun) lun_list; }; static struct ctl_be_ramdisk_softc rd_softc; @@ -157,8 +156,6 @@ static int ctl_backend_ramdisk_create(struct ctl_be_ra static int ctl_backend_ramdisk_modify(struct ctl_be_ramdisk_softc *softc, struct ctl_lun_req *req); static void ctl_backend_ramdisk_lun_shutdown(void *be_lun); -static void ctl_backend_ramdisk_lun_config_status(void *be_lun, - ctl_lun_config_status status); static struct ctl_backend_driver ctl_be_ramdisk_driver = { @@ -174,7 +171,7 @@ static struct ctl_backend_driver ctl_be_ramdisk_driver .lun_attr = ctl_backend_ramdisk_lun_attr, }; -MALLOC_DEFINE(M_RAMDISK, "ramdisk", "Memory used for CTL RAMdisk"); +MALLOC_DEFINE(M_RAMDISK, "ctlramdisk", "Memory used for CTL RAMdisk"); CTL_BACKEND_DECLARE(cbr, ctl_be_ramdisk_driver); static int @@ -183,8 +180,9 @@ ctl_backend_ramdisk_init(void) struct ctl_be_ramdisk_softc *softc = &rd_softc; memset(softc, 0, sizeof(*softc)); - mtx_init(&softc->lock, "ctlramdisk", NULL, MTX_DEF); - STAILQ_INIT(&softc->lun_list); + sx_init(&softc->modify_lock, "ctlrammod"); + mtx_init(&softc->lock, "ctlram", NULL, MTX_DEF); + SLIST_INIT(&softc->lun_list); return (0); } @@ -192,22 +190,24 @@ static int ctl_backend_ramdisk_shutdown(void) { struct ctl_be_ramdisk_softc *softc = &rd_softc; - struct ctl_be_ramdisk_lun *lun, *next_lun; + struct ctl_be_ramdisk_lun *lun; mtx_lock(&softc->lock); - STAILQ_FOREACH_SAFE(lun, &softc->lun_list, links, next_lun) { + while ((lun = SLIST_FIRST(&softc->lun_list)) != NULL) { + SLIST_REMOVE_HEAD(&softc->lun_list, links); + softc->num_luns--; /* - * Drop our lock here. Since ctl_invalidate_lun() can call + * Drop our lock here. Since ctl_remove_lun() can call * back into us, this could potentially lead to a recursive * lock of the same mutex, which would cause a hang. */ mtx_unlock(&softc->lock); - ctl_disable_lun(&lun->cbe_lun); - ctl_invalidate_lun(&lun->cbe_lun); + ctl_remove_lun(&lun->cbe_lun); mtx_lock(&softc->lock); } mtx_unlock(&softc->lock); mtx_destroy(&softc->lock); + sx_destroy(&softc->modify_lock); return (0); } @@ -889,12 +889,18 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *so int retval; params = &req->reqdata.rm; + sx_xlock(&softc->modify_lock); mtx_lock(&softc->lock); - STAILQ_FOREACH(be_lun, &softc->lun_list, links) { - if (be_lun->cbe_lun.lun_id == params->lun_id) + SLIST_FOREACH(be_lun, &softc->lun_list, links) { + if (be_lun->cbe_lun.lun_id == params->lun_id) { + SLIST_REMOVE(&softc->lun_list, be_lun, + ctl_be_ramdisk_lun, links); + softc->num_luns--; break; + } } mtx_unlock(&softc->lock); + sx_xunlock(&softc->modify_lock); if (be_lun == NULL) { snprintf(req->error_str, sizeof(req->error_str), "%s: LUN %u is not managed by the ramdisk backend", @@ -902,14 +908,6 @@ ctl_backend_ramdisk_rm(struct ctl_be_ramdisk_softc *so goto bailout_error; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat May 2 17:18: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 C0DC32D5257; Sat, 2 May 2020 17:18:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DwnN4jbCz4QQ3; Sat, 2 May 2020 17:18:32 +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 9D092250AB; Sat, 2 May 2020 17:18:32 +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 042HIWmO039569; Sat, 2 May 2020 17:18:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042HIWjX039568; Sat, 2 May 2020 17:18:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202005021718.042HIWjX039568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 2 May 2020 17:18:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360565 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 360565 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 17:18:32 -0000 Author: jhb Date: Sat May 2 17:18:32 2020 New Revision: 360565 URL: https://svnweb.freebsd.org/changeset/base/360565 Log: Actually remove support for Triple DES, not just the warning. Missed in r360562. Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Sat May 2 16:54:59 2020 (r360564) +++ head/sys/opencrypto/cryptodev.c Sat May 2 17:18:32 2020 (r360565) @@ -403,9 +403,6 @@ cryptof_ioctl( switch (sop->cipher) { case 0: break; - case CRYPTO_3DES_CBC: - txform = &enc_xform_3des; - break; case CRYPTO_AES_CBC: txform = &enc_xform_rijndael128; break; From owner-svn-src-head@freebsd.org Sat May 2 18:34: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 9F85E2D6E90 for ; Sat, 2 May 2020 18:34:30 +0000 (UTC) (envelope-from 01000171d6ab1502-e76bf5ef-c2f2-4258-bc38-1b0504d04abd-000000@amazonses.com) Received: from a8-237.smtp-out.amazonses.com (a8-237.smtp-out.amazonses.com [54.240.8.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49DyT12vsZz4VMG for ; Sat, 2 May 2020 18:34:29 +0000 (UTC) (envelope-from 01000171d6ab1502-e76bf5ef-c2f2-4258-bc38-1b0504d04abd-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn; d=tarsnap.com; t=1588444468; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=V6scXrA3AhBns8eWsezfQPPqhUIAkXYvUhdf29mhEvw=; b=mxO8OIkh74F2yEfm7TScnXrwrj4svn77sqdJ8DPvywi2h1yBWdFKoxQZuf/8TIO6 ULfa649n4NqfrorKkVgtxfjUflspBjNYRHcbses6B6Q5wzChETD26N1LhiFSIGMtULb +DEIdE4gFeQnx/ILhrtWB807zUkMZjwyi2gmADgc= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1588444468; h=Subject:To:References:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=V6scXrA3AhBns8eWsezfQPPqhUIAkXYvUhdf29mhEvw=; b=RS7D9VnUOHp3fBnMxb65DIfBdShQ1JQdLdBZl2LCScF/0r8kWe4hrK+lCMXEPXcL OVIb9n1MR+Gx4s2+mpCZWTCTaS2FlrjDysKbbS+hy8c6MbotyA5375ZvqJXr4pjiLN+ ZMX4UzKcK8j+x6szY9ELLfzymCQSP5zhesFDg5zo= Subject: Re: svn commit: r360508 - head/sys/cam/nvme To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202004302108.03UL8xks087664@repo.freebsd.org> From: Colin Percival Autocrypt: addr=cperciva@tarsnap.com; prefer-encrypt=mutual; keydata= mQGhBElrAAcRBACDfDys4ZtK+ErCJ1HAzYeteKpm3OEsvT/49AjUTLihkF79HhIKrCQU+1KC zv7BwHCMLb6hq30As9L7iFKG7n5QFLFC4Te/VcITUnWHMG/c3ViLOfJGvi+9/nOEHaM1dVJY D6tEp5yM1nHmVQpo9932j4KGuGFR0LhOK5IHXOSfGwCgxSFDPdgxe2OEjWxjGgY+oV3EafcD +JROXCTjlcQiG/OguQH4Vks3mhHfFnEppLxTkDuYgHZQiUtpcT9ssH5khgqoTyMar05OUdAj ZIhNbWDh4LgTj+7ZmvLhXT5Zxw8LX9d7T36aTB8XDQSenDqEtinMWOb0TCBBLbsB8EFG1WTT ESbZci9jJS5yhtktuZoY/eM8uXMD/3k4FWFO80VRRkELSp+XSy/VlSQjyi/rhl2nQq/oOA9F oJbDaB0yq9VNhxP+uFBzBWSqeIX0t1ZWLtNfVFr4TRP5hihI5ICrg/0OpqgisKsU2NFe9xyO hyJLYmfD8ebpDJ/9k30C7Iju9pVrwLm1QgS4S2fqJRcR+U4WbjvP7CgStCVDb2xpbiBQZXJj aXZhbCA8Y3BlcmNpdmFAdGFyc25hcC5jb20+iGEEExECACEFAklrALYCGwMHCwkIBwMCAQQV AggDBBYCAwECHgECF4AACgkQOM7KaQxqam6/igCgn+z2k3V5ggNppmWrZstt1U2lugsAoL7L wS9V9yLtil3oWmHtwpUqYruEuQINBElrAAcQCAD3ZLMIsP4CIDoJORg+YY0lqLVBgcnF7pFb 4Uy2+KvdWofN+DKH61rZLjgXXkNE9M4EQC1B4lGttBP8IY2gs41y3AUogGdyFbidq99rCBz7 LTsgARHwFxZoaHmXyiZLEU1QZuMqwPZV1mCviRhN5E3rRqYNXVcrnXAAuhBpvNyj/ntHvcDN 2/m+ochiuBYueU4kX3lHya7sOj+mTsndcWmQ9soOUyr8O0r/BG088bMn4qqtUw4dl5/pglXk jbl7uOOPinKf0WVd2r6M0wLPJCD4NPHrCWRLLLAjwfjrtoSRvXxDbXhCdgGBa72+K8eYLzVs hgq7tJOoBWzjVK6XRxR7AAMGB/9Mo3iJ2DxqDecd02KCB5BsFDICbJGhPltU7FwrtbC7djSb XUrwsEVLHi4st4cbdGNCWCrp0BRezXZKohKnNAPFOTK++ZfgeKxrV2sJod+Q9RILF86tQ4XF 7A7Yme5hy92t/WgiU4vc/fWbgP8gV/19f8nunaT2E9NSa70mZFjZNu4iuwThoUUO5CV3Wo0Y UISsnRK8XD1+LR3A2qVyLiFRwh/miC1hgLFCTGCQ3GLxZeZzIpYSlGdQJ0L5lixW5ZQD9r1I 8i/8zhE6qRFAM0upUMI3Gt1Oq2w03DiXrZU0Fu/R8Rm8rlnkQKA+95mRTUq1xL5P5NZIi4gJ Z569OPMFiEkEGBECAAkFAklrAAcCGwwACgkQOM7KaQxqam41igCfbaldnFTu5uAdrnrghESv EI3CAo8AoLkNMks1pThl2BJNRm4CtTK9xZeH Message-ID: <01000171d6ab1502-e76bf5ef-c2f2-4258-bc38-1b0504d04abd-000000@email.amazonses.com> Date: Sat, 2 May 2020 18:34:28 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <202004302108.03UL8xks087664@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2020.05.02-54.240.8.237 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES X-Rspamd-Queue-Id: 49DyT12vsZz4VMG X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=tarsnap.com header.s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn header.b=mxO8OIkh; dkim=pass header.d=amazonses.com header.s=224i4yxa5dv7c2xz3womw6peuasteono header.b=RS7D9VnU; dmarc=none; spf=pass (mx1.freebsd.org: domain of 01000171d6ab1502-e76bf5ef-c2f2-4258-bc38-1b0504d04abd-000000@amazonses.com designates 54.240.8.237 as permitted sender) smtp.mailfrom=01000171d6ab1502-e76bf5ef-c2f2-4258-bc38-1b0504d04abd-000000@amazonses.com X-Spamd-Result: default: False [-1.77 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[tarsnap.com:s=ae7m2yrxjw65l2cqdpjxuucyrvy564tn,amazonses.com:s=224i4yxa5dv7c2xz3womw6peuasteono]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:54.240.0.0/18]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[tarsnap.com]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[tarsnap.com:+,amazonses.com:+]; RCVD_IN_DNSWL_NONE(0.00)[237.8.240.54.list.dnswl.org : 127.0.15.0]; IP_SCORE(-2.07)[ip: (-2.69), ipnet: 54.240.8.0/21(-4.60), asn: 14618(-3.01), country: US(-0.05)]; FORGED_SENDER(0.30)[cperciva@tarsnap.com,01000171d6ab1502-e76bf5ef-c2f2-4258-bc38-1b0504d04abd-000000@amazonses.com]; RCVD_COUNT_ZERO(0.00)[0]; MIME_TRACE(0.00)[0:+]; RWL_MAILSPIKE_VERYGOOD(0.00)[237.8.240.54.rep.mailspike.net : 127.0.0.19]; ASN(0.00)[asn:14618, ipnet:54.240.8.0/21, country:US]; FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN(2.50)[]; FROM_NEQ_ENVFROM(0.00)[cperciva@tarsnap.com, 01000171d6ab1502-e76bf5ef-c2f2-4258-bc38-1b0504d04abd-000000@amazonses.com] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 18:34:30 -0000 On 2020-04-30 14:08, Warner Losh wrote: > Author: imp > Date: Thu Apr 30 21:08:59 2020 > New Revision: 360508 > URL: https://svnweb.freebsd.org/changeset/base/360508 > > - Unlock the periph before returning. We don't need to relock it to > release the ccb. You sure about that? I'm getting a panic here: panic: mutex CAM device lock not owned at /usr/src/sys/cam/cam_xpt.c:3983 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00d8243430 vpanic() at vpanic+0x182/frame 0xfffffe00d8243480 panic() at panic+0x43/frame 0xfffffe00d82434e0 __mtx_assert() at __mtx_assert+0xb0/frame 0xfffffe00d82434f0 xpt_release_ccb() at xpt_release_ccb+0x30/frame 0xfffffe00d8243520 ndaioctl() at ndaioctl+0x241/frame 0xfffffe00d8243730 -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-svn-src-head@freebsd.org Sat May 2 18:54:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 308752D7662; Sat, 2 May 2020 18:54:26 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49Dyw20CJ6z4WRM; Sat, 2 May 2020 18:54:26 +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 0244726398; Sat, 2 May 2020 18:54:26 +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 042IsP3Q000790; Sat, 2 May 2020 18:54:25 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042IsPBG000789; Sat, 2 May 2020 18:54:25 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202005021854.042IsPBG000789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 2 May 2020 18:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360566 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360566 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 18:54:26 -0000 Author: cem Date: Sat May 2 18:54:25 2020 New Revision: 360566 URL: https://svnweb.freebsd.org/changeset/base/360566 Log: kern_exec.c: Produce valid code ifndef SYS_PROTO_H Reported by: Coccinelle Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sat May 2 17:18:32 2020 (r360565) +++ head/sys/kern/kern_exec.c Sat May 2 18:54:25 2020 (r360566) @@ -233,7 +233,7 @@ struct fexecve_args { int fd; char **argv; char **envv; -} +}; #endif int sys_fexecve(struct thread *td, struct fexecve_args *uap) From owner-svn-src-head@freebsd.org Sat May 2 19:07: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 963882D7943 for ; Sat, 2 May 2020 19:07:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49DzCP39DGz4Wvq for ; Sat, 2 May 2020 19:07:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82c.google.com with SMTP id i68so10661004qtb.5 for ; Sat, 02 May 2020 12:07: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=/yj7LphtV93g5dFmkjXes+BDHUjNvqvCs30OUsCzyN0=; b=z7ieyvZlPUOdJVHARZ/T3Fl3kIlQvCNst2EuAP0K96gMhRKR9dycWeyRcZKloq/fJA 5InmTlBu4/FQ01ax8IjKQPc3ufcH4jTJvr4avLoEh8k5qW/euK5eemfXkjAT5aM98WkW iGp65xPPawVZ3JJeIVGHKPp1/BAsC746+IaEntbCvBfK+KEqoDtAcMjVAvMp0XHoFCIA yJOBY9tO1GxtiKv1GacA9XEh92GBEVGsR721qq55hsB3rwEyYQeBNU4LN/lWMi2Y12C/ O460kRnEV9zJOByWISeE8jH9qqWFZgJhDXhv1k7s3kUSj++FUBs47AlukNQ3iVvD39Mo m2Kg== 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=/yj7LphtV93g5dFmkjXes+BDHUjNvqvCs30OUsCzyN0=; b=gkhsU49mbBUiJhmVbeyCoZWyjJqzPs9T85w58+LJndbodZ9a0UviT0vMgUOavjr543 SKaHmwpOReXdR6xs1+jznuV6rOkTGJUvaEJG96Ya5BO2ze0lxFEUhTPQenggNlgnvN3Y N2zW63VSQpBWCCmVIDNLqP5GchncddmYVvLa5wMx0SD2GnD4PKuPQbLhR/CTraIkRNt9 w6Z6J8fEbAOOiecFXAWZcp1AVHxONhjlAtKXiQd+zyy9JktXoc1RH/zrcJmhDWNY7jtq VdqceqFOuo0ng9vLmn3kpAdNHm/bPehwmx3w/M5uYFBIDJizIBJfaXypozNXl+y8/95g +xtQ== X-Gm-Message-State: AGi0PuZ7eswKuD+8170aK0PxO0TcM3EdP+IArMFn5N8McZdUMIKWe4+d RuOGs4Lz7FnJliNG0oNtuaaWRtBmi+xJm9uz/qPnAo5N X-Google-Smtp-Source: APiQypLnwbDN97zEpRznMGRkzPJDAThyzepcv7S9hJlCVrE8cdaiHFywSLEQqXRq0LGsCbDiqlnQKDAQ1cwJwNF5xDU= X-Received: by 2002:ac8:3844:: with SMTP id r4mr9462807qtb.32.1588446464207; Sat, 02 May 2020 12:07:44 -0700 (PDT) MIME-Version: 1.0 References: <202004302108.03UL8xks087664@repo.freebsd.org> <01000171d6ab14d7-e7c44f4c-9bc1-4bb4-93e0-09cc66b777e2-000000@email.amazonses.com> In-Reply-To: <01000171d6ab14d7-e7c44f4c-9bc1-4bb4-93e0-09cc66b777e2-000000@email.amazonses.com> From: Warner Losh Date: Sat, 2 May 2020 13:07:32 -0600 Message-ID: Subject: Re: svn commit: r360508 - head/sys/cam/nvme To: Colin Percival Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 49DzCP39DGz4Wvq X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=z7ieyvZl; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::82c) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-4.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[c.2.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.00)[ip: (-9.17), ipnet: 2607:f8b0::/32(-0.33), asn: 15169(-0.43), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 19:07:46 -0000 On Sat, May 2, 2020, 12:34 PM Colin Percival wrote: > On 2020-04-30 14:08, Warner Losh wrote: > > Author: imp > > Date: Thu Apr 30 21:08:59 2020 > > New Revision: 360508 > > URL: https://svnweb.freebsd.org/changeset/base/360508 > > > > - Unlock the periph before returning. We don't need to relock it to > > release the ccb. > > You sure about that? I'm getting a panic here: > > panic: mutex CAM device lock not owned at /usr/src/sys/cam/cam_xpt.c:3983 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame > 0xfffffe00d8243430 > vpanic() at vpanic+0x182/frame 0xfffffe00d8243480 > panic() at panic+0x43/frame 0xfffffe00d82434e0 > __mtx_assert() at __mtx_assert+0xb0/frame 0xfffffe00d82434f0 > xpt_release_ccb() at xpt_release_ccb+0x30/frame 0xfffffe00d8243520 > ndaioctl() at ndaioctl+0x241/frame 0xfffffe00d8243730 > Hmmm... I'm not.. I need to figure out why... I thought I was running with invariants... Warner -- > Colin Percival > Security Officer Emeritus, FreeBSD | The power to serve > Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid > From owner-svn-src-head@freebsd.org Sat May 2 20:15: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 A60742C15AD; Sat, 2 May 2020 20:15:00 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F0j03xTkz4bgr; Sat, 2 May 2020 20:15:00 +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 820CE272A3; Sat, 2 May 2020 20:15:00 +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 042KF0Cn049874; Sat, 2 May 2020 20:15:00 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042KF08Z049872; Sat, 2 May 2020 20:15:00 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202005022015.042KF08Z049872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 2 May 2020 20:15:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360567 - in head/tests/sys: fs/fusefs mac/bsdextended X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head/tests/sys: fs/fusefs mac/bsdextended X-SVN-Commit-Revision: 360567 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 20:15:00 -0000 Author: asomers Date: Sat May 2 20:14:59 2020 New Revision: 360567 URL: https://svnweb.freebsd.org/changeset/base/360567 Log: Resolve conflict between the fusefs(5) and mac_bsdextended(4) tests mac_bsdextended(4), when enabled, causes ordinary operations to send many more VOP_GETATTRs to file system. The fusefs tests expectations aren't written with those in mind. Optionally expecting them would greatly obfuscate the fusefs tests. Worse, certain fusefs functionality (like attribute caching) would be impossible to test if the tests couldn't expect an exact number of GETATTR operations. This commit resolves that conflict by making two changes: 1. The fusefs tests will now check for mac_bsdextended, and skip if it's enabled. 2. The mac_bsdextended tests will now check whether the module is enabled, not merely loaded. If it's loaded but disabled, the tests will automatically enable it for the duration of the tests. With these changes, a CI system can achieve best coverage by loading both fusefs and mac_bsdextended at boot, and setting security.mac.bsdextended.enabled=0 PR: 244229 Reported by: lwhsu Reviewed by: cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24577 Modified: head/tests/sys/fs/fusefs/utils.cc head/tests/sys/mac/bsdextended/matches_test.sh Modified: head/tests/sys/fs/fusefs/utils.cc ============================================================================== --- head/tests/sys/fs/fusefs/utils.cc Sat May 2 18:54:25 2020 (r360566) +++ head/tests/sys/fs/fusefs/utils.cc Sat May 2 20:14:59 2020 (r360567) @@ -70,6 +70,10 @@ const uint32_t default_max_write = MIN(libfuse_max_wri void check_environment() { const char *devnode = "/dev/fuse"; + const char *bsdextended_node = "security.mac.bsdextended.enabled"; + int bsdextended_val = 0; + size_t bsdextended_size = sizeof(bsdextended_val); + int bsdextended_found; const char *usermount_node = "vfs.usermount"; int usermount_val = 0; size_t usermount_size = sizeof(usermount_val); @@ -83,9 +87,19 @@ void check_environment() GTEST_SKIP() << strerror(errno); } } + // mac_bsdextended(4), when enabled, generates many more GETATTR + // operations. The fusefs tests' expectations don't account for those, + // and adding extra code to handle them obfuscates the real purpose of + // the tests. Better just to skip the fusefs tests if mac_bsdextended + // is enabled. + bsdextended_found = sysctlbyname(bsdextended_node, &bsdextended_val, + &bsdextended_size, NULL, 0); + if (bsdextended_found == 0 && bsdextended_val != 0) + GTEST_SKIP() << + "The fusefs tests are incompatible with mac_bsdextended."; ASSERT_EQ(sysctlbyname(usermount_node, &usermount_val, &usermount_size, NULL, 0), - 0);; + 0); if (geteuid() != 0 && !usermount_val) GTEST_SKIP() << "current user is not allowed to mount"; } Modified: head/tests/sys/mac/bsdextended/matches_test.sh ============================================================================== --- head/tests/sys/mac/bsdextended/matches_test.sh Sat May 2 18:54:25 2020 (r360566) +++ head/tests/sys/mac/bsdextended/matches_test.sh Sat May 2 20:14:59 2020 (r360567) @@ -16,6 +16,12 @@ check_ko() if ! sysctl -N security.mac.bsdextended >/dev/null 2>&1; then atf_skip "mac_bsdextended(4) support isn't available" fi + if [ $(sysctl -n security.mac.bsdextended.enabled) = "0" ]; then + # The kernel module is loaded but disabled. Enable it for the + # duration of the test. + touch enabled_bsdextended + sysctl security.mac.bsdextended.enabled=1 + fi } setup() @@ -68,6 +74,9 @@ cleanup() umount -f mnt if [ -f md_device ]; then mdconfig -d -u $( cat md_device ) + fi + if [ -f enabled_bsdextended ]; then + sysctl security.mac.bsdextended.enabled=0 fi } From owner-svn-src-head@freebsd.org Sat May 2 20:48: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 56A2E2C3A3B; Sat, 2 May 2020 20:48:00 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F1R41gZVz4g43; Sat, 2 May 2020 20:48:00 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34B1D2784D; Sat, 2 May 2020 20:48:00 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042Km0Qp068823; Sat, 2 May 2020 20:48:00 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042Klwcr068812; Sat, 2 May 2020 20:47:58 GMT (envelope-from dab@FreeBSD.org) Message-Id: <202005022047.042Klwcr068812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Sat, 2 May 2020 20:47:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360568 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: dab X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 360568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 20:48:00 -0000 Author: dab Date: Sat May 2 20:47:58 2020 New Revision: 360568 URL: https://svnweb.freebsd.org/changeset/base/360568 Log: Fix various Coverity-detected errors in nvme driver This fixes several Coverity-detected errors in the nvme driver. CIDs addressed: 1008344, 1009377, 1009380, 1193740, 1305470, 1403975, 1403980 Reviewed by: imp@, vangyzen@ MFC after: 5 days Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D24532 Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_ns.c head/sys/dev/nvme/nvme_pci.c head/sys/dev/nvme/nvme_qpair.c head/sys/dev/nvme/nvme_sysctl.c head/sys/dev/nvme/nvme_test.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme.c Sat May 2 20:47:58 2020 (r360568) @@ -138,7 +138,8 @@ nvme_attach(device_t dev) ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook; ctrlr->config_hook.ich_arg = ctrlr; - config_intrhook_establish(&ctrlr->config_hook); + if (config_intrhook_establish(&ctrlr->config_hook) != 0) + return (ENOMEM); return (0); } Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_ctrlr.c Sat May 2 20:47:58 2020 (r360568) @@ -1335,6 +1335,7 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_ struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg; strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev), sizeof(gnsid->cdev)); + gnsid->cdev[sizeof(gnsid->cdev) - 1] = '\0'; gnsid->nsid = 0; break; } @@ -1619,12 +1620,12 @@ nvme_ctrlr_resume(struct nvme_controller *ctrlr) goto fail; /* - * Now that we're reset the hardware, we can restart the controller. Any + * Now that we've reset the hardware, we can restart the controller. Any * I/O that was pending is requeued. Any admin commands are aborted with * an error. Once we've restarted, take the controller out of reset. */ nvme_ctrlr_start(ctrlr, true); - atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); + (void)atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); return (0); fail: @@ -1635,6 +1636,6 @@ fail: */ nvme_printf(ctrlr, "Failed to reset on resume, failing.\n"); nvme_ctrlr_fail(ctrlr); - atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); + (void)atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); return (0); } Modified: head/sys/dev/nvme/nvme_ns.c ============================================================================== --- head/sys/dev/nvme/nvme_ns.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_ns.c Sat May 2 20:47:58 2020 (r360568) @@ -87,6 +87,7 @@ nvme_ns_ioctl(struct cdev *cdev, u_long cmd, caddr_t a struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg; strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev), sizeof(gnsid->cdev)); + gnsid->cdev[sizeof(gnsid->cdev) - 1] = '\0'; gnsid->nsid = ns->id; break; } Modified: head/sys/dev/nvme/nvme_pci.c ============================================================================== --- head/sys/dev/nvme/nvme_pci.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_pci.c Sat May 2 20:47:58 2020 (r360568) @@ -243,11 +243,9 @@ nvme_ctrlr_configure_intx(struct nvme_controller *ctrl return (ENOMEM); } - bus_setup_intr(ctrlr->dev, ctrlr->res, + if (bus_setup_intr(ctrlr->dev, ctrlr->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, - ctrlr, &ctrlr->tag); - - if (ctrlr->tag == NULL) { + ctrlr, &ctrlr->tag) != 0) { nvme_printf(ctrlr, "unable to setup intx handler\n"); return (ENOMEM); } Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_qpair.c Sat May 2 20:47:58 2020 (r360568) @@ -671,9 +671,12 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &qpair->rid, RF_ACTIVE); - bus_setup_intr(ctrlr->dev, qpair->res, + if (bus_setup_intr(ctrlr->dev, qpair->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, - nvme_qpair_msix_handler, qpair, &qpair->tag); + nvme_qpair_msix_handler, qpair, &qpair->tag) != 0) { + nvme_printf(ctrlr, "unable to setup intx handler\n"); + goto out; + } if (qpair->id == 0) { bus_describe_intr(ctrlr->dev, qpair->res, qpair->tag, "admin"); Modified: head/sys/dev/nvme/nvme_sysctl.c ============================================================================== --- head/sys/dev/nvme/nvme_sysctl.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_sysctl.c Sat May 2 20:47:58 2020 (r360568) @@ -146,16 +146,17 @@ static int nvme_sysctl_timeout_period(SYSCTL_HANDLER_ARGS) { struct nvme_controller *ctrlr = arg1; - uint32_t oldval = ctrlr->timeout_period; - int error = sysctl_handle_int(oidp, &ctrlr->timeout_period, 0, req); + uint32_t newval = ctrlr->timeout_period; + int error = sysctl_handle_int(oidp, &newval, 0, req); - if (error) + if (error || (req->newptr == NULL)) return (error); - if (ctrlr->timeout_period > NVME_MAX_TIMEOUT_PERIOD || - ctrlr->timeout_period < NVME_MIN_TIMEOUT_PERIOD) { - ctrlr->timeout_period = oldval; + if (newval > NVME_MAX_TIMEOUT_PERIOD || + newval < NVME_MIN_TIMEOUT_PERIOD) { return (EINVAL); + } else { + ctrlr->timeout_period = newval; } return (0); Modified: head/sys/dev/nvme/nvme_test.c ============================================================================== --- head/sys/dev/nvme/nvme_test.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_test.c Sat May 2 20:47:58 2020 (r360568) @@ -100,7 +100,7 @@ nvme_ns_bio_test(void *arg) idx = atomic_fetchadd_int(&io_test->td_idx, 1); dev = io_test->ns->cdev; - offset = idx * 2048 * nvme_ns_get_sector_size(io_test->ns); + offset = idx * 2048ULL * nvme_ns_get_sector_size(io_test->ns); while (1) { @@ -120,6 +120,8 @@ nvme_ns_bio_test(void *arg) } else csw = dev->si_devsw; + if (csw == NULL) + panic("Unable to retrieve device switch"); mtx = mtx_pool_find(mtxpool_sleep, bio); mtx_lock(mtx); (*csw->d_strategy)(bio); From owner-svn-src-head@freebsd.org Sat May 2 22:39: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 C86AC2C6584; Sat, 2 May 2020 22:39:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F3vj5JDRz3HGD; Sat, 2 May 2020 22:39:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96CF1D96; Sat, 2 May 2020 22:39:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042MdTXk036066; Sat, 2 May 2020 22:39:29 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042MdR7Z036054; Sat, 2 May 2020 22:39:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022239.042MdR7Z036054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 22:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360569 - in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: dev/cxgbe dev/cxgbe/crypto dev/cxgbe/tom kern sys X-SVN-Commit-Revision: 360569 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 22:39:29 -0000 Author: glebius Date: Sat May 2 22:39:26 2020 New Revision: 360569 URL: https://svnweb.freebsd.org/changeset/base/360569 Log: Continuation of multi page mbuf redesign from r359919. The following series of patches addresses three things: Now that array of pages is embedded into mbuf, we no longer need separate structure to pass around, so struct mbuf_ext_pgs is an artifact of the first implementation. And struct mbuf_ext_pgs_data is a crutch to accomodate the main idea r359919 with minimal churn. Also, M_EXT of type EXT_PGS are just a synonym of M_NOMAP. The namespace for the newfeature is somewhat inconsistent and sometimes has a lengthy prefixes. In these patches we will gradually bring the namespace to "m_epg" prefix for all mbuf fields and most functions. Step 1 of 4: o Anonymize mbuf_ext_pgs_data, embed in m_ext o Embed mbuf_ext_pgs o Start documenting all this entanglement Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/kern/kern_mbuf.c head/sys/kern/kern_sendfile.c head/sys/kern/subr_bus_dma.c head/sys/kern/subr_sglist.c head/sys/kern/uipc_ktls.c head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h head/sys/sys/sglist.h Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May 2 22:39:26 2020 (r360569) @@ -906,7 +906,7 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb MBUF_EXT_PGS_ASSERT(m_tls); ext_pgs = &m_tls->m_ext_pgs; - hdr = (void *)ext_pgs->m_epg_hdr; + hdr = (void *)m_tls->m_epg_hdr; plen = ntohs(hdr->tls_length); /* @@ -962,7 +962,7 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf * MBUF_EXT_PGS_ASSERT(m_tls); ext_pgs = &m_tls->m_ext_pgs; - hdr = (void *)ext_pgs->m_epg_hdr; + hdr = (void *)m_tls->m_epg_hdr; plen = ntohs(hdr->tls_length); #ifdef INVARIANTS mlen = mtod(m_tls, vm_offset_t) + m_tls->m_len; @@ -1040,7 +1040,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc return (wr_len); } - hdr = (void *)ext_pgs->m_epg_hdr; + hdr = (void *)m_tls->m_epg_hdr; plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - ext_pgs->trail_len; if (tlen < plen) { plen = tlen; @@ -1064,7 +1064,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc wr_len += roundup2(imm_len, 16); /* TLS record payload via DSGL. */ - *nsegsp = sglist_count_ext_pgs(ext_pgs, ext_pgs->hdr_len + offset, + *nsegsp = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len + offset, plen - (ext_pgs->hdr_len + offset)); wr_len += ktls_sgl_size(*nsegsp); @@ -1543,7 +1543,7 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds (m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen + sizeof(*tcp))); /* Copy the subset of the TLS header requested. */ - copy_to_txd(&txq->eq, (char *)ext_pgs->m_epg_hdr + + copy_to_txd(&txq->eq, (char *)m_tls->m_epg_hdr + mtod(m_tls, vm_offset_t), &out, m_tls->m_len); txq->imm_wrs++; @@ -1604,7 +1604,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* Locate the TLS header. */ MBUF_EXT_PGS_ASSERT(m_tls); ext_pgs = &m_tls->m_ext_pgs; - hdr = (void *)ext_pgs->m_epg_hdr; + hdr = (void *)m_tls->m_epg_hdr; plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - ext_pgs->trail_len; /* Determine how much of the TLS record to send. */ @@ -1799,7 +1799,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* Recalculate 'nsegs' if cached value is not available. */ if (nsegs == 0) - nsegs = sglist_count_ext_pgs(ext_pgs, ext_pgs->hdr_len + + nsegs = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len + offset, plen - (ext_pgs->hdr_len + offset)); /* Calculate the size of the TLS work request. */ @@ -2031,7 +2031,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* Populate the TLS header */ out = (void *)(tx_data + 1); if (offset == 0) { - memcpy(out, ext_pgs->m_epg_hdr, ext_pgs->hdr_len); + memcpy(out, m_tls->m_epg_hdr, ext_pgs->hdr_len); out += ext_pgs->hdr_len; } @@ -2067,7 +2067,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* SGL for record payload */ sglist_reset(txq->gl); - if (sglist_append_ext_pgs(txq->gl, ext_pgs, ext_pgs->hdr_len + offset, + if (sglist_append_ext_pgs(txq->gl, m_tls, ext_pgs->hdr_len + offset, plen - (ext_pgs->hdr_len + offset)) != 0) { #ifdef INVARIANTS panic("%s: failed to append sglist", __func__); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/dev/cxgbe/t4_sge.c Sat May 2 22:39:26 2020 (r360569) @@ -2435,7 +2435,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_ off = 0; len -= seglen; paddr = pmap_kextract( - (vm_offset_t)&ext_pgs->m_epg_hdr[segoff]); + (vm_offset_t)&m->m_epg_hdr[segoff]); if (*nextaddr != paddr) nsegs++; *nextaddr = paddr + seglen; @@ -2454,7 +2454,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_ off = 0; seglen = min(seglen, len); len -= seglen; - paddr = ext_pgs->m_epg_pa[i] + segoff; + paddr = m->m_epg_pa[i] + segoff; if (*nextaddr != paddr) nsegs++; *nextaddr = paddr + seglen; @@ -2463,7 +2463,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_ if (len != 0) { seglen = min(len, ext_pgs->trail_len - off); len -= seglen; - paddr = pmap_kextract((vm_offset_t)&ext_pgs->m_epg_trail[off]); + paddr = pmap_kextract((vm_offset_t)&m->m_epg_trail[off]); if (*nextaddr != paddr) nsegs++; *nextaddr = paddr + seglen; Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat May 2 22:39:26 2020 (r360569) @@ -1935,7 +1935,7 @@ aiotx_free_pgs(struct mbuf *m) #endif for (int i = 0; i < ext_pgs->npgs; i++) { - pg = PHYS_TO_VM_PAGE(ext_pgs->m_epg_pa[i]); + pg = PHYS_TO_VM_PAGE(m->m_epg_pa[i]); vm_page_unwire(pg, PQ_ACTIVE); } @@ -2003,7 +2003,7 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len) (npages - 2) * PAGE_SIZE; } for (i = 0; i < npages; i++) - ext_pgs->m_epg_pa[i] = VM_PAGE_TO_PHYS(pgs[i]); + m->m_epg_pa[i] = VM_PAGE_TO_PHYS(pgs[i]); m->m_len = mlen; m->m_ext.ext_size = npages * PAGE_SIZE; Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/dev/cxgbe/tom/t4_tls.c Sat May 2 22:39:26 2020 (r360569) @@ -1623,26 +1623,24 @@ t4_push_tls_records(struct adapter *sc, struct toepcb #ifdef KERN_TLS static int -count_ext_pgs_segs(struct mbuf_ext_pgs *ext_pgs, - struct mbuf_ext_pgs_data *ext_pgs_data) +count_ext_pgs_segs(struct mbuf *m) { vm_paddr_t nextpa; u_int i, nsegs; - MPASS(ext_pgs->npgs > 0); + MPASS(m->m_ext_pgs.npgs > 0); nsegs = 1; - nextpa = ext_pgs_data->pa[0] + PAGE_SIZE; - for (i = 1; i < ext_pgs->npgs; i++) { - if (nextpa != ext_pgs_data->pa[i]) + nextpa = m->m_epg_pa[0] + PAGE_SIZE; + for (i = 1; i < m->m_ext_pgs.npgs; i++) { + if (nextpa != m->m_epg_pa[i]) nsegs++; - nextpa = ext_pgs_data->pa[i] + PAGE_SIZE; + nextpa = m->m_epg_pa[i] + PAGE_SIZE; } return (nsegs); } static void -write_ktlstx_sgl(void *dst, struct mbuf_ext_pgs *ext_pgs, - struct mbuf_ext_pgs_data *ext_pgs_data, int nsegs) +write_ktlstx_sgl(void *dst, struct mbuf *m, int nsegs) { struct ulptx_sgl *usgl = dst; vm_paddr_t pa; @@ -1655,15 +1653,15 @@ write_ktlstx_sgl(void *dst, struct mbuf_ext_pgs *ext_p V_ULPTX_NSGE(nsegs)); /* Figure out the first S/G length. */ - pa = ext_pgs_data->pa[0] + ext_pgs->first_pg_off; + pa = m->m_epg_pa[0] + m->m_ext_pgs.first_pg_off; usgl->addr0 = htobe64(pa); - len = mbuf_ext_pg_len(ext_pgs, 0, ext_pgs->first_pg_off); + len = mbuf_ext_pg_len(&m->m_ext_pgs, 0, m->m_ext_pgs.first_pg_off); pa += len; - for (i = 1; i < ext_pgs->npgs; i++) { - if (ext_pgs_data->pa[i] != pa) + for (i = 1; i < m->m_ext_pgs.npgs; i++) { + if (m->m_epg_pa[i] != pa) break; - len += mbuf_ext_pg_len(ext_pgs, i, 0); - pa += mbuf_ext_pg_len(ext_pgs, i, 0); + len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); + pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); } usgl->len0 = htobe32(len); #ifdef INVARIANTS @@ -1671,21 +1669,21 @@ write_ktlstx_sgl(void *dst, struct mbuf_ext_pgs *ext_p #endif j = -1; - for (; i < ext_pgs->npgs; i++) { - if (j == -1 || ext_pgs_data->pa[i] != pa) { + for (; i < m->m_ext_pgs.npgs; i++) { + if (j == -1 || m->m_epg_pa[i] != pa) { if (j >= 0) usgl->sge[j / 2].len[j & 1] = htobe32(len); j++; #ifdef INVARIANTS nsegs--; #endif - pa = ext_pgs_data->pa[i]; + pa = m->m_epg_pa[i]; usgl->sge[j / 2].addr[j & 1] = htobe64(pa); - len = mbuf_ext_pg_len(ext_pgs, i, 0); + len = mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); pa += len; } else { - len += mbuf_ext_pg_len(ext_pgs, i, 0); - pa += mbuf_ext_pg_len(ext_pgs, i, 0); + len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); + pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); } } if (j >= 0) { @@ -1694,8 +1692,7 @@ write_ktlstx_sgl(void *dst, struct mbuf_ext_pgs *ext_p if ((j & 1) == 0) usgl->sge[j / 2].len[1] = htobe32(0); } - KASSERT(nsegs == 0, ("%s: nsegs %d, ext_pgs %p", __func__, nsegs, - ext_pgs)); + KASSERT(nsegs == 0, ("%s: nsegs %d, m %p", __func__, nsegs, m)); } /* @@ -1813,8 +1810,7 @@ t4_push_ktls(struct adapter *sc, struct toepcb *toep, wr_len += AES_BLOCK_LEN; /* Account for SGL in work request length. */ - nsegs = count_ext_pgs_segs(&m->m_ext_pgs, - &m->m_ext.ext_pgs); + nsegs = count_ext_pgs_segs(m); wr_len += sizeof(struct ulptx_sgl) + ((3 * (nsegs - 1)) / 2 + ((nsegs - 1) & 1)) * 8; @@ -1892,8 +1888,7 @@ t4_push_ktls(struct adapter *sc, struct toepcb *toep, memcpy(buf, thdr + 1, toep->tls.iv_len); buf += AES_BLOCK_LEN; - write_ktlstx_sgl(buf, &m->m_ext_pgs, &m->m_ext.ext_pgs, - nsegs); + write_ktlstx_sgl(buf, m, nsegs); KASSERT(toep->tx_credits >= credits, ("%s: not enough credits", __func__)); Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/kern/kern_mbuf.c Sat May 2 22:39:26 2020 (r360569) @@ -311,9 +311,6 @@ static void mb_reclaim(uma_zone_t, int); /* Ensure that MSIZE is a power of 2. */ CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); -_Static_assert(offsetof(struct mbuf, m_ext) == - offsetof(struct mbuf, m_ext_pgs.m_ext), - "m_ext offset mismatch between mbuf and ext_pgs"); _Static_assert(sizeof(struct mbuf) <= MSIZE, "size of mbuf exceeds MSIZE"); /* @@ -984,7 +981,7 @@ _mb_unmapped_to_ext(struct mbuf *m) goto fail; m_new->m_len = seglen; prev = top = m_new; - memcpy(mtod(m_new, void *), &ext_pgs->m_epg_hdr[segoff], + memcpy(mtod(m_new, void *), &m->m_epg_hdr[segoff], seglen); } } @@ -1002,7 +999,7 @@ _mb_unmapped_to_ext(struct mbuf *m) seglen = min(seglen, len); len -= seglen; - pg = PHYS_TO_VM_PAGE(ext_pgs->m_epg_pa[i]); + pg = PHYS_TO_VM_PAGE(m->m_epg_pa[i]); m_new = m_get(M_NOWAIT, MT_DATA); if (m_new == NULL) goto fail; @@ -1036,7 +1033,7 @@ _mb_unmapped_to_ext(struct mbuf *m) else prev->m_next = m_new; m_new->m_len = len; - memcpy(mtod(m_new, void *), &ext_pgs->m_epg_trail[off], len); + memcpy(mtod(m_new, void *), &m->m_epg_trail[off], len); } if (ref_inc != 0) { @@ -1154,8 +1151,9 @@ mb_alloc_ext_pgs(int how, m_ext_free_t ext_free) #ifdef INVARIANT_SUPPORT void -mb_ext_pgs_check(struct mbuf_ext_pgs *ext_pgs) +mb_ext_pgs_check(struct mbuf *m) { + struct mbuf_ext_pgs *ext_pgs = &m->m_ext_pgs; /* * NB: This expects a non-empty buffer (npgs > 0 and @@ -1163,7 +1161,7 @@ mb_ext_pgs_check(struct mbuf_ext_pgs *ext_pgs) */ KASSERT(ext_pgs->npgs > 0, ("ext_pgs with no valid pages: %p", ext_pgs)); - KASSERT(ext_pgs->npgs <= nitems(ext_pgs->m_epg_pa), + KASSERT(ext_pgs->npgs <= nitems(m->m_epg_pa), ("ext_pgs with too many pages: %p", ext_pgs)); KASSERT(ext_pgs->nrdy <= ext_pgs->npgs, ("ext_pgs with too many ready pages: %p", ext_pgs)); @@ -1178,9 +1176,9 @@ mb_ext_pgs_check(struct mbuf_ext_pgs *ext_pgs) PAGE_SIZE, ("ext_pgs with single page too large: %p", ext_pgs)); } - KASSERT(ext_pgs->hdr_len <= sizeof(ext_pgs->m_epg_hdr), + KASSERT(ext_pgs->hdr_len <= sizeof(m->m_epg_hdr), ("ext_pgs with too large header length: %p", ext_pgs)); - KASSERT(ext_pgs->trail_len <= sizeof(ext_pgs->m_epg_trail), + KASSERT(ext_pgs->trail_len <= sizeof(m->m_epg_trail), ("ext_pgs with too large header length: %p", ext_pgs)); } #endif Modified: head/sys/kern/kern_sendfile.c ============================================================================== --- head/sys/kern/kern_sendfile.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/kern/kern_sendfile.c Sat May 2 22:39:26 2020 (r360569) @@ -203,7 +203,7 @@ sendfile_free_mext_pg(struct mbuf *m) for (i = 0; i < ext_pgs->npgs; i++) { if (cache_last && i == ext_pgs->npgs - 1) flags = 0; - pg = PHYS_TO_VM_PAGE(ext_pgs->m_epg_pa[i]); + pg = PHYS_TO_VM_PAGE(m->m_epg_pa[i]); vm_page_release(pg, flags); } @@ -1046,11 +1046,11 @@ retry_space: ext_pgs->nrdy++; } - ext_pgs->m_epg_pa[ext_pgs_idx] = VM_PAGE_TO_PHYS(pga); + m0->m_epg_pa[ext_pgs_idx] = VM_PAGE_TO_PHYS(pga); ext_pgs->npgs++; xfs = xfsize(i, npages, off, space); ext_pgs->last_pg_len = xfs; - MBUF_EXT_PGS_ASSERT_SANITY(ext_pgs); + MBUF_EXT_PGS_ASSERT_SANITY(m0); mtail->m_len += xfs; mtail->m_ext.ext_size += PAGE_SIZE; continue; Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/kern/subr_bus_dma.c Sat May 2 22:39:26 2020 (r360569) @@ -141,7 +141,7 @@ _bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, off = 0; len -= seglen; error = _bus_dmamap_load_buffer(dmat, map, - &ext_pgs->m_epg_hdr[segoff], seglen, kernel_pmap, + &m->m_epg_hdr[segoff], seglen, kernel_pmap, flags, segs, nsegs); } } @@ -159,7 +159,7 @@ _bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, seglen = min(seglen, len); len -= seglen; error = _bus_dmamap_load_phys(dmat, map, - ext_pgs->m_epg_pa[i] + segoff, seglen, flags, segs, nsegs); + m->m_epg_pa[i] + segoff, seglen, flags, segs, nsegs); pgoff = 0; }; if (len != 0 && error == 0) { @@ -167,7 +167,7 @@ _bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, ("off + len > trail (%d + %d > %d)", off, len, ext_pgs->trail_len)); error = _bus_dmamap_load_buffer(dmat, map, - &ext_pgs->m_epg_trail[off], len, kernel_pmap, flags, segs, + &m->m_epg_trail[off], len, kernel_pmap, flags, segs, nsegs); } return (error); Modified: head/sys/kern/subr_sglist.c ============================================================================== --- head/sys/kern/subr_sglist.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/kern/subr_sglist.c Sat May 2 22:39:26 2020 (r360569) @@ -223,8 +223,9 @@ sglist_count_vmpages(vm_page_t *m, size_t pgoff, size_ * describe an EXT_PGS buffer. */ int -sglist_count_ext_pgs(struct mbuf_ext_pgs *ext_pgs, size_t off, size_t len) +sglist_count_ext_pgs(struct mbuf *m, size_t off, size_t len) { + struct mbuf_ext_pgs *ext_pgs = &m->m_ext_pgs; vm_paddr_t nextaddr, paddr; size_t seglen, segoff; int i, nsegs, pglen, pgoff; @@ -242,7 +243,7 @@ sglist_count_ext_pgs(struct mbuf_ext_pgs *ext_pgs, siz seglen = MIN(seglen, len); off = 0; len -= seglen; - nsegs += sglist_count(&ext_pgs->m_epg_hdr[segoff], + nsegs += sglist_count(&m->m_epg_hdr[segoff], seglen); } } @@ -260,7 +261,7 @@ sglist_count_ext_pgs(struct mbuf_ext_pgs *ext_pgs, siz off = 0; seglen = MIN(seglen, len); len -= seglen; - paddr = ext_pgs->m_epg_pa[i] + segoff; + paddr = m->m_epg_pa[i] + segoff; if (paddr != nextaddr) nsegs++; nextaddr = paddr + seglen; @@ -269,7 +270,7 @@ sglist_count_ext_pgs(struct mbuf_ext_pgs *ext_pgs, siz if (len != 0) { seglen = MIN(len, ext_pgs->trail_len - off); len -= seglen; - nsegs += sglist_count(&ext_pgs->m_epg_trail[off], seglen); + nsegs += sglist_count(&m->m_epg_trail[off], seglen); } KASSERT(len == 0, ("len != 0")); return (nsegs); @@ -284,8 +285,7 @@ sglist_count_mb_ext_pgs(struct mbuf *m) { MBUF_EXT_PGS_ASSERT(m); - return (sglist_count_ext_pgs(&m->m_ext_pgs, mtod(m, vm_offset_t), - m->m_len)); + return (sglist_count_ext_pgs(m, mtod(m, vm_offset_t), m->m_len)); } /* @@ -395,9 +395,9 @@ sglist_append_phys(struct sglist *sg, vm_paddr_t paddr * fails with EFBIG. */ int -sglist_append_ext_pgs(struct sglist *sg, struct mbuf_ext_pgs *ext_pgs, - size_t off, size_t len) +sglist_append_ext_pgs(struct sglist *sg, struct mbuf *m, size_t off, size_t len) { + struct mbuf_ext_pgs *ext_pgs = &m->m_ext_pgs; size_t seglen, segoff; vm_paddr_t paddr; int error, i, pglen, pgoff; @@ -413,7 +413,7 @@ sglist_append_ext_pgs(struct sglist *sg, struct mbuf_e off = 0; len -= seglen; error = sglist_append(sg, - &ext_pgs->m_epg_hdr[segoff], seglen); + &m->m_epg_hdr[segoff], seglen); } } pgoff = ext_pgs->first_pg_off; @@ -429,7 +429,7 @@ sglist_append_ext_pgs(struct sglist *sg, struct mbuf_e off = 0; seglen = MIN(seglen, len); len -= seglen; - paddr = ext_pgs->m_epg_pa[i] + segoff; + paddr = m->m_epg_pa[i] + segoff; error = sglist_append_phys(sg, paddr, seglen); pgoff = 0; }; @@ -437,7 +437,7 @@ sglist_append_ext_pgs(struct sglist *sg, struct mbuf_e seglen = MIN(len, ext_pgs->trail_len - off); len -= seglen; error = sglist_append(sg, - &ext_pgs->m_epg_trail[off], seglen); + &m->m_epg_trail[off], seglen); } if (error == 0) KASSERT(len == 0, ("len != 0")); @@ -455,8 +455,7 @@ sglist_append_mb_ext_pgs(struct sglist *sg, struct mbu /* for now, all unmapped mbufs are assumed to be EXT_PGS */ MBUF_EXT_PGS_ASSERT(m); - return (sglist_append_ext_pgs(sg, &m->m_ext_pgs, - mtod(m, vm_offset_t), m->m_len)); + return (sglist_append_ext_pgs(sg, m, mtod(m, vm_offset_t), m->m_len)); } /* Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/kern/uipc_ktls.c Sat May 2 22:39:26 2020 (r360569) @@ -1374,7 +1374,7 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, m->m_len += pgs->hdr_len + pgs->trail_len; /* Populate the TLS header. */ - tlshdr = (void *)pgs->m_epg_hdr; + tlshdr = (void *)m->m_epg_hdr; tlshdr->tls_vmajor = tls->params.tls_vmajor; /* @@ -1387,7 +1387,7 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, tlshdr->tls_type = TLS_RLTYPE_APP; /* save the real record type for later */ pgs->record_type = record_type; - pgs->m_epg_trail[0] = record_type; + m->m_epg_trail[0] = record_type; } else { tlshdr->tls_vminor = tls->params.tls_vminor; tlshdr->tls_type = record_type; @@ -1552,7 +1552,7 @@ ktls_encrypt(struct mbuf_ext_pgs *pgs) len = mbuf_ext_pg_len(pgs, i, off); src_iov[i].iov_len = len; src_iov[i].iov_base = - (char *)(void *)PHYS_TO_DMAP(pgs->m_epg_pa[i]) + + (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[i]) + off; if (is_anon) { @@ -1576,8 +1576,8 @@ retry_page: npages += i; error = (*tls->sw_encrypt)(tls, - (const struct tls_record_layer *)pgs->m_epg_hdr, - pgs->m_epg_trail, src_iov, dst_iov, i, pgs->seqno, + (const struct tls_record_layer *)m->m_epg_hdr, + m->m_epg_trail, src_iov, dst_iov, i, pgs->seqno, pgs->record_type); if (error) { counter_u64_add(ktls_offload_failed_crypto, 1); @@ -1595,7 +1595,7 @@ retry_page: /* Replace them with the new pages. */ for (i = 0; i < pgs->npgs; i++) - pgs->m_epg_pa[i] = parray[i]; + m->m_epg_pa[i] = parray[i]; /* Use the basic free routine. */ m->m_ext.ext_free = mb_free_mext_pgs; Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Sat May 2 20:47:58 2020 (r360568) +++ head/sys/kern/uipc_mbuf.c Sat May 2 22:39:26 2020 (r360569) @@ -163,11 +163,11 @@ CTASSERT(offsetof(struct mbuf, m_pktdat) % 8 == 0); #if defined(__LP64__) CTASSERT(offsetof(struct mbuf, m_dat) == 32); CTASSERT(sizeof(struct pkthdr) == 56); -CTASSERT(sizeof(struct m_ext) == 168); +CTASSERT(sizeof(struct m_ext) == 160); #else CTASSERT(offsetof(struct mbuf, m_dat) == 24); CTASSERT(sizeof(struct pkthdr) == 48); -CTASSERT(sizeof(struct m_ext) == 184); +CTASSERT(sizeof(struct m_ext) == 180); #endif /* @@ -195,19 +195,30 @@ mb_dupcl(struct mbuf *n, struct mbuf *m) KASSERT(!(n->m_flags & M_EXT), ("%s: M_EXT set on %p", __func__, n)); /* - * Cache access optimization. For most kinds of external - * storage we don't need full copy of m_ext, since the - * holder of the 'ext_count' is responsible to carry the - * free routine and its arguments. Exclusion is EXT_EXTREF, - * where 'ext_cnt' doesn't point into mbuf at all. + * Cache access optimization. + * + * o Regular M_EXT storage doesn't need full copy of m_ext, since + * the holder of the 'ext_count' is responsible to carry the free + * routine and its arguments. + * o EXT_PGS data is split between main part of mbuf and m_ext, the + * main part is copied in full, the m_ext part is similar to M_EXT. + * o EXT_EXTREF, where 'ext_cnt' doesn't point into mbuf at all, is + * special - it needs full copy of m_ext into each mbuf, since any + * copy could end up as the last to free. */ - if (m->m_ext.ext_type == EXT_EXTREF) - bcopy(&m->m_ext, &n->m_ext, sizeof(struct m_ext)); - else if (m->m_ext.ext_type == EXT_PGS) + switch (m->m_ext.ext_type) { + case EXT_PGS: + bcopy(&m->m_ext, &n->m_ext, m_epg_copylen); bcopy(&m->m_ext_pgs, &n->m_ext_pgs, sizeof(struct mbuf_ext_pgs)); - else + break; + case EXT_EXTREF: + bcopy(&m->m_ext, &n->m_ext, sizeof(struct m_ext)); + break; + default: bcopy(&m->m_ext, &n->m_ext, m_ext_copylen); + } + n->m_flags |= M_EXT; n->m_flags |= m->m_flags & (M_RDONLY | M_NOMAP); @@ -1623,7 +1634,7 @@ mb_free_mext_pgs(struct mbuf *m) MBUF_EXT_PGS_ASSERT(m); ext_pgs = &m->m_ext_pgs; for (int i = 0; i < ext_pgs->npgs; i++) { - pg = PHYS_TO_VM_PAGE(ext_pgs->m_epg_pa[i]); + pg = PHYS_TO_VM_PAGE(m->m_epg_pa[i]); vm_page_unwire_noq(pg); vm_page_free(pg); } @@ -1681,11 +1692,11 @@ retry_page: } } pg_array[i]->flags &= ~PG_ZERO; - pgs->m_epg_pa[i] = VM_PAGE_TO_PHYS(pg_array[i]); + mb->m_epg_pa[i] = VM_PAGE_TO_PHYS(pg_array[i]); pgs->npgs++; } pgs->last_pg_len = length - PAGE_SIZE * (pgs->npgs - 1); - MBUF_EXT_PGS_ASSERT_SANITY(pgs); + MBUF_EXT_PGS_ASSERT_SANITY(mb); total -= length; error = uiomove_fromphys(pg_array, 0, length, uio); if (error != 0) @@ -1788,7 +1799,8 @@ m_unmappedtouio(const struct mbuf *m, int m_off, struc seglen = min(seglen, len); off = 0; len -= seglen; - error = uiomove(&ext_pgs->m_epg_hdr[segoff], seglen, uio); + error = uiomove(__DECONST(void *, + &m->m_epg_hdr[segoff]), seglen, uio); } } pgoff = ext_pgs->first_pg_off; @@ -1804,7 +1816,7 @@ m_unmappedtouio(const struct mbuf *m, int m_off, struc off = 0; seglen = min(seglen, len); len -= seglen; - pg = PHYS_TO_VM_PAGE(ext_pgs->m_epg_pa[i]); + pg = PHYS_TO_VM_PAGE(m->m_epg_pa[i]); error = uiomove_fromphys(&pg, segoff, seglen, uio); pgoff = 0; }; @@ -1812,7 +1824,8 @@ m_unmappedtouio(const struct mbuf *m, int m_off, struc KASSERT((off + len) <= ext_pgs->trail_len, ("off + len > trail (%d + %d > %d, m_off = %d)", off, len, ext_pgs->trail_len, m_off)); - error = uiomove(&ext_pgs->m_epg_trail[off], len, uio); + error = uiomove(__DECONST(void *, &m->m_epg_trail[off]), + len, uio); } return (error); } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat May 2 20:47:58 2020 (r360568) +++ head/sys/sys/mbuf.h Sat May 2 22:39:26 2020 (r360569) @@ -231,13 +231,6 @@ struct pkthdr { #define MBUF_PEXT_FLAG_ANON 1 /* Data can be encrypted in place. */ - -struct mbuf_ext_pgs_data { - vm_paddr_t pa[MBUF_PEXT_MAX_PGS]; /* phys addrs of pgs */ - char trail[MBUF_PEXT_TRAIL_LEN]; /* TLS trailer */ - char hdr[MBUF_PEXT_HDR_LEN]; /* TLS header */ -}; - struct ktls_session; struct socket; @@ -266,49 +259,49 @@ struct m_ext { uint32_t ext_size; /* size of buffer, for ext_free */ uint32_t ext_type:8, /* type of external storage */ ext_flags:24; /* external storage mbuf flags */ - char *ext_buf; /* start of buffer */ - /* - * Fields below store the free context for the external storage. - * They are valid only in the refcount carrying mbuf, the one with - * EXT_FLAG_EMBREF flag, with exclusion for EXT_EXTREF type, where - * the free context is copied into all mbufs that use same external - * storage. - */ -#define m_ext_copylen offsetof(struct m_ext, ext_free) - m_ext_free_t *ext_free; /* free routine if not the usual */ - void *ext_arg1; /* optional argument pointer */ union { - void *ext_arg2; /* optional argument pointer */ - struct mbuf_ext_pgs_data ext_pgs; + struct { + /* + * Regular M_EXT mbuf: + * o ext_buf always points to the external buffer. + * o ext_free (below) and two optional arguments + * ext_arg1 and ext_arg2 store the free context for + * the external storage. They are set only in the + * refcount carrying mbuf, the one with + * EXT_FLAG_EMBREF flag, with exclusion for + * EXT_EXTREF type, where the free context is copied + * into all mbufs that use same external storage. + */ + char *ext_buf; /* start of buffer */ +#define m_ext_copylen offsetof(struct m_ext, ext_arg2) + void *ext_arg2; + }; + struct { + /* + * Multi-page M_EXTPG mbuf: + * o extpg_pa - page vector. + * o extpg_trail and extpg_hdr - TLS trailer and + * header. + * Uses ext_free and may also use ext_arg1. + */ + vm_paddr_t extpg_pa[MBUF_PEXT_MAX_PGS]; + char extpg_trail[MBUF_PEXT_TRAIL_LEN]; + char extpg_hdr[MBUF_PEXT_HDR_LEN]; + /* Pretend these 3 fields are part of mbuf itself. */ +#define m_epg_pa m_ext.extpg_pa +#define m_epg_trail m_ext.extpg_trail +#define m_epg_hdr m_ext.extpg_hdr +#define m_epg_copylen offsetof(struct m_ext, ext_free) + }; }; + /* + * Free method and optional argument pointer, both + * used by M_EXT and M_EXTPG. + */ + m_ext_free_t *ext_free; + void *ext_arg1; }; -struct mbuf_ext_pgs { - uint8_t npgs; /* Number of attached pages */ - uint8_t nrdy; /* Pages with I/O pending */ - uint8_t hdr_len; /* TLS header length */ - uint8_t trail_len; /* TLS trailer length */ - uint16_t first_pg_off; /* Offset into 1st page */ - uint16_t last_pg_len; /* Length of last page */ - uint8_t flags; /* Flags */ - uint8_t record_type; - uint8_t spare[2]; - int enc_cnt; - struct ktls_session *tls; /* TLS session */ - struct socket *so; - uint64_t seqno; - struct mbuf *mbuf; - STAILQ_ENTRY(mbuf_ext_pgs) stailq; -#if !defined(__LP64__) - uint8_t pad[8]; /* pad to size of pkthdr */ -#endif - struct m_ext m_ext; -}; - -#define m_epg_hdr m_ext.ext_pgs.hdr -#define m_epg_trail m_ext.ext_pgs.trail -#define m_epg_pa m_ext.ext_pgs.pa - /* * The core of the mbuf object along with some shortcut defines for practical * purposes. @@ -347,15 +340,48 @@ struct mbuf { * order to support future work on variable-size mbufs. */ union { - union { - struct { - struct pkthdr m_pkthdr; /* M_PKTHDR set */ - union { - struct m_ext m_ext; /* M_EXT set */ - char m_pktdat[0]; - }; + struct { + union { + /* M_PKTHDR set. */ + struct pkthdr m_pkthdr; + + /* M_EXTPG set. + * Multi-page M_EXTPG mbuf has its meta data + * split between the mbuf_ext_pgs structure + * and m_ext. It carries vector of pages, + * optional header and trailer char vectors + * and pointers to socket/TLS data. + */ + struct mbuf_ext_pgs { + /* Overall count of pages and count of + * pages with I/O pending. */ + uint8_t npgs; + uint8_t nrdy; + /* TLS header and trailer lengths. + * The data itself resides in m_ext. */ + uint8_t hdr_len; + uint8_t trail_len; + /* Offset into 1st page and lenght of + * data in the last page. */ + uint16_t first_pg_off; + uint16_t last_pg_len; + uint8_t flags; + uint8_t record_type; + uint8_t spare[2]; + int enc_cnt; + struct ktls_session *tls; + struct socket *so; + uint64_t seqno; + struct mbuf *mbuf; + STAILQ_ENTRY(mbuf_ext_pgs) stailq; + } m_ext_pgs; }; - struct mbuf_ext_pgs m_ext_pgs; + union { + /* M_EXT or M_EXTPG set. */ + struct m_ext m_ext; + /* M_PKTHDR set, neither M_EXT nor M_EXTPG. */ + char m_pktdat[0]; + }; }; char m_dat[0]; /* !M_PKTHDR, !M_EXT */ }; @@ -375,12 +401,12 @@ mbuf_ext_pg_len(struct mbuf_ext_pgs *ext_pgs, int pidx } #ifdef INVARIANT_SUPPORT -void mb_ext_pgs_check(struct mbuf_ext_pgs *ext_pgs); +void mb_ext_pgs_check(struct mbuf *m); #endif #ifdef INVARIANTS -#define MBUF_EXT_PGS_ASSERT_SANITY(ext_pgs) mb_ext_pgs_check((ext_pgs)) +#define MBUF_EXT_PGS_ASSERT_SANITY(m) mb_ext_pgs_check((m)) #else -#define MBUF_EXT_PGS_ASSERT_SANITY(ext_pgs) +#define MBUF_EXT_PGS_ASSERT_SANITY(m) #endif #endif Modified: head/sys/sys/sglist.h ============================================================================== --- head/sys/sys/sglist.h Sat May 2 20:47:58 2020 (r360568) +++ head/sys/sys/sglist.h Sat May 2 22:39:26 2020 (r360569) @@ -57,7 +57,6 @@ struct sglist { struct bio; struct mbuf; -struct mbuf_ext_pgs; struct uio; static __inline void @@ -88,8 +87,8 @@ sglist_hold(struct sglist *sg) struct sglist *sglist_alloc(int nsegs, int mflags); int sglist_append(struct sglist *sg, void *buf, size_t len); int sglist_append_bio(struct sglist *sg, struct bio *bp); -int sglist_append_ext_pgs(struct sglist *sg, struct mbuf_ext_pgs *ext_pgs, - size_t off, size_t len); +int sglist_append_ext_pgs(struct sglist *sg, struct mbuf *m, size_t off, + size_t len); int sglist_append_mb_ext_pgs(struct sglist *sg, struct mbuf *m); int sglist_append_mbuf(struct sglist *sg, struct mbuf *m0); int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, @@ -105,8 +104,7 @@ struct sglist *sglist_build(void *buf, size_t len, int struct sglist *sglist_clone(struct sglist *sg, int mflags); int sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid); int sglist_count(void *buf, size_t len); -int sglist_count_ext_pgs(struct mbuf_ext_pgs *ext_pgs, size_t off, - size_t len); +int sglist_count_ext_pgs(struct mbuf *m, size_t off, size_t len); int sglist_count_mb_ext_pgs(struct mbuf *m); int sglist_count_vmpages(vm_page_t *m, size_t pgoff, size_t len); void sglist_free(struct sglist *sg); From owner-svn-src-head@freebsd.org Sat May 2 22:44: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 886F22C6871; Sat, 2 May 2020 22:44:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F41N33bbz3Hj5; Sat, 2 May 2020 22:44:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64378F92; Sat, 2 May 2020 22:44:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042MiOKw041898; Sat, 2 May 2020 22:44:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042MiO0K041897; Sat, 2 May 2020 22:44:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022244.042MiO0K041897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 22:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360570 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 360570 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 22:44:24 -0000 Author: glebius Date: Sat May 2 22:44:23 2020 New Revision: 360570 URL: https://svnweb.freebsd.org/changeset/base/360570 Log: In mb_unmapped_compress() we don't need mbuf structure to keep data, but we need buffer of MLEN bytes. This isn't just a simplification, but important fixup, because previous commit shrinked sizeof(struct mbuf) down below MSIZE, and instantiating an mbuf on stack no longer provides enough data. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat May 2 22:39:26 2020 (r360569) +++ head/sys/kern/kern_mbuf.c Sat May 2 22:44:23 2020 (r360570) @@ -853,7 +853,7 @@ int mb_unmapped_compress(struct mbuf *m) { volatile u_int *refcnt; - struct mbuf m_temp; + char buf[MLEN]; /* * Assert that 'm' does not have a packet header. If 'm' had @@ -876,12 +876,8 @@ mb_unmapped_compress(struct mbuf *m) if (*refcnt != 1) return (EBUSY); - m_init(&m_temp, M_NOWAIT, MT_DATA, 0); + m_copydata(m, 0, m->m_len, buf); - /* copy data out of old mbuf */ - m_copydata(m, 0, m->m_len, mtod(&m_temp, char *)); - m_temp.m_len = m->m_len; - /* Free the backing pages. */ m->m_ext.ext_free(m); @@ -889,8 +885,8 @@ mb_unmapped_compress(struct mbuf *m) m->m_flags &= ~(M_EXT | M_RDONLY | M_NOMAP); m->m_data = m->m_dat; - /* copy data back into m */ - m_copydata(&m_temp, 0, m_temp.m_len, mtod(m, char *)); + /* Copy data back into m. */ + bcopy(buf, mtod(m, char *), m->m_len); return (0); } From owner-svn-src-head@freebsd.org Sat May 2 22:49: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 DEF1D2C6979; Sat, 2 May 2020 22:49:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F46z5XFfz3HsJ; Sat, 2 May 2020 22:49:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4DE6F95; Sat, 2 May 2020 22:49:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042MnFQ3042158; Sat, 2 May 2020 22:49:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042MnFHE042155; Sat, 2 May 2020 22:49:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022249.042MnFHE042155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 22:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360571 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 360571 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 22:49:15 -0000 Author: glebius Date: Sat May 2 22:49:14 2020 New Revision: 360571 URL: https://svnweb.freebsd.org/changeset/base/360571 Log: Start moving into EPG_/epg_ namespace. There is only one flag, but next commit brings in second flag, so let them already be in the future namespace. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/sys/kern/uipc_ktls.c head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Sat May 2 22:44:23 2020 (r360570) +++ head/sys/kern/uipc_ktls.c Sat May 2 22:49:14 2020 (r360571) @@ -1545,7 +1545,7 @@ ktls_encrypt(struct mbuf_ext_pgs *pgs) * (from sendfile), anonymous wired pages are * allocated and assigned to the destination iovec. */ - is_anon = (pgs->flags & MBUF_PEXT_FLAG_ANON) != 0; + is_anon = (pgs->flags & EPG_FLAG_ANON) != 0; off = pgs->first_pg_off; for (i = 0; i < pgs->npgs; i++, off = 0) { @@ -1601,7 +1601,7 @@ retry_page: m->m_ext.ext_free = mb_free_mext_pgs; /* Pages are now writable. */ - pgs->flags |= MBUF_PEXT_FLAG_ANON; + pgs->flags |= EPG_FLAG_ANON; } /* Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Sat May 2 22:44:23 2020 (r360570) +++ head/sys/kern/uipc_mbuf.c Sat May 2 22:49:14 2020 (r360571) @@ -1678,7 +1678,7 @@ m_uiotombuf_nomap(struct uio *uio, int how, int len, i prev->m_next = mb; prev = mb; pgs = &mb->m_ext_pgs; - pgs->flags = MBUF_PEXT_FLAG_ANON; + pgs->flags = EPG_FLAG_ANON; needed = length = MIN(maxseg, total); for (i = 0; needed > 0; i++, needed -= PAGE_SIZE) { retry_page: Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat May 2 22:44:23 2020 (r360570) +++ head/sys/sys/mbuf.h Sat May 2 22:49:14 2020 (r360571) @@ -229,8 +229,6 @@ struct pkthdr { #define MBUF_PEXT_MAX_BYTES \ (MBUF_PEXT_MAX_PGS * PAGE_SIZE + MBUF_PEXT_HDR_LEN + MBUF_PEXT_TRAIL_LEN) -#define MBUF_PEXT_FLAG_ANON 1 /* Data can be encrypted in place. */ - struct ktls_session; struct socket; @@ -366,6 +364,7 @@ struct mbuf { uint16_t first_pg_off; uint16_t last_pg_len; uint8_t flags; +#define EPG_FLAG_ANON 0x1 /* Data can be encrypted in place. */ uint8_t record_type; uint8_t spare[2]; int enc_cnt; From owner-svn-src-head@freebsd.org Sat May 2 22:56: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 8E54F2C6E9B; Sat, 2 May 2020 22:56:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F4HC3GVPz3JQK; Sat, 2 May 2020 22:56:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 532C31183; Sat, 2 May 2020 22:56:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042MuNXm048000; Sat, 2 May 2020 22:56:23 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042MuNa3047999; Sat, 2 May 2020 22:56:23 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022256.042MuNa3047999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 22:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360572 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 360572 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 22:56:23 -0000 Author: glebius Date: Sat May 2 22:56:22 2020 New Revision: 360572 URL: https://svnweb.freebsd.org/changeset/base/360572 Log: Get rid of the mbuf self-pointing pointer. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/sys/kern/uipc_ktls.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Sat May 2 22:49:14 2020 (r360571) +++ head/sys/kern/uipc_ktls.c Sat May 2 22:56:22 2020 (r360572) @@ -1436,7 +1436,7 @@ ktls_enqueue_to_free(struct mbuf_ext_pgs *pgs) bool running; /* Mark it for freeing. */ - pgs->mbuf = NULL; + pgs->flags |= EPG_FLAG_2FREE; wq = &ktls_wq[pgs->tls->wq_index]; mtx_lock(&wq->mtx); STAILQ_INSERT_TAIL(&wq->head, pgs, stailq); @@ -1463,7 +1463,6 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int pa KASSERT(pgs->tls->mode == TCP_TLS_MODE_SW, ("!SW TLS mbuf")); pgs->enc_cnt = page_count; - pgs->mbuf = m; /* * Save a pointer to the socket. The caller is responsible @@ -1496,12 +1495,11 @@ ktls_encrypt(struct mbuf_ext_pgs *pgs) so = pgs->so; tls = pgs->tls; - top = pgs->mbuf; + top = __containerof(pgs, struct mbuf, m_ext_pgs); KASSERT(tls != NULL, ("tls = NULL, top = %p, pgs = %p\n", top, pgs)); KASSERT(so != NULL, ("so = NULL, top = %p, pgs = %p\n", top, pgs)); #ifdef INVARIANTS pgs->so = NULL; - pgs->mbuf = NULL; #endif total_pages = pgs->enc_cnt; npages = 0; @@ -1654,14 +1652,14 @@ ktls_work_thread(void *ctx) mtx_unlock(&wq->mtx); STAILQ_FOREACH_SAFE(p, &local_head, stailq, n) { - if (p->mbuf != NULL) { - ktls_encrypt(p); - counter_u64_add(ktls_cnt_on, -1); - } else { + if (p->flags & EPG_FLAG_2FREE) { tls = p->tls; ktls_free(tls); m = __containerof(p, struct mbuf, m_ext_pgs); uma_zfree(zone_mbuf, m); + } else { + ktls_encrypt(p); + counter_u64_add(ktls_cnt_on, -1); } } } Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat May 2 22:49:14 2020 (r360571) +++ head/sys/sys/mbuf.h Sat May 2 22:56:22 2020 (r360572) @@ -365,13 +365,13 @@ struct mbuf { uint16_t last_pg_len; uint8_t flags; #define EPG_FLAG_ANON 0x1 /* Data can be encrypted in place. */ +#define EPG_FLAG_2FREE 0x2 /* Scheduled for free. */ uint8_t record_type; uint8_t spare[2]; int enc_cnt; struct ktls_session *tls; struct socket *so; uint64_t seqno; - struct mbuf *mbuf; STAILQ_ENTRY(mbuf_ext_pgs) stailq; } m_ext_pgs; }; From owner-svn-src-head@freebsd.org Sat May 2 23:38: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 EEFD02C82D5; Sat, 2 May 2020 23:38:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F5CV63Jfz3LWg; Sat, 2 May 2020 23:38:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACBB5190C; Sat, 2 May 2020 23:38:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042NcEsX072684; Sat, 2 May 2020 23:38:14 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042NcD0F072681; Sat, 2 May 2020 23:38:13 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022338.042NcD0F072681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 23:38:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360573 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 360573 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 23:38:15 -0000 Author: glebius Date: Sat May 2 23:38:13 2020 New Revision: 360573 URL: https://svnweb.freebsd.org/changeset/base/360573 Log: Step 2.1: Build TLS workqueue from mbufs, not struct mbuf_ext_pgs. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/sys/kern/kern_mbuf.c head/sys/kern/uipc_ktls.c head/sys/sys/ktls.h head/sys/sys/mbuf.h Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat May 2 22:56:22 2020 (r360572) +++ head/sys/kern/kern_mbuf.c Sat May 2 23:38:13 2020 (r360573) @@ -1246,7 +1246,6 @@ mb_free_ext(struct mbuf *m) break; case EXT_PGS: { #ifdef KERN_TLS - struct mbuf_ext_pgs *pgs; struct ktls_session *tls; #endif @@ -1254,11 +1253,10 @@ mb_free_ext(struct mbuf *m) ("%s: ext_free not set", __func__)); mref->m_ext.ext_free(mref); #ifdef KERN_TLS - pgs = &mref->m_ext_pgs; - tls = pgs->tls; + tls = mref->m_ext_pgs.tls; if (tls != NULL && !refcount_release_if_not_last(&tls->refcount)) - ktls_enqueue_to_free(pgs); + ktls_enqueue_to_free(mref); else #endif uma_zfree(zone_mbuf, mref); Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Sat May 2 22:56:22 2020 (r360572) +++ head/sys/kern/uipc_ktls.c Sat May 2 23:38:13 2020 (r360573) @@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$"); struct ktls_wq { struct mtx mtx; - STAILQ_HEAD(, mbuf_ext_pgs) head; + STAILQ_HEAD(, mbuf) head; bool running; } __aligned(CACHE_LINE_SIZE); @@ -1430,16 +1430,19 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, } void -ktls_enqueue_to_free(struct mbuf_ext_pgs *pgs) +ktls_enqueue_to_free(struct mbuf *m) { + struct mbuf_ext_pgs *pgs; struct ktls_wq *wq; bool running; + pgs = &m->m_ext_pgs; + /* Mark it for freeing. */ pgs->flags |= EPG_FLAG_2FREE; wq = &ktls_wq[pgs->tls->wq_index]; mtx_lock(&wq->mtx); - STAILQ_INSERT_TAIL(&wq->head, pgs, stailq); + STAILQ_INSERT_TAIL(&wq->head, m, m_ext_pgs.stailq); running = wq->running; mtx_unlock(&wq->mtx); if (!running) @@ -1472,7 +1475,7 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int pa wq = &ktls_wq[pgs->tls->wq_index]; mtx_lock(&wq->mtx); - STAILQ_INSERT_TAIL(&wq->head, pgs, stailq); + STAILQ_INSERT_TAIL(&wq->head, m, m_ext_pgs.stailq); running = wq->running; mtx_unlock(&wq->mtx); if (!running) @@ -1481,11 +1484,12 @@ ktls_enqueue(struct mbuf *m, struct socket *so, int pa } static __noinline void -ktls_encrypt(struct mbuf_ext_pgs *pgs) +ktls_encrypt(struct mbuf *top) { struct ktls_session *tls; struct socket *so; - struct mbuf *m, *top; + struct mbuf *m; + struct mbuf_ext_pgs *pgs; vm_paddr_t parray[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; struct iovec src_iov[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; struct iovec dst_iov[1 + btoc(TLS_MAX_MSG_SIZE_V10_2)]; @@ -1493,15 +1497,14 @@ ktls_encrypt(struct mbuf_ext_pgs *pgs) int error, i, len, npages, off, total_pages; bool is_anon; - so = pgs->so; - tls = pgs->tls; - top = __containerof(pgs, struct mbuf, m_ext_pgs); - KASSERT(tls != NULL, ("tls = NULL, top = %p, pgs = %p\n", top, pgs)); - KASSERT(so != NULL, ("so = NULL, top = %p, pgs = %p\n", top, pgs)); + so = top->m_ext_pgs.so; + tls = top->m_ext_pgs.tls; + KASSERT(tls != NULL, ("tls = NULL, top = %p\n", top)); + KASSERT(so != NULL, ("so = NULL, top = %p\n", top)); #ifdef INVARIANTS - pgs->so = NULL; + top->m_ext_pgs.so = NULL; #endif - total_pages = pgs->enc_cnt; + total_pages = top->m_ext_pgs.enc_cnt; npages = 0; /* @@ -1631,10 +1634,8 @@ static void ktls_work_thread(void *ctx) { struct ktls_wq *wq = ctx; - struct mbuf_ext_pgs *p, *n; - struct ktls_session *tls; - struct mbuf *m; - STAILQ_HEAD(, mbuf_ext_pgs) local_head; + struct mbuf *m, *n; + STAILQ_HEAD(, mbuf) local_head; #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) fpu_kern_thread(0); @@ -1651,14 +1652,12 @@ ktls_work_thread(void *ctx) STAILQ_CONCAT(&local_head, &wq->head); mtx_unlock(&wq->mtx); - STAILQ_FOREACH_SAFE(p, &local_head, stailq, n) { - if (p->flags & EPG_FLAG_2FREE) { - tls = p->tls; - ktls_free(tls); - m = __containerof(p, struct mbuf, m_ext_pgs); + STAILQ_FOREACH_SAFE(m, &local_head, m_ext_pgs.stailq, n) { + if (m->m_ext_pgs.flags & EPG_FLAG_2FREE) { + ktls_free(m->m_ext_pgs.tls); uma_zfree(zone_mbuf, m); } else { - ktls_encrypt(p); + ktls_encrypt(m); counter_u64_add(ktls_cnt_on, -1); } } Modified: head/sys/sys/ktls.h ============================================================================== --- head/sys/sys/ktls.h Sat May 2 22:56:22 2020 (r360572) +++ head/sys/sys/ktls.h Sat May 2 23:38:13 2020 (r360573) @@ -169,7 +169,6 @@ struct iovec; struct ktls_session; struct m_snd_tag; struct mbuf; -struct mbuf_ext_pgs; struct sockbuf; struct socket; @@ -212,7 +211,7 @@ void ktls_frame(struct mbuf *m, struct ktls_session *t uint8_t record_type); void ktls_seq(struct sockbuf *sb, struct mbuf *m); void ktls_enqueue(struct mbuf *m, struct socket *so, int page_count); -void ktls_enqueue_to_free(struct mbuf_ext_pgs *pgs); +void ktls_enqueue_to_free(struct mbuf *m); int ktls_get_rx_mode(struct socket *so); int ktls_set_tx_mode(struct socket *so, int mode); int ktls_get_tx_mode(struct socket *so); Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat May 2 22:56:22 2020 (r360572) +++ head/sys/sys/mbuf.h Sat May 2 23:38:13 2020 (r360573) @@ -372,7 +372,7 @@ struct mbuf { struct ktls_session *tls; struct socket *so; uint64_t seqno; - STAILQ_ENTRY(mbuf_ext_pgs) stailq; + STAILQ_ENTRY(mbuf) stailq; } m_ext_pgs; }; union { From owner-svn-src-head@freebsd.org Sat May 2 23:46: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 A68472C86B2; Sat, 2 May 2020 23:46:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F5P34LHTz3M0T; Sat, 2 May 2020 23:46:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FB8F1AEE; Sat, 2 May 2020 23:46:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042NkVCw078462; Sat, 2 May 2020 23:46:31 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042NkUYk078455; Sat, 2 May 2020 23:46:30 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022346.042NkUYk078455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 23:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360574 - in head: share/man/man9 sys/dev/cxgbe sys/dev/cxgbe/crypto sys/dev/cxgbe/tom sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head: share/man/man9 sys/dev/cxgbe sys/dev/cxgbe/crypto sys/dev/cxgbe/tom sys/kern sys/sys X-SVN-Commit-Revision: 360574 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 23:46:31 -0000 Author: glebius Date: Sat May 2 23:46:29 2020 New Revision: 360574 URL: https://svnweb.freebsd.org/changeset/base/360574 Log: Step 2.2: o Shrink sglist(9) functions to work with multipage mbufs down from four functions to two. o Don't use 'struct mbuf_ext_pgs *' as argument, use struct mbuf. o Rename to something matching _epg. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/share/man/man9/sglist.9 head/sys/dev/cxgbe/crypto/t4_kern_tls.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/kern/subr_bus_dma.c head/sys/kern/subr_sglist.c head/sys/sys/sglist.h Modified: head/share/man/man9/sglist.9 ============================================================================== --- head/share/man/man9/sglist.9 Sat May 2 23:38:13 2020 (r360573) +++ head/share/man/man9/sglist.9 Sat May 2 23:46:29 2020 (r360574) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 28, 2019 +.Dd April 24, 2020 .Dt SGLIST 9 .Os .Sh NAME @@ -34,9 +34,8 @@ .Nm sglist_alloc , .Nm sglist_append , .Nm sglist_append_bio , -.Nm sglist_append_ext_pgs, -.Nm sglist_append_mb_ext_pgs, .Nm sglist_append_mbuf , +.Nm sglist_append_mbuf_epg, .Nm sglist_append_phys , .Nm sglist_append_sglist , .Nm sglist_append_uio , @@ -46,8 +45,7 @@ .Nm sglist_clone , .Nm sglist_consume_uio , .Nm sglist_count , -.Nm sglist_count_ext_pgs , -.Nm sglist_count_mb_ext_pgs , +.Nm sglist_count_mbuf_epg , .Nm sglist_count_vmpages , .Nm sglist_free , .Nm sglist_hold , @@ -68,10 +66,8 @@ .Ft int .Fn sglist_append_bio "struct sglist *sg" "struct bio *bp" .Ft int -.Fn sglist_append_ext_pgs "struct sglist *sg" "struct mbuf_ext_pgs *ext_pgs" "size_t offset" "size_t len" +.Fn sglist_append_mbuf_epg "struct sglist *sg" "struct mbuf *m" "size_t offset" "size_t len" .Ft int -.Fn sglist_append_mb_ext_pgs "struct sglist *sg" "struct mbuf *m" -.Ft int .Fn sglist_append_mbuf "struct sglist *sg" "struct mbuf *m" .Ft int .Fn sglist_append_phys "struct sglist *sg" "vm_paddr_t paddr" "size_t len" @@ -92,10 +88,8 @@ .Ft int .Fn sglist_count "void *buf" "size_t len" .Ft int -.Fn sglist_count_ext_pgs "struct mbuf_ext_pgs *ext_pgs" "size_t offset" "size_t len" +.Fn sglist_count_mbuf_epg "struct mbuf *m" "size_t offset" "size_t len" .Ft int -.Fn sglist_count_mb_ext_pgs "struct mbuf *m" -.Ft int .Fn sglist_count_vmpages "vm_page_t *m" "size_t pgoff" "size_t len" .Ft void .Fn sglist_free "struct sglist *sg" @@ -158,20 +152,15 @@ and is bytes long. .Pp The -.Nm sglist_count_ext_pgs +.Nm sglist_count_mbuf_epg function returns the number of scatter/gather list elements needed to describe -the unmapped external mbuf buffer -.Fa ext_pgs . +the external multipage mbuf buffer +.Fa m . The ranges start at an offset of .Fa offset relative to the start of the buffer and is .Fa len bytes long. -The -.Nm sglist_count_mb_ext_pgs -function returns the number of scatter/gather list elements needed to describe -the physical address ranges of a single unmapped mbuf -.Fa m . .Pp The .Nm sglist_count_vmpages @@ -265,9 +254,11 @@ to the scatter/gather list .Fa sg . .Pp The -.Nm sglist_append_ext_pgs -function appends the physical address ranges described by the unmapped -external mbuf buffer +.Nm sglist_append_mbuf_epg +function appends the physical address ranges described by the +external multipage +.Xr mbuf 9 +buffer .Fa ext_pgs to the scatter/gather list .Fa sg . @@ -278,17 +269,9 @@ within and continue for .Fa len bytes. -.Pp -The -.Nm sglist_append_mb_ext_pgs -function appends the physical address ranges described by the unmapped -mbuf -.Fa m -to the scatter/gather list -.Fa sg . Note that unlike .Nm sglist_append_mbuf , -.Nm sglist_append_mb_ext_pgs +.Nm sglist_append_mbuf_epg only adds ranges for a single mbuf, not an entire mbuf chain. .Pp Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May 2 23:38:13 2020 (r360573) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May 2 23:46:29 2020 (r360574) @@ -1064,7 +1064,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc wr_len += roundup2(imm_len, 16); /* TLS record payload via DSGL. */ - *nsegsp = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len + offset, + *nsegsp = sglist_count_mbuf_epg(m_tls, ext_pgs->hdr_len + offset, plen - (ext_pgs->hdr_len + offset)); wr_len += ktls_sgl_size(*nsegsp); @@ -1799,7 +1799,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* Recalculate 'nsegs' if cached value is not available. */ if (nsegs == 0) - nsegs = sglist_count_ext_pgs(m_tls, ext_pgs->hdr_len + + nsegs = sglist_count_mbuf_epg(m_tls, ext_pgs->hdr_len + offset, plen - (ext_pgs->hdr_len + offset)); /* Calculate the size of the TLS work request. */ @@ -2067,7 +2067,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* SGL for record payload */ sglist_reset(txq->gl); - if (sglist_append_ext_pgs(txq->gl, m_tls, ext_pgs->hdr_len + offset, + if (sglist_append_mbuf_epg(txq->gl, m_tls, ext_pgs->hdr_len + offset, plen - (ext_pgs->hdr_len + offset)) != 0) { #ifdef INVARIANTS panic("%s: failed to append sglist", __func__); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat May 2 23:38:13 2020 (r360573) +++ head/sys/dev/cxgbe/t4_sge.c Sat May 2 23:46:29 2020 (r360574) @@ -2413,23 +2413,21 @@ m_advance(struct mbuf **pm, int *poffset, int len) static inline int count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_t *nextaddr) { - struct mbuf_ext_pgs *ext_pgs; vm_paddr_t paddr; int i, len, off, pglen, pgoff, seglen, segoff; int nsegs = 0; MBUF_EXT_PGS_ASSERT(m); - ext_pgs = &m->m_ext_pgs; off = mtod(m, vm_offset_t); len = m->m_len; off += skip; len -= skip; - if (ext_pgs->hdr_len != 0) { - if (off >= ext_pgs->hdr_len) { - off -= ext_pgs->hdr_len; + if (m->m_ext_pgs.hdr_len != 0) { + if (off >= m->m_ext_pgs.hdr_len) { + off -= m->m_ext_pgs.hdr_len; } else { - seglen = ext_pgs->hdr_len - off; + seglen = m->m_ext_pgs.hdr_len - off; segoff = off; seglen = min(seglen, len); off = 0; @@ -2441,9 +2439,9 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_ *nextaddr = paddr + seglen; } } - pgoff = ext_pgs->first_pg_off; - for (i = 0; i < ext_pgs->npgs && len > 0; i++) { - pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + pgoff = m->m_ext_pgs.first_pg_off; + for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) { + pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; @@ -2461,7 +2459,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_ pgoff = 0; }; if (len != 0) { - seglen = min(len, ext_pgs->trail_len - off); + seglen = min(len, m->m_ext_pgs.trail_len - off); len -= seglen; paddr = pmap_kextract((vm_offset_t)&m->m_epg_trail[off]); if (*nextaddr != paddr) @@ -5838,9 +5836,12 @@ write_ethofld_wr(struct cxgbe_rate_tag *cst, struct fw immhdrs -= m0->m_len; continue; } - - sglist_append(&sg, mtod(m0, char *) + immhdrs, - m0->m_len - immhdrs); + if (m0->m_flags & M_NOMAP) + sglist_append_mbuf_epg(&sg, m0, + mtod(m0, vm_offset_t), m0->m_len); + else + sglist_append(&sg, mtod(m0, char *) + immhdrs, + m0->m_len - immhdrs); immhdrs = 0; } MPASS(sg.sg_nseg == nsegs); Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat May 2 23:38:13 2020 (r360573) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat May 2 23:46:29 2020 (r360574) @@ -611,7 +611,8 @@ write_tx_sgl(void *dst, struct mbuf *start, struct mbu i = -1; for (m = start; m != stop; m = m->m_next) { if (m->m_flags & M_NOMAP) - rc = sglist_append_mb_ext_pgs(&sg, m); + rc = sglist_append_mbuf_epg(&sg, m, + mtod(m, vm_offset_t), m->m_len); else rc = sglist_append(&sg, mtod(m, void *), m->m_len); if (__predict_false(rc != 0)) @@ -742,7 +743,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep break; } #endif - n = sglist_count_mb_ext_pgs(m); + n = sglist_count_mbuf_epg(m, + mtod(m, vm_offset_t), m->m_len); } else n = sglist_count(mtod(m, void *), m->m_len); Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Sat May 2 23:38:13 2020 (r360573) +++ head/sys/kern/subr_bus_dma.c Sat May 2 23:46:29 2020 (r360574) @@ -116,14 +116,12 @@ _bus_dmamap_load_plist(bus_dma_tag_t dmat, bus_dmamap_ * Load an unmapped mbuf */ static int -_bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map, +_bus_dmamap_load_mbuf_epg(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *segs, int *nsegs, int flags) { - struct mbuf_ext_pgs *ext_pgs; int error, i, off, len, pglen, pgoff, seglen, segoff; MBUF_EXT_PGS_ASSERT(m); - ext_pgs = &m->m_ext_pgs; len = m->m_len; error = 0; @@ -131,11 +129,11 @@ _bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, /* Skip over any data removed from the front. */ off = mtod(m, vm_offset_t); - if (ext_pgs->hdr_len != 0) { - if (off >= ext_pgs->hdr_len) { - off -= ext_pgs->hdr_len; + if (m->m_ext_pgs.hdr_len != 0) { + if (off >= m->m_ext_pgs.hdr_len) { + off -= m->m_ext_pgs.hdr_len; } else { - seglen = ext_pgs->hdr_len - off; + seglen = m->m_ext_pgs.hdr_len - off; segoff = off; seglen = min(seglen, len); off = 0; @@ -145,9 +143,9 @@ _bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, flags, segs, nsegs); } } - pgoff = ext_pgs->first_pg_off; - for (i = 0; i < ext_pgs->npgs && error == 0 && len > 0; i++) { - pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + pgoff = m->m_ext_pgs.first_pg_off; + for (i = 0; i < m->m_ext_pgs.npgs && error == 0 && len > 0; i++) { + pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; @@ -163,9 +161,9 @@ _bus_dmamap_load_unmapped_mbuf_sg(bus_dma_tag_t dmat, pgoff = 0; }; if (len != 0 && error == 0) { - KASSERT((off + len) <= ext_pgs->trail_len, + KASSERT((off + len) <= m->m_ext_pgs.trail_len, ("off + len > trail (%d + %d > %d)", off, len, - ext_pgs->trail_len)); + m->m_ext_pgs.trail_len)); error = _bus_dmamap_load_buffer(dmat, map, &m->m_epg_trail[off], len, kernel_pmap, flags, segs, nsegs); @@ -187,7 +185,7 @@ _bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmama for (m = m0; m != NULL && error == 0; m = m->m_next) { if (m->m_len > 0) { if ((m->m_flags & M_NOMAP) != 0) - error = _bus_dmamap_load_unmapped_mbuf_sg(dmat, + error = _bus_dmamap_load_mbuf_epg(dmat, map, m, segs, nsegs, flags); else error = _bus_dmamap_load_buffer(dmat, map, Modified: head/sys/kern/subr_sglist.c ============================================================================== --- head/sys/kern/subr_sglist.c Sat May 2 23:38:13 2020 (r360573) +++ head/sys/kern/subr_sglist.c Sat May 2 23:46:29 2020 (r360574) @@ -223,9 +223,8 @@ sglist_count_vmpages(vm_page_t *m, size_t pgoff, size_ * describe an EXT_PGS buffer. */ int -sglist_count_ext_pgs(struct mbuf *m, size_t off, size_t len) +sglist_count_mbuf_epg(struct mbuf *m, size_t off, size_t len) { - struct mbuf_ext_pgs *ext_pgs = &m->m_ext_pgs; vm_paddr_t nextaddr, paddr; size_t seglen, segoff; int i, nsegs, pglen, pgoff; @@ -234,11 +233,11 @@ sglist_count_ext_pgs(struct mbuf *m, size_t off, size_ return (0); nsegs = 0; - if (ext_pgs->hdr_len != 0) { - if (off >= ext_pgs->hdr_len) { - off -= ext_pgs->hdr_len; + if (m->m_ext_pgs.hdr_len != 0) { + if (off >= m->m_ext_pgs.hdr_len) { + off -= m->m_ext_pgs.hdr_len; } else { - seglen = ext_pgs->hdr_len - off; + seglen = m->m_ext_pgs.hdr_len - off; segoff = off; seglen = MIN(seglen, len); off = 0; @@ -248,9 +247,9 @@ sglist_count_ext_pgs(struct mbuf *m, size_t off, size_ } } nextaddr = 0; - pgoff = ext_pgs->first_pg_off; - for (i = 0; i < ext_pgs->npgs && len > 0; i++) { - pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + pgoff = m->m_ext_pgs.first_pg_off; + for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) { + pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; @@ -268,7 +267,7 @@ sglist_count_ext_pgs(struct mbuf *m, size_t off, size_ pgoff = 0; }; if (len != 0) { - seglen = MIN(len, ext_pgs->trail_len - off); + seglen = MIN(len, m->m_ext_pgs.trail_len - off); len -= seglen; nsegs += sglist_count(&m->m_epg_trail[off], seglen); } @@ -277,18 +276,6 @@ sglist_count_ext_pgs(struct mbuf *m, size_t off, size_ } /* - * Determine the number of scatter/gather list elements needed to - * describe an EXT_PGS mbuf. - */ -int -sglist_count_mb_ext_pgs(struct mbuf *m) -{ - - MBUF_EXT_PGS_ASSERT(m); - return (sglist_count_ext_pgs(m, mtod(m, vm_offset_t), m->m_len)); -} - -/* * Allocate a scatter/gather list along with 'nsegs' segments. The * 'mflags' parameters are the same as passed to malloc(9). The caller * should use sglist_free() to free this list. @@ -390,24 +377,25 @@ sglist_append_phys(struct sglist *sg, vm_paddr_t paddr } /* - * Append the segments to describe an EXT_PGS buffer to a - * scatter/gather list. If there are insufficient segments, then this - * fails with EFBIG. + * Append the segments of single multi-page mbuf. + * If there are insufficient segments, then this fails with EFBIG. */ int -sglist_append_ext_pgs(struct sglist *sg, struct mbuf *m, size_t off, size_t len) +sglist_append_mbuf_epg(struct sglist *sg, struct mbuf *m, size_t off, + size_t len) { - struct mbuf_ext_pgs *ext_pgs = &m->m_ext_pgs; size_t seglen, segoff; vm_paddr_t paddr; int error, i, pglen, pgoff; + MBUF_EXT_PGS_ASSERT(m); + error = 0; - if (ext_pgs->hdr_len != 0) { - if (off >= ext_pgs->hdr_len) { - off -= ext_pgs->hdr_len; + if (m->m_ext_pgs.hdr_len != 0) { + if (off >= m->m_ext_pgs.hdr_len) { + off -= m->m_ext_pgs.hdr_len; } else { - seglen = ext_pgs->hdr_len - off; + seglen = m->m_ext_pgs.hdr_len - off; segoff = off; seglen = MIN(seglen, len); off = 0; @@ -416,9 +404,9 @@ sglist_append_ext_pgs(struct sglist *sg, struct mbuf * &m->m_epg_hdr[segoff], seglen); } } - pgoff = ext_pgs->first_pg_off; - for (i = 0; i < ext_pgs->npgs && error == 0 && len > 0; i++) { - pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + pgoff = m->m_ext_pgs.first_pg_off; + for (i = 0; i < m->m_ext_pgs.npgs && error == 0 && len > 0; i++) { + pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; @@ -434,7 +422,7 @@ sglist_append_ext_pgs(struct sglist *sg, struct mbuf * pgoff = 0; }; if (error == 0 && len > 0) { - seglen = MIN(len, ext_pgs->trail_len - off); + seglen = MIN(len, m->m_ext_pgs.trail_len - off); len -= seglen; error = sglist_append(sg, &m->m_epg_trail[off], seglen); @@ -445,20 +433,6 @@ sglist_append_ext_pgs(struct sglist *sg, struct mbuf * } /* - * Append the segments to describe an EXT_PGS mbuf to a scatter/gather - * list. If there are insufficient segments, then this fails with - * EFBIG. - */ -int -sglist_append_mb_ext_pgs(struct sglist *sg, struct mbuf *m) -{ - - /* for now, all unmapped mbufs are assumed to be EXT_PGS */ - MBUF_EXT_PGS_ASSERT(m); - return (sglist_append_ext_pgs(sg, m, mtod(m, vm_offset_t), m->m_len)); -} - -/* * Append the segments that describe a single mbuf chain to a * scatter/gather list. If there are insufficient segments, then this * fails with EFBIG. @@ -478,7 +452,8 @@ sglist_append_mbuf(struct sglist *sg, struct mbuf *m0) for (m = m0; m != NULL; m = m->m_next) { if (m->m_len > 0) { if ((m->m_flags & M_NOMAP) != 0) - error = sglist_append_mb_ext_pgs(sg, m); + error = sglist_append_mbuf_epg(sg, m, + mtod(m, vm_offset_t), m->m_len); else error = sglist_append(sg, m->m_data, m->m_len); Modified: head/sys/sys/sglist.h ============================================================================== --- head/sys/sys/sglist.h Sat May 2 23:38:13 2020 (r360573) +++ head/sys/sys/sglist.h Sat May 2 23:46:29 2020 (r360574) @@ -87,10 +87,9 @@ sglist_hold(struct sglist *sg) struct sglist *sglist_alloc(int nsegs, int mflags); int sglist_append(struct sglist *sg, void *buf, size_t len); int sglist_append_bio(struct sglist *sg, struct bio *bp); -int sglist_append_ext_pgs(struct sglist *sg, struct mbuf *m, size_t off, - size_t len); -int sglist_append_mb_ext_pgs(struct sglist *sg, struct mbuf *m); int sglist_append_mbuf(struct sglist *sg, struct mbuf *m0); +int sglist_append_mbuf_epg(struct sglist *sg, struct mbuf *m0, size_t off, + size_t len); int sglist_append_phys(struct sglist *sg, vm_paddr_t paddr, size_t len); int sglist_append_sglist(struct sglist *sg, struct sglist *source, @@ -104,8 +103,7 @@ struct sglist *sglist_build(void *buf, size_t len, int struct sglist *sglist_clone(struct sglist *sg, int mflags); int sglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid); int sglist_count(void *buf, size_t len); -int sglist_count_ext_pgs(struct mbuf *m, size_t off, size_t len); -int sglist_count_mb_ext_pgs(struct mbuf *m); +int sglist_count_mbuf_epg(struct mbuf *m, size_t off, size_t len); int sglist_count_vmpages(vm_page_t *m, size_t pgoff, size_t len); void sglist_free(struct sglist *sg); int sglist_join(struct sglist *first, struct sglist *second); From owner-svn-src-head@freebsd.org Sat May 2 23:52: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 4C88B2C88DE; Sat, 2 May 2020 23:52:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F5X51GMBz3MMP; Sat, 2 May 2020 23:52:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 26B291CBF; Sat, 2 May 2020 23:52:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042NqboM084639; Sat, 2 May 2020 23:52:37 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042NqZr2084631; Sat, 2 May 2020 23:52:35 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022352.042NqZr2084631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 23:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360575 - in head/sys: dev/cxgbe dev/cxgbe/tom kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: dev/cxgbe dev/cxgbe/tom kern sys X-SVN-Commit-Revision: 360575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 23:52:37 -0000 Author: glebius Date: Sat May 2 23:52:35 2020 New Revision: 360575 URL: https://svnweb.freebsd.org/changeset/base/360575 Log: Step 2.3: Rename mbuf_ext_pg_len() to m_epg_pagelen() that uses mbuf argument. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/kern/kern_mbuf.c head/sys/kern/subr_bus_dma.c head/sys/kern/subr_sglist.c head/sys/kern/uipc_ktls.c head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat May 2 23:46:29 2020 (r360574) +++ head/sys/dev/cxgbe/t4_sge.c Sat May 2 23:52:35 2020 (r360575) @@ -2441,7 +2441,7 @@ count_mbuf_ext_pgs(struct mbuf *m, int skip, vm_paddr_ } pgoff = m->m_ext_pgs.first_pg_off; for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) { - pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); + pglen = m_epg_pagelen(m, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Sat May 2 23:46:29 2020 (r360574) +++ head/sys/dev/cxgbe/tom/t4_tls.c Sat May 2 23:52:35 2020 (r360575) @@ -1655,13 +1655,13 @@ write_ktlstx_sgl(void *dst, struct mbuf *m, int nsegs) /* Figure out the first S/G length. */ pa = m->m_epg_pa[0] + m->m_ext_pgs.first_pg_off; usgl->addr0 = htobe64(pa); - len = mbuf_ext_pg_len(&m->m_ext_pgs, 0, m->m_ext_pgs.first_pg_off); + len = m_epg_pagelen(m, 0, m->m_ext_pgs.first_pg_off); pa += len; for (i = 1; i < m->m_ext_pgs.npgs; i++) { if (m->m_epg_pa[i] != pa) break; - len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); - pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); + len += m_epg_pagelen(m, i, 0); + pa += m_epg_pagelen(m, i, 0); } usgl->len0 = htobe32(len); #ifdef INVARIANTS @@ -1679,11 +1679,11 @@ write_ktlstx_sgl(void *dst, struct mbuf *m, int nsegs) #endif pa = m->m_epg_pa[i]; usgl->sge[j / 2].addr[j & 1] = htobe64(pa); - len = mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); + len = m_epg_pagelen(m, i, 0); pa += len; } else { - len += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); - pa += mbuf_ext_pg_len(&m->m_ext_pgs, i, 0); + len += m_epg_pagelen(m, i, 0); + pa += m_epg_pagelen(m, i, 0); } } if (j >= 0) { Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Sat May 2 23:46:29 2020 (r360574) +++ head/sys/kern/kern_mbuf.c Sat May 2 23:52:35 2020 (r360575) @@ -983,7 +983,7 @@ _mb_unmapped_to_ext(struct mbuf *m) } pgoff = ext_pgs->first_pg_off; for (i = 0; i < ext_pgs->npgs && len > 0; i++) { - pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + pglen = m_epg_pagelen(m, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; Modified: head/sys/kern/subr_bus_dma.c ============================================================================== --- head/sys/kern/subr_bus_dma.c Sat May 2 23:46:29 2020 (r360574) +++ head/sys/kern/subr_bus_dma.c Sat May 2 23:52:35 2020 (r360575) @@ -145,7 +145,7 @@ _bus_dmamap_load_mbuf_epg(bus_dma_tag_t dmat, bus_dmam } pgoff = m->m_ext_pgs.first_pg_off; for (i = 0; i < m->m_ext_pgs.npgs && error == 0 && len > 0; i++) { - pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); + pglen = m_epg_pagelen(m, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; Modified: head/sys/kern/subr_sglist.c ============================================================================== --- head/sys/kern/subr_sglist.c Sat May 2 23:46:29 2020 (r360574) +++ head/sys/kern/subr_sglist.c Sat May 2 23:52:35 2020 (r360575) @@ -249,7 +249,7 @@ sglist_count_mbuf_epg(struct mbuf *m, size_t off, size nextaddr = 0; pgoff = m->m_ext_pgs.first_pg_off; for (i = 0; i < m->m_ext_pgs.npgs && len > 0; i++) { - pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); + pglen = m_epg_pagelen(m, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; @@ -406,7 +406,7 @@ sglist_append_mbuf_epg(struct sglist *sg, struct mbuf } pgoff = m->m_ext_pgs.first_pg_off; for (i = 0; i < m->m_ext_pgs.npgs && error == 0 && len > 0; i++) { - pglen = mbuf_ext_pg_len(&m->m_ext_pgs, i, pgoff); + pglen = m_epg_pagelen(m, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Sat May 2 23:46:29 2020 (r360574) +++ head/sys/kern/uipc_ktls.c Sat May 2 23:52:35 2020 (r360575) @@ -1550,7 +1550,7 @@ ktls_encrypt(struct mbuf *top) off = pgs->first_pg_off; for (i = 0; i < pgs->npgs; i++, off = 0) { - len = mbuf_ext_pg_len(pgs, i, off); + len = m_epg_pagelen(m, i, off); src_iov[i].iov_len = len; src_iov[i].iov_base = (char *)(void *)PHYS_TO_DMAP(m->m_epg_pa[i]) + Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Sat May 2 23:46:29 2020 (r360574) +++ head/sys/kern/uipc_mbuf.c Sat May 2 23:52:35 2020 (r360575) @@ -1805,7 +1805,7 @@ m_unmappedtouio(const struct mbuf *m, int m_off, struc } pgoff = ext_pgs->first_pg_off; for (i = 0; i < ext_pgs->npgs && error == 0 && len > 0; i++) { - pglen = mbuf_ext_pg_len(ext_pgs, i, pgoff); + pglen = m_epg_pagelen(m, i, pgoff); if (off >= pglen) { off -= pglen; pgoff = 0; Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Sat May 2 23:46:29 2020 (r360574) +++ head/sys/sys/mbuf.h Sat May 2 23:52:35 2020 (r360575) @@ -388,12 +388,14 @@ struct mbuf { #ifdef _KERNEL static inline int -mbuf_ext_pg_len(struct mbuf_ext_pgs *ext_pgs, int pidx, int pgoff) +m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) { + KASSERT(pgoff == 0 || pidx == 0, - ("page %d with non-zero offset %d in %p", pidx, pgoff, ext_pgs)); - if (pidx == ext_pgs->npgs - 1) { - return (ext_pgs->last_pg_len); + ("page %d with non-zero offset %d in %p", pidx, pgoff, m)); + + if (pidx == m->m_ext_pgs.npgs - 1) { + return (m->m_ext_pgs.last_pg_len); } else { return (PAGE_SIZE - pgoff); } From owner-svn-src-head@freebsd.org Sat May 2 23:58: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 2024D2C8BBE; Sat, 2 May 2020 23:58:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49F5fj02yxz3MWW; Sat, 2 May 2020 23:58:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0ACE1CC6; Sat, 2 May 2020 23:58:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 042NwKe1084965; Sat, 2 May 2020 23:58:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 042NwKia084962; Sat, 2 May 2020 23:58:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202005022358.042NwKia084962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 2 May 2020 23:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360576 - in head/sys/dev: cxgbe/crypto cxgbe/tom mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/dev: cxgbe/crypto cxgbe/tom mlx5/mlx5_en X-SVN-Commit-Revision: 360576 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2020 23:58:21 -0000 Author: glebius Date: Sat May 2 23:58:20 2020 New Revision: 360576 URL: https://svnweb.freebsd.org/changeset/base/360576 Log: Step 2.4: Stop using 'struct mbuf_ext_pgs' in drivers. Reviewed by: gallatin, hselasky Differential Revision: https://reviews.freebsd.org/D24598 Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Modified: head/sys/dev/cxgbe/crypto/t4_kern_tls.c ============================================================================== --- head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May 2 23:52:35 2020 (r360575) +++ head/sys/dev/cxgbe/crypto/t4_kern_tls.c Sat May 2 23:58:20 2020 (r360576) @@ -900,12 +900,10 @@ ktls_base_wr_size(struct tlspcb *tlsp) static u_int ktls_tcp_payload_length(struct tlspcb *tlsp, struct mbuf *m_tls) { - struct mbuf_ext_pgs *ext_pgs; struct tls_record_layer *hdr; u_int plen, mlen; MBUF_EXT_PGS_ASSERT(m_tls); - ext_pgs = &m_tls->m_ext_pgs; hdr = (void *)m_tls->m_epg_hdr; plen = ntohs(hdr->tls_length); @@ -924,8 +922,8 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb * trim the length to avoid sending any of the trailer. There * is no way to send a partial trailer currently. */ - if (mlen > TLS_HEADER_LENGTH + plen - ext_pgs->trail_len) - mlen = TLS_HEADER_LENGTH + plen - ext_pgs->trail_len; + if (mlen > TLS_HEADER_LENGTH + plen - m_tls->m_ext_pgs.trail_len) + mlen = TLS_HEADER_LENGTH + plen - m_tls->m_ext_pgs.trail_len; /* @@ -953,7 +951,6 @@ ktls_tcp_payload_length(struct tlspcb *tlsp, struct mb static u_int ktls_payload_offset(struct tlspcb *tlsp, struct mbuf *m_tls) { - struct mbuf_ext_pgs *ext_pgs; struct tls_record_layer *hdr; u_int offset, plen; #ifdef INVARIANTS @@ -961,14 +958,13 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf * #endif MBUF_EXT_PGS_ASSERT(m_tls); - ext_pgs = &m_tls->m_ext_pgs; hdr = (void *)m_tls->m_epg_hdr; plen = ntohs(hdr->tls_length); #ifdef INVARIANTS mlen = mtod(m_tls, vm_offset_t) + m_tls->m_len; MPASS(mlen < TLS_HEADER_LENGTH + plen); #endif - if (mtod(m_tls, vm_offset_t) <= ext_pgs->hdr_len) + if (mtod(m_tls, vm_offset_t) <= m_tls->m_ext_pgs.hdr_len) return (0); if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) { /* @@ -979,8 +975,8 @@ ktls_payload_offset(struct tlspcb *tlsp, struct mbuf * * the offset at the last byte of the record payload * to send the last cipher block. */ - offset = min(mtod(m_tls, vm_offset_t) - ext_pgs->hdr_len, - (plen - TLS_HEADER_LENGTH - ext_pgs->trail_len) - 1); + offset = min(mtod(m_tls, vm_offset_t) - m_tls->m_ext_pgs.hdr_len, + (plen - TLS_HEADER_LENGTH - m_tls->m_ext_pgs.trail_len) - 1); return (rounddown(offset, AES_BLOCK_LEN)); } return (0); @@ -1003,19 +999,17 @@ static int ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struct mbuf *m_tls, int *nsegsp) { - struct mbuf_ext_pgs *ext_pgs; struct tls_record_layer *hdr; u_int imm_len, offset, plen, wr_len, tlen; MBUF_EXT_PGS_ASSERT(m_tls); - ext_pgs = &m_tls->m_ext_pgs; /* * Determine the size of the TLS record payload to send * excluding header and trailer. */ tlen = ktls_tcp_payload_length(tlsp, m_tls); - if (tlen <= ext_pgs->hdr_len) { + if (tlen <= m_tls->m_ext_pgs.hdr_len) { /* * For requests that only want to send the TLS header, * send a tunnelled packet as immediate data. @@ -1041,7 +1035,7 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc } hdr = (void *)m_tls->m_epg_hdr; - plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - ext_pgs->trail_len; + plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - m_tls->m_ext_pgs.trail_len; if (tlen < plen) { plen = tlen; offset = ktls_payload_offset(tlsp, m_tls); @@ -1058,14 +1052,14 @@ ktls_wr_len(struct tlspcb *tlsp, struct mbuf *m, struc */ imm_len = 0; if (offset == 0) - imm_len += ext_pgs->hdr_len; + imm_len += m_tls->m_ext_pgs.hdr_len; if (plen == tlen) imm_len += AES_BLOCK_LEN; wr_len += roundup2(imm_len, 16); /* TLS record payload via DSGL. */ - *nsegsp = sglist_count_mbuf_epg(m_tls, ext_pgs->hdr_len + offset, - plen - (ext_pgs->hdr_len + offset)); + *nsegsp = sglist_count_mbuf_epg(m_tls, m_tls->m_ext_pgs.hdr_len + offset, + plen - (m_tls->m_ext_pgs.hdr_len + offset)); wr_len += ktls_sgl_size(*nsegsp); wr_len = roundup2(wr_len, 16); @@ -1466,7 +1460,6 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds struct ip *ip, newip; struct ip6_hdr *ip6, newip6; struct tcphdr *tcp, newtcp; - struct mbuf_ext_pgs *ext_pgs; caddr_t out; TXQ_LOCK_ASSERT_OWNED(txq); @@ -1474,7 +1467,6 @@ ktls_write_tunnel_packet(struct sge_txq *txq, void *ds /* Locate the template TLS header. */ MBUF_EXT_PGS_ASSERT(m_tls); - ext_pgs = &m_tls->m_ext_pgs; /* This should always be the last TLS record in a chain. */ MPASS(m_tls->m_next == NULL); @@ -1577,7 +1569,6 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq struct ulptx_idata *idata; struct cpl_tx_sec_pdu *sec_pdu; struct cpl_tx_data *tx_data; - struct mbuf_ext_pgs *ext_pgs; struct tls_record_layer *hdr; char *iv, *out; u_int aad_start, aad_stop; @@ -1603,20 +1594,19 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* Locate the TLS header. */ MBUF_EXT_PGS_ASSERT(m_tls); - ext_pgs = &m_tls->m_ext_pgs; hdr = (void *)m_tls->m_epg_hdr; - plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - ext_pgs->trail_len; + plen = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - m_tls->m_ext_pgs.trail_len; /* Determine how much of the TLS record to send. */ tlen = ktls_tcp_payload_length(tlsp, m_tls); - if (tlen <= ext_pgs->hdr_len) { + if (tlen <= m_tls->m_ext_pgs.hdr_len) { /* * For requests that only want to send the TLS header, * send a tunnelled packet as immediate data. */ #ifdef VERBOSE_TRACES CTR3(KTR_CXGBE, "%s: tid %d header-only TLS record %u", - __func__, tlsp->tid, (u_int)ext_pgs->seqno); + __func__, tlsp->tid, (u_int)m_tls->m_ext_pgs.seqno); #endif return (ktls_write_tunnel_packet(txq, dst, m, m_tls, available, tcp_seqno, pidx)); @@ -1626,7 +1616,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq offset = ktls_payload_offset(tlsp, m_tls); #ifdef VERBOSE_TRACES CTR4(KTR_CXGBE, "%s: tid %d short TLS record %u with offset %u", - __func__, tlsp->tid, (u_int)ext_pgs->seqno, offset); + __func__, tlsp->tid, (u_int)m_tls->m_ext_pgs.seqno, offset); #endif if (m_tls->m_next == NULL && (tcp->th_flags & TH_FIN) != 0) { txq->kern_tls_fin_short++; @@ -1681,10 +1671,10 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq */ tx_max_offset = mtod(m_tls, vm_offset_t); if (tx_max_offset > TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - - ext_pgs->trail_len) { + m_tls->m_ext_pgs.trail_len) { /* Always send the full trailer. */ tx_max_offset = TLS_HEADER_LENGTH + ntohs(hdr->tls_length) - - ext_pgs->trail_len; + m_tls->m_ext_pgs.trail_len; } if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_CBC && tx_max_offset > TLS_HEADER_LENGTH) { @@ -1799,15 +1789,15 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* Recalculate 'nsegs' if cached value is not available. */ if (nsegs == 0) - nsegs = sglist_count_mbuf_epg(m_tls, ext_pgs->hdr_len + - offset, plen - (ext_pgs->hdr_len + offset)); + nsegs = sglist_count_mbuf_epg(m_tls, m_tls->m_ext_pgs.hdr_len + + offset, plen - (m_tls->m_ext_pgs.hdr_len + offset)); /* Calculate the size of the TLS work request. */ twr_len = ktls_base_wr_size(tlsp); imm_len = 0; if (offset == 0) - imm_len += ext_pgs->hdr_len; + imm_len += m_tls->m_ext_pgs.hdr_len; if (plen == tlen) imm_len += AES_BLOCK_LEN; twr_len += roundup2(imm_len, 16); @@ -1923,13 +1913,13 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq cipher_stop = 0; sec_pdu->pldlen = htobe32(16 + plen - - (ext_pgs->hdr_len + offset)); + (m_tls->m_ext_pgs.hdr_len + offset)); /* These two flits are actually a CPL_TLS_TX_SCMD_FMT. */ sec_pdu->seqno_numivs = tlsp->scmd0_short.seqno_numivs; sec_pdu->ivgen_hdrlen = htobe32( tlsp->scmd0_short.ivgen_hdrlen | - V_SCMD_HDR_LEN(offset == 0 ? ext_pgs->hdr_len : 0)); + V_SCMD_HDR_LEN(offset == 0 ? m_tls->m_ext_pgs.hdr_len : 0)); txq->kern_tls_short++; } else { @@ -1942,7 +1932,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq aad_start = 1; aad_stop = TLS_HEADER_LENGTH; iv_offset = TLS_HEADER_LENGTH + 1; - cipher_start = ext_pgs->hdr_len + 1; + cipher_start = m_tls->m_ext_pgs.hdr_len + 1; if (tlsp->enc_mode == SCMD_CIPH_MODE_AES_GCM) { cipher_stop = 0; auth_start = cipher_start; @@ -1981,7 +1971,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq V_CPL_TX_SEC_PDU_AUTHSTOP(auth_stop) | V_CPL_TX_SEC_PDU_AUTHINSERT(auth_insert)); - sec_pdu->scmd1 = htobe64(ext_pgs->seqno); + sec_pdu->scmd1 = htobe64(m_tls->m_ext_pgs.seqno); /* Key context */ out = (void *)(sec_pdu + 1); @@ -2021,8 +2011,8 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq tx_data->rsvd = htobe32(tcp_seqno); } else { tx_data->len = htobe32(V_TX_DATA_MSS(mss) | - V_TX_LENGTH(tlen - (ext_pgs->hdr_len + offset))); - tx_data->rsvd = htobe32(tcp_seqno + ext_pgs->hdr_len + offset); + V_TX_LENGTH(tlen - (m_tls->m_ext_pgs.hdr_len + offset))); + tx_data->rsvd = htobe32(tcp_seqno + m_tls->m_ext_pgs.hdr_len + offset); } tx_data->flags = htobe32(F_TX_BYPASS); if (last_wr && tcp->th_flags & TH_PUSH) @@ -2031,8 +2021,8 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* Populate the TLS header */ out = (void *)(tx_data + 1); if (offset == 0) { - memcpy(out, m_tls->m_epg_hdr, ext_pgs->hdr_len); - out += ext_pgs->hdr_len; + memcpy(out, m_tls->m_epg_hdr, m_tls->m_ext_pgs.hdr_len); + out += m_tls->m_ext_pgs.hdr_len; } /* AES IV for a short record. */ @@ -2067,8 +2057,8 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq /* SGL for record payload */ sglist_reset(txq->gl); - if (sglist_append_mbuf_epg(txq->gl, m_tls, ext_pgs->hdr_len + offset, - plen - (ext_pgs->hdr_len + offset)) != 0) { + if (sglist_append_mbuf_epg(txq->gl, m_tls, m_tls->m_ext_pgs.hdr_len + offset, + plen - (m_tls->m_ext_pgs.hdr_len + offset)) != 0) { #ifdef INVARIANTS panic("%s: failed to append sglist", __func__); #endif @@ -2090,7 +2080,7 @@ ktls_write_tls_wr(struct tlspcb *tlsp, struct sge_txq txq->kern_tls_waste += mtod(m_tls, vm_offset_t); else txq->kern_tls_waste += mtod(m_tls, vm_offset_t) - - (ext_pgs->hdr_len + offset); + (m_tls->m_ext_pgs.hdr_len + offset); } txsd = &txq->sdesc[pidx]; Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat May 2 23:52:35 2020 (r360575) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat May 2 23:58:20 2020 (r360576) @@ -1924,19 +1924,17 @@ aiotx_free_job(struct kaiocb *job) static void aiotx_free_pgs(struct mbuf *m) { - struct mbuf_ext_pgs *ext_pgs; struct kaiocb *job; vm_page_t pg; MBUF_EXT_PGS_ASSERT(m); - ext_pgs = &m->m_ext_pgs; job = m->m_ext.ext_arg1; #ifdef VERBOSE_TRACES CTR3(KTR_CXGBE, "%s: completed %d bytes for tid %d", __func__, m->m_len, jobtotid(job)); #endif - for (int i = 0; i < ext_pgs->npgs; i++) { + for (int i = 0; i < m->m_ext_pgs.npgs; i++) { pg = PHYS_TO_VM_PAGE(m->m_epg_pa[i]); vm_page_unwire(pg, PQ_ACTIVE); } @@ -1954,7 +1952,6 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len) struct vmspace *vm; vm_page_t pgs[MBUF_PEXT_MAX_PGS]; struct mbuf *m, *top, *last; - struct mbuf_ext_pgs *ext_pgs; vm_map_t map; vm_offset_t start; int i, mlen, npages, pgoff; @@ -1992,16 +1989,15 @@ alloc_aiotx_mbuf(struct kaiocb *job, int len) break; } - ext_pgs = &m->m_ext_pgs; - ext_pgs->first_pg_off = pgoff; - ext_pgs->npgs = npages; + m->m_ext_pgs.first_pg_off = pgoff; + m->m_ext_pgs.npgs = npages; if (npages == 1) { KASSERT(mlen + pgoff <= PAGE_SIZE, ("%s: single page is too large (off %d len %d)", __func__, pgoff, mlen)); - ext_pgs->last_pg_len = mlen; + m->m_ext_pgs.last_pg_len = mlen; } else { - ext_pgs->last_pg_len = mlen - (PAGE_SIZE - pgoff) - + m->m_ext_pgs.last_pg_len = mlen - (PAGE_SIZE - pgoff) - (npages - 2) * PAGE_SIZE; } for (i = 0; i < npages; i++) Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Sat May 2 23:52:35 2020 (r360575) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Sat May 2 23:58:20 2020 (r360576) @@ -680,13 +680,11 @@ done: static int mlx5e_sq_tls_populate(struct mbuf *mb, uint64_t *pseq) { - struct mbuf_ext_pgs *ext_pgs; for (; mb != NULL; mb = mb->m_next) { if (!(mb->m_flags & M_NOMAP)) continue; - ext_pgs = &mb->m_ext_pgs; - *pseq = ext_pgs->seqno; + *pseq = mb->m_ext_pgs.seqno; return (1); } return (0);