From owner-svn-src-stable-12@freebsd.org Sun Aug 16 02:04:36 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60A603ADDC9; Sun, 16 Aug 2020 02:04:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BTgTw1wqZz3Vx0; Sun, 16 Aug 2020 02:04:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2580A8AE2; Sun, 16 Aug 2020 02:04:36 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07G24aDw067580; Sun, 16 Aug 2020 02:04:36 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07G24axg067579; Sun, 16 Aug 2020 02:04:36 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202008160204.07G24axg067579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sun, 16 Aug 2020 02:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364265 - stable/12/sbin/ifconfig X-SVN-Group: stable-12 X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: stable/12/sbin/ifconfig X-SVN-Commit-Revision: 364265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Aug 2020 02:04:36 -0000 Author: eugen Date: Sun Aug 16 02:04:35 2020 New Revision: 364265 URL: https://svnweb.freebsd.org/changeset/base/364265 Log: MFC r364186: ifconfig(8): plug memory leak Modified: stable/12/sbin/ifconfig/ifconfig.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.c Sat Aug 15 22:59:44 2020 (r364264) +++ stable/12/sbin/ifconfig/ifconfig.c Sun Aug 16 02:04:35 2020 (r364265) @@ -748,6 +748,7 @@ group_member(const char *ifname, const char *match, co if (nomatch) nomatched &= fnmatch(nomatch, ifg->ifgrq_group, 0); } + free(ifgr.ifgr_groups); if (match && !nomatch) return (matched); From owner-svn-src-stable-12@freebsd.org Mon Aug 17 12:38:36 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20E853B1677; Mon, 17 Aug 2020 12:38:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVYW007zRz4dDb; Mon, 17 Aug 2020 12:38:36 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCD5E20C54; Mon, 17 Aug 2020 12:38: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 07HCcZt1046874; Mon, 17 Aug 2020 12:38:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07HCcZH1046872; Mon, 17 Aug 2020 12:38:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008171238.07HCcZH1046872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 17 Aug 2020 12:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364298 - in stable/12/usr.bin/fortune: fortune strfile X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/usr.bin/fortune: fortune strfile X-SVN-Commit-Revision: 364298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2020 12:38:36 -0000 Author: markj Date: Mon Aug 17 12:38:35 2020 New Revision: 364298 URL: https://svnweb.freebsd.org/changeset/base/364298 Log: MFC r364083: fortune, strfile: Improve validation of command-line arguments. PR: 246050 Modified: stable/12/usr.bin/fortune/fortune/fortune.c stable/12/usr.bin/fortune/strfile/strfile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/fortune/fortune/fortune.c ============================================================================== --- stable/12/usr.bin/fortune/fortune/fortune.c Mon Aug 17 10:51:03 2020 (r364297) +++ stable/12/usr.bin/fortune/fortune/fortune.c Mon Aug 17 12:38:35 2020 (r364298) @@ -400,11 +400,12 @@ form_file_list(char **files, int file_cnt) sp = files[i]; else { percent = 0; - for (sp = files[i]; isdigit((unsigned char)*sp); sp++) + for (sp = files[i]; isdigit((unsigned char)*sp); sp++) { percent = percent * 10 + *sp - '0'; - if (percent > 100) { - fprintf(stderr, "percentages must be <= 100\n"); - return (FALSE); + if (percent > 100) { + fprintf(stderr, "percentages must be <= 100\n"); + return (FALSE); + } } if (*sp == '.') { fprintf(stderr, "percentages must be integers\n"); Modified: stable/12/usr.bin/fortune/strfile/strfile.c ============================================================================== --- stable/12/usr.bin/fortune/strfile/strfile.c Mon Aug 17 10:51:03 2020 (r364297) +++ stable/12/usr.bin/fortune/strfile/strfile.c Mon Aug 17 12:38:35 2020 (r364298) @@ -295,16 +295,26 @@ getargs(int argc, char **argv) if (*argv) { Infile = *argv; - if (*++argv) - strcpy(Outfile, *argv); + if (*++argv) { + if (strlcpy(Outfile, *argv, sizeof(Outfile)) >= + sizeof(Outfile)) { + fprintf(stderr, + "output_file path is too long\n"); + exit(1); + } + } } if (!Infile) { puts("No input file name"); usage(); } if (*Outfile == '\0') { - strlcpy(Outfile, Infile, sizeof(Outfile)); - strlcat(Outfile, ".dat", sizeof(Outfile)); + if ((size_t)snprintf(Outfile, sizeof(Outfile), "%s.dat", + Infile) >= sizeof(Outfile)) { + fprintf(stderr, + "generated output_file path is too long\n"); + exit(1); + } } } From owner-svn-src-stable-12@freebsd.org Mon Aug 17 16:27:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDB613B5FD1; Mon, 17 Aug 2020 16:27:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVfZb5tWrz3crR; Mon, 17 Aug 2020 16:27:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A9FAA238A3; Mon, 17 Aug 2020 16:27:03 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07HGR3IG088783; Mon, 17 Aug 2020 16:27:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07HGR2gl088779; Mon, 17 Aug 2020 16:27:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202008171627.07HGR2gl088779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 17 Aug 2020 16:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364311 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 364311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2020 16:27:04 -0000 Author: kib Date: Mon Aug 17 16:27:02 2020 New Revision: 364311 URL: https://svnweb.freebsd.org/changeset/base/364311 Log: MFC r364091: Export scandir_b from libc. PR: 248572 Modified: stable/12/lib/libc/gen/Makefile.inc stable/12/lib/libc/gen/Symbol.map stable/12/lib/libc/gen/scandir-compat11.c stable/12/lib/libc/gen/scandir.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/Makefile.inc ============================================================================== --- stable/12/lib/libc/gen/Makefile.inc Mon Aug 17 15:37:08 2020 (r364310) +++ stable/12/lib/libc/gen/Makefile.inc Mon Aug 17 16:27:02 2020 (r364311) @@ -110,6 +110,7 @@ SRCS+= __getosreldate.c \ recvmmsg.c \ rewinddir.c \ scandir.c \ + scandir_b.c \ seed48.c \ seekdir.c \ semctl.c \ Modified: stable/12/lib/libc/gen/Symbol.map ============================================================================== --- stable/12/lib/libc/gen/Symbol.map Mon Aug 17 15:37:08 2020 (r364310) +++ stable/12/lib/libc/gen/Symbol.map Mon Aug 17 16:27:02 2020 (r364311) @@ -416,7 +416,6 @@ FBSD_1.5 { readdir; readdir_r; scandir; - scandir_b; sem_clockwait_np; setproctitle_fast; timespec_get; @@ -425,6 +424,7 @@ FBSD_1.5 { FBSD_1.6 { __sysctlbyname; memalign; + scandir_b; sigandset; sigisemptyset; sigorset; Modified: stable/12/lib/libc/gen/scandir-compat11.c ============================================================================== --- stable/12/lib/libc/gen/scandir-compat11.c Mon Aug 17 15:37:08 2020 (r364310) +++ stable/12/lib/libc/gen/scandir-compat11.c Mon Aug 17 16:27:02 2020 (r364311) @@ -49,32 +49,25 @@ __FBSDID("$FreeBSD$"); #include "gen-compat.h" -#ifdef I_AM_SCANDIR_B -#include "block_abi.h" -#define SELECT(x) CALL_BLOCK(select, x) -#ifndef __BLOCKS__ -void -qsort_b(void *, size_t, size_t, void*); -#endif -#else +/* + * scandir_b@FBSD_1.4 was never exported from libc.so.7 due to a + * mistake, so there is no use of exporting it now with some earlier + * symbol version. As result, we do not need to implement compat + * function freebsd11_scandir_b(). + */ + #define SELECT(x) select(x) -#endif +void qsort_b(void *, size_t, size_t, void *); + static int freebsd11_alphasort_thunk(void *thunk, const void *p1, const void *p2); int -#ifdef I_AM_SCANDIR_B -freebsd11_scandir_b(const char *dirname, struct freebsd11_dirent ***namelist, - DECLARE_BLOCK(int, select, const struct freebsd11_dirent *), - DECLARE_BLOCK(int, dcomp, const struct freebsd11_dirent **, - const struct freebsd11_dirent **)) -#else freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist, int (*select)(const struct freebsd11_dirent *), int (*dcomp)(const struct freebsd11_dirent **, const struct freebsd11_dirent **)) -#endif { struct freebsd11_dirent *d, *p, **names = NULL; size_t arraysz, numitems; @@ -124,13 +117,8 @@ freebsd11_scandir(const char *dirname, struct freebsd1 } closedir(dirp); if (numitems && dcomp != NULL) -#ifdef I_AM_SCANDIR_B - qsort_b(names, numitems, sizeof(struct freebsd11_dirent *), - (void*)dcomp); -#else qsort_r(names, numitems, sizeof(struct freebsd11_dirent *), &dcomp, freebsd11_alphasort_thunk); -#endif *namelist = names; return (numitems); @@ -168,4 +156,3 @@ freebsd11_alphasort_thunk(void *thunk, const void *p1, __sym_compat(alphasort, freebsd11_alphasort, FBSD_1.0); __sym_compat(scandir, freebsd11_scandir, FBSD_1.0); -__sym_compat(scandir_b, freebsd11_scandir_b, FBSD_1.4); Modified: stable/12/lib/libc/gen/scandir.c ============================================================================== --- stable/12/lib/libc/gen/scandir.c Mon Aug 17 15:37:08 2020 (r364310) +++ stable/12/lib/libc/gen/scandir.c Mon Aug 17 16:27:02 2020 (r364311) @@ -50,8 +50,7 @@ __FBSDID("$FreeBSD$"); #include "block_abi.h" #define SELECT(x) CALL_BLOCK(select, x) #ifndef __BLOCKS__ -void -qsort_b(void *, size_t, size_t, void*); +void qsort_b(void *, size_t, size_t, void *); #endif #else #define SELECT(x) select(x) @@ -134,6 +133,7 @@ fail: return (-1); } +#ifndef I_AM_SCANDIR_B /* * Alphabetic order comparison routine for those who want it. * POSIX 2008 requires that alphasort() uses strcoll(). @@ -153,3 +153,4 @@ alphasort_thunk(void *thunk, const void *p1, const voi dc = *(int (**)(const struct dirent **, const struct dirent **))thunk; return (dc((const struct dirent **)p1, (const struct dirent **)p2)); } +#endif From owner-svn-src-stable-12@freebsd.org Mon Aug 17 17:47:05 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88C7F3B8399; Mon, 17 Aug 2020 17:47:05 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVhLx30ncz41Y4; Mon, 17 Aug 2020 17:47:05 +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 4BBE3246AD; Mon, 17 Aug 2020 17:47:05 +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 07HHl5sX039396; Mon, 17 Aug 2020 17:47:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07HHl59i039395; Mon, 17 Aug 2020 17:47:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202008171747.07HHl59i039395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 17 Aug 2020 17:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364319 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 364319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2020 17:47:05 -0000 Author: emaste Date: Mon Aug 17 17:47:04 2020 New Revision: 364319 URL: https://svnweb.freebsd.org/changeset/base/364319 Log: MFC r360501: 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: stable/12/share/mk/src.opts.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/src.opts.mk ============================================================================== --- stable/12/share/mk/src.opts.mk Mon Aug 17 17:17:33 2020 (r364318) +++ stable/12/share/mk/src.opts.mk Mon Aug 17 17:47:04 2020 (r364319) @@ -507,6 +507,10 @@ MK_DMAGENT:= no MK_OPENSSH:= no MK_KERBEROS:= 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-stable-12@freebsd.org Mon Aug 17 17:48:29 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46F903B83D7; Mon, 17 Aug 2020 17:48:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVhNY1Bxlz41Zb; Mon, 17 Aug 2020 17:48:29 +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 0D57A24814; Mon, 17 Aug 2020 17:48:29 +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 07HHmSPL039540; Mon, 17 Aug 2020 17:48:28 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07HHmSOe039539; Mon, 17 Aug 2020 17:48:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202008171748.07HHmSOe039539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 17 Aug 2020 17:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364320 - stable/12/tests/sys/geom/class X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/tests/sys/geom/class X-SVN-Commit-Revision: 364320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2020 17:48:29 -0000 Author: emaste Date: Mon Aug 17 17:48:28 2020 New Revision: 364320 URL: https://svnweb.freebsd.org/changeset/base/364320 Log: MFC r360509: geli tests require OpenSSL - exclude them under WITHOUT_OPENSSL PR: 245931 Submitted by: The FreeBSD Foundation Modified: stable/12/tests/sys/geom/class/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/geom/class/Makefile ============================================================================== --- stable/12/tests/sys/geom/class/Makefile Mon Aug 17 17:47:04 2020 (r364319) +++ stable/12/tests/sys/geom/class/Makefile Mon Aug 17 17:48:28 2020 (r364320) @@ -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-stable-12@freebsd.org Mon Aug 17 19:17:55 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 708E63B9EEB; Mon, 17 Aug 2020 19:17:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVkMl28zQz46f1; Mon, 17 Aug 2020 19:17:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E929259B5; Mon, 17 Aug 2020 19:17:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07HJHtpm094842; Mon, 17 Aug 2020 19:17:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07HJHt29094841; Mon, 17 Aug 2020 19:17:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202008171917.07HJHt29094841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 17 Aug 2020 19:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364323 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 364323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2020 19:17:55 -0000 Author: kib Date: Mon Aug 17 19:17:54 2020 New Revision: 364323 URL: https://svnweb.freebsd.org/changeset/base/364323 Log: Insta-MFC r364322: Remove unused declaration for qsort_b(). This should fix the build on gcc arches. It seems that gcc 4.2 port of the blocks support defines the guard symbol unconditionally. Modified: stable/12/lib/libc/gen/scandir-compat11.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/scandir-compat11.c ============================================================================== --- stable/12/lib/libc/gen/scandir-compat11.c Mon Aug 17 19:14:09 2020 (r364322) +++ stable/12/lib/libc/gen/scandir-compat11.c Mon Aug 17 19:17:54 2020 (r364323) @@ -58,8 +58,6 @@ __FBSDID("$FreeBSD$"); #define SELECT(x) select(x) -void qsort_b(void *, size_t, size_t, void *); - static int freebsd11_alphasort_thunk(void *thunk, const void *p1, const void *p2); From owner-svn-src-stable-12@freebsd.org Tue Aug 18 03:40:10 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D2B23AC61F; Tue, 18 Aug 2020 03:40:10 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVxWG0ZtTz4dlT; Tue, 18 Aug 2020 03:40:10 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB389B987; Tue, 18 Aug 2020 03:40:09 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07I3e9Eh005664; Tue, 18 Aug 2020 03:40:09 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07I3e9t0005662; Tue, 18 Aug 2020 03:40:09 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <202008180340.07I3e9t0005662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Tue, 18 Aug 2020 03:40:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364334 - in stable/12: sys/sys usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: grehan X-SVN-Commit-Paths: in stable/12: sys/sys usr.sbin/bhyve X-SVN-Commit-Revision: 364334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 03:40:10 -0000 Author: grehan Date: Tue Aug 18 03:40:09 2020 New Revision: 364334 URL: https://svnweb.freebsd.org/changeset/base/364334 Log: MFC 363596, 363719, 363733 363596 Support the setting of additional AHCI controller parameters. 363719 Definition for the 'removable media flag' from word 0 in the Identify page. 363733 Replace magic numbers in Identify page register 0 with ATA definitions. Relnotes: yes Modified: stable/12/sys/sys/ata.h stable/12/usr.sbin/bhyve/bhyve.8 stable/12/usr.sbin/bhyve/pci_ahci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/ata.h ============================================================================== --- stable/12/sys/sys/ata.h Tue Aug 18 02:42:51 2020 (r364333) +++ stable/12/sys/sys/ata.h Tue Aug 18 03:40:09 2020 (r364334) @@ -46,6 +46,7 @@ struct ata_params { #define ATA_ATAPI_TYPE_TAPE 0x0100 /* streaming tape */ #define ATA_ATAPI_TYPE_CDROM 0x0500 /* CD-ROM device */ #define ATA_ATAPI_TYPE_OPTICAL 0x0700 /* optical disk */ +#define ATA_ATAPI_REMOVABLE 0x0080 #define ATA_DRQ_MASK 0x0060 #define ATA_DRQ_SLOW 0x0000 /* cpu 3 ms delay */ #define ATA_DRQ_INTR 0x0020 /* interrupt 10 ms delay */ Modified: stable/12/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/12/usr.sbin/bhyve/bhyve.8 Tue Aug 18 02:42:51 2020 (r364333) +++ stable/12/usr.sbin/bhyve/bhyve.8 Tue Aug 18 03:40:09 2020 (r364334) @@ -494,6 +494,27 @@ Sector size (defaults to blockif sector size). .It Li ser Serial number with maximum 20 characters. .El +.Pp +AHCI devices: +.Bl -tag -width 10n +.It Li nmrr +Nominal Media Rotation Rate, known as RPM. value 1 will indicate device as Solid State Disk. default value is 0, not report. +.It Li ser +Serial Number with maximum 20 characters. +.It Li rev +Revision Number with maximum 8 characters. +.It Li model +Model Number with maximum 40 characters. +.El +.Pp +HD Audio devices: +.Bl -tag -width 10n +.It Li play +Playback device, typically +.Ar /dev/dsp0 . +.It Li rec +Recording device, typically +.Ar /dev/dsp0 . .El .It Fl S Wire guest memory. Modified: stable/12/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_ahci.c Tue Aug 18 02:42:51 2020 (r364333) +++ stable/12/usr.sbin/bhyve/pci_ahci.c Tue Aug 18 03:40:09 2020 (r364334) @@ -136,9 +136,9 @@ struct ahci_ioreq { struct ahci_port { struct blockif_ctxt *bctx; struct pci_ahci_softc *pr_sc; + struct ata_params ata_ident; uint8_t *cmd_lst; uint8_t *rfis; - char ident[AHCI_PORT_IDENT]; int port; int atapi; int reset; @@ -983,7 +983,50 @@ handle_identify(struct ahci_port *p, int slot, uint8_t ahci_write_fis_d2h(p, slot, cfis, (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR); } else { - uint16_t buf[256]; + ahci_write_fis_piosetup(p); + write_prdt(p, slot, cfis, (void*)&p->ata_ident, sizeof(struct ata_params)); + ahci_write_fis_d2h(p, slot, cfis, ATA_S_DSC | ATA_S_READY); + } +} + +static void +ata_identify_init(struct ahci_port* p, int atapi) +{ + struct ata_params* ata_ident = &p->ata_ident; + + if (atapi) { + ata_ident->config = ATA_PROTO_ATAPI | ATA_ATAPI_TYPE_CDROM | + ATA_ATAPI_REMOVABLE | ATA_DRQ_FAST; + ata_ident->capabilities1 = ATA_SUPPORT_LBA | + ATA_SUPPORT_DMA; + ata_ident->capabilities2 = (1 << 14 | 1); + ata_ident->atavalid = ATA_FLAG_54_58 | ATA_FLAG_64_70; + ata_ident->obsolete62 = 0x3f; + ata_ident->mwdmamodes = 7; + if (p->xfermode & ATA_WDMA0) + ata_ident->mwdmamodes |= (1 << ((p->xfermode & 7) + 8)); + ata_ident->apiomodes = 3; + ata_ident->mwdmamin = 0x0078; + ata_ident->mwdmarec = 0x0078; + ata_ident->pioblind = 0x0078; + ata_ident->pioiordy = 0x0078; + ata_ident->satacapabilities = (ATA_SATA_GEN1 | ATA_SATA_GEN2 | ATA_SATA_GEN3); + ata_ident->satacapabilities2 = ((p->ssts & ATA_SS_SPD_MASK) >> 3); + ata_ident->satasupport = ATA_SUPPORT_NCQ_STREAM; + ata_ident->version_major = 0x3f0; + ata_ident->support.command1 = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_PACKET | + ATA_SUPPORT_RESET | ATA_SUPPORT_NOP); + ata_ident->support.command2 = (1 << 14); + ata_ident->support.extension = (1 << 14); + ata_ident->enabled.command1 = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_PACKET | + ATA_SUPPORT_RESET | ATA_SUPPORT_NOP); + ata_ident->enabled.extension = (1 << 14); + ata_ident->udmamodes = 0x7f; + if (p->xfermode & ATA_UDMA0) + ata_ident->udmamodes |= (1 << ((p->xfermode & 7) + 8)); + ata_ident->transport_major = 0x1020; + ata_ident->integrity = 0x00a5; + } else { uint64_t sectors; int sectsz, psectsz, psectoff, candelete, ro; uint16_t cyl; @@ -995,87 +1038,85 @@ handle_identify(struct ahci_port *p, int slot, uint8_t sectors = blockif_size(p->bctx) / sectsz; blockif_chs(p->bctx, &cyl, &heads, &sech); blockif_psectsz(p->bctx, &psectsz, &psectoff); - memset(buf, 0, sizeof(buf)); - buf[0] = 0x0040; - buf[1] = cyl; - buf[3] = heads; - buf[6] = sech; - ata_string((uint8_t *)(buf+10), p->ident, 20); - ata_string((uint8_t *)(buf+23), "001", 8); - ata_string((uint8_t *)(buf+27), "BHYVE SATA DISK", 40); - buf[47] = (0x8000 | 128); - buf[48] = 0; - buf[49] = (1 << 8 | 1 << 9 | 1 << 11); - buf[50] = (1 << 14); - buf[53] = (1 << 1 | 1 << 2); + ata_ident->config = ATA_DRQ_FAST; + ata_ident->cylinders = cyl; + ata_ident->heads = heads; + ata_ident->sectors = sech; + + ata_ident->sectors_intr = (0x8000 | 128); + ata_ident->tcg = 0; + + ata_ident->capabilities1 = ATA_SUPPORT_DMA | + ATA_SUPPORT_LBA | ATA_SUPPORT_IORDY; + ata_ident->capabilities2 = (1 << 14); + ata_ident->atavalid = ATA_FLAG_54_58 | + ATA_FLAG_64_70; if (p->mult_sectors) - buf[59] = (0x100 | p->mult_sectors); + ata_ident->multi = (ATA_MULTI_VALID | p->mult_sectors); if (sectors <= 0x0fffffff) { - buf[60] = sectors; - buf[61] = (sectors >> 16); + ata_ident->lba_size_1 = sectors; + ata_ident->lba_size_2 = (sectors >> 16); } else { - buf[60] = 0xffff; - buf[61] = 0x0fff; + ata_ident->lba_size_1 = 0xffff; + ata_ident->lba_size_2 = 0x0fff; } - buf[63] = 0x7; + ata_ident->mwdmamodes = 0x7; if (p->xfermode & ATA_WDMA0) - buf[63] |= (1 << ((p->xfermode & 7) + 8)); - buf[64] = 0x3; - buf[65] = 120; - buf[66] = 120; - buf[67] = 120; - buf[68] = 120; - buf[69] = 0; - buf[75] = 31; - buf[76] = (ATA_SATA_GEN1 | ATA_SATA_GEN2 | ATA_SATA_GEN3 | - ATA_SUPPORT_NCQ); - buf[77] = (ATA_SUPPORT_RCVSND_FPDMA_QUEUED | - (p->ssts & ATA_SS_SPD_MASK) >> 3); - buf[80] = 0x3f0; - buf[81] = 0x28; - buf[82] = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_WRITECACHE| - ATA_SUPPORT_LOOKAHEAD | ATA_SUPPORT_NOP); - buf[83] = (ATA_SUPPORT_ADDRESS48 | ATA_SUPPORT_FLUSHCACHE | - ATA_SUPPORT_FLUSHCACHE48 | 1 << 14); - buf[84] = (1 << 14); - buf[85] = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_WRITECACHE| - ATA_SUPPORT_LOOKAHEAD | ATA_SUPPORT_NOP); - buf[86] = (ATA_SUPPORT_ADDRESS48 | ATA_SUPPORT_FLUSHCACHE | - ATA_SUPPORT_FLUSHCACHE48 | 1 << 15); - buf[87] = (1 << 14); - buf[88] = 0x7f; + ata_ident->mwdmamodes |= (1 << ((p->xfermode & 7) + 8)); + ata_ident->apiomodes = 0x3; + ata_ident->mwdmamin = 0x0078; + ata_ident->mwdmarec = 0x0078; + ata_ident->pioblind = 0x0078; + ata_ident->pioiordy = 0x0078; + ata_ident->support3 = 0; + ata_ident->queue = 31; + ata_ident->satacapabilities = (ATA_SATA_GEN1 | ATA_SATA_GEN2 | ATA_SATA_GEN3 | + ATA_SUPPORT_NCQ); + ata_ident->satacapabilities2 = (ATA_SUPPORT_RCVSND_FPDMA_QUEUED | + (p->ssts & ATA_SS_SPD_MASK) >> 3); + ata_ident->version_major = 0x3f0; + ata_ident->version_minor = 0x28; + ata_ident->support.command1 = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_WRITECACHE | + ATA_SUPPORT_LOOKAHEAD | ATA_SUPPORT_NOP); + ata_ident->support.command2 = (ATA_SUPPORT_ADDRESS48 | ATA_SUPPORT_FLUSHCACHE | + ATA_SUPPORT_FLUSHCACHE48 | 1 << 14); + ata_ident->support.extension = (1 << 14); + ata_ident->enabled.command1 = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_WRITECACHE | + ATA_SUPPORT_LOOKAHEAD | ATA_SUPPORT_NOP); + ata_ident->enabled.command2 = (ATA_SUPPORT_ADDRESS48 | ATA_SUPPORT_FLUSHCACHE | + ATA_SUPPORT_FLUSHCACHE48 | 1 << 15); + ata_ident->enabled.extension = (1 << 14); + ata_ident->udmamodes = 0x7f; if (p->xfermode & ATA_UDMA0) - buf[88] |= (1 << ((p->xfermode & 7) + 8)); - buf[100] = sectors; - buf[101] = (sectors >> 16); - buf[102] = (sectors >> 32); - buf[103] = (sectors >> 48); + ata_ident->udmamodes |= (1 << ((p->xfermode & 7) + 8)); + ata_ident->lba_size48_1 = sectors; + ata_ident->lba_size48_2 = (sectors >> 16); + ata_ident->lba_size48_3 = (sectors >> 32); + ata_ident->lba_size48_4 = (sectors >> 48); + if (candelete && !ro) { - buf[69] |= ATA_SUPPORT_RZAT | ATA_SUPPORT_DRAT; - buf[105] = 1; - buf[169] = ATA_SUPPORT_DSM_TRIM; + ata_ident->support3 |= ATA_SUPPORT_RZAT | ATA_SUPPORT_DRAT; + ata_ident->max_dsm_blocks = 1; + ata_ident->support_dsm = ATA_SUPPORT_DSM_TRIM; } - buf[106] = 0x4000; - buf[209] = 0x4000; + ata_ident->pss = ATA_PSS_VALID_VALUE; + ata_ident->lsalign = 0x4000; if (psectsz > sectsz) { - buf[106] |= 0x2000; - buf[106] |= ffsl(psectsz / sectsz) - 1; - buf[209] |= (psectoff / sectsz); + ata_ident->pss |= ATA_PSS_MULTLS; + ata_ident->pss |= ffsl(psectsz / sectsz) - 1; + ata_ident->lsalign |= (psectoff / sectsz); } if (sectsz > 512) { - buf[106] |= 0x1000; - buf[117] = sectsz / 2; - buf[118] = ((sectsz / 2) >> 16); + ata_ident->pss |= ATA_PSS_LSSABOVE512; + ata_ident->lss_1 = sectsz / 2; + ata_ident->lss_2 = ((sectsz / 2) >> 16); } - buf[119] = (ATA_SUPPORT_RWLOGDMAEXT | 1 << 14); - buf[120] = (ATA_SUPPORT_RWLOGDMAEXT | 1 << 14); - buf[222] = 0x1020; - buf[255] = 0x00a5; - ahci_checksum((uint8_t *)buf, sizeof(buf)); - ahci_write_fis_piosetup(p); - write_prdt(p, slot, cfis, (void *)buf, sizeof(buf)); - ahci_write_fis_d2h(p, slot, cfis, ATA_S_DSC | ATA_S_READY); + ata_ident->support2 = (ATA_SUPPORT_RWLOGDMAEXT | 1 << 14); + ata_ident->enabled2 = (ATA_SUPPORT_RWLOGDMAEXT | 1 << 14); + ata_ident->transport_major = 0x1020; + ata_ident->integrity = 0x00a5; } + ahci_checksum((uint8_t*)ata_ident, sizeof(struct ata_params)); } static void @@ -1085,44 +1126,8 @@ handle_atapi_identify(struct ahci_port *p, int slot, u ahci_write_fis_d2h(p, slot, cfis, (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR); } else { - uint16_t buf[256]; - - memset(buf, 0, sizeof(buf)); - buf[0] = (2 << 14 | 5 << 8 | 1 << 7 | 2 << 5); - ata_string((uint8_t *)(buf+10), p->ident, 20); - ata_string((uint8_t *)(buf+23), "001", 8); - ata_string((uint8_t *)(buf+27), "BHYVE SATA DVD ROM", 40); - buf[49] = (1 << 9 | 1 << 8); - buf[50] = (1 << 14 | 1); - buf[53] = (1 << 2 | 1 << 1); - buf[62] = 0x3f; - buf[63] = 7; - if (p->xfermode & ATA_WDMA0) - buf[63] |= (1 << ((p->xfermode & 7) + 8)); - buf[64] = 3; - buf[65] = 120; - buf[66] = 120; - buf[67] = 120; - buf[68] = 120; - buf[76] = (ATA_SATA_GEN1 | ATA_SATA_GEN2 | ATA_SATA_GEN3); - buf[77] = ((p->ssts & ATA_SS_SPD_MASK) >> 3); - buf[78] = (1 << 5); - buf[80] = 0x3f0; - buf[82] = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_PACKET | - ATA_SUPPORT_RESET | ATA_SUPPORT_NOP); - buf[83] = (1 << 14); - buf[84] = (1 << 14); - buf[85] = (ATA_SUPPORT_POWERMGT | ATA_SUPPORT_PACKET | - ATA_SUPPORT_RESET | ATA_SUPPORT_NOP); - buf[87] = (1 << 14); - buf[88] = 0x7f; - if (p->xfermode & ATA_UDMA0) - buf[88] |= (1 << ((p->xfermode & 7) + 8)); - buf[222] = 0x1020; - buf[255] = 0x00a5; - ahci_checksum((uint8_t *)buf, sizeof(buf)); ahci_write_fis_piosetup(p); - write_prdt(p, slot, cfis, (void *)buf, sizeof(buf)); + write_prdt(p, slot, cfis, (void *)&p->ata_ident, sizeof(struct ata_params)); ahci_write_fis_d2h(p, slot, cfis, ATA_S_DSC | ATA_S_READY); } } @@ -2314,6 +2319,10 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *p MD5_CTX mdctx; u_char digest[16]; char *next, *next2; + char *bopt, *uopt, *xopts, *config; + FILE* fp; + size_t block_len; + int comma, optpos; ret = 0; @@ -2330,6 +2339,9 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *p slots = 32; for (p = 0; p < MAX_PORTS && opts != NULL; p++, opts = next) { + struct ata_params *ata_ident = &sc->port[p].ata_ident; + memset(ata_ident, 0, sizeof(struct ata_params)); + /* Identify and cut off type of present port. */ if (strncmp(opts, "hd:", 3) == 0) { atapi = 0; @@ -2352,13 +2364,82 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *p if (opts[0] == 0) continue; + uopt = strdup(opts); + bopt = NULL; + fp = open_memstream(&bopt, &block_len); + comma = 0; + optpos = 0; + + for (xopts = strtok(uopt, ","); + xopts != NULL; + xopts = strtok(NULL, ",")) { + + /* First option assume as block filename. */ + if (optpos == 0) { + /* + * Create an identifier for the backing file. + * Use parts of the md5 sum of the filename + */ + char ident[AHCI_PORT_IDENT]; + MD5Init(&mdctx); + MD5Update(&mdctx, opts, strlen(opts)); + MD5Final(digest, &mdctx); + snprintf(ident, AHCI_PORT_IDENT, + "BHYVE-%02X%02X-%02X%02X-%02X%02X", + digest[0], digest[1], digest[2], digest[3], digest[4], + digest[5]); + ata_string((uint8_t*)&ata_ident->serial, ident, 20); + ata_string((uint8_t*)&ata_ident->revision, "001", 8); + if (atapi) { + ata_string((uint8_t*)&ata_ident->model, "BHYVE SATA DVD ROM", 40); + } + else { + ata_string((uint8_t*)&ata_ident->model, "BHYVE SATA DISK", 40); + } + } + + if ((config = strchr(xopts, '=')) != NULL) { + *config++ = '\0'; + if (!strcmp("nmrr", xopts)) { + ata_ident->media_rotation_rate = atoi(config); + } + else if (!strcmp("ser", xopts)) { + ata_string((uint8_t*)(&ata_ident->serial), config, 20); + } + else if (!strcmp("rev", xopts)) { + ata_string((uint8_t*)(&ata_ident->revision), config, 8); + } + else if (!strcmp("model", xopts)) { + ata_string((uint8_t*)(&ata_ident->model), config, 40); + } + else { + /* Pass all other options to blockif_open. */ + *--config = '='; + fprintf(fp, "%s%s", comma ? "," : "", xopts); + comma = 1; + } + } + else { + /* Pass all other options to blockif_open. */ + fprintf(fp, "%s%s", comma ? "," : "", xopts); + comma = 1; + } + optpos++; + } + free(uopt); + fclose(fp); + + DPRINTF("%s\n", bopt); + /* * Attempt to open the backing image. Use the PCI slot/func * and the port number for the identifier string. */ snprintf(bident, sizeof(bident), "%d:%d:%d", pi->pi_slot, pi->pi_func, p); - bctxt = blockif_open(opts, bident); + bctxt = blockif_open(bopt, bident); + free(bopt); + if (bctxt == NULL) { sc->ports = p; ret = 1; @@ -2369,17 +2450,7 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *p sc->port[p].port = p; sc->port[p].atapi = atapi; - /* - * Create an identifier for the backing file. - * Use parts of the md5 sum of the filename - */ - MD5Init(&mdctx); - MD5Update(&mdctx, opts, strlen(opts)); - MD5Final(digest, &mdctx); - snprintf(sc->port[p].ident, AHCI_PORT_IDENT, - "BHYVE-%02X%02X-%02X%02X-%02X%02X", - digest[0], digest[1], digest[2], digest[3], digest[4], - digest[5]); + ata_identify_init(&sc->port[p], atapi); /* * Allocate blockif request structures and add them From owner-svn-src-stable-12@freebsd.org Tue Aug 18 06:55:13 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 544CA3B0E7F; Tue, 18 Aug 2020 06:55:13 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BW1rK1Z5tz4psr; Tue, 18 Aug 2020 06:55:13 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 19351DA54; Tue, 18 Aug 2020 06:55:13 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07I6tCqr028027; Tue, 18 Aug 2020 06:55:12 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07I6tC24028026; Tue, 18 Aug 2020 06:55:12 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008180655.07I6tC24028026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Tue, 18 Aug 2020 06:55:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364338 - stable/12/usr.bin/tput X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: stable/12/usr.bin/tput X-SVN-Commit-Revision: 364338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 06:55:13 -0000 Author: gbe (doc committer) Date: Tue Aug 18 06:55:12 2020 New Revision: 364338 URL: https://svnweb.freebsd.org/changeset/base/364338 Log: MFC r364131: tput(1): Several enhancements for the manual page - a couple of descriptions are incomplete - synopsis doesn't show that all arguments are optional - missing an ENVIRONMENT section with TERM mentioned PR: 84670 Submitted by: Gary W. Swearingen Reviewed by: bcr Approved by: bcr Differential Revision: https://reviews.freebsd.org/D26009 Modified: stable/12/usr.bin/tput/tput.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/tput/tput.1 ============================================================================== --- stable/12/usr.bin/tput/tput.1 Tue Aug 18 06:34:56 2020 (r364337) +++ stable/12/usr.bin/tput/tput.1 Tue Aug 18 06:55:12 2020 (r364338) @@ -38,22 +38,24 @@ .Sh SYNOPSIS .Nm .Op Fl T Ar term -.Ar attribute ... +.Op Ar attribute ... .Nm clear .Sh DESCRIPTION The .Nm utility makes terminal-dependent information available to users or shell applications. -When invoked as the +.Pp +The .Nm clear -utility, the screen will be cleared as if +utility executes the .Dl tput clear -had been executed. -The options to +command, ignoring any arguments. +.Pp +The only option to .Nm -are as follows: -.Bl -tag -width Ds +is: +.Bl -tag -width 2n .It Fl T The terminal name as specified in the .Xr termcap 5 @@ -65,7 +67,9 @@ If not specified, .Nm retrieves the .Dq Ev TERM -variable from the environment. +variable from the environment unless that too is not specified, +in which case an error message will be sent to standard error and +the error status will be 2. .El .Pp The @@ -83,45 +87,66 @@ If an is of type string, and takes arguments (e.g.\& cursor movement, the termcap .Dq cm -sequence) the arguments are taken from the command line immediately +capability) the arguments are taken from the command line immediately following the attribute. .Pp -The following special attributes are available: +The following special attributes are available. +The first three use the capabilities of the specified terminal, +and only work if compatible with the utility's terminal. .Bl -tag -width Ar .It Cm clear Clear the screen (the .Xr termcap 5 .Dq cl -sequence). +capability). .It Cm init Initialize the terminal (the .Xr termcap 5 .Dq is -sequence). -.It Cm longname -Print the descriptive name of the user's terminal type. +capability). .It Cm reset Reset the terminal (the .Xr termcap 5 .Dq rs -sequence). +capability). +.It Cm longname +Print the descriptive name of the user's terminal type. .El +.Sh ENVIRONMENT +.Bl -tag -width ".Ev TERM" +.It Ev TERM +The terminal name, if set and +.Fl T +is not used. +.El .Sh EXIT STATUS The exit status of .Nm is as follows: .Bl -tag -width indent .It 0 -If the last attribute +If the last .Ar attribute -argument is of type string or integer, its value was successfully written +is of type string or integer, its value was successfully written to standard output. -If the argument is of type boolean, the terminal has this attribute. +If the +.Ar attribute +is of type boolean, the terminal does have the +.Ar attribute . +Otherwise, no +.Ar attribute +was specified. .It 1 -This terminal does not have the specified boolean +If the last +.Ar attribute +is of type boolean, +this terminal does not have the .Ar attribute . .It 2 Usage error. +For example, see +.Fl T +description. .It 3 No information is available about the specified terminal type. .El From owner-svn-src-stable-12@freebsd.org Tue Aug 18 20:41:05 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DE833C6951; Tue, 18 Aug 2020 20:41:05 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWN9D6f55z4crj; Tue, 18 Aug 2020 20:41:04 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C817A178AD; Tue, 18 Aug 2020 20:41:04 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07IKf4uX033501; Tue, 18 Aug 2020 20:41:04 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07IKf3hs033495; Tue, 18 Aug 2020 20:41:03 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008182041.07IKf3hs033495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 18 Aug 2020 20:41:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364357 - stable/12/libexec/rc/rc.d X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/12/libexec/rc/rc.d X-SVN-Commit-Revision: 364357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 20:41:05 -0000 Author: cy Date: Tue Aug 18 20:41:03 2020 New Revision: 364357 URL: https://svnweb.freebsd.org/changeset/base/364357 Log: MFC r364133: When booting a system with WITHOUT_IPFILTER the following errors are encountered at boot time: rcorder: requirement `ipfs' in file `/etc/rc.d/netif' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/netif' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/netwait' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/net_watchdog' has no providers. rcorder: requirement `ipfilter' in file `/etc/rc.d/securelevel' has no providers. Listing its own requrements in BEFORE rather than use REQUIRE of non-optional scripts resolves this issue. The issue was discovered and patched by glebius at Netflix. Submitted by: glebius Reported by: glebius Modified: stable/12/libexec/rc/rc.d/ipfilter stable/12/libexec/rc/rc.d/ipmon stable/12/libexec/rc/rc.d/ipnat stable/12/libexec/rc/rc.d/netif stable/12/libexec/rc/rc.d/netwait stable/12/libexec/rc/rc.d/securelevel Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.d/ipfilter ============================================================================== --- stable/12/libexec/rc/rc.d/ipfilter Tue Aug 18 20:20:45 2020 (r364356) +++ stable/12/libexec/rc/rc.d/ipfilter Tue Aug 18 20:41:03 2020 (r364357) @@ -5,6 +5,7 @@ # PROVIDE: ipfilter # REQUIRE: FILESYSTEMS +# BEFORE: ipmon ipnat netif netwait securelevel # KEYWORD: nojailvnet . /etc/rc.subr Modified: stable/12/libexec/rc/rc.d/ipmon ============================================================================== --- stable/12/libexec/rc/rc.d/ipmon Tue Aug 18 20:20:45 2020 (r364356) +++ stable/12/libexec/rc/rc.d/ipmon Tue Aug 18 20:41:03 2020 (r364357) @@ -4,7 +4,7 @@ # # PROVIDE: ipmon -# REQUIRE: FILESYSTEMS hostname sysctl ipfilter +# REQUIRE: FILESYSTEMS hostname sysctl # BEFORE: SERVERS # KEYWORD: nojailvnet Modified: stable/12/libexec/rc/rc.d/ipnat ============================================================================== --- stable/12/libexec/rc/rc.d/ipnat Tue Aug 18 20:20:45 2020 (r364356) +++ stable/12/libexec/rc/rc.d/ipnat Tue Aug 18 20:41:03 2020 (r364357) @@ -4,7 +4,6 @@ # # PROVIDE: ipnat -# REQUIRE: ipfilter # KEYWORD: nojailvnet . /etc/rc.subr Modified: stable/12/libexec/rc/rc.d/netif ============================================================================== --- stable/12/libexec/rc/rc.d/netif Tue Aug 18 20:20:45 2020 (r364356) +++ stable/12/libexec/rc/rc.d/netif Tue Aug 18 20:41:03 2020 (r364357) @@ -27,7 +27,7 @@ # PROVIDE: netif # REQUIRE: FILESYSTEMS iovctl serial sppp sysctl -# REQUIRE: hostid ipfilter ipfs +# REQUIRE: hostid ipfs # KEYWORD: nojailvnet . /etc/rc.subr Modified: stable/12/libexec/rc/rc.d/netwait ============================================================================== --- stable/12/libexec/rc/rc.d/netwait Tue Aug 18 20:20:45 2020 (r364356) +++ stable/12/libexec/rc/rc.d/netwait Tue Aug 18 20:41:03 2020 (r364357) @@ -3,7 +3,7 @@ # $FreeBSD$ # # PROVIDE: netwait -# REQUIRE: devd ipfilter ipfw pf routing +# REQUIRE: devd ipfw pf routing # KEYWORD: nojail # # The netwait script helps handle two situations: Modified: stable/12/libexec/rc/rc.d/securelevel ============================================================================== --- stable/12/libexec/rc/rc.d/securelevel Tue Aug 18 20:20:45 2020 (r364356) +++ stable/12/libexec/rc/rc.d/securelevel Tue Aug 18 20:41:03 2020 (r364357) @@ -4,7 +4,7 @@ # # PROVIDE: securelevel -# REQUIRE: adjkerntz ipfw ipfilter pf +# REQUIRE: adjkerntz ipfw pf . /etc/rc.subr From owner-svn-src-stable-12@freebsd.org Wed Aug 19 10:32:27 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 036A23BA21C; Wed, 19 Aug 2020 10:32:27 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWkcV6GPMz4Yff; Wed, 19 Aug 2020 10:32:26 +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 BB23D218DA; Wed, 19 Aug 2020 10:32:26 +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 07JAWQQW051391; Wed, 19 Aug 2020 10:32:26 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JAWQla051390; Wed, 19 Aug 2020 10:32:26 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202008191032.07JAWQla051390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Wed, 19 Aug 2020 10:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364376 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 364376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 10:32:27 -0000 Author: rscheff Date: Wed Aug 19 10:32:26 2020 New Revision: 364376 URL: https://svnweb.freebsd.org/changeset/base/364376 Log: MFC r362988: Fix KASSERT during tcp_newtcpcb when low on memory While testing with system default cc set to cubic, and running a memory exhaustion validation, FreeBSD panics for a missing inpcb reference / lock. Reviewed by: rgrimes (mentor), tuexen (mentor) Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D25583 Modified: stable/12/sys/netinet/tcp_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_subr.c ============================================================================== --- stable/12/sys/netinet/tcp_subr.c Wed Aug 19 10:01:05 2020 (r364375) +++ stable/12/sys/netinet/tcp_subr.c Wed Aug 19 10:32:26 2020 (r364376) @@ -1615,6 +1615,12 @@ tcp_newtcpcb(struct inpcb *inp) KASSERT(!STAILQ_EMPTY(&cc_list), ("cc_list is empty!")); CC_ALGO(tp) = CC_DEFAULT(); CC_LIST_RUNLOCK(); + /* + * The tcpcb will hold a reference on its inpcb until tcp_discardcb() + * is called. + */ + in_pcbref(inp); /* Reference for tcpcb */ + tp->t_inpcb = inp; if (CC_ALGO(tp)->cb_init != NULL) if (CC_ALGO(tp)->cb_init(tp->ccv) > 0) { @@ -1659,12 +1665,6 @@ tcp_newtcpcb(struct inpcb *inp) if (V_tcp_do_sack) tp->t_flags |= TF_SACK_PERMIT; TAILQ_INIT(&tp->snd_holes); - /* - * The tcpcb will hold a reference on its inpcb until tcp_discardcb() - * is called. - */ - in_pcbref(inp); /* Reference for tcpcb */ - tp->t_inpcb = inp; /* * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no From owner-svn-src-stable-12@freebsd.org Wed Aug 19 10:36:18 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC5E63B9FE1; Wed, 19 Aug 2020 10:36:18 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWkhy4V52z4YgJ; Wed, 19 Aug 2020 10:36:18 +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 79C77214D8; Wed, 19 Aug 2020 10:36:18 +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 07JAaIBa051668; Wed, 19 Aug 2020 10:36:18 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JAaGpK051661; Wed, 19 Aug 2020 10:36:16 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202008191036.07JAaGpK051661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Wed, 19 Aug 2020 10:36:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364377 - stable/12/sys/netinet/cc X-SVN-Group: stable-12 X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: stable/12/sys/netinet/cc X-SVN-Commit-Revision: 364377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 10:36:18 -0000 Author: rscheff Date: Wed Aug 19 10:36:16 2020 New Revision: 364377 URL: https://svnweb.freebsd.org/changeset/base/364377 Log: MFC r363380: Add MODULE_VERSION to TCP loadable congestion control modules. Without versioning information, using preexisting loader / linker code is not easily possible when another module may have dependencies on pre-loaded modules, and also doesn't allow the automatic loading of dependent modules. No functional change of the actual modules. Reviewed by: tuexen (mentor), rgrimes (mentor) Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D25744 Modified: stable/12/sys/netinet/cc/cc_cdg.c stable/12/sys/netinet/cc/cc_chd.c stable/12/sys/netinet/cc/cc_cubic.c stable/12/sys/netinet/cc/cc_dctcp.c stable/12/sys/netinet/cc/cc_hd.c stable/12/sys/netinet/cc/cc_htcp.c stable/12/sys/netinet/cc/cc_newreno.c stable/12/sys/netinet/cc/cc_vegas.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/cc/cc_cdg.c ============================================================================== --- stable/12/sys/netinet/cc/cc_cdg.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_cdg.c Wed Aug 19 10:36:16 2020 (r364377) @@ -714,5 +714,5 @@ SYSCTL_UINT(_net_inet_tcp_cc_cdg, OID_AUTO, loss_compe "the window backoff for loss based CC compatibility"); DECLARE_CC_MODULE(cdg, &cdg_cc_algo); - +MODULE_VERSION(cdg, 1); MODULE_DEPEND(cdg, ertt, 1, 1, 1); Modified: stable/12/sys/netinet/cc/cc_chd.c ============================================================================== --- stable/12/sys/netinet/cc/cc_chd.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_chd.c Wed Aug 19 10:36:16 2020 (r364377) @@ -493,4 +493,5 @@ SYSCTL_UINT(_net_inet_tcp_cc_chd, OID_AUTO, use_max, "as the basic delay measurement for the algorithm."); DECLARE_CC_MODULE(chd, &chd_cc_algo); +MODULE_VERSION(chd, 1); MODULE_DEPEND(chd, ertt, 1, 1, 1); Modified: stable/12/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/12/sys/netinet/cc/cc_cubic.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_cubic.c Wed Aug 19 10:36:16 2020 (r364377) @@ -473,3 +473,4 @@ cubic_ssthresh_update(struct cc_var *ccv) DECLARE_CC_MODULE(cubic, &cubic_cc_algo); +MODULE_VERSION(cubic, 1); Modified: stable/12/sys/netinet/cc/cc_dctcp.c ============================================================================== --- stable/12/sys/netinet/cc/cc_dctcp.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_dctcp.c Wed Aug 19 10:36:16 2020 (r364377) @@ -467,3 +467,4 @@ SYSCTL_PROC(_net_inet_tcp_cc_dctcp, OID_AUTO, slowstar "IU", "half CWND reduction after the first slow start"); DECLARE_CC_MODULE(dctcp, &dctcp_cc_algo); +MODULE_VERSION(dctcp, 1); Modified: stable/12/sys/netinet/cc/cc_hd.c ============================================================================== --- stable/12/sys/netinet/cc/cc_hd.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_hd.c Wed Aug 19 10:36:16 2020 (r364377) @@ -249,4 +249,5 @@ SYSCTL_PROC(_net_inet_tcp_cc_hd, OID_AUTO, queue_min, &hd_qmin_handler, "IU", "minimum queueing delay threshold (qmin) in ticks"); DECLARE_CC_MODULE(hd, &hd_cc_algo); +MODULE_VERSION(hd, 1); MODULE_DEPEND(hd, ertt, 1, 1, 1); Modified: stable/12/sys/netinet/cc/cc_htcp.c ============================================================================== --- stable/12/sys/netinet/cc/cc_htcp.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_htcp.c Wed Aug 19 10:36:16 2020 (r364377) @@ -530,3 +530,4 @@ SYSCTL_UINT(_net_inet_tcp_cc_htcp, OID_AUTO, rtt_scali "enable H-TCP RTT scaling"); DECLARE_CC_MODULE(htcp, &htcp_cc_algo); +MODULE_VERSION(htcp, 1); Modified: stable/12/sys/netinet/cc/cc_newreno.c ============================================================================== --- stable/12/sys/netinet/cc/cc_newreno.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_newreno.c Wed Aug 19 10:36:16 2020 (r364377) @@ -399,3 +399,4 @@ SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_e "New Reno beta ecn, specified as number between 1 and 100"); DECLARE_CC_MODULE(newreno, &newreno_cc_algo); +MODULE_VERSION(newreno, 1); Modified: stable/12/sys/netinet/cc/cc_vegas.c ============================================================================== --- stable/12/sys/netinet/cc/cc_vegas.c Wed Aug 19 10:32:26 2020 (r364376) +++ stable/12/sys/netinet/cc/cc_vegas.c Wed Aug 19 10:36:16 2020 (r364377) @@ -300,4 +300,5 @@ SYSCTL_PROC(_net_inet_tcp_cc_vegas, OID_AUTO, beta, "vegas beta, specified as number of \"buffers\" (0 < alpha < beta)"); DECLARE_CC_MODULE(vegas, &vegas_cc_algo); +MODULE_VERSION(vegas, 1); MODULE_DEPEND(vegas, ertt, 1, 1, 1); From owner-svn-src-stable-12@freebsd.org Wed Aug 19 10:40:03 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39CD33BA4A4; Wed, 19 Aug 2020 10:40:03 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWknH0pwyz4Z6J; Wed, 19 Aug 2020 10:40:03 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F400C21456; Wed, 19 Aug 2020 10:40:02 +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 07JAe2Nq052225; Wed, 19 Aug 2020 10:40:02 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JAe2x1052224; Wed, 19 Aug 2020 10:40:02 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202008191040.07JAe2x1052224@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Wed, 19 Aug 2020 10:40:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364378 - stable/12/sys/netinet/cc X-SVN-Group: stable-12 X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: stable/12/sys/netinet/cc X-SVN-Commit-Revision: 364378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 10:40:03 -0000 Author: rscheff Date: Wed Aug 19 10:40:02 2020 New Revision: 364378 URL: https://svnweb.freebsd.org/changeset/base/364378 Log: MFC r363397: Fix style and comment around concave/convex regions in TCP cubic. In cubic, the concave region is when snd_cwnd starts growing slower towards max_cwnd (cwnd at the time of the congestion event), and the convex region is when snd_cwnd starts to grow faster and eventually appearing like slow-start like growth. PR: 238478 Reviewed by: tuexen (mentor), rgrimes (mentor) Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D24657 Modified: stable/12/sys/netinet/cc/cc_cubic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/cc/cc_cubic.c ============================================================================== --- stable/12/sys/netinet/cc/cc_cubic.c Wed Aug 19 10:36:16 2020 (r364377) +++ stable/12/sys/netinet/cc/cc_cubic.c Wed Aug 19 10:40:02 2020 (r364378) @@ -185,12 +185,11 @@ cubic_ack_received(struct cc_var *ccv, uint16_t type) */ if (CCV(ccv, snd_cwnd) < w_tf) CCV(ccv, snd_cwnd) = ulmin(w_tf, INT_MAX); - } - - else if (CCV(ccv, snd_cwnd) < w_cubic_next) { + } else if (CCV(ccv, snd_cwnd) < w_cubic_next) { /* * Concave or convex region, follow CUBIC * cwnd growth. + * Only update snd_cwnd, if it doesn't shrink. */ if (V_tcp_do_rfc3465) CCV(ccv, snd_cwnd) = ulmin(w_cubic_next, From owner-svn-src-stable-12@freebsd.org Wed Aug 19 12:16:12 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D469F3BCBA3; Wed, 19 Aug 2020 12:16:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWmwD5Drjz3SVj; Wed, 19 Aug 2020 12:16:12 +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 925F022943; Wed, 19 Aug 2020 12:16:12 +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 07JCGCA1015256; Wed, 19 Aug 2020 12:16:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JCGCVe015255; Wed, 19 Aug 2020 12:16:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008191216.07JCGCVe015255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Aug 2020 12:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364380 - in stable/12/sys/dev: rtwn/usb usb X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev: rtwn/usb usb X-SVN-Commit-Revision: 364380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 12:16:12 -0000 Author: hselasky Date: Wed Aug 19 12:16:11 2020 New Revision: 364380 URL: https://svnweb.freebsd.org/changeset/base/364380 Log: MFC r363950: Add new USB ID. Submitted by: Dmitry Luhtionov Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h ============================================================================== --- stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h Wed Aug 19 11:50:12 2020 (r364379) +++ stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h Wed Aug 19 12:16:11 2020 (r364380) @@ -123,6 +123,7 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { RTWN_RTL8188EU_DEV(TPLINK, WN727NV5), RTWN_RTL8188EU_DEV(REALTEK, RTL8188ETV), RTWN_RTL8188EU_DEV(REALTEK, RTL8188EU), + RTWN_RTL8188EU_DEV(MERCUSYS, MW150US), #undef RTWN_RTL8188EU_DEV /* RTL8812AU */ Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Wed Aug 19 11:50:12 2020 (r364379) +++ stable/12/sys/dev/usb/usbdevs Wed Aug 19 12:16:11 2020 (r364380) @@ -783,6 +783,7 @@ vendor NHJ 0x2770 NHJ vendor THINGM 0x27b8 ThingM vendor PERASO 0x2932 Peraso Technologies, Inc. vendor PLANEX 0x2c02 Planex Communications +vendor MERCUSYS 0x2c4e Mercusys, Inc. vendor QUECTEL 0x2c7c Quectel Wireless Solutions vendor VIDZMEDIA 0x3275 VidzMedia Pte Ltd vendor LINKINSTRUMENTS 0x3195 Link Instruments Inc. @@ -3191,6 +3192,9 @@ product MELCO WLIUCGNM2 0x01ee WLI-UC-GNM2 product MELCO WIU2433DM 0x0242 WI-U2-433DM product MELCO WIU3866D 0x025d WI-U3-866D product MELCO WIU2433DHP 0x029b WI-U2-433DHP + +/* Mercusys, Inc. */ +product MERCUSYS MW150US 0x0102 Mercusys MW150US /* Merlin products */ product MERLIN V620 0x1110 Merlin V620 From owner-svn-src-stable-12@freebsd.org Wed Aug 19 12:23:05 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E06B83BD132; Wed, 19 Aug 2020 12:23:05 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWn495XtQz3Sxc; Wed, 19 Aug 2020 12:23:05 +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 A211F228BE; Wed, 19 Aug 2020 12:23:05 +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 07JCN5g8021223; Wed, 19 Aug 2020 12:23:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JCN56g021222; Wed, 19 Aug 2020 12:23:05 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008191223.07JCN56g021222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Aug 2020 12:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364381 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 364381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 12:23:05 -0000 Author: hselasky Date: Wed Aug 19 12:23:05 2020 New Revision: 364381 URL: https://svnweb.freebsd.org/changeset/base/364381 Log: MFC r364019: Add full support support for dynamic allocation and freeing of epoch's. Make sure to reclaim epoch structures when they are freed to support dynamic allocation and freeing of epoch structures. While at it, move the 64 supported epoch control structures to the static memory domain. This overall simplifies the management and debugging of system epoch's. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D25960 Sponsored by: Mellanox Technologies Modified: stable/12/sys/kern/subr_epoch.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_epoch.c ============================================================================== --- stable/12/sys/kern/subr_epoch.c Wed Aug 19 12:16:11 2020 (r364380) +++ stable/12/sys/kern/subr_epoch.c Wed Aug 19 12:23:05 2020 (r364381) @@ -54,8 +54,6 @@ __FBSDID("$FreeBSD$"); #include -static MALLOC_DEFINE(M_EPOCH, "epoch", "epoch based reclamation"); - #ifdef __amd64__ #define EPOCH_ALIGN CACHE_LINE_SIZE*2 #else @@ -76,7 +74,7 @@ typedef struct epoch_record { struct epoch { struct ck_epoch e_epoch __aligned(EPOCH_ALIGN); epoch_record_t e_pcpu_record; - int e_idx; + int e_in_use; int e_flags; /* fields above are part of KBI and cannot be modified */ struct sx e_drain_sx; @@ -123,19 +121,23 @@ TAILQ_HEAD (threadlist, thread); CK_STACK_CONTAINER(struct ck_epoch_entry, stack_entry, ck_epoch_entry_container) -epoch_t allepochs[MAX_EPOCHS]; +static struct epoch epoch_array[MAX_EPOCHS]; DPCPU_DEFINE(struct grouptask, epoch_cb_task); DPCPU_DEFINE(int, epoch_cb_count); static __read_mostly int inited; -static __read_mostly int epoch_count; __read_mostly epoch_t global_epoch; __read_mostly epoch_t global_epoch_preempt; static void epoch_call_task(void *context __unused); static uma_zone_t pcpu_zone_record; +static struct sx epoch_sx; + +#define EPOCH_LOCK() sx_xlock(&epoch_sx) +#define EPOCH_UNLOCK() sx_xunlock(&epoch_sx) + static void epoch_init(void *arg __unused) { @@ -158,6 +160,7 @@ epoch_init(void *arg __unused) DPCPU_ID_PTR(cpu, epoch_cb_task), NULL, cpu, -1, "epoch call task"); } + sx_init(&epoch_sx, "epoch-sx"); inited = 1; global_epoch = epoch_alloc(0); global_epoch_preempt = epoch_alloc(EPOCH_PREEMPT); @@ -203,18 +206,47 @@ epoch_t epoch_alloc(int flags) { epoch_t epoch; + int i; + MPASS(name != NULL); + if (__predict_false(!inited)) panic("%s called too early in boot", __func__); - epoch = malloc(sizeof(struct epoch), M_EPOCH, M_ZERO | M_WAITOK); + + EPOCH_LOCK(); + + /* + * Find a free index in the epoch array. If no free index is + * found, try to use the index after the last one. + */ + for (i = 0;; i++) { + /* + * If too many epochs are currently allocated, + * return NULL. + */ + if (i == MAX_EPOCHS) { + epoch = NULL; + goto done; + } + if (epoch_array[i].e_in_use == 0) + break; + } + + epoch = epoch_array + i; ck_epoch_init(&epoch->e_epoch); epoch_ctor(epoch); - MPASS(epoch_count < MAX_EPOCHS - 2); epoch->e_flags = flags; - epoch->e_idx = epoch_count; sx_init(&epoch->e_drain_sx, "epoch-drain-sx"); mtx_init(&epoch->e_drain_mtx, "epoch-drain-mtx", NULL, MTX_DEF); - allepochs[epoch_count++] = epoch; + + /* + * Set e_in_use last, because when this field is set the + * epoch_call_task() function will start scanning this epoch + * structure. + */ + atomic_store_rel_int(&epoch->e_in_use, 1); +done: + EPOCH_UNLOCK(); return (epoch); } @@ -222,13 +254,24 @@ void epoch_free(epoch_t epoch) { + EPOCH_LOCK(); + + MPASS(epoch->e_in_use != 0); + epoch_drain_callbacks(epoch); - allepochs[epoch->e_idx] = NULL; + + atomic_store_rel_int(&epoch->e_in_use, 0); + /* + * Make sure the epoch_call_task() function see e_in_use equal + * to zero, by calling epoch_wait() on the global_epoch: + */ epoch_wait(global_epoch); uma_zfree_pcpu(pcpu_zone_record, epoch->e_pcpu_record); mtx_destroy(&epoch->e_drain_mtx); sx_destroy(&epoch->e_drain_sx); - free(epoch, M_EPOCH); + memset(epoch, 0, sizeof(*epoch)); + + EPOCH_UNLOCK(); } static epoch_record_t @@ -592,8 +635,10 @@ epoch_call_task(void *arg __unused) ck_stack_init(&cb_stack); critical_enter(); epoch_enter(global_epoch); - for (total = i = 0; i < epoch_count; i++) { - if (__predict_false((epoch = allepochs[i]) == NULL)) + for (total = i = 0; i != MAX_EPOCHS; i++) { + epoch = epoch_array + i; + if (__predict_false( + atomic_load_acq_int(&epoch->e_in_use) == 0)) continue; er = epoch_currecord(epoch); record = &er->er_record; From owner-svn-src-stable-12@freebsd.org Wed Aug 19 12:25:35 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FD283BCF6E; Wed, 19 Aug 2020 12:25:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWn731v2zz3Syf; Wed, 19 Aug 2020 12:25:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1FEE922D51; Wed, 19 Aug 2020 12:25:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07JCPYSP021418; Wed, 19 Aug 2020 12:25:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JCPYR6021416; Wed, 19 Aug 2020 12:25:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008191225.07JCPYR6021416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Aug 2020 12:25:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364382 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 364382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 12:25:35 -0000 Author: hselasky Date: Wed Aug 19 12:25:34 2020 New Revision: 364382 URL: https://svnweb.freebsd.org/changeset/base/364382 Log: MFC r364028: Implement radix_tree_store() in the LinuxKPI for use with the coming extensible arrays implementation. While at it add some more comments explaining the current radix_tree_insert() function and make sure to clean the root node when the radix tree reaches the maximum height. This can happen if the index passed is too big when the tree is empty. The radix_tree_store() function is basically a copy of the radix_tree_insert() function with some added functionality. The radix_tree_store() function is local to FreeBSD and does not yet exist in Linux. Reviewed by: kib Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/radix-tree.h stable/12/sys/compat/linuxkpi/common/src/linux_radix.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/radix-tree.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/radix-tree.h Wed Aug 19 12:23:05 2020 (r364381) +++ stable/12/sys/compat/linuxkpi/common/include/linux/radix-tree.h Wed Aug 19 12:25:34 2020 (r364382) @@ -78,6 +78,7 @@ radix_tree_exception(void *arg) void *radix_tree_lookup(struct radix_tree_root *, unsigned long); void *radix_tree_delete(struct radix_tree_root *, unsigned long); int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); +int radix_tree_store(struct radix_tree_root *, unsigned long, void **); bool radix_tree_iter_find(struct radix_tree_root *, struct radix_tree_iter *, void ***); void radix_tree_iter_delete(struct radix_tree_root *, struct radix_tree_iter *, void **); Modified: stable/12/sys/compat/linuxkpi/common/src/linux_radix.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_radix.c Wed Aug 19 12:23:05 2020 (r364381) +++ stable/12/sys/compat/linuxkpi/common/src/linux_radix.c Wed Aug 19 12:25:34 2020 (r364382) @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2018 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2020 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,17 @@ radix_pos(long id, int height) return (id >> (RADIX_TREE_MAP_SHIFT * height)) & RADIX_TREE_MAP_MASK; } +static void +radix_tree_clean_root_node(struct radix_tree_root *root) +{ + /* Check if the root node should be freed */ + if (root->rnode->count == 0) { + free(root->rnode, M_RADIX); + root->rnode = NULL; + root->height = 0; + } +} + void * radix_tree_lookup(struct radix_tree_root *root, unsigned long index) { @@ -197,8 +208,10 @@ radix_tree_insert(struct radix_tree_root *root, unsign while (radix_max(root) < index) { /* check if the radix tree is getting too big */ - if (root->height == RADIX_TREE_MAX_HEIGHT) + if (root->height == RADIX_TREE_MAX_HEIGHT) { + radix_tree_clean_root_node(root); return (-E2BIG); + } /* * If the root radix level is not empty, we need to @@ -206,8 +219,16 @@ radix_tree_insert(struct radix_tree_root *root, unsign */ if (node->count != 0) { node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); - if (node == NULL) + if (node == NULL) { + /* + * Freeing the already allocated radix + * levels, if any, will be handled by + * the radix_tree_delete() function. + * This code path can only happen when + * the tree is not empty. + */ return (-ENOMEM); + } node->slots[0] = root->rnode; node->count++; root->rnode = node; @@ -231,14 +252,9 @@ radix_tree_insert(struct radix_tree_root *root, unsign temp[idx] = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); if (temp[idx] == NULL) { - while(idx--) + while (idx--) free(temp[idx], M_RADIX); - /* Check if we should free the root node as well. */ - if (root->rnode->count == 0) { - free(root->rnode, M_RADIX); - root->rnode = NULL; - root->height = 0; - } + radix_tree_clean_root_node(root); return (-ENOMEM); } } @@ -260,5 +276,112 @@ radix_tree_insert(struct radix_tree_root *root, unsign node->slots[idx] = item; node->count++; + return (0); +} + +int +radix_tree_store(struct radix_tree_root *root, unsigned long index, void **ppitem) +{ + struct radix_tree_node *node; + struct radix_tree_node *temp[RADIX_TREE_MAX_HEIGHT - 1]; + void *pitem; + int height; + int idx; + + /* + * Inserting a NULL item means delete it. The old pointer is + * stored at the location pointed to by "ppitem". + */ + if (*ppitem == NULL) { + *ppitem = radix_tree_delete(root, index); + return (0); + } + + /* get root node, if any */ + node = root->rnode; + + /* allocate root node, if any */ + if (node == NULL) { + node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); + if (node == NULL) + return (-ENOMEM); + root->rnode = node; + root->height++; + } + + /* expand radix tree as needed */ + while (radix_max(root) < index) { + + /* check if the radix tree is getting too big */ + if (root->height == RADIX_TREE_MAX_HEIGHT) { + radix_tree_clean_root_node(root); + return (-E2BIG); + } + + /* + * If the root radix level is not empty, we need to + * allocate a new radix level: + */ + if (node->count != 0) { + node = malloc(sizeof(*node), M_RADIX, root->gfp_mask | M_ZERO); + if (node == NULL) { + /* + * Freeing the already allocated radix + * levels, if any, will be handled by + * the radix_tree_delete() function. + * This code path can only happen when + * the tree is not empty. + */ + return (-ENOMEM); + } + node->slots[0] = root->rnode; + node->count++; + root->rnode = node; + } + root->height++; + } + + /* get radix tree height index */ + height = root->height - 1; + + /* walk down the tree until the first missing node, if any */ + for ( ; height != 0; height--) { + idx = radix_pos(index, height); + if (node->slots[idx] == NULL) + break; + node = node->slots[idx]; + } + + /* allocate the missing radix levels, if any */ + for (idx = 0; idx != height; idx++) { + temp[idx] = malloc(sizeof(*node), M_RADIX, + root->gfp_mask | M_ZERO); + if (temp[idx] == NULL) { + while (idx--) + free(temp[idx], M_RADIX); + radix_tree_clean_root_node(root); + return (-ENOMEM); + } + } + + /* setup new radix levels, if any */ + for ( ; height != 0; height--) { + idx = radix_pos(index, height); + node->slots[idx] = temp[height - 1]; + node->count++; + node = node->slots[idx]; + } + + /* + * Insert and adjust count if the item does not already exist. + */ + idx = radix_pos(index, 0); + /* swap */ + pitem = node->slots[idx]; + node->slots[idx] = *ppitem; + *ppitem = pitem; + + if (pitem == NULL) + node->count++; return (0); } From owner-svn-src-stable-12@freebsd.org Wed Aug 19 12:47:05 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F207B3BDC0F; Wed, 19 Aug 2020 12:47:05 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWnbs66Qvz3VM9; Wed, 19 Aug 2020 12:47:05 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5F54230DE; Wed, 19 Aug 2020 12:47:05 +0000 (UTC) (envelope-from 0mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07JCl5dc034089; Wed, 19 Aug 2020 12:47:05 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JCl5VA034088; Wed, 19 Aug 2020 12:47:05 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202008191247.07JCl5VA034088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: 0mp set sender to 0mp@FreeBSD.org using -f From: Mateusz Piotrowski <0mp@FreeBSD.org> Date: Wed, 19 Aug 2020 12:47:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364384 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 364384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 12:47:06 -0000 Author: 0mp (doc,ports committer) Date: Wed Aug 19 12:47:05 2020 New Revision: 364384 URL: https://svnweb.freebsd.org/changeset/base/364384 Log: MFC 364294, 364295: - Remove an unnecessary macro - Comment out TODO notes from bectl(8) manual page Modified: stable/12/sbin/bectl/bectl.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl.8 ============================================================================== --- stable/12/sbin/bectl/bectl.8 Wed Aug 19 12:26:23 2020 (r364383) +++ stable/12/sbin/bectl/bectl.8 Wed Aug 19 12:47:05 2020 (r364384) @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 18, 2020 +.Dd August 17, 2020 .Dt BECTL 8 .Os .Sh NAME @@ -102,7 +102,7 @@ Activate the given .Ar beName as the default boot filesystem. If the -.Op Fl t +.Fl t flag is given, this takes effect only for the next boot. .It Xo .Cm check @@ -337,11 +337,11 @@ prints usage information if or .Fl \&? is specified. -.Sh EXAMPLES -.Bl -bullet -.It -To fill in with jail upgrade example when behavior is firm. -.El +\" .Sh EXAMPLES +\" .Bl -bullet +\" .It +\" To fill in with jail upgrade example when behavior is firm. +\" .El .Sh SEE ALSO .Xr libbe 3 , .Xr beinstall.sh 8 , From owner-svn-src-stable-12@freebsd.org Wed Aug 19 13:07:06 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FE3B3BE2D1; Wed, 19 Aug 2020 13:07:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWp2y01mJz3X6R; Wed, 19 Aug 2020 13:07:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7C8323511; Wed, 19 Aug 2020 13:07:05 +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 07JD754t046813; Wed, 19 Aug 2020 13:07:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JD74oO046808; Wed, 19 Aug 2020 13:07:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008191307.07JD74oO046808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Aug 2020 13:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364386 - in stable/12/sys: dev/hwpmc kern netinet netinet6 sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: dev/hwpmc kern netinet netinet6 sys X-SVN-Commit-Revision: 364386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 13:07:06 -0000 Author: hselasky Date: Wed Aug 19 13:07:04 2020 New Revision: 364386 URL: https://svnweb.freebsd.org/changeset/base/364386 Log: MFC r359438 and r359477: Remove the "config" taskqgroup and its KPIs. Equivalent functionality is already provided by taskqueue(9), just use that instead. Interfaces may be detached from a taskqueue_thread task, for example by prison_complete(), so after r359438, when draining the queue we may end up deadlocking. Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c stable/12/sys/kern/subr_gtaskqueue.c stable/12/sys/netinet/in_mcast.c stable/12/sys/netinet6/in6_mcast.c stable/12/sys/sys/gtaskqueue.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/12/sys/dev/hwpmc/hwpmc_mod.c Wed Aug 19 12:51:13 2020 (r364385) +++ stable/12/sys/dev/hwpmc/hwpmc_mod.c Wed Aug 19 13:07:04 2020 (r364386) @@ -36,9 +36,9 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include -#include #include #include #include @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include /* needs to be after */ @@ -187,7 +187,7 @@ static int pmc_threadfreelist_entries=0; /* * Task to free thread descriptors */ -static struct grouptask free_gtask; +static struct task free_task; /* * A map of row indices to classdep structures. @@ -2411,15 +2411,15 @@ pmc_thread_descriptor_pool_free(struct pmc_thread *pt) LIST_INSERT_HEAD(&pmc_threadfreelist, pt, pt_next); pmc_threadfreelist_entries++; if (pmc_threadfreelist_entries > pmc_threadfreelist_max) - GROUPTASK_ENQUEUE(&free_gtask); + taskqueue_enqueue(taskqueue_fast, &free_task); mtx_unlock_spin(&pmc_threadfreelist_mtx); } /* - * A callout to manage the free list. + * An asynchronous task to manage the free list. */ static void -pmc_thread_descriptor_pool_free_task(void *arg __unused) +pmc_thread_descriptor_pool_free_task(void *arg __unused, int pending __unused) { struct pmc_thread *pt; LIST_HEAD(, pmc_thread) tmplist; @@ -5715,11 +5715,8 @@ pmc_initialize(void) mtx_init(&pmc_threadfreelist_mtx, "pmc-threadfreelist", "pmc-leaf", MTX_SPIN); - /* - * Initialize the callout to monitor the thread free list. - * This callout will also handle the initial population of the list. - */ - taskqgroup_config_gtask_init(NULL, &free_gtask, pmc_thread_descriptor_pool_free_task, "thread descriptor pool free task"); + /* Initialize the task to prune the thread free list. */ + TASK_INIT(&free_task, 0, pmc_thread_descriptor_pool_free_task, NULL); /* register process {exit,fork,exec} handlers */ pmc_exit_tag = EVENTHANDLER_REGISTER(process_exit, @@ -5818,6 +5815,7 @@ pmc_cleanup(void) } /* reclaim allocated data structures */ + taskqueue_drain(taskqueue_fast, &free_task); mtx_destroy(&pmc_threadfreelist_mtx); pmc_thread_descriptor_pool_drain(); @@ -5825,7 +5823,6 @@ pmc_cleanup(void) mtx_pool_destroy(&pmc_mtxpool); mtx_destroy(&pmc_processhash_mtx); - taskqgroup_config_gtask_deinit(&free_gtask); if (pmc_processhash) { #ifdef HWPMC_DEBUG struct pmc_process *pp; Modified: stable/12/sys/kern/subr_gtaskqueue.c ============================================================================== --- stable/12/sys/kern/subr_gtaskqueue.c Wed Aug 19 12:51:13 2020 (r364385) +++ stable/12/sys/kern/subr_gtaskqueue.c Wed Aug 19 13:07:04 2020 (r364386) @@ -55,7 +55,6 @@ static int task_is_running(struct gtaskqueue *queue, s static void gtaskqueue_drain_locked(struct gtaskqueue *queue, struct gtask *gtask); TASKQGROUP_DEFINE(softirq, mp_ncpus, 1); -TASKQGROUP_DEFINE(config, 1, 1); struct gtaskqueue_busy { struct gtask *tb_running; @@ -891,24 +890,6 @@ taskqgroup_bind(struct taskqgroup *qgroup) } } -static void -taskqgroup_config_init(void *arg) -{ - struct taskqgroup *qgroup = qgroup_config; - LIST_HEAD(, grouptask) gtask_head = LIST_HEAD_INITIALIZER(NULL); - - LIST_SWAP(>ask_head, &qgroup->tqg_queue[0].tgc_tasks, - grouptask, gt_list); - qgroup->tqg_queue[0].tgc_cnt = 0; - taskqgroup_cpu_create(qgroup, 0, 0); - - qgroup->tqg_cnt = 1; - qgroup->tqg_stride = 1; -} - -SYSINIT(taskqgroup_config_init, SI_SUB_TASKQ, SI_ORDER_SECOND, - taskqgroup_config_init, NULL); - static int _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride) { @@ -1028,21 +1009,5 @@ taskqgroup_create(const char *name) void taskqgroup_destroy(struct taskqgroup *qgroup) { - } -void -taskqgroup_config_gtask_init(void *ctx, struct grouptask *gtask, gtask_fn_t *fn, - const char *name) -{ - - GROUPTASK_INIT(gtask, 0, fn, ctx); - taskqgroup_attach(qgroup_config, gtask, gtask, -1, name); -} - -void -taskqgroup_config_gtask_deinit(struct grouptask *gtask) -{ - - taskqgroup_detach(qgroup_config, gtask); -} Modified: stable/12/sys/netinet/in_mcast.c ============================================================================== --- stable/12/sys/netinet/in_mcast.c Wed Aug 19 12:51:13 2020 (r364385) +++ stable/12/sys/netinet/in_mcast.c Wed Aug 19 13:07:04 2020 (r364386) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -223,24 +222,17 @@ inm_is_ifp_detached(const struct in_multi *inm) } #endif -static struct grouptask free_gtask; -static struct in_multi_head inm_free_list; -static void inm_release_task(void *arg __unused); -static void inm_init(void) +static struct task free_task; +static struct in_multi_head inm_free_list = SLIST_HEAD_INITIALIZER(); +static void inm_release_task(void *arg __unused, int pending __unused); + +static void +inm_init(void) { - SLIST_INIT(&inm_free_list); - taskqgroup_config_gtask_init(NULL, &free_gtask, inm_release_task, "inm release task"); + TASK_INIT(&free_task, 0, inm_release_task, NULL); } +SYSINIT(inm_init, SI_SUB_TASKQ, SI_ORDER_ANY, inm_init, NULL); -#ifdef EARLY_AP_STARTUP -SYSINIT(inm_init, SI_SUB_SMP + 1, SI_ORDER_FIRST, - inm_init, NULL); -#else -SYSINIT(inm_init, SI_SUB_ROOT_CONF - 1, SI_ORDER_FIRST, - inm_init, NULL); -#endif - - void inm_release_list_deferred(struct in_multi_head *inmh) { @@ -250,7 +242,7 @@ inm_release_list_deferred(struct in_multi_head *inmh) mtx_lock(&in_multi_free_mtx); SLIST_CONCAT(&inm_free_list, inmh, in_multi, inm_nrele); mtx_unlock(&in_multi_free_mtx); - GROUPTASK_ENQUEUE(&free_gtask); + taskqueue_enqueue(taskqueue_thread, &free_task); } void @@ -303,7 +295,7 @@ inm_release_deferred(struct in_multi *inm) } static void -inm_release_task(void *arg __unused) +inm_release_task(void *arg __unused, int pending __unused) { struct in_multi_head inm_free_tmp; struct in_multi *inm, *tinm; Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Wed Aug 19 12:51:13 2020 (r364385) +++ stable/12/sys/netinet6/in6_mcast.c Wed Aug 19 13:07:04 2020 (r364386) @@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include - #include #include #include @@ -510,24 +509,22 @@ in6m_release(struct in6_multi *inm) } } -static struct grouptask free_gtask; -static struct in6_multi_head in6m_free_list; -static void in6m_release_task(void *arg __unused); -static void in6m_init(void) +/* + * Interface detach can happen in a taskqueue thread context, so we must use a + * dedicated thread to avoid deadlocks when draining in6m_release tasks. + */ +TASKQUEUE_DEFINE_THREAD(in6m_free); +static struct task in6m_free_task; +static struct in6_multi_head in6m_free_list = SLIST_HEAD_INITIALIZER(); +static void in6m_release_task(void *arg __unused, int pending __unused); + +static void +in6m_init(void) { - SLIST_INIT(&in6m_free_list); - taskqgroup_config_gtask_init(NULL, &free_gtask, in6m_release_task, "in6m release task"); + TASK_INIT(&in6m_free_task, 0, in6m_release_task, NULL); } +SYSINIT(in6m_init, SI_SUB_TASKQ, SI_ORDER_ANY, in6m_init, NULL); -#ifdef EARLY_AP_STARTUP -SYSINIT(in6m_init, SI_SUB_SMP + 1, SI_ORDER_FIRST, - in6m_init, NULL); -#else -SYSINIT(in6m_init, SI_SUB_ROOT_CONF - 1, SI_ORDER_SECOND, - in6m_init, NULL); -#endif - - void in6m_release_list_deferred(struct in6_multi_head *inmh) { @@ -536,15 +533,13 @@ in6m_release_list_deferred(struct in6_multi_head *inmh mtx_lock(&in6_multi_free_mtx); SLIST_CONCAT(&in6m_free_list, inmh, in6_multi, in6m_nrele); mtx_unlock(&in6_multi_free_mtx); - GROUPTASK_ENQUEUE(&free_gtask); + taskqueue_enqueue(taskqueue_in6m_free, &in6m_free_task); } void in6m_release_wait(void) { - - /* Wait for all jobs to complete. */ - gtaskqueue_drain_all(free_gtask.gt_taskqueue); + taskqueue_drain_all(taskqueue_in6m_free); } void @@ -604,7 +599,7 @@ in6m_disconnect_locked(struct in6_multi_head *inmh, st } static void -in6m_release_task(void *arg __unused) +in6m_release_task(void *arg __unused, int pending __unused) { struct in6_multi_head in6m_free_tmp; struct in6_multi *inm, *tinm; Modified: stable/12/sys/sys/gtaskqueue.h ============================================================================== --- stable/12/sys/sys/gtaskqueue.h Wed Aug 19 12:51:13 2020 (r364385) +++ stable/12/sys/sys/gtaskqueue.h Wed Aug 19 13:07:04 2020 (r364386) @@ -64,9 +64,6 @@ void taskqgroup_detach(struct taskqgroup *qgroup, stru struct taskqgroup *taskqgroup_create(const char *name); void taskqgroup_destroy(struct taskqgroup *qgroup); int taskqgroup_adjust(struct taskqgroup *qgroup, int cnt, int stride); -void taskqgroup_config_gtask_init(void *ctx, struct grouptask *gtask, - gtask_fn_t *fn, const char *name); -void taskqgroup_config_gtask_deinit(struct grouptask *gtask); #define TASK_ENQUEUED 0x1 #define TASK_SKIP_WAKEUP 0x2 From owner-svn-src-stable-12@freebsd.org Wed Aug 19 13:23:54 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51BE93BE774; Wed, 19 Aug 2020 13:23:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWpQL1Nk0z3Y8C; Wed, 19 Aug 2020 13:23:54 +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 12CFC23894; Wed, 19 Aug 2020 13:23:54 +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 07JDNrUu059228; Wed, 19 Aug 2020 13:23:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JDNqOv059222; Wed, 19 Aug 2020 13:23:52 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008191323.07JDNqOv059222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Aug 2020 13:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364388 - in stable/12/sys: netinet netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: netinet netinet6 X-SVN-Commit-Revision: 364388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 13:23:54 -0000 Author: hselasky Date: Wed Aug 19 13:23:52 2020 New Revision: 364388 URL: https://svnweb.freebsd.org/changeset/base/364388 Log: MFC r364072, r364073 and r364102: Use proper prototype for SYSINIT() functions. Mark the unused argument using the __unused macro. Make sure the multicast release tasks are properly drained when destroying a VNET or a network interface. Else the inm release tasks, both IPv4 and IPv6 may cause a panic accessing a freed VNET or network interface. Use a static initializer for the multicast free tasks. This makes the SYSINIT() function updated in r364072 superfluous. Differential Revision: https://reviews.freebsd.org/D24914 Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet/in.c stable/12/sys/netinet/in_mcast.c stable/12/sys/netinet/in_var.h stable/12/sys/netinet6/in6_ifattach.c stable/12/sys/netinet6/in6_mcast.c stable/12/sys/netinet6/in6_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/in.c ============================================================================== --- stable/12/sys/netinet/in.c Wed Aug 19 13:09:31 2020 (r364387) +++ stable/12/sys/netinet/in.c Wed Aug 19 13:23:52 2020 (r364388) @@ -998,6 +998,13 @@ in_ifdetach(struct ifnet *ifp) in_pcbpurgeif0(&V_ulitecbinfo, ifp); in_purgemaddrs(ifp); IN_MULTI_UNLOCK(); + + /* + * Make sure all multicast deletions invoking if_ioctl() are + * completed before returning. Else we risk accessing a freed + * ifnet structure pointer. + */ + inm_release_wait(NULL); } /* Modified: stable/12/sys/netinet/in_mcast.c ============================================================================== --- stable/12/sys/netinet/in_mcast.c Wed Aug 19 13:09:31 2020 (r364387) +++ stable/12/sys/netinet/in_mcast.c Wed Aug 19 13:23:52 2020 (r364388) @@ -222,16 +222,28 @@ inm_is_ifp_detached(const struct in_multi *inm) } #endif -static struct task free_task; +/* + * Interface detach can happen in a taskqueue thread context, so we must use a + * dedicated thread to avoid deadlocks when draining inm_release tasks. + */ +TASKQUEUE_DEFINE_THREAD(inm_free); static struct in_multi_head inm_free_list = SLIST_HEAD_INITIALIZER(); static void inm_release_task(void *arg __unused, int pending __unused); +static struct task inm_free_task = TASK_INITIALIZER(0, inm_release_task, NULL); -static void -inm_init(void) +void +inm_release_wait(void *arg __unused) { - TASK_INIT(&free_task, 0, inm_release_task, NULL); + + /* + * Make sure all pending multicast addresses are freed before + * the VNET or network device is destroyed: + */ + taskqueue_drain(taskqueue_inm_free, &inm_free_task); } -SYSINIT(inm_init, SI_SUB_TASKQ, SI_ORDER_ANY, inm_init, NULL); +#ifdef VIMAGE +VNET_SYSUNINIT(inm_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, inm_release_wait, NULL); +#endif void inm_release_list_deferred(struct in_multi_head *inmh) @@ -242,7 +254,7 @@ inm_release_list_deferred(struct in_multi_head *inmh) mtx_lock(&in_multi_free_mtx); SLIST_CONCAT(&inm_free_list, inmh, in_multi, inm_nrele); mtx_unlock(&in_multi_free_mtx); - taskqueue_enqueue(taskqueue_thread, &free_task); + taskqueue_enqueue(taskqueue_inm_free, &inm_free_task); } void Modified: stable/12/sys/netinet/in_var.h ============================================================================== --- stable/12/sys/netinet/in_var.h Wed Aug 19 13:09:31 2020 (r364387) +++ stable/12/sys/netinet/in_var.h Wed Aug 19 13:23:52 2020 (r364388) @@ -449,6 +449,7 @@ void inm_print(const struct in_multi *); int inm_record_source(struct in_multi *inm, const in_addr_t); void inm_release_deferred(struct in_multi *); void inm_release_list_deferred(struct in_multi_head *); +void inm_release_wait(void *); struct in_multi * in_addmulti(struct in_addr *, struct ifnet *); int in_joingroup(struct ifnet *, const struct in_addr *, Modified: stable/12/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/12/sys/netinet6/in6_ifattach.c Wed Aug 19 13:09:31 2020 (r364387) +++ stable/12/sys/netinet6/in6_ifattach.c Wed Aug 19 13:23:52 2020 (r364388) @@ -878,7 +878,7 @@ in6_purgemaddrs(struct ifnet *ifp) * completed before returning. Else we risk accessing a freed * ifnet structure pointer. */ - in6m_release_wait(); + in6m_release_wait(NULL); } void Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Wed Aug 19 13:09:31 2020 (r364387) +++ stable/12/sys/netinet6/in6_mcast.c Wed Aug 19 13:23:52 2020 (r364388) @@ -514,17 +514,10 @@ in6m_release(struct in6_multi *inm) * dedicated thread to avoid deadlocks when draining in6m_release tasks. */ TASKQUEUE_DEFINE_THREAD(in6m_free); -static struct task in6m_free_task; static struct in6_multi_head in6m_free_list = SLIST_HEAD_INITIALIZER(); static void in6m_release_task(void *arg __unused, int pending __unused); +static struct task in6m_free_task = TASK_INITIALIZER(0, in6m_release_task, NULL); -static void -in6m_init(void) -{ - TASK_INIT(&in6m_free_task, 0, in6m_release_task, NULL); -} -SYSINIT(in6m_init, SI_SUB_TASKQ, SI_ORDER_ANY, in6m_init, NULL); - void in6m_release_list_deferred(struct in6_multi_head *inmh) { @@ -537,10 +530,18 @@ in6m_release_list_deferred(struct in6_multi_head *inmh } void -in6m_release_wait(void) +in6m_release_wait(void *arg __unused) { + + /* + * Make sure all pending multicast addresses are freed before + * the VNET or network device is destroyed: + */ taskqueue_drain_all(taskqueue_in6m_free); } +#ifdef VIMAGE +VNET_SYSUNINIT(in6m_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, in6m_release_wait, NULL); +#endif void in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm) Modified: stable/12/sys/netinet6/in6_var.h ============================================================================== --- stable/12/sys/netinet6/in6_var.h Wed Aug 19 13:09:31 2020 (r364387) +++ stable/12/sys/netinet6/in6_var.h Wed Aug 19 13:23:52 2020 (r364388) @@ -868,7 +868,7 @@ void in6m_commit(struct in6_multi *); void in6m_print(const struct in6_multi *); int in6m_record_source(struct in6_multi *, const struct in6_addr *); void in6m_release_list_deferred(struct in6_multi_head *); -void in6m_release_wait(void); +void in6m_release_wait(void *); void ip6_freemoptions(struct ip6_moptions *); int ip6_getmoptions(struct inpcb *, struct sockopt *); int ip6_setmoptions(struct inpcb *, struct sockopt *); From owner-svn-src-stable-12@freebsd.org Wed Aug 19 13:28:50 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B11783BE86A; Wed, 19 Aug 2020 13:28:50 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWpX24Gs6z3YVv; Wed, 19 Aug 2020 13:28:50 +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 75EFC2366B; Wed, 19 Aug 2020 13:28:50 +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 07JDSonW059498; Wed, 19 Aug 2020 13:28:50 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JDSo4k059497; Wed, 19 Aug 2020 13:28:50 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008191328.07JDSo4k059497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Aug 2020 13:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364389 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 364389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 13:28:50 -0000 Author: hselasky Date: Wed Aug 19 13:28:50 2020 New Revision: 364389 URL: https://svnweb.freebsd.org/changeset/base/364389 Log: Fix for INVARIANTS build. The "name" argument is not present in the EPOCH(9) APIs in 12-stable as merged in r364381 . This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/12/sys/kern/subr_epoch.c Modified: stable/12/sys/kern/subr_epoch.c ============================================================================== --- stable/12/sys/kern/subr_epoch.c Wed Aug 19 13:23:52 2020 (r364388) +++ stable/12/sys/kern/subr_epoch.c Wed Aug 19 13:28:50 2020 (r364389) @@ -208,8 +208,6 @@ epoch_alloc(int flags) epoch_t epoch; int i; - MPASS(name != NULL); - if (__predict_false(!inited)) panic("%s called too early in boot", __func__); From owner-svn-src-stable-12@freebsd.org Wed Aug 19 13:32:56 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C8AB63BF023; Wed, 19 Aug 2020 13:32:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWpcm4ZmJz3YwT; Wed, 19 Aug 2020 13:32:56 +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 80837238BD; Wed, 19 Aug 2020 13:32:56 +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 07JDWuA8065516; Wed, 19 Aug 2020 13:32:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JDWtwK065514; Wed, 19 Aug 2020 13:32:55 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008191332.07JDWtwK065514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 19 Aug 2020 13:32:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364390 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Commit-Revision: 364390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 13:32:56 -0000 Author: hselasky Date: Wed Aug 19 13:32:55 2020 New Revision: 364390 URL: https://svnweb.freebsd.org/changeset/base/364390 Log: MFC r364109: Need to clone the task struct fields related to RCU aswell in the LinuxKPI after r359727. This fixes a minor regression issue. Else the priority tracking won't work properly when both sleepable and non-sleepable RCU is in use on the same thread. Bump the __FreeBSD_version to force recompilation of external kernel modules. PR: 242272 Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sched.h stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/sched.h Wed Aug 19 13:28:50 2020 (r364389) +++ stable/12/sys/compat/linuxkpi/common/include/linux/sched.h Wed Aug 19 13:32:55 2020 (r364390) @@ -76,8 +76,9 @@ struct task_struct { unsigned bsd_ioctl_len; struct completion parked; struct completion exited; - TAILQ_ENTRY(task_struct) rcu_entry; - int rcu_recurse; +#define TS_RCU_TYPE_MAX 2 + TAILQ_ENTRY(task_struct) rcu_entry[TS_RCU_TYPE_MAX]; + int rcu_recurse[TS_RCU_TYPE_MAX]; int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ struct task_struct *group_leader; Modified: stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c Wed Aug 19 13:28:50 2020 (r364389) +++ stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c Wed Aug 19 13:32:55 2020 (r364390) @@ -74,6 +74,7 @@ struct linux_epoch_record { ck_epoch_record_t epoch_record; TAILQ_HEAD(, task_struct) ts_head; int cpuid; + int type; } __aligned(CACHE_LINE_SIZE); /* @@ -90,6 +91,8 @@ CTASSERT(sizeof(struct rcu_head) == sizeof(struct call */ CTASSERT(offsetof(struct linux_epoch_record, epoch_record) == 0); +CTASSERT(TS_RCU_TYPE_MAX == RCU_TYPE_MAX); + static ck_epoch_t linux_epoch[RCU_TYPE_MAX]; static struct linux_epoch_head linux_epoch_head[RCU_TYPE_MAX]; DPCPU_DEFINE_STATIC(struct linux_epoch_record, linux_epoch_record[RCU_TYPE_MAX]); @@ -118,6 +121,7 @@ linux_rcu_runtime_init(void *arg __unused) record = &DPCPU_ID_GET(i, linux_epoch_record[j]); record->cpuid = i; + record->type = j; ck_epoch_register(&linux_epoch[j], &record->epoch_record, NULL); TAILQ_INIT(&record->ts_head); @@ -201,9 +205,9 @@ linux_rcu_read_lock(unsigned type) */ critical_enter(); ck_epoch_begin(&record->epoch_record, NULL); - ts->rcu_recurse++; - if (ts->rcu_recurse == 1) - TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry); + ts->rcu_recurse[type]++; + if (ts->rcu_recurse[type] == 1) + TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); critical_exit(); } @@ -227,9 +231,9 @@ linux_rcu_read_unlock(unsigned type) */ critical_enter(); ck_epoch_end(&record->epoch_record, NULL); - ts->rcu_recurse--; - if (ts->rcu_recurse == 0) - TAILQ_REMOVE(&record->ts_head, ts, rcu_entry); + ts->rcu_recurse[type]--; + if (ts->rcu_recurse[type] == 0) + TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); critical_exit(); sched_unpin(); @@ -254,7 +258,7 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c * the threads in the queue are CPU-pinned and cannot * go anywhere while the current thread is locked. */ - TAILQ_FOREACH(ts, &record->ts_head, rcu_entry) { + TAILQ_FOREACH(ts, &record->ts_head, rcu_entry[record->type]) { if (ts->task_thread->td_priority > prio) prio = ts->task_thread->td_priority; is_sleeping |= (ts->task_thread->td_inhibitors != 0); Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Wed Aug 19 13:28:50 2020 (r364389) +++ stable/12/sys/sys/param.h Wed Aug 19 13:32:55 2020 (r364390) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1201522 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201523 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-12@freebsd.org Wed Aug 19 13:44:08 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D36A13BF341; Wed, 19 Aug 2020 13:44: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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BWpsh5JfTz3Zd5; Wed, 19 Aug 2020 13:44: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 9A36C23862; Wed, 19 Aug 2020 13:44: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 07JDi80M072124; Wed, 19 Aug 2020 13:44:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07JDi8mT072123; Wed, 19 Aug 2020 13:44:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008191344.07JDi8mT072123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 19 Aug 2020 13:44:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364392 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 364392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 13:44:08 -0000 Author: markj Date: Wed Aug 19 13:44:08 2020 New Revision: 364392 URL: https://svnweb.freebsd.org/changeset/base/364392 Log: MFC r364168: linprocfs: Fix some inaccuracies in meminfo. PR: 248463 Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Wed Aug 19 13:35:32 2020 (r364391) +++ stable/12/sys/compat/linprocfs/linprocfs.c Wed Aug 19 13:44:08 2020 (r364392) @@ -145,41 +145,35 @@ static int linprocfs_domeminfo(PFS_FILL_ARGS) { unsigned long memtotal; /* total memory in bytes */ - unsigned long memused; /* used memory in bytes */ unsigned long memfree; /* free memory in bytes */ - unsigned long buffers, cached; /* buffer / cache memory ??? */ + unsigned long cached; /* page cache */ + unsigned long buffers; /* buffer cache */ unsigned long long swaptotal; /* total swap space in bytes */ unsigned long long swapused; /* used swap space in bytes */ unsigned long long swapfree; /* free swap space in bytes */ - int i, j; + size_t sz; + int error, i, j; memtotal = physmem * PAGE_SIZE; - /* - * The correct thing here would be: - * - memfree = vm_free_count() * PAGE_SIZE; - memused = memtotal - memfree; - * - * but it might mislead linux binaries into thinking there - * is very little memory left, so we cheat and tell them that - * all memory that isn't wired down is free. - */ - memused = vm_wire_count() * PAGE_SIZE; - memfree = memtotal - memused; + memfree = (unsigned long)vm_free_count() * PAGE_SIZE; swap_pager_status(&i, &j); swaptotal = (unsigned long long)i * PAGE_SIZE; swapused = (unsigned long long)j * PAGE_SIZE; swapfree = swaptotal - swapused; + /* - * We'd love to be able to write: - * - buffers = bufspace; - * - * but bufspace is internal to vfs_bio.c and we don't feel - * like unstaticizing it just for linprocfs's sake. + * This value may exclude wired pages, but we have no good way of + * accounting for that. */ - buffers = 0; - cached = vm_inactive_count() * PAGE_SIZE; + cached = + (vm_active_count() + vm_inactive_count() + vm_laundry_count()) * + PAGE_SIZE; + + sz = sizeof(buffers); + error = kernel_sysctlbyname(curthread, "vfs.bufspace", &buffers, &sz, + NULL, 0, 0, 0); + if (error != 0) + buffers = 0; sbuf_printf(sb, "MemTotal: %9lu kB\n" From owner-svn-src-stable-12@freebsd.org Thu Aug 20 02:51:18 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C40DD3AB0B9; Thu, 20 Aug 2020 02:51:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BX8Ky4vHDz4vgk; Thu, 20 Aug 2020 02:51:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B812D2C6; Thu, 20 Aug 2020 02:51:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07K2pIMa073132; Thu, 20 Aug 2020 02:51:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07K2pId2073131; Thu, 20 Aug 2020 02:51:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008200251.07K2pId2073131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 20 Aug 2020 02:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364413 - stable/12/sys/cam/nvme X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/nvme X-SVN-Commit-Revision: 364413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2020 02:51:18 -0000 Author: mav Date: Thu Aug 20 02:51:18 2020 New Revision: 364413 URL: https://svnweb.freebsd.org/changeset/base/364413 Log: MFC r364178: Report proper stripesize for nda(4). Same as for nvd(4) report NPWG if present, otherise NOIOB. Modified: stable/12/sys/cam/nvme/nvme_da.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/12/sys/cam/nvme/nvme_da.c Thu Aug 20 01:31:21 2020 (r364412) +++ stable/12/sys/cam/nvme/nvme_da.c Thu Aug 20 02:51:18 2020 (r364413) @@ -805,7 +805,11 @@ ndaregister(struct cam_periph *periph, void *arg) disk->d_hba_device = cpi.hba_device; disk->d_hba_subvendor = cpi.hba_subvendor; disk->d_hba_subdevice = cpi.hba_subdevice; - disk->d_stripesize = disk->d_sectorsize; + if (((nsd->nsfeat >> NVME_NS_DATA_NSFEAT_NPVALID_SHIFT) & + NVME_NS_DATA_NSFEAT_NPVALID_MASK) != 0 && nsd->npwg != 0) + disk->d_stripesize = ((nsd->npwg + 1) * disk->d_sectorsize); + else + disk->d_stripesize = nsd->noiob * disk->d_sectorsize; disk->d_stripeoffset = 0; disk->d_devstat = devstat_new_entry(periph->periph_name, periph->unit_number, disk->d_sectorsize, From owner-svn-src-stable-12@freebsd.org Thu Aug 20 02:54:45 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F9A03AB5C8; Thu, 20 Aug 2020 02:54:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BX8Px3M2Qz3RZC; Thu, 20 Aug 2020 02:54:45 +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 4E075D627; Thu, 20 Aug 2020 02:54:45 +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 07K2sjxo075595; Thu, 20 Aug 2020 02:54:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07K2sjiE075594; Thu, 20 Aug 2020 02:54:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008200254.07K2sjiE075594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 20 Aug 2020 02:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364414 - stable/12/sys/cam/nvme X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/nvme X-SVN-Commit-Revision: 364414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2020 02:54:45 -0000 Author: mav Date: Thu Aug 20 02:54:44 2020 New Revision: 364414 URL: https://svnweb.freebsd.org/changeset/base/364414 Log: MFC r364185: Fill device serial_num and device_id in NVMe XPT. It allows to report GEOM::lunid for nda(4) same as for nvd(4). Since NVMe now allows multiple LUs (namespaces) with multiple paths unique LU identification is important. The serial_num field is filled same as before with the controller serial number, while device_id is based on namespace GUID and/or EUI64 fields as recommended by "NVM Express: SCSI Translation Reference" and matching nvd(4) at the end. Modified: stable/12/sys/cam/nvme/nvme_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/nvme/nvme_xpt.c ============================================================================== --- stable/12/sys/cam/nvme/nvme_xpt.c Thu Aug 20 02:51:18 2020 (r364413) +++ stable/12/sys/cam/nvme/nvme_xpt.c Thu Aug 20 02:54:44 2020 (r364414) @@ -311,9 +311,11 @@ nvme_probe_done(struct cam_periph *periph, union ccb * struct nvme_controller_data *nvme_cdata; nvme_probe_softc *softc; struct cam_path *path; + struct scsi_vpd_device_id *did; + struct scsi_vpd_id_descriptor *idd; cam_status status; u_int32_t priority; - int found = 1; + int found = 1, e, g, len; CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("nvme_probe_done\n")); @@ -370,6 +372,21 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONF bcopy(&softc->cd, nvme_cdata, sizeof(*nvme_cdata)); path->device->nvme_cdata = nvme_cdata; + /* Save/update serial number. */ + if (path->device->serial_num != NULL) { + free(path->device->serial_num, M_CAMXPT); + path->device->serial_num = NULL; + path->device->serial_num_len = 0; + } + path->device->serial_num = (u_int8_t *) + malloc(NVME_SERIAL_NUMBER_LENGTH + 1, M_CAMXPT, M_NOWAIT); + if (path->device->serial_num != NULL) { + cam_strvis(path->device->serial_num, nvme_cdata->sn, + NVME_SERIAL_NUMBER_LENGTH, NVME_SERIAL_NUMBER_LENGTH + 1); + path->device->serial_num_len = + strlen(path->device->serial_num); + } + // nvme_find_quirk(path->device); nvme_device_transport(path); NVME_PROBE_SET_ACTION(softc, NVME_PROBE_IDENTIFY_NS); @@ -395,6 +412,53 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONF bcopy(&softc->ns, nvme_data, sizeof(*nvme_data)); path->device->nvme_data = nvme_data; + /* Save/update device_id based on NGUID and/or EUI64. */ + if (path->device->device_id != NULL) { + free(path->device->device_id, M_CAMXPT); + path->device->device_id = NULL; + path->device->device_id_len = 0; + } + len = 0; + for (g = 0; g < sizeof(nvme_data->nguid); g++) { + if (nvme_data->nguid[g] != 0) + break; + } + if (g < sizeof(nvme_data->nguid)) + len += sizeof(struct scsi_vpd_id_descriptor) + 16; + for (e = 0; e < sizeof(nvme_data->eui64); e++) { + if (nvme_data->eui64[e] != 0) + break; + } + if (e < sizeof(nvme_data->eui64)) + len += sizeof(struct scsi_vpd_id_descriptor) + 8; + if (len > 0) { + path->device->device_id = (u_int8_t *) + malloc(SVPD_DEVICE_ID_HDR_LEN + len, + M_CAMXPT, M_NOWAIT); + } + if (path->device->device_id != NULL) { + did = (struct scsi_vpd_device_id *)path->device->device_id; + did->device = SID_QUAL_LU_CONNECTED | T_DIRECT; + did->page_code = SVPD_DEVICE_ID; + scsi_ulto2b(len, did->length); + idd = (struct scsi_vpd_id_descriptor *)(did + 1); + if (g < sizeof(nvme_data->nguid)) { + idd->proto_codeset = SVPD_ID_CODESET_BINARY; + idd->id_type = SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_EUI64; + idd->length = 16; + bcopy(nvme_data->nguid, idd->identifier, 16); + idd = (struct scsi_vpd_id_descriptor *) + &idd->identifier[16]; + } + if (e < sizeof(nvme_data->eui64)) { + idd->proto_codeset = SVPD_ID_CODESET_BINARY; + idd->id_type = SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_EUI64; + idd->length = 8; + bcopy(nvme_data->eui64, idd->identifier, 8); + } + path->device->device_id_len = SVPD_DEVICE_ID_HDR_LEN + len; + } + if (periph->path->device->flags & CAM_DEV_UNCONFIGURED) { path->device->flags &= ~CAM_DEV_UNCONFIGURED; xpt_acquire_device(path->device); @@ -547,9 +611,9 @@ nvme_alloc_device(struct cam_eb *bus, struct cam_et *t device->maxtags = 0; device->inq_flags = 0; device->queue_flags = 0; - device->device_id = NULL; /* XXX Need to set this somewhere */ + device->device_id = NULL; device->device_id_len = 0; - device->serial_num = NULL; /* XXX Need to set this somewhere */ + device->serial_num = NULL; device->serial_num_len = 0; return (device); } From owner-svn-src-stable-12@freebsd.org Thu Aug 20 14:07:30 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61C9B3BF649; Thu, 20 Aug 2020 14:07:30 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXRLB1x4Vz4TJb; Thu, 20 Aug 2020 14:07:30 +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 2595B154CD; Thu, 20 Aug 2020 14:07:30 +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 07KE7Tb2090884; Thu, 20 Aug 2020 14:07:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07KE7TLt090882; Thu, 20 Aug 2020 14:07:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008201407.07KE7TLt090882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 20 Aug 2020 14:07:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364422 - stable/12/usr.sbin/certctl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.sbin/certctl X-SVN-Commit-Revision: 364422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2020 14:07:30 -0000 Author: kevans Date: Thu Aug 20 14:07:29 2020 New Revision: 364422 URL: https://svnweb.freebsd.org/changeset/base/364422 Log: MFC r361397, r361683: certctl(8) unprivileged mode r361397: Add an unprivileged mode where calls to install are passed appropriate flags. For ease of integration, use the same flags as install: -U unprivileged mode -D Specify DESTDIR (overrides the environment) -M Full path to METALOG file r361683: certctl: fix test syntax test doesn't understand &&, but it does understand -a. Modified: stable/12/usr.sbin/certctl/certctl.8 stable/12/usr.sbin/certctl/certctl.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/certctl/certctl.8 ============================================================================== --- stable/12/usr.sbin/certctl/certctl.8 Thu Aug 20 12:50:49 2020 (r364421) +++ stable/12/usr.sbin/certctl/certctl.8 Thu Aug 20 14:07:29 2020 (r364422) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 30, 2020 +.Dd August 20, 2020 .Dt CERTCTL 8 .Os .Sh NAME @@ -40,7 +40,9 @@ .Op Fl v .Ic blacklisted .Nm -.Op Fl nv +.Op Fl nUv +.Op Fl D Ar destdir +.Op Fl M Ar metalog .Ic rehash .Nm .Op Fl nv @@ -56,10 +58,17 @@ applications that use OpenSSL. .Pp Flags: .Bl -tag -width 4n +.It Fl D Ar destdir +Specify the DESTDIR (overriding values from the environment). +.It Fl M Ar metalog +Specify the path of the METALOG file (default: $DESTDIR/METALOG). .It Fl n No-Op mode, do not actually perform any actions. .It Fl v be verbose, print details about actions before performing them. +.It Fl U +Unprivileged mode, do not change the ownership of created links. +Do record the ownership in the METALOG file. .El .Pp Primary command functions: Modified: stable/12/usr.sbin/certctl/certctl.sh ============================================================================== --- stable/12/usr.sbin/certctl/certctl.sh Thu Aug 20 12:50:49 2020 (r364421) +++ stable/12/usr.sbin/certctl/certctl.sh Thu Aug 20 14:07:29 2020 (r364422) @@ -30,10 +30,6 @@ ############################################################ CONFIGURATION : ${DESTDIR:=} -: ${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}/usr/local/share/certs:${DESTDIR}/usr/local/etc/ssl/certs} -: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted} -: ${CERTDESTDIR:=${DESTDIR}/etc/ssl/certs} -: ${BLACKLISTDESTDIR:=${DESTDIR}/etc/ssl/blacklisted} : ${FILEPAT:="\.pem$|\.crt$|\.cer$|\.crl$|\.0$"} : ${VERBOSE:=0} @@ -42,6 +38,7 @@ SCRIPTNAME="${0##*/}" ERRORS=0 NOOP=0 +UNPRIV=0 ############################################################ FUNCTIONS @@ -69,7 +66,7 @@ create_trusted_link() return 1 fi [ $VERBOSE -gt 0 ] && echo "Adding $hash.0 to trust store" - [ $NOOP -eq 0 ] && install -lrs $(realpath "$1") "$CERTDESTDIR/$hash.0" + [ $NOOP -eq 0 ] && install ${INSTALLFLAGS} -lrs $(realpath "$1") "$CERTDESTDIR/$hash.0" } create_blacklisted() @@ -88,7 +85,7 @@ create_blacklisted() return fi [ $VERBOSE -gt 0 ] && echo "Adding $filename to blacklist" - [ $NOOP -eq 0 ] && install -lrs "$srcfile" "$BLACKLISTDESTDIR/$filename" + [ $NOOP -eq 0 ] && install ${INSTALLFLAGS} -lrs "$srcfile" "$BLACKLISTDESTDIR/$filename" } do_scan() @@ -105,7 +102,7 @@ do_scan() [ -d "$CPATH" ] || continue echo "Scanning $CPATH for certificates..." for CFILE in $(ls -1 "${CPATH}" | grep -Ee "${FILEPAT}"); do - [ -e "$CPATH/$CFILE" ] || continue + [ -e "$CPATH/$CFILE" -a $UNPRIV -eq 0 ] || continue [ $VERBOSE -gt 0 ] && echo "Reading $CFILE" "$CFUNC" "$CPATH/$CFILE" done @@ -209,7 +206,7 @@ usage() echo " List trusted certificates" echo " $SCRIPTNAME [-v] blacklisted" echo " List blacklisted certificates" - echo " $SCRIPTNAME [-nv] rehash" + echo " $SCRIPTNAME [-nUv] [-D ] [-M ] rehash" echo " Generate hash links for all certificates" echo " $SCRIPTNAME [-nv] blacklist " echo " Add to the list of blacklisted certificates" @@ -220,13 +217,24 @@ usage() ############################################################ MAIN -while getopts nv flag; do +while getopts D:M:nUv flag; do case "$flag" in + D) DESTDIR=${OPTARG} ;; + M) METALOG=${OPTARG} ;; n) NOOP=1 ;; + U) UNPRIV=1 ;; v) VERBOSE=$(( $VERBOSE + 1 )) ;; esac done shift $(( $OPTIND - 1 )) + +: ${METALOG:=${DESTDIR}/METALOG} +INSTALLFLAGS= +[ $UNPRIV -eq 1 ] && INSTALLFLAGS=-U -M ${METALOG} -D ${DESTDIR} +: ${TRUSTPATH:=${DESTDIR}/usr/share/certs/trusted:${DESTDIR}/usr/local/share/certs:${DESTDIR}/usr/local/etc/ssl/certs} +: ${BLACKLISTPATH:=${DESTDIR}/usr/share/certs/blacklisted:${DESTDIR}/usr/local/etc/ssl/blacklisted} +: ${CERTDESTDIR:=${DESTDIR}/etc/ssl/certs} +: ${BLACKLISTDESTDIR:=${DESTDIR}/etc/ssl/blacklisted} [ $# -gt 0 ] || usage case "$1" in From owner-svn-src-stable-12@freebsd.org Thu Aug 20 17:35:10 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 253BF3C4310; Thu, 20 Aug 2020 17:35:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXWxp00Dvz3TlY; Thu, 20 Aug 2020 17:35: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 D887117E5E; Thu, 20 Aug 2020 17:35: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 07KHZ9Tq019390; Thu, 20 Aug 2020 17:35:09 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07KHZ9VL019386; Thu, 20 Aug 2020 17:35:09 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202008201735.07KHZ9VL019386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 20 Aug 2020 17:35:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364431 - in stable/12: share/man/man4 sys/dev/usb/misc X-SVN-Group: stable-12 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/usb/misc X-SVN-Commit-Revision: 364431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2020 17:35:10 -0000 Author: imp Date: Thu Aug 20 17:35:09 2020 New Revision: 364431 URL: https://svnweb.freebsd.org/changeset/base/364431 Log: MFC: 359521 ufm removal ufm will be removed from 13, note it here. Relnotes: Yes (maybe, very obscure) Modified: stable/12/share/man/man4/ufm.4 stable/12/sys/dev/usb/misc/ufm.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ufm.4 ============================================================================== --- stable/12/share/man/man4/ufm.4 Thu Aug 20 17:19:40 2020 (r364430) +++ stable/12/share/man/man4/ufm.4 Thu Aug 20 17:35:09 2020 (r364431) @@ -44,6 +44,12 @@ module at boot time, place the following line in .Bd -literal -offset indent ufm_load="YES" .Ed +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 13.0 +and later. .Sh DESCRIPTION The .Nm Modified: stable/12/sys/dev/usb/misc/ufm.c ============================================================================== --- stable/12/sys/dev/usb/misc/ufm.c Thu Aug 20 17:19:40 2020 (r364430) +++ stable/12/sys/dev/usb/misc/ufm.c Thu Aug 20 17:35:09 2020 (r364431) @@ -165,6 +165,7 @@ ufm_attach(device_t dev) if (error) { goto detach; } + gone_in_dev(dev, 13, "Driver no longer relevant"); return (0); /* success */ detach: From owner-svn-src-stable-12@freebsd.org Fri Aug 21 00:59:16 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FB683AED6D; Fri, 21 Aug 2020 00:59:16 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXjpD0TMvz4GqP; Fri, 21 Aug 2020 00:59:16 +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 E7AA61D062; Fri, 21 Aug 2020 00:59:15 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07L0xFrw094995; Fri, 21 Aug 2020 00:59:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07L0xFp9094993; Fri, 21 Aug 2020 00:59:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008210059.07L0xFp9094993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 21 Aug 2020 00:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364445 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 364445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 00:59:16 -0000 Author: markj Date: Fri Aug 21 00:59:15 2020 New Revision: 364445 URL: https://svnweb.freebsd.org/changeset/base/364445 Log: MFC r364235: Rename the pipe_map field of struct pipe. Modified: stable/12/sys/kern/sys_pipe.c stable/12/sys/sys/pipe.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_pipe.c ============================================================================== --- stable/12/sys/kern/sys_pipe.c Fri Aug 21 00:34:33 2020 (r364444) +++ stable/12/sys/kern/sys_pipe.c Fri Aug 21 00:59:15 2020 (r364445) @@ -736,19 +736,19 @@ pipe_read(struct file *fp, struct uio *uio, struct ucr /* * Direct copy, bypassing a kernel buffer. */ - } else if ((size = rpipe->pipe_map.cnt) != 0) { + } else if ((size = rpipe->pipe_pages.cnt) != 0) { if (size > uio->uio_resid) size = (u_int) uio->uio_resid; PIPE_UNLOCK(rpipe); - error = uiomove_fromphys(rpipe->pipe_map.ms, - rpipe->pipe_map.pos, size, uio); + error = uiomove_fromphys(rpipe->pipe_pages.ms, + rpipe->pipe_pages.pos, size, uio); PIPE_LOCK(rpipe); if (error) break; nread += size; - rpipe->pipe_map.pos += size; - rpipe->pipe_map.cnt -= size; - if (rpipe->pipe_map.cnt == 0) { + rpipe->pipe_pages.pos += size; + rpipe->pipe_pages.cnt -= size; + if (rpipe->pipe_pages.cnt == 0) { rpipe->pipe_state &= ~PIPE_WANTW; wakeup(rpipe); } @@ -852,7 +852,7 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio PIPE_LOCK_ASSERT(wpipe, MA_OWNED); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, ("%s: PIPE_DIRECTW set on %p", __func__, wpipe)); - KASSERT(wpipe->pipe_map.cnt == 0, + KASSERT(wpipe->pipe_pages.cnt == 0, ("%s: pipe map for %p contains residual data", __func__, wpipe)); if (uio->uio_iov->iov_len > wpipe->pipe_buffer.size) @@ -864,17 +864,17 @@ pipe_build_write_buffer(struct pipe *wpipe, struct uio PIPE_UNLOCK(wpipe); i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, (vm_offset_t)uio->uio_iov->iov_base, size, VM_PROT_READ, - wpipe->pipe_map.ms, PIPENPAGES); + wpipe->pipe_pages.ms, PIPENPAGES); PIPE_LOCK(wpipe); if (i < 0) { wpipe->pipe_state &= ~PIPE_DIRECTW; return (EFAULT); } - wpipe->pipe_map.npages = i; - wpipe->pipe_map.pos = + wpipe->pipe_pages.npages = i; + wpipe->pipe_pages.pos = ((vm_offset_t) uio->uio_iov->iov_base) & PAGE_MASK; - wpipe->pipe_map.cnt = size; + wpipe->pipe_pages.cnt = size; uio->uio_iov->iov_len -= size; uio->uio_iov->iov_base = (char *)uio->uio_iov->iov_base + size; @@ -895,12 +895,12 @@ pipe_destroy_write_buffer(struct pipe *wpipe) PIPE_LOCK_ASSERT(wpipe, MA_OWNED); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); - KASSERT(wpipe->pipe_map.cnt == 0, + KASSERT(wpipe->pipe_pages.cnt == 0, ("%s: pipe map for %p contains residual data", __func__, wpipe)); wpipe->pipe_state &= ~PIPE_DIRECTW; - vm_page_unhold_pages(wpipe->pipe_map.ms, wpipe->pipe_map.npages); - wpipe->pipe_map.npages = 0; + vm_page_unhold_pages(wpipe->pipe_pages.ms, wpipe->pipe_pages.npages); + wpipe->pipe_pages.npages = 0; } /* @@ -920,9 +920,9 @@ pipe_clone_write_buffer(struct pipe *wpipe) KASSERT((wpipe->pipe_state & PIPE_DIRECTW) != 0, ("%s: PIPE_DIRECTW not set on %p", __func__, wpipe)); - size = wpipe->pipe_map.cnt; - pos = wpipe->pipe_map.pos; - wpipe->pipe_map.cnt = 0; + size = wpipe->pipe_pages.cnt; + pos = wpipe->pipe_pages.pos; + wpipe->pipe_pages.cnt = 0; wpipe->pipe_buffer.in = size; wpipe->pipe_buffer.out = 0; @@ -938,7 +938,7 @@ pipe_clone_write_buffer(struct pipe *wpipe) uio.uio_segflg = UIO_SYSSPACE; uio.uio_rw = UIO_READ; uio.uio_td = curthread; - uiomove_fromphys(wpipe->pipe_map.ms, pos, size, &uio); + uiomove_fromphys(wpipe->pipe_pages.ms, pos, size, &uio); PIPE_LOCK(wpipe); pipe_destroy_write_buffer(wpipe); } @@ -1002,7 +1002,7 @@ retry: goto error1; } - while (wpipe->pipe_map.cnt != 0 && + while (wpipe->pipe_pages.cnt != 0 && (wpipe->pipe_state & PIPE_EOF) == 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; @@ -1019,7 +1019,7 @@ retry: } if ((wpipe->pipe_state & PIPE_EOF) != 0) { - wpipe->pipe_map.cnt = 0; + wpipe->pipe_pages.cnt = 0; pipe_destroy_write_buffer(wpipe); pipeselwakeup(wpipe); error = EPIPE; @@ -1144,7 +1144,7 @@ pipe_write(struct file *fp, struct uio *uio, struct uc * pipe buffer. We break out if a signal occurs or the * reader goes away. */ - if (wpipe->pipe_map.cnt != 0) { + if (wpipe->pipe_pages.cnt != 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -1362,8 +1362,8 @@ pipe_ioctl(struct file *fp, u_long cmd, void *data, st PIPE_UNLOCK(mpipe); return (0); } - if (mpipe->pipe_map.cnt != 0) - *(int *)data = mpipe->pipe_map.cnt; + if (mpipe->pipe_pages.cnt != 0) + *(int *)data = mpipe->pipe_pages.cnt; else *(int *)data = mpipe->pipe_buffer.cnt; break; @@ -1418,7 +1418,7 @@ pipe_poll(struct file *fp, int events, struct ucred *a goto locked_error; #endif if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) - if (rpipe->pipe_map.cnt > 0 || rpipe->pipe_buffer.cnt > 0) + if (rpipe->pipe_pages.cnt > 0 || rpipe->pipe_buffer.cnt > 0) revents |= events & (POLLIN | POLLRDNORM); if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) @@ -1500,8 +1500,8 @@ pipe_stat(struct file *fp, struct stat *ub, struct ucr bzero(ub, sizeof(*ub)); ub->st_mode = S_IFIFO; ub->st_blksize = PAGE_SIZE; - if (pipe->pipe_map.cnt != 0) - ub->st_size = pipe->pipe_map.cnt; + if (pipe->pipe_pages.cnt != 0) + ub->st_size = pipe->pipe_pages.cnt; else ub->st_size = pipe->pipe_buffer.cnt; ub->st_blocks = howmany(ub->st_size, ub->st_blksize); @@ -1591,9 +1591,9 @@ pipe_free_kmem(struct pipe *cpipe) } #ifndef PIPE_NODIRECT { - cpipe->pipe_map.cnt = 0; - cpipe->pipe_map.pos = 0; - cpipe->pipe_map.npages = 0; + cpipe->pipe_pages.cnt = 0; + cpipe->pipe_pages.pos = 0; + cpipe->pipe_pages.npages = 0; } #endif } @@ -1739,7 +1739,7 @@ filt_piperead(struct knote *kn, long hint) 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; + kn->kn_data = rpipe->pipe_pages.cnt; if ((rpipe->pipe_state & PIPE_EOF) != 0 && ((rpipe->pipe_state & PIPE_NAMED) == 0 || Modified: stable/12/sys/sys/pipe.h ============================================================================== --- stable/12/sys/sys/pipe.h Fri Aug 21 00:34:33 2020 (r364444) +++ stable/12/sys/sys/pipe.h Fri Aug 21 00:59:15 2020 (r364445) @@ -103,7 +103,7 @@ struct pipemapping { */ struct pipe { struct pipebuf pipe_buffer; /* data storage */ - struct pipemapping pipe_map; /* pipe mapping for direct I/O */ + struct pipemapping pipe_pages; /* wired pages for direct I/O */ struct selinfo pipe_sel; /* for compat with select */ struct timespec pipe_atime; /* time of last access */ struct timespec pipe_mtime; /* time of last modify */ From owner-svn-src-stable-12@freebsd.org Fri Aug 21 03:50:26 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29DD13B20BB; Fri, 21 Aug 2020 03:50:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXnbk0J5Kz4Nts; Fri, 21 Aug 2020 03:50:26 +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 DD7541F534; Fri, 21 Aug 2020 03:50:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07L3oPpd099687; Fri, 21 Aug 2020 03:50:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07L3oPaF099686; Fri, 21 Aug 2020 03:50:25 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008210350.07L3oPaF099686@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 21 Aug 2020 03:50:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364448 - stable/12/lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/lib/libc/sys X-SVN-Commit-Revision: 364448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 03:50:26 -0000 Author: kevans Date: Fri Aug 21 03:50:25 2020 New Revision: 364448 URL: https://svnweb.freebsd.org/changeset/base/364448 Log: MFC r363398 (asomers): document close_range(2) as async-signal-safe Modified: stable/12/lib/libc/sys/sigaction.2 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/sigaction.2 ============================================================================== --- stable/12/lib/libc/sys/sigaction.2 Fri Aug 21 03:31:01 2020 (r364447) +++ stable/12/lib/libc/sys/sigaction.2 Fri Aug 21 03:50:25 2020 (r364448) @@ -28,7 +28,7 @@ .\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94 .\" $FreeBSD$ .\" -.Dd June 28, 2018 +.Dd June 29, 2020 .Dt SIGACTION 2 .Os .Sh NAME @@ -569,6 +569,7 @@ Extension Interfaces: .Pp .Fn accept4 , .Fn bindat , +.Fn close_range , .Fn closefrom , .Fn connectat , .Fn eaccess , From owner-svn-src-stable-12@freebsd.org Fri Aug 21 07:52:57 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76CC73B6A89; Fri, 21 Aug 2020 07:52:57 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXtzY2bNLz4Zmx; Fri, 21 Aug 2020 07:52:57 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D27721FDB; Fri, 21 Aug 2020 07:52:57 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07L7qvd3051662; Fri, 21 Aug 2020 07:52:57 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07L7qvlR051661; Fri, 21 Aug 2020 07:52:57 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202008210752.07L7qvlR051661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Fri, 21 Aug 2020 07:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364451 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 364451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 07:52:57 -0000 Author: vmaffione Date: Fri Aug 21 07:52:56 2020 New Revision: 364451 URL: https://svnweb.freebsd.org/changeset/base/364451 Log: MFC r363996 iflib: netmap: don't increment ifl_cidx on the wrong free list Netmap only uses free list 0 to keep it consistent with its one-to-one mapping between each netmap ring and a device RX (or TX) queue. However, the current iflib_netmap_rxsync() routine was mistakenly updating the ifl_cidx field of both free lists. PR: 248494 Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Fri Aug 21 07:03:54 2020 (r364450) +++ stable/12/sys/net/iflib.c Fri Aug 21 07:52:56 2020 (r364451) @@ -1081,28 +1081,28 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl struct netmap_adapter *na = kring->na; struct netmap_ring *ring = kring->ring; if_t ifp = na->ifp; - iflib_fl_t fl; uint32_t nm_i; /* index into the netmap ring */ uint32_t nic_i; /* index into the NIC ring */ - u_int i, n; + u_int n; u_int const lim = kring->nkr_num_slots - 1; u_int const head = kring->rhead; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; - struct if_rxd_info ri; if_ctx_t ctx = ifp->if_softc; iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; + iflib_fl_t fl = &rxq->ifr_fl[0]; + struct if_rxd_info ri; + if (head > lim) return netmap_ring_reinit(kring); /* - * XXX netmap_fl_refill() only ever (re)fills free list 0 so far. + * netmap only uses free list 0, to avoid out of order consumption + * of receive buffers */ - for (i = 0, fl = rxq->ifr_fl; i < rxq->ifr_nfl; i++, fl++) { - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - } + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* * First part: import newly received packets. @@ -1124,38 +1124,35 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl int crclen = iflib_crcstrip ? 0 : 4; int error, avail; - for (i = 0; i < rxq->ifr_nfl; i++) { - fl = &rxq->ifr_fl[i]; - nic_i = fl->ifl_cidx; - nm_i = netmap_idx_n2k(kring, nic_i); - avail = ctx->isc_rxd_available(ctx->ifc_softc, - rxq->ifr_id, nic_i, USHRT_MAX); - for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) { - rxd_info_zero(&ri); - ri.iri_frags = rxq->ifr_frags; - ri.iri_qsidx = kring->ring_id; - ri.iri_ifp = ctx->ifc_ifp; - ri.iri_cidx = nic_i; + nic_i = fl->ifl_cidx; + nm_i = netmap_idx_n2k(kring, nic_i); + avail = ctx->isc_rxd_available(ctx->ifc_softc, + rxq->ifr_id, nic_i, USHRT_MAX); + for (n = 0; avail > 0 && nm_i != hwtail_lim; n++, avail--) { + rxd_info_zero(&ri); + ri.iri_frags = rxq->ifr_frags; + ri.iri_qsidx = kring->ring_id; + ri.iri_ifp = ctx->ifc_ifp; + ri.iri_cidx = nic_i; - error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, &ri); - ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen; - ring->slot[nm_i].flags = 0; - bus_dmamap_sync(fl->ifl_buf_tag, - fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); - nm_i = nm_next(nm_i, lim); - nic_i = nm_next(nic_i, lim); + error = ctx->isc_rxd_pkt_get(ctx->ifc_softc, &ri); + ring->slot[nm_i].len = error ? 0 : ri.iri_len - crclen; + ring->slot[nm_i].flags = 0; + bus_dmamap_sync(fl->ifl_buf_tag, + fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); + nm_i = nm_next(nm_i, lim); + nic_i = nm_next(nic_i, lim); + } + if (n) { /* update the state variables */ + if (netmap_no_pendintr && !force_update) { + /* diagnostics */ + iflib_rx_miss ++; + iflib_rx_miss_bufs += n; } - if (n) { /* update the state variables */ - if (netmap_no_pendintr && !force_update) { - /* diagnostics */ - iflib_rx_miss ++; - iflib_rx_miss_bufs += n; - } - fl->ifl_cidx = nic_i; - kring->nr_hwtail = nm_i; - } - kring->nr_kflags &= ~NKR_PENDINTR; + fl->ifl_cidx = nic_i; + kring->nr_hwtail = nm_i; } + kring->nr_kflags &= ~NKR_PENDINTR; } /* * Second part: skip past packets that userspace has released. @@ -1165,7 +1162,6 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl * nic_i is the index in the NIC ring, and * nm_i == (nic_i + kring->nkr_hwofs) % ring_size */ - /* XXX not sure how this will work with multiple free lists */ nm_i = kring->nr_hwcur; return (netmap_fl_refill(rxq, kring, nm_i, false)); From owner-svn-src-stable-12@freebsd.org Fri Aug 21 07:54:17 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 483A63B6AAD; Fri, 21 Aug 2020 07:54:17 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BXv151FqNz4Znw; Fri, 21 Aug 2020 07:54:17 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F700220C1; Fri, 21 Aug 2020 07:54:17 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07L7sGA5051795; Fri, 21 Aug 2020 07:54:16 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07L7sGna051794; Fri, 21 Aug 2020 07:54:16 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <202008210754.07L7sGna051794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Fri, 21 Aug 2020 07:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364452 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 364452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 07:54:17 -0000 Author: vmaffione Date: Fri Aug 21 07:54:16 2020 New Revision: 364452 URL: https://svnweb.freebsd.org/changeset/base/364452 Log: MFC r363997 iflib: netmap: drop redundant check The validity of head is already checked by nm_rxsync_prologue(). Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Fri Aug 21 07:52:56 2020 (r364451) +++ stable/12/sys/net/iflib.c Fri Aug 21 07:54:16 2020 (r364452) @@ -1085,16 +1085,12 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int fl uint32_t nic_i; /* index into the NIC ring */ u_int n; u_int const lim = kring->nkr_num_slots - 1; - u_int const head = kring->rhead; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; if_ctx_t ctx = ifp->if_softc; iflib_rxq_t rxq = &ctx->ifc_rxqs[kring->ring_id]; iflib_fl_t fl = &rxq->ifr_fl[0]; struct if_rxd_info ri; - - if (head > lim) - return netmap_ring_reinit(kring); /* * netmap only uses free list 0, to avoid out of order consumption From owner-svn-src-stable-12@freebsd.org Fri Aug 21 13:11:34 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 917193BD1ED; Fri, 21 Aug 2020 13:11:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BY23B3R4Dz3dyM; Fri, 21 Aug 2020 13:11:34 +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 5A48725A4F; Fri, 21 Aug 2020 13:11:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07LDBY1r045108; Fri, 21 Aug 2020 13:11:34 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07LDBYJF045107; Fri, 21 Aug 2020 13:11:34 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202008211311.07LDBYJF045107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 21 Aug 2020 13:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364456 - stable/12/sys/netpfil/pf X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/sys/netpfil/pf X-SVN-Commit-Revision: 364456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 13:11:34 -0000 Author: kp Date: Fri Aug 21 13:11:33 2020 New Revision: 364456 URL: https://svnweb.freebsd.org/changeset/base/364456 Log: MFC r355744: pf: Make request_maxcount runtime adjustable There's no reason for this to be a tunable. It's perfectly safe to change this at runtime. Modified: stable/12/sys/netpfil/pf/pf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/pf/pf.c ============================================================================== --- stable/12/sys/netpfil/pf/pf.c Fri Aug 21 10:06:01 2020 (r364455) +++ stable/12/sys/netpfil/pf/pf.c Fri Aug 21 13:11:33 2020 (r364456) @@ -382,7 +382,7 @@ SYSCTL_ULONG(_net_pf, OID_AUTO, states_hashsize, CTLFL &pf_hashsize, 0, "Size of pf(4) states hashtable"); SYSCTL_ULONG(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN, &pf_srchashsize, 0, "Size of pf(4) source nodes hashtable"); -SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RDTUN, +SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RW, &pf_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a single ioctl() call"); VNET_DEFINE(void *, pf_swi_cookie); From owner-svn-src-stable-12@freebsd.org Fri Aug 21 19:28:27 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 944763C72E0; Fri, 21 Aug 2020 19:28:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BYBQ33RmVz4P5y; Fri, 21 Aug 2020 19:28:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59BA5A341; Fri, 21 Aug 2020 19:28:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07LJSR3k079387; Fri, 21 Aug 2020 19:28:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07LJSR4O079386; Fri, 21 Aug 2020 19:28:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202008211928.07LJSR4O079386@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 21 Aug 2020 19:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364461 - stable/12/sbin/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sbin/ipfw X-SVN-Commit-Revision: 364461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 19:28:27 -0000 Author: emaste Date: Fri Aug 21 19:28:26 2020 New Revision: 364461 URL: https://svnweb.freebsd.org/changeset/base/364461 Log: MFC r364321: ipfw: line up `ipfw -t list` with and without timestamp From the PR: When I run `ipfw -t list` on release/12 or current, I get misaligned output between lines that do and do not have a last match timestamp, like so: 00100 Tue Aug 11 03:03:26 2020 allow ip from any to any via lo0 00200 deny ip from any to 127.0.0.0/8 (specifically, the "allow" and "deny" strings do not line up) PR: 248608 Submitted by: Taylor Stearns Modified: stable/12/sbin/ipfw/ipfw2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw2.c ============================================================================== --- stable/12/sbin/ipfw/ipfw2.c Fri Aug 21 18:31:57 2020 (r364460) +++ stable/12/sbin/ipfw/ipfw2.c Fri Aug 21 19:28:26 2020 (r364461) @@ -2188,7 +2188,7 @@ show_static_rule(struct cmdline_opts *co, struct forma *strchr(timestr, '\n') = '\0'; bprintf(bp, "%s ", timestr); } else { - bprintf(bp, "%*s", twidth, " "); + bprintf(bp, "%*s", twidth + 1, " "); } } From owner-svn-src-stable-12@freebsd.org Sat Aug 22 00:42:34 2020 Return-Path: Delivered-To: svn-src-stable-12@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A8883CDC72; Sat, 22 Aug 2020 00:42:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BYKNV3847z3bfj; Sat, 22 Aug 2020 00:42:34 +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 4FE0DE035; Sat, 22 Aug 2020 00:42:34 +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 07M0gYfm087665; Sat, 22 Aug 2020 00:42:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07M0gYcC087664; Sat, 22 Aug 2020 00:42:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008220042.07M0gYcC087664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 22 Aug 2020 00:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364471 - stable/12/sys/dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/acpica X-SVN-Commit-Revision: 364471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2020 00:42:34 -0000 Author: mav Date: Sat Aug 22 00:42:33 2020 New Revision: 364471 URL: https://svnweb.freebsd.org/changeset/base/364471 Log: MFC r364407: Unify AcpiGetTable() KPI use in identify, probe and attach. While there, change probe order to not call AcpiGetTable() for every probed ACPI device. PR: 248746 Modified: stable/12/sys/dev/acpica/acpi_apei.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_apei.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 21 23:00:15 2020 (r364470) +++ stable/12/sys/dev/acpica/acpi_apei.c Sat Aug 22 00:42:33 2020 (r364471) @@ -550,20 +550,29 @@ apei_identify(driver_t *driver, device_t parent) { device_t child; int found; + ACPI_TABLE_HEADER *hest; + ACPI_STATUS status; if (acpi_disabled("apei")) return; - if (acpi_find_table(ACPI_SIG_HEST) == 0) + + /* Without HEST table we have nothing to do. */ + status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest); + if (ACPI_FAILURE(status)) return; + AcpiPutTable(hest); + /* Only one APEI device can exist. */ if (devclass_get_device(apei_devclass, 0)) return; + /* Search for ACPI error device to be used. */ found = 0; AcpiWalkNamespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 100, apei_find, NULL, NULL, (void *)&found); if (found) return; + /* If not found - create a fake one. */ child = BUS_ADD_CHILD(parent, 2, "apei", 0); if (child == NULL) @@ -573,18 +582,27 @@ apei_identify(driver_t *driver, device_t parent) static int apei_probe(device_t dev) { + ACPI_TABLE_HEADER *hest; + ACPI_STATUS status; int rv; if (acpi_disabled("apei")) return (ENXIO); - if (acpi_find_table(ACPI_SIG_HEST) == 0) - return (ENXIO); - if (acpi_get_handle(dev) != NULL) + + if (acpi_get_handle(dev) != NULL) { rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) == NULL); - else + if (rv > 0) + return (rv); + } else rv = 0; - if (rv <= 0) - device_set_desc(dev, "Platform Error Interface"); + + /* Without HEST table we have nothing to do. */ + status = AcpiGetTable(ACPI_SIG_HEST, 0, &hest); + if (ACPI_FAILURE(status)) + return (ENXIO); + AcpiPutTable(hest); + + device_set_desc(dev, "ACPI Platform Error Interface"); return (rv); }